buttercms 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e5b474891964780a00d8138aec446079073ac11
4
- data.tar.gz: 7af731be314e3c32b884231cef478cb77c4319fe
3
+ metadata.gz: 4709766ace0ac3d68ebe5631674bb39d9188d990
4
+ data.tar.gz: 6d2f2662ba196da271bb203975836ca84464ec1c
5
5
  SHA512:
6
- metadata.gz: c8d0688edbd6d302f51eb751d5b3560292c116c24ffbf6c9b9899fbc08237fbb5d0bd75d76d26fa3964ba123b43d1314f5878eaaaf1e01fddf5e437e1898feea
7
- data.tar.gz: 1400feefb4bb290deacec029bd0fa566bb464742d7bbf7c75e630113d58f721543d8233af83c0fcb7479efae5edab8a17157bda4bb4bcf9ed26e78db740d1ca9
6
+ metadata.gz: 6ee57d214b7c1f204de6692ec319357f7ce613ba70f385553db5e329711828900f7fe512b1a14999f2c4ea0234a0e2a60b6105f1d16d382878a269ed3f1074c7
7
+ data.tar.gz: 38d6c914a3fa9deae22014893a1fe432e6b712c820fb4fab4466024e7fcdcf5d5ef8e15542a02c2d65c08e2222f0ec7d16c9332a6112c86fcedf1af2c2774e4f
@@ -59,6 +59,13 @@ module Buttercms
59
59
  def post
60
60
  response = make_request("#{API_URL}posts/#{params[:slug]}")
61
61
  @post = JSON.parse(response)
62
+
63
+ begin
64
+ # Check for overridden template.
65
+ render template: Rails.application.config.blog_post_template
66
+ rescue NoMethodError
67
+ # Default to normal blog post template.
68
+ end
62
69
  end
63
70
 
64
71
  def author
@@ -67,6 +74,12 @@ module Buttercms
67
74
  @first_name = response_json['first_name']
68
75
  @last_name = response_json['last_name']
69
76
  @recent_posts = response_json['recent_posts']
77
+
78
+ begin
79
+ # Check for overridden template.
80
+ render template: Rails.application.config.blog_author_template
81
+ rescue NoMethodError
82
+ end
70
83
  end
71
84
 
72
85
  def category
@@ -74,6 +87,12 @@ module Buttercms
74
87
  response_json = JSON.parse(response)
75
88
  @name = response_json['name']
76
89
  @recent_posts = response_json['recent_posts']
90
+
91
+ begin
92
+ # Check for overridden template.
93
+ render template: Rails.application.config.blog_category_template
94
+ rescue NoMethodError
95
+ end
77
96
  end
78
97
  end
79
98
  end
@@ -0,0 +1,13 @@
1
+ <ul class="pager">
2
+ <% if next_page %>
3
+ <li class="previous">
4
+ <%= link_to("&larr; Older Posts".html_safe, archive_path(:page => next_page)) %>
5
+ </li>
6
+ <% end %>
7
+
8
+ <% if previous_page %>
9
+ <li class="previous">
10
+ <%= link_to("Newer Posts &rarr;".html_safe, archive_path(:page => previous_page)) %>
11
+ </li>
12
+ <% end %>
13
+ </ul>
@@ -0,0 +1,22 @@
1
+ <div class="post-preview">
2
+ <h2 class="post-title">
3
+ <%= link_to(post['title'], blog_post_path(:slug => post['slug'])) %>
4
+ </h2>
5
+
6
+ <p class="post-meta">
7
+ Posted by
8
+ <%= link_to("#{post['author']['first_name']} #{post['author']['last_name']}", blog_author_path(:author_slug => post['author']['slug'])) %>
9
+ on <%= post['created'] %>
10
+
11
+ <% post['categories'].each do |category| %>
12
+ <span class="label label-default">
13
+ <%= link_to(category['name'], blog_category_path(:category_slug => category['slug'])) %>
14
+ </span>
15
+ <% end %>
16
+ </p>
17
+
18
+ <p class="post-summary">
19
+ <%= post['summary'] %>
20
+ </p>
21
+ </div>
22
+ <hr>
@@ -1,26 +1,3 @@
1
1
  <h2>Recent posts from <%=@first_name %> <%=@last_name %></h2>
2
2
 
3
- <% @recent_posts.each do |post| %>
4
- <div class="post-preview">
5
- <h2 class="post-title">
6
- <%= link_to(post['title'], blog_post_path(:slug => post['slug'])) %>
7
- </h2>
8
-
9
- <p class="post-meta">
10
- Posted by
11
- <%= link_to("#{post['author']['first_name']} #{post['author']['last_name']}", blog_author_path(:author_slug => post['author']['slug'])) %>
12
- on <%= post['created'] %>
13
-
14
- <% post['categories'].each do |category| %>
15
- <span class="label label-default">
16
- <%= link_to(category['name'], blog_category_path(:category_slug => category['slug'])) %>
17
- </span>
18
- <% end %>
19
- </p>
20
-
21
- <p class="post-summary">
22
- <%= post['summary'] %>
23
- </p>
24
- </div>
25
- <hr>
26
- <% end %>
3
+ <%= render partial: "post", collection: @recent_posts %>
@@ -1,26 +1,3 @@
1
1
  <h2>Recent <%=@name %> posts</h2>
2
2
 
3
- <% @recent_posts.each do |post| %>
4
- <div class="post-preview">
5
- <h2 class="post-title">
6
- <%= link_to(post['title'], blog_post_path(:slug => post['slug'])) %>
7
- </h2>
8
-
9
- <p class="post-meta">
10
- Posted by
11
- <%= link_to("#{post['author']['first_name']} #{post['author']['last_name']}", blog_author_path(:author_slug => post['author']['slug'])) %>
12
- on <%= post['created'] %>
13
-
14
- <% post['categories'].each do |category| %>
15
- <span class="label label-default">
16
- <%= link_to(category['name'], blog_category_path(:category_slug => category['slug'])) %>
17
- </span>
18
- <% end %>
19
- </p>
20
-
21
- <p class="post-summary">
22
- <%= post['summary'] %>
23
- </p>
24
- </div>
25
- <hr>
26
- <% end %>
3
+ <%= render partial: "post", collection: @recent_posts %>
@@ -1,38 +1,3 @@
1
- <% @recent_posts.each do |post| %>
2
- <div class="post-preview">
3
- <h2 class="post-title">
4
- <%= link_to(post['title'], blog_post_path(:slug => post['slug'])) %>
5
- </h2>
1
+ <%= render partial: "post", collection: @recent_posts %>
6
2
 
7
- <p class="post-meta">
8
- Posted by
9
- <%= link_to("#{post['author']['first_name']} #{post['author']['last_name']}", blog_author_path(:author_slug => post['author']['slug'])) %>
10
- on <%= post['created'] %>
11
-
12
- <% post['categories'].each do |category| %>
13
- <span class="label label-default">
14
- <%= link_to(category['name'], blog_category_path(:category_slug => category['slug'])) %>
15
- </span>
16
- <% end %>
17
- </p>
18
-
19
- <p class="post-summary">
20
- <%= post['summary'] %>
21
- </p>
22
- </div>
23
- <hr>
24
- <% end %>
25
-
26
- <ul class="pager">
27
- <% if @next_page %>
28
- <li class="previous">
29
- <%= link_to("&larr; Older Posts".html_safe, archive_path(:page => @next_page)) %>
30
- </li>
31
- <% end %>
32
-
33
- <% if @previous_page %>
34
- <li class="previous">
35
- <%= link_to("Newer Posts &rarr;".html_safe, archive_path(:page => @previous_page)) %>
36
- </li>
37
- <% end %>
38
- </ul>
3
+ <%= render partial: "pagers", locals: {next_page: @next_page, previous_page: @previous_page} %>
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buttercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ButterCms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,8 @@ files:
87
87
  - app/controllers/buttercms/application_controller.rb
88
88
  - app/controllers/buttercms/blog_controller.rb
89
89
  - app/helpers/buttercms/application_helper.rb
90
+ - app/views/buttercms/blog/_pagers.html.erb
91
+ - app/views/buttercms/blog/_post.html.erb
90
92
  - app/views/buttercms/blog/author.html.erb
91
93
  - app/views/buttercms/blog/category.html.erb
92
94
  - app/views/buttercms/blog/home.html.erb