go_blog 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/blog/posts_controller.rb +6 -4
- data/app/decorator/blog/post_decorator.rb +12 -0
- data/app/models/blog/post.rb +1 -0
- data/app/views/blog/posts/_collection_list.html.erb +2 -1
- data/app/views/blog/posts/_pagination.html.erb +4 -0
- data/app/views/blog/posts/index.html.erb +2 -0
- data/app/views/blog/posts/list.html.erb +3 -0
- data/app/views/blog/posts/show_list.html.erb +1 -1
- data/lib/go_blog/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb6bfb2449235be656dc7ce3b75badba94ba7f0d
|
4
|
+
data.tar.gz: eea8b106187bf50d0a145e316b036230484e2808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf78a5192bad9cce53e6dc5a8150df6079b1d8b0cc6193d236d758e1e2a3450efc55cdc5f4391af938d4f93b5f15a1dc8bf640db30465c6e6048c8dee9e4b45
|
7
|
+
data.tar.gz: ac2cd29b119d9b72966d37f6e113de70bbea2d0a73c2f488fc6baadd814a23edef3dbf66af2d9c0ca45ae4685c5b9d7727bb2addcc94fbeb502d349726ba445e
|
@@ -1,21 +1,23 @@
|
|
1
1
|
module Blog
|
2
2
|
class PostsController < ApplicationController
|
3
|
-
before_action :set_blog_post, only: [:show, :edit, :update, :destroy
|
3
|
+
before_action :set_blog_post, only: [:show, :edit, :update, :destroy, :show_list]
|
4
4
|
before_action :authenticate_user!, except: [:list, :show_list]
|
5
|
-
load_and_authorize_resource except: [:list, :show_list
|
5
|
+
load_and_authorize_resource except: [:list, :show_list, :create]
|
6
6
|
# GET /blog/posts
|
7
7
|
def index
|
8
|
-
@blog_posts = Post.all
|
8
|
+
@blog_posts = Post.all.page params[:page]
|
9
9
|
end
|
10
10
|
|
11
11
|
def list
|
12
|
-
@blog_posts = Post.
|
12
|
+
@blog_posts = Post.where('? >= published_at and draft = ?', DateTime.now, false).includes(:user).page params[:page]
|
13
13
|
end
|
14
14
|
|
15
15
|
# GET /blog/posts/1
|
16
16
|
def show
|
17
17
|
end
|
18
|
+
|
18
19
|
def show_list
|
20
|
+
@blog_post.increment!(:access_count)
|
19
21
|
end
|
20
22
|
|
21
23
|
# GET /blog/posts/new
|
@@ -23,6 +23,18 @@ module Blog
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
|
27
|
+
def link_to_author
|
28
|
+
h.link_to h.user_path(id: self.user),
|
29
|
+
class: 'link-effect font-s13 font-w600',
|
30
|
+
title: '',
|
31
|
+
style: '' do
|
32
|
+
h.content_tag :span do
|
33
|
+
self.user.decorate.name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
26
38
|
def link_to_title
|
27
39
|
h.link_to h.show_list_blog_posts_path(id: self.id),
|
28
40
|
class: 'text-primary-dark',
|
data/app/models/blog/post.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
<div class="col-md-12">
|
11
11
|
<div class="font-s12 push-10">
|
12
12
|
<em class="pull-right"><!--10 min--></em>
|
13
|
-
|
13
|
+
<%= resource.decorate.link_to_author %> - <%= converte_date(resource.published_at) %>
|
14
14
|
</div>
|
15
15
|
<h4 class="text-uppercase push-10">
|
16
16
|
<%= resource.decorate.link_to_title %></h4>
|
@@ -24,3 +24,4 @@
|
|
24
24
|
</div>
|
25
25
|
</div>
|
26
26
|
<% end %>
|
27
|
+
|
@@ -41,6 +41,8 @@
|
|
41
41
|
<!--</li>-->
|
42
42
|
<!--</ul>-->
|
43
43
|
<!--</nav>-->
|
44
|
+
<%=render 'pagination',collection: @blog_posts%>
|
45
|
+
|
44
46
|
</div>
|
45
47
|
<!--<div class="col-md-4">-->
|
46
48
|
<!--<div class="block">-->
|
@@ -142,6 +144,7 @@
|
|
142
144
|
<!--</div>-->
|
143
145
|
<!--</div>-->
|
144
146
|
<!--</div>-->
|
147
|
+
|
145
148
|
</div>
|
146
149
|
</div>
|
147
150
|
</section>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="bg-white">
|
12
12
|
<section class="content content-boxed">
|
13
13
|
<div class="text-center">
|
14
|
-
|
14
|
+
<%= @blog_post.decorate.link_to_author %> - <%= converte_date(@blog_post.published_at) %> <em>visualizado <%=@blog_post.access_count%></em>
|
15
15
|
</div>
|
16
16
|
<div class="row push-50-t push-50 nice-copy-story">
|
17
17
|
<div class="col-sm-8 col-sm-offset-2">
|
data/lib/go_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Carlos Ottobboni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: draper
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: blog engine
|
56
70
|
email:
|
57
71
|
- jcottobboni@gmail.com
|
@@ -75,6 +89,7 @@ files:
|
|
75
89
|
- app/views/blog/posts/_collection.html.erb
|
76
90
|
- app/views/blog/posts/_collection_list.html.erb
|
77
91
|
- app/views/blog/posts/_form.html.erb
|
92
|
+
- app/views/blog/posts/_pagination.html.erb
|
78
93
|
- app/views/blog/posts/edit.html.erb
|
79
94
|
- app/views/blog/posts/index.html.erb
|
80
95
|
- app/views/blog/posts/list.html.erb
|