Page initiativtext

This commit is contained in:
2017-04-11 08:06:32 +02:00
parent 51a2ace11d
commit 7ce05f1ae4
11 changed files with 103 additions and 6 deletions
+13 -2
View File
@@ -1,5 +1,16 @@
class PagesController < ApplicationController
def map
@supporters = Supporter.where(:coordinates.ne => nil).only(:coordinates, :support)
def show
if valid_page?
render template: "pages/#{params[:page]}"
else
render plain: t('.not_found'), status: :not_found
end
end
private
def valid_page?
return true if File.exist?("#{Rails.root}/app/views/pages/#{params[:page]}.#{I18n.locale}.slim")
return true if File.exist?("#{Rails.root}/app/views/pages/#{params[:page]}.#{I18n.default_locale}.slim")
end
end