Class: Precious::Views::History

Inherits:
Layout
  • Object
show all
Includes:
HasPage, HasUserIcons, Pagination, SprocketsHelpers, Sprockets::Helpers
Defined in:
lib/gollum/views/history.rb

Constant Summary collapse

DATE_FORMAT =
'%B %d, %Y'

Constants included from RouteHelpers

RouteHelpers::ROUTES

Constants included from LocaleHelpers

LocaleHelpers::NO_METHOD_MESSAGE, LocaleHelpers::YAML_VARIABLE_REGEXP

Instance Attribute Summary collapse

Attributes inherited from Layout

#name, #path

Instance Method Summary collapse

Methods included from SprocketsHelpers

included, #sprockets_asset_path, #sprockets_image_path, #sprockets_javascript_tag, #sprockets_stylesheet_tag

Methods included from HasUserIcons

#partial, #user_icon_code

Methods included from Pagination

#next_page, #previous_page

Methods included from HasPage

#escaped_url_path, #format, #id, #path

Methods inherited from Layout

#base_url, #critic_markup, #css, #custom_css, #custom_js, #custom_path, #escaped_name, #has_path, #history, #js, #latest_changes, #mathjax_config_path, #mathjax_js, #overview, #partial, #per_page_uploads, #search, #show_local_time

Methods included from TemplateCascade

#first_path_available, #template_file, #template_priority_path, #template_priority_path=

Methods included from OcticonHelpers

included, #octicon, #rocticon, #rocticon_css

Methods included from RouteHelpers

#clean_url, included, #page_route, parse_routes

Methods included from LocaleHelpers

#t

Methods included from AppHelpers

#extract_page_dir

Instance Attribute Details

#allow_editingObject (readonly)

Returns the value of attribute allow_editing.



12
13
14
# File 'lib/gollum/views/history.rb', line 12

def allow_editing
  @allow_editing
end

#pageObject (readonly)

Returns the value of attribute page.



12
13
14
# File 'lib/gollum/views/history.rb', line 12

def page
  @page
end

Instance Method Details

#editableObject



42
43
44
# File 'lib/gollum/views/history.rb', line 42

def editable
  @editable
end

#titleObject



14
15
16
# File 'lib/gollum/views/history.rb', line 14

def title
  @page.title
end

#versionsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gollum/views/history.rb', line 18

def versions
  i = @versions.size + 1
  @versions.map do |v|
    i -= 1
    filename = path_for_version(v.tracked_pathname)
    authored_date = v.authored_date
    { :id          => v.id,
      :id7         => v.id[0..6],
      :href        => page_route("gollum/commit/#{v.id}"),
      :href_page   => page_route("#{filename}/#{v.id}"),
      :num         => i,
      :selected    => @page.version.id == v.id,
      :author      => v.author.name.respond_to?(:force_encoding) ? v.author.name.force_encoding('UTF-8') : v.author.name,
      :message     => v.message.respond_to?(:force_encoding) ? v.message.force_encoding('UTF-8') : v.message,
      :date_full   => authored_date,
      :date        => authored_date.strftime(DATE_FORMAT),
      :datetime    => authored_date.utc.iso8601,
      :date_format => DATE_FORMAT,
      :user_icon   => self.user_icon_code(v.author.email),
      :filename    => filename
    }
  end
end