buttercms 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4709766ace0ac3d68ebe5631674bb39d9188d990
4
- data.tar.gz: 6d2f2662ba196da271bb203975836ca84464ec1c
3
+ metadata.gz: 1a899685662a22b2ad2a4ec87e0f9e0683fbcdaa
4
+ data.tar.gz: a7d27b415b8e3d6e16ce7368f1cfd527e60e4301
5
5
  SHA512:
6
- metadata.gz: 6ee57d214b7c1f204de6692ec319357f7ce613ba70f385553db5e329711828900f7fe512b1a14999f2c4ea0234a0e2a60b6105f1d16d382878a269ed3f1074c7
7
- data.tar.gz: 38d6c914a3fa9deae22014893a1fe432e6b712c820fb4fab4466024e7fcdcf5d5ef8e15542a02c2d65c08e2222f0ec7d16c9332a6112c86fcedf1af2c2774e4f
6
+ metadata.gz: e1aae93ced97c476b91c31efdfa3ce2d4f6b82e30a9527d3963c9661ae3c07eb3aee0215d8d706f0f787a247f14e0c95d605e0731352b459a204fa40a7905e1d
7
+ data.tar.gz: 2559999bf1ea8819f7d95334162e3e14e839af3aa1f120215167e08f2ae4419f7c42585cfa261f80729e4bb2a2efb627b3ed1434d669fd895439cd132217e778
data/README.rst CHANGED
@@ -42,7 +42,9 @@ Grab your API token from https://buttercms.com/api_token
42
42
 
43
43
  Nice job. You've now got a blog running natively in your Rails project. Nothing but Ruby goodness. (No PHP scripts here ;))
44
44
 
45
- Check it out! localhost:3000/blog
45
+ Check it out: localhost:3000/blog
46
+
47
+ Log into https://buttercms.com/ to start blogging!
46
48
 
47
49
  Specify the Blog Layout
48
50
  -----------------------
@@ -51,10 +53,61 @@ We've provided a default layout but we expect you'll want the blog to appear you
51
53
  .. code:: ruby
52
54
 
53
55
  # In application.rb (or an initializer like constants.rb)
54
- config.blog_layout = "<your_main_layout>"
56
+ config.blog_layout = "<your_blog_layout>"
55
57
 
56
- Note that an ideal layout simply defines the header and footer for the page and <%= yields %> the main body.
58
+ Note that an ideal layout simply defines the header and footer for the page and <%= yields %> the main body. Restart the server and go to localhost:3000/blog and you'll see your new branded blog!
57
59
 
58
- Restart the server and go to localhost:3000/blog and you'll see your new professional branded blog!
60
+ Add comments to blog post template
61
+ ----------------------------------
62
+ If you want to customize the blog post template (for example to add `Disqus
63
+ <https://disqus.com/>`_ comments at the bottom), it's simple:
59
64
 
60
- Log into https://buttercms.com/ to start blogging!
65
+ First create your template. We recommend putting it in `views/blog/post.html.erb`
66
+
67
+ .. code:: html
68
+
69
+ <div class="post-preview">
70
+ <h2 class="post-title">
71
+ <%= @post['title'] %>
72
+ </h2>
73
+
74
+ <p class="post-meta">
75
+ Posted by
76
+ <%= link_to("#{@post['author']['first_name']} #{@post['author']['last_name']}", blog_author_path(:author_slug => @post['author']['slug'])) %>
77
+ on <%= @post['created'] %>
78
+
79
+ <% @post['categories'].each do |category| %>
80
+ <span class="label label-default">
81
+ <%= link_to(category['name'], blog_category_path(:category_slug => category['slug'])) %>
82
+ </span>
83
+ <% end %>
84
+ </p>
85
+
86
+ <p class="post-body">
87
+ <%= @post['body'].html_safe %>
88
+ </p>
89
+ </div>
90
+
91
+ <hr>
92
+
93
+ <!-- Paste your Disqus embed code here --->
94
+
95
+ Then tell Butter about this template:
96
+
97
+ .. code:: ruby
98
+
99
+ # In application.rb
100
+ config.blog_post_template = "blog/post"
101
+
102
+
103
+ Customize other templates
104
+ -------------------------
105
+ You can customize other parts of the blog as well by following the same pattern. A full list of page types + settings is below:
106
+
107
+ .. code:: ruby
108
+
109
+ # In application.rb
110
+ config.blog_home_template = "blog/home"
111
+ config.blog_post_template = "blog/post"
112
+ config.blog_author_template = "blog/author"
113
+ config.blog_category_template = "blog/category"
@@ -54,6 +54,12 @@ module Buttercms
54
54
  @next_page = response_json['next_page']
55
55
  @previous_page = response_json['previous_page']
56
56
  @recent_posts = response_json['results']
57
+
58
+ begin
59
+ # Check for overridden template.
60
+ render template: Rails.application.config.blog_home_template
61
+ rescue NoMethodError
62
+ end
57
63
  end
58
64
 
59
65
  def post
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
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.6
4
+ version: 0.0.7
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-12 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler