diff --git a/app/assets/images/heart.png b/app/assets/images/heart.png new file mode 100644 index 0000000..2bc7e0a Binary files /dev/null and b/app/assets/images/heart.png differ diff --git a/app/assets/images/map.jpg b/app/assets/images/map.jpg index 9735557..89f55cd 100644 Binary files a/app/assets/images/map.jpg and b/app/assets/images/map.jpg differ diff --git a/app/assets/stylesheets/posts.sass b/app/assets/stylesheets/posts.sass index 19f3123..2ea1603 100644 --- a/app/assets/stylesheets/posts.sass +++ b/app/assets/stylesheets/posts.sass @@ -61,10 +61,11 @@ section margin: 80px 0px 200px z-index: -20 article.about - max-width: 90% + max-width: 80% margin: 0 auto .desc padding: 30px + font-size: 1.3rem .post max-width: 700px margin: 50px auto 80px @@ -111,6 +112,8 @@ section &.sample font-size: 1.8rem line-height: 1.2 + + footer font-size: 0.9rem line-height: 2 diff --git a/app/assets/stylesheets/public.sass b/app/assets/stylesheets/public.sass index 5caff60..9a37beb 100644 --- a/app/assets/stylesheets/public.sass +++ b/app/assets/stylesheets/public.sass @@ -132,11 +132,19 @@ hr #map max-width: 1100px - margin: 50 auto + margin: 50px auto 0px .header font-size: 3rem text-align: center padding: 30px 10px + &.travels + margin-top: 80px + &.heart + margin-top: -25px + img + position: relative + top: 22px + left: 10px .button text-decoration: none margin-right: 5px diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index de15b04..05b1682 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -33,7 +33,11 @@ def update @post.photos.create(photo: photo) end end - redirect_to @post, notice: 'Post updated successfully' + if @post.category_id == 4 + redirect_to '/about' + else + redirect_to @post, notice: 'Post updated successfully' + end else flash.now.notice = 'Some errors occured, cannot update post.' render :edit diff --git a/app/views/posts/_form.html.haml b/app/views/posts/_form.html.haml index dd06489..6e495ad 100644 --- a/app/views/posts/_form.html.haml +++ b/app/views/posts/_form.html.haml @@ -6,7 +6,7 @@ .input = f.label :category_id - = f.select :category_id, [['travels', 1], ['food', 2], ['my life', 3]], prompt: '- select category -' + = f.select :category_id, [['travels', 1], ['food', 2], ['my life', 3], ['about', 4]], prompt: '- select category -' .input = f.label :title = f.text_field :title diff --git a/app/views/public/about.html.haml b/app/views/public/about.html.haml index 563c1ed..726b214 100644 --- a/app/views/public/about.html.haml +++ b/app/views/public/about.html.haml @@ -3,7 +3,7 @@ %article.about .header= @post.title .desc - = @post.desc + = @post.desc.html_safe = link_to :back do .button.edit back diff --git a/app/views/public/index.html.haml b/app/views/public/index.html.haml index 5e4c721..f890b71 100644 --- a/app/views/public/index.html.haml +++ b/app/views/public/index.html.haml @@ -1,6 +1,6 @@ - if @controller == 'travels' #map - .header= 'All of my travels' + .header.travels= 'All of my travels' #map_photo = image_tag 'map.jpg' - @pins.each do |pin| @@ -11,6 +11,13 @@ .date= pin[4].strftime('%d/%m/%Y') .container %section - .header= 'Latests posts' + -if @controller == 'life' + .header= "My little world" + -elsif @controller == 'food' + .header.heart + = "Food" + =image_tag 'heart.png' + -else + .header= 'Latest posts' -if @posts = render @posts \ No newline at end of file