Class: Precious::Views::LatestChanges

Inherits:
Layout
  • Object
show all
Includes:
HasUserIcons, Pagination
Defined in:
lib/gollum/views/latest_changes.rb

Constant Summary collapse

DATE_FORMAT =
'%B %d, %Y'

Constants included from RouteHelpers

RouteHelpers::ROUTES

Constants included from LocaleHelpers

Precious::Views::LocaleHelpers::NO_METHOD_MESSAGE, Precious::Views::LocaleHelpers::YAML_VARIABLE_REGEXP

Instance Attribute Summary collapse

Attributes inherited from Layout

#name, #path

Instance Method Summary collapse

Methods included from HasUserIcons

#partial, #user_icon_code

Methods included from Pagination

#next_page, #previous_page

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 SprocketsHelpers

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

Methods included from LocaleHelpers

#t

Methods included from AppHelpers

#extract_page_dir

Instance Attribute Details

#wikiObject (readonly)

Returns the value of attribute wiki.



9
10
11
# File 'lib/gollum/views/latest_changes.rb', line 9

def wiki
  @wiki
end

Instance Method Details

#titleObject



11
12
13
# File 'lib/gollum/views/latest_changes.rb', line 11

def title
  "Latest Changes (Globally)"
end

#versionsObject



15
16
17
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/latest_changes.rb', line 15

def versions
  i = @versions.size + 1
  @versions.map do |v|
    i -= 1
    authored_date = v.authored_date
    { :id          => v.id,
      :id7         => v.id[0..6],
      :href        => page_route("gollum/commit/#{v.id}"),
      :num         => i,
      :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),
      :files       => v.stats.files.map { |f|
        new_path = extract_page_dir(f[:new_file])
        { :file => new_path,
          :link => "#{page_route(new_path)}/#{v.id}",
          :renamed => f[:old_file] ? extract_page_dir(f[:old_file]) : nil
        }
      }
    }
  end
end