Class: Smeagol::Views::Form

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

Overview

The form view is used for generic files that are not Gollum wiki pages. These are typically html or xml files and they are rendered as mustache templates.

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, #initialize, #layout, #mathjax, #menu_html, #metadata, #name, #post?, #posts, #ribbon_html, #ribbon_url, #settings, #setup_template_path, #source_url, #standard_layout, #tagline, #tracking_id, #wiki_title

Constructor Details

This class inherits a constructor from Smeagol::Views::Base

Instance Method Details

#contentObject

Rendered content of the file.


16
17
18
# File 'lib/smeagol/views/form.rb', line 16

def content
  @content ||= Mustache.render(file.raw_data, self)
end

#hrefObject

static href, used when generating static site.


37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/smeagol/views/form.rb', line 37

def href
  dir  = ::File.dirname(file.path)
  ext  = ::File.extname(file.path)

  if dir != '.'
    ::File.join(dir, name.chomp(ext)) #file.path) 
  else
    if name == settings.index #|| 'Home'
      'index.html'
    else
      name.chomp(ext) #file.path
    end
  end
end

#not_home?Boolean

A flag stating that this is not the home file.

Returns:

  • (Boolean)

32
33
34
# File 'lib/smeagol/views/form.rb', line 32

def not_home?
  filename != "index.html"
end

#titleObject Also known as: page_title


21
22
23
# File 'lib/smeagol/views/form.rb', line 21

def title
  filename  # TODO: better idea for form title?
end