Sha256: 3ac373aac090b4b753c26c5519f7cb18816969ea43ba422820aab97c0b50ec24

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

module Precious
  module Views
    class History < Layout
      attr_reader :page, :page_num

      def title
        @page.title
      end

      def versions
        i = @versions.size + 1
        @versions.map do |v|
          i -= 1
          { :id       => v.id,
            :id7      => v.id[0..6],
            :num      => i,
            :selected => @page.version.id == v.id,
            :author   => v.author.name,
            :message  => v.message,
            :date     => v.committed_date.strftime("%B %d, %Y"),
            :gravatar => Digest::MD5.hexdigest(v.author.email) }
        end
      end

      def previous_link
        label = "&laquo; Previous"
        if @page_num == 1
          %(<span class="disabled">#{label}</span>)
        else
          %(<a href="/history/#{@page.name}?page=#{@page_num-1}" hotkey="h">#{label}</a>)
        end
      end

      def next_link
        label = "Next &raquo;"
        if @versions.size == Gollum::Page.per_page
          %(<a href="/history/#{@page.name}?page=#{@page_num+1}" hotkey="l">#{label}</a>)
        else
          %(<span class="disabled">#{label}</span>)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
gollum-2.0.0 lib/gollum/frontend/views/history.rb
gollum-1.4.3 lib/gollum/frontend/views/history.rb
gollum-1.4.2 lib/gollum/frontend/views/history.rb
read-only-gollum-1.4.0 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.4.4 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.4.3 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.4.2 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.4.1 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.3.2 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.4.0 lib/gollum/frontend/views/history.rb
gollum-bibanon-1.3.1 lib/gollum/frontend/views/history.rb
gollum-1.3.1 lib/gollum/frontend/views/history.rb
jugyo-gollum-1.3.1 lib/gollum/frontend/views/history.rb
gollum-1.2.1 lib/gollum/frontend/views/history.rb
gollum-1.3.0 lib/gollum/frontend/views/history.rb
gollum-1.2.0 lib/gollum/frontend/views/history.rb