Show wikipage on login screen when present

This commit is contained in:
wvengen 2015-01-19 23:41:56 +01:00
parent 1447b38bb3
commit c59ee3a6a7
2 changed files with 11 additions and 0 deletions

View file

@ -10,6 +10,9 @@
.alert.alert-error .alert.alert-error
!= t '.nojs', link: link_to(t('.noscript'), "http://noscript.net/") != t '.nojs', link: link_to(t('.noscript'), "http://noscript.net/")
- if defined?(FoodsoftWiki) && (page = Page.public_front_page)
= wikified_body page.body, page.title
= form_tag sessions_path, class: 'form-horizontal' do = form_tag sessions_path, class: 'form-horizontal' do
.control-group .control-group
%label(for='nick' class='control-label') %label(for='nick' class='control-label')

View file

@ -28,6 +28,14 @@ class Page < ActiveRecord::Base
permalink == "Home" permalink == "Home"
end end
def public_front_page?
permalink == "Public_frontpage"
end
def self.public_front_page
where(permalink: "Public_frontpage").first
end
def set_permalink def set_permalink
unless title.blank? unless title.blank?
self.permalink = Page.count == 0 ? "Home" : Page.permalink(title) self.permalink = Page.count == 0 ? "Home" : Page.permalink(title)