404 i zmiana strony glownej

This commit is contained in:
Adrian Hinz 2018-01-21 18:39:41 +01:00
parent d670e38b40
commit 5e7b304359
4 changed files with 19 additions and 12 deletions

View File

@ -6,7 +6,10 @@ class SiteController < ApplicationController
def show
pages_get
@page = PublishedPage.friendly.find(params[:id])
@page = PublishedPage.where('id = ? OR slug = ?',params[:id],params[:id]).first
if @page.blank?
redirect_to '/404.html'
end
end
def kontakt
@ -16,12 +19,18 @@ class SiteController < ApplicationController
def preview
pages_get
if params[:id]
@page = AllPage.friendly.find(params[:id])
else
@page = AllPage.first
@page = AllPage.where('id = ? OR slug = ?',params[:id],params[:id]).first
end
if @page.blank?
redirect_to '/404.html'
end
end
def send_email
end
def pages_get
@pages = PublishedPage.where('type_of != 3').order('priority ASC')
end

View File

@ -7,9 +7,10 @@ module ApplicationHelper
ret += '<ul class="navbar-nav ml-auto">'
friendly_id = nil
if params[:id]
pp = PublishedPage.friendly.find(params[:id])
if pp = PublishedPage.where('id = ? OR slug = ?',params[:id],params[:id]).first
friendly_id = pp.type_of == 3 ? pp.article_friendly : params[:id]
end
end
for page in pages
ret += '<li class="nav-item">'
if !friendly_id.blank?

View File

@ -1,3 +1 @@
<h1>Home#index in admin</h1>
<%= current_admin.email %>
<p>Find me in app/views/home/index.html.erb</p>
<p>ToDo - Zmiana hasła, do logowania</p>

View File

@ -8,10 +8,9 @@
<h1 class="text-uppercase">
&nbsp;<strong style="display:none" id="line2">Pieniądze są najważniejsze</strong>
</h1>
&nbsp;<hr class="mini" style="visibility:hidden" id="line3">
</div>
<div class="col-lg-8 mx-auto" >
&nbsp;<p class="text-faded mb-5" style="visibility:hidden" id="line4">czyli dlaczego warto ubezpieczać należności</p>
&nbsp;<h3 class="text-faded mb-5" style="visibility:hidden" id="line4"><strong>czyli dlaczego warto ubezpieczać należności</strong></h3>
</div>
</div>
</div>
@ -20,7 +19,7 @@
$( document ).ready(function() {
$('#line1').fadeIn(2000, function() {
$('#line2').fadeIn(2000, function() {
$('#line3').css("visibility","visible");
//$('#line3').css("visibility","visible");
$('#line4').css("visibility","visible");
});
});