2015-10-05 12:40:08 +02:00
|
|
|
class PagesController < ApplicationController
|
2017-04-11 08:06:32 +02:00
|
|
|
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")
|
2015-10-06 14:10:53 +02:00
|
|
|
end
|
2015-10-05 12:40:08 +02:00
|
|
|
end
|