Class: Smeagol::Views::Versions

Inherits:
Base
  • Object
show all
Defined in:
lib/smeagol/views/versions.rb

Instance Attribute Summary

Attributes inherited from Base

#file, #version, #wiki

Instance Method Summary collapse

Methods inherited from Base

#base_path, #custom_layout, #custom_layout?, #default_layout, #filename, #mathjax, #menu_html, #metadata, #name, #post?, #posts, #ribbon_html, #ribbon_url, #settings, #setup_template_path, #standard_layout, #tagline, #tracking_id, #wiki_title

Constructor Details

#initialize(master) ⇒ Object

Initializes a new mustache view template data object.

Parameters:

  • master

    Master controller, which creates all the views.


9
10
11
12
13
14
# File 'lib/smeagol/views/versions.rb', line 9

def initialize(master)
  @master  = master
  @wiki    = master.wiki

  setup_template_path
end

Instance Method Details

#contentObject

The HTML formatted content of the page.


17
18
19
20
21
22
23
24
# File 'lib/smeagol/views/versions.rb', line 17

def content
  html = "<a href=\"/\">Current</a><br/>"
  wiki.repo.tags.each do |tag|
    href = tag.name.start_with?('v') ? "/#{tag.name}" : "/v#{tag.name}"
    html << "<a href=\"#{href}\">#{tag.name}</a><br/>"
  end
  html
end

#layoutObject

TODO: Allow customization ?


33
34
35
# File 'lib/smeagol/views/versions.rb', line 33

def layout
  IO.read(LIBDIR + "/templates/layouts/versions.mustache")
end

#source_urlObject

The URL of the project source code. This is set in the settings file.


28
29
30
# File 'lib/smeagol/views/versions.rb', line 28

def source_url
  settings.source_url
end