buttercms 0.1.1 → 0.1.2

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: 93c8abdd5de9af65a95f692c1f3476bee23346a9
4
- data.tar.gz: 49b2f0ed710503c5703cb86618aa9970f2c6a8ad
3
+ metadata.gz: 16e84fc7ba404ed82a8945ad1495498a03c3f2eb
4
+ data.tar.gz: dd9ac538f9700cf0c03b3ce82ce1c4a23601c7e6
5
5
  SHA512:
6
- metadata.gz: 034030908557fda92ec5ae37868d821db406264738adf7274ebe0af7693bc1537aca26b9e58420c929822a6b7ee3b6ef3ea77696d8f30779f7eaac1986a7192d
7
- data.tar.gz: a04979ccac4f823f9ef932642a11ab0256ae9eaf0c5b1f4dbee5d9c3f1c06c55d87388bba2e1f2f11d1cd39828dd0bd999303946af95f80519458dba6aa4e8aa
6
+ metadata.gz: 538bba2499246d2d1207729d7646812256781829259843814200232075fade6afd9f8eac4393e9f77d06aabb5322d1fe062b66cdaf776bda64d06837ac488965
7
+ data.tar.gz: 2da147dda13d145808a6543a17779d0eecca85d211af52a776fbba5bbf64af8ae7eb83c8fcf6fa355edfa276adf14245f572825cf2b7750623e212fd9d2b7cd1
data/README.rst CHANGED
@@ -28,7 +28,7 @@ Add buttercms gem to your Gemfile and install it.
28
28
 
29
29
  $ gem install buttercms
30
30
 
31
- Now run the Butter install generator. This will create `config/initializers/butter.rb` and define a route in `config/routes.rb`. By default, your blog will live at "/blog".
31
+ Now run the Butter install generator. This will setup a `butter.rb` initializer, which provides many customization options, and defines a route in `config/routes.rb`. By default, your blog will live at "/blog".
32
32
 
33
33
  .. code-block:: bash
34
34
 
@@ -38,87 +38,27 @@ Grab your API token from https://buttercms.com/api_token and throw it in `config
38
38
 
39
39
  That's it! You’ve now got a blog running natively in your Rails project.
40
40
 
41
- Check it out: localhost:3000/blog
41
+ Check it out: http://localhost:3000/blog
42
42
 
43
43
  Log into https://buttercms.com/ to start blogging!
44
44
 
45
- ==========================
46
- Overview of key blog views
47
- ==========================
48
- The Butter gem implements several actions for your blog and provides a default view+layout for each of them. The gem also talks to an API that resides on https://buttercms.com to retrieve your blog content and makes that content easily available in each view.
49
-
50
- Here's an overview each action+view and the available content:
51
-
52
- home: /blog
53
- -----------
54
- .. code:: ruby
55
-
56
- @next_page # Integer used for blog post pagination (i.e. 2)
57
- @previous_page # Integer used for blog post pagination (i.e. 1)
58
- @recent_posts # Array of blog posts
59
-
60
- post: /blog/:post-slug
61
- ----------------------
62
- .. code:: ruby
63
-
64
- @post # All content for a blog post
65
-
66
- =begin
67
- @post has the following structure
68
- "url": "https://buttercms.com/blog/the-state-of-company-blogs",
69
- "created": "05/16/2015",
70
- "author": {
71
- "first_name": "Butter",
72
- "last_name": "Cms",
73
- "slug": "butter-cms"
74
- },
75
- "categories": [
76
- {
77
- "name": "blogs",
78
- "slug": "blogs"
79
- },
80
- {
81
- "name": "butter",
82
- "slug": "butter"
83
- }
84
- ],
85
- "slug": "the-state-of-company-blogs",
86
- "title": "The State of Company Blogs",
87
- "body": "<h3>The problem</h3><p>Countless people and essentially every...</p>",
88
- "summary": <h3>The problem</h3><p>Countless people and essentially...</p>,
89
- "status": "published"
90
- =end
91
-
92
- author: /blog/author/:author-slug
93
- ---------------------------------
94
- .. code:: ruby
95
-
96
- @first_name # First name of author
97
- @last_name # Last name of author
98
- @recent_posts # Array of blog posts
99
-
100
- category: /blog/category/:category-slug
101
- ---------------------------------------
102
- .. code:: ruby
103
-
104
- @name # Name of the category
105
- @recent_posts # Array of blog posts
106
-
107
45
 
108
46
  =====================
109
47
  Customizing your blog
110
48
  =====================
111
49
 
50
+ Open `initializers/butter.rb` to see the full set of options available for customizing your blog.
51
+
112
52
  Specify the Blog Layout
113
53
  -----------------------
114
- We've provided a default layout but we expect you'll want the blog to appear your branded layout so we've made this as simple as defining config.blog_layout.
54
+ We've provided a default layout but we expect you'll want the blog to appear your branded layout so we've made this as simple as defining `config.layout` in `initializers/butter.rb`
115
55
 
116
56
  .. code:: ruby
117
57
 
118
- # In application.rb (or an initializer like constants.rb)
119
- config.blog_layout = "<your_blog_layout>"
58
+ # In initializers/butter.rb
59
+ config.layout = "<your_blog_layout>"
120
60
 
121
- 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!
61
+ 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 http://localhost:3000/blog and you'll see your new branded blog!
122
62
 
123
63
  Customizing the view templates
124
64
  ------------------------------
@@ -126,11 +66,11 @@ You can customize any view of your blog. Here is full list of page types + setti
126
66
 
127
67
  .. code:: ruby
128
68
 
129
- # In application.rb
130
- config.blog_home_template = "blog/home"
131
- config.blog_post_template = "blog/post"
132
- config.blog_author_template = "blog/author"
133
- config.blog_category_template = "blog/category"
69
+ # In initializers/butter.rb
70
+ config.home_template = "blog/home"
71
+ config.post_template = "blog/post"
72
+ config.author_template = "blog/author"
73
+ config.category_template = "blog/category"
134
74
 
135
75
  We recommend putting any custom templates in `views/blog/<template>.html.erb`
136
76
 
@@ -175,7 +115,70 @@ Then tell Butter about this template:
175
115
 
176
116
  .. code:: ruby
177
117
 
178
- # In application.rb
179
- config.blog_post_template = "blog/post"
118
+ # In initializers/butter.rb
119
+ config.post_template = "blog/post"
180
120
 
181
- That's it. Reload the server and you'll see your new customized blog post with comments!
121
+ That's it. Reload the server and you'll see your new customized blog post with comments!
122
+
123
+
124
+ ==========================
125
+ Overview of key blog views
126
+ ==========================
127
+ The Butter gem implements several actions for your blog and provides a default view+layout for each of them. The gem also talks to an API that resides on https://buttercms.com to retrieve your blog content and makes that content easily available in each view.
128
+
129
+ Here's an overview each action+view and the available content:
130
+
131
+ home: /blog
132
+ -----------
133
+ .. code:: ruby
134
+
135
+ @next_page # Integer used for blog post pagination (i.e. 2)
136
+ @previous_page # Integer used for blog post pagination (i.e. 1)
137
+ @recent_posts # Array of blog posts
138
+
139
+ post: /blog/:post-slug
140
+ ----------------------
141
+ .. code:: ruby
142
+
143
+ @post # All content for a blog post
144
+
145
+ =begin
146
+ @post has the following structure
147
+ "url": "https://buttercms.com/blog/the-state-of-company-blogs",
148
+ "created": "05/16/2015",
149
+ "author": {
150
+ "first_name": "Butter",
151
+ "last_name": "Cms",
152
+ "slug": "butter-cms"
153
+ },
154
+ "categories": [
155
+ {
156
+ "name": "blogs",
157
+ "slug": "blogs"
158
+ },
159
+ {
160
+ "name": "butter",
161
+ "slug": "butter"
162
+ }
163
+ ],
164
+ "slug": "the-state-of-company-blogs",
165
+ "title": "The State of Company Blogs",
166
+ "body": "<h3>The problem</h3><p>Countless people and essentially every...</p>",
167
+ "summary": <h3>The problem</h3><p>Countless people and essentially...</p>,
168
+ "status": "published"
169
+ =end
170
+
171
+ author: /blog/author/:author-slug
172
+ ---------------------------------
173
+ .. code:: ruby
174
+
175
+ @first_name # First name of author
176
+ @last_name # Last name of author
177
+ @recent_posts # Array of blog posts
178
+
179
+ category: /blog/category/:category-slug
180
+ ---------------------------------------
181
+ .. code:: ruby
182
+
183
+ @name # Name of the category
184
+ @recent_posts # Array of blog posts
@@ -4,11 +4,11 @@ module Buttercms
4
4
 
5
5
  def get_layout
6
6
  if defined? Buttercms.configuration
7
- if defined? Buttercms.configuration.blog_layout
8
- return Buttercms.configuration.blog_layout
7
+ if defined? Buttercms.configuration.layout
8
+ return Buttercms.configuration.layout
9
9
  end
10
10
  end
11
-
11
+
12
12
  # Default to the included layout.
13
13
  end
14
14
  end
@@ -60,8 +60,8 @@ module Buttercms
60
60
  @recent_posts = response_json['results']
61
61
 
62
62
  if defined? Buttercms.configuration
63
- if !Buttercms.configuration.blog_home_template.nil?
64
- render template: Buttercms.configuration.blog_home_template
63
+ if !Buttercms.configuration.home_template.nil?
64
+ render template: Buttercms.configuration.home_template
65
65
  end
66
66
  end
67
67
  end
@@ -71,8 +71,8 @@ module Buttercms
71
71
  @post = JSON.parse(response)
72
72
 
73
73
  if defined? Buttercms.configuration
74
- if !Buttercms.configuration.blog_post_template.nil?
75
- render template: Buttercms.configuration.blog_post_template
74
+ if !Buttercms.configuration.post_template.nil?
75
+ render template: Buttercms.configuration.post_template
76
76
  end
77
77
  end
78
78
  end
@@ -85,8 +85,8 @@ module Buttercms
85
85
  @recent_posts = response_json['recent_posts']
86
86
 
87
87
  if defined? Buttercms.configuration
88
- if !Buttercms.configuration.blog_author_template.nil?
89
- render template: Buttercms.configuration.blog_author_template
88
+ if !Buttercms.configuration.author_template.nil?
89
+ render template: Buttercms.configuration.author_template
90
90
  end
91
91
  end
92
92
  end
@@ -98,8 +98,8 @@ module Buttercms
98
98
  @recent_posts = response_json['recent_posts']
99
99
 
100
100
  if defined? Buttercms.configuration
101
- if !Buttercms.configuration.blog_category_template.nil?
102
- render template: Buttercms.configuration.blog_category_template
101
+ if !Buttercms.configuration.category_template.nil?
102
+ render template: Buttercms.configuration.category_template
103
103
  end
104
104
  end
105
105
  end
data/lib/buttercms.rb CHANGED
@@ -11,7 +11,7 @@ module Buttercms
11
11
  end
12
12
 
13
13
  class Configuration
14
- attr_accessor :token, :blog_layout, :blog_home_template, :blog_post_template, :blog_author_template, :blog_category_template
14
+ attr_accessor :token, :layout, :home_template, :post_template, :author_template, :category_template
15
15
 
16
16
  def initialize
17
17
  # Displays a default blog post with instructions on getting a personal token.
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buttercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ButterCms