Class: Protozoa::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Protozoa::App
- Includes:
- Amiba::Repo
- Defined in:
- lib/amiba/frontend/app.rb
Instance Method Summary collapse
- #commit_message ⇒ Object
-
#show_page_or_file(name) ⇒ Object
end.
- #update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil) ⇒ Object
Methods included from Amiba::Repo
#add_and_commit, #init, #last_commit_date, #last_commit_dates, #pull, #push, #repo
Instance Method Details
#commit_message ⇒ Object
259 260 261 |
# File 'lib/amiba/frontend/app.rb', line 259 def { :message => params[:message] } end |
#show_page_or_file(name) ⇒ Object
end
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/amiba/frontend/app.rb', line 233 def show_page_or_file(name) wiki = Gollum::Wiki.new(settings.gollum_path, settings.) if page = wiki.page(name) @page = page @name = name @content = page.formatted_data @editable = true mustache :page elsif file = wiki.file(name) content_type file.mime_type file.raw_data else @name = name mustache :create end end |
#update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil) ⇒ Object
250 251 252 253 254 255 256 257 |
# File 'lib/amiba/frontend/app.rb', line 250 def update_wiki_page(wiki, page, content, , name = nil, format = nil) return if !page || ((!content || page.raw_data == content) && page.format == format) name ||= page.name format = (format || page.format).to_sym content ||= page.raw_data wiki.update_page(page, name, format, content.to_s, ) end |