blog_boi 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -16
- data/app/assets/javascripts/blog_boi/global.js +0 -7
- data/app/assets/stylesheets/blog_boi/_blog.scss +29 -0
- data/app/assets/stylesheets/blog_boi/_footer.scss +1 -3
- data/app/assets/stylesheets/blog_boi/application.scss +4 -0
- data/app/controllers/blog_boi/application_controller.rb +3 -1
- data/app/controllers/blog_boi/articles_controller.rb +9 -4
- data/app/views/blog_boi/articles/_article.html.erb +5 -9
- data/app/views/blog_boi/articles/_article_body.html.erb +1 -1
- data/app/views/blog_boi/articles/_form.html.erb +10 -0
- data/app/views/blog_boi/articles/edit.html.erb +1 -1
- data/app/views/blog_boi/articles/index.html.erb +13 -1
- data/app/views/blog_boi/articles/show.html.erb +5 -5
- data/app/views/layouts/blog_boi/_footer.html.erb +10 -14
- data/app/views/layouts/blog_boi/_head_meta_tags.html.erb +8 -3
- data/app/views/layouts/blog_boi/_header.html.erb +1 -1
- data/db/migrate/20191007141852_add_hidden_column_to_articles.rb +6 -0
- data/lib/blog_boi.rb +3 -2
- data/lib/blog_boi/engine.rb +0 -1
- data/lib/blog_boi/version.rb +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31645c10388c99890a39ed3cbc1014c1737342b8a3de3852546385b596b08b2b
|
4
|
+
data.tar.gz: 8f67cc1616593ae250c446eb10543d90214b594cd6e052ee00793405aca26a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b30b08d8e722878e01adbd7628ce0f8bca54227a5897e969ee19912b67879056cc740c69801ed368825a2b2453bf5842c533c31a2cde68a40abfd0e330a14a4
|
7
|
+
data.tar.gz: 060ff5ea76418a59046d97ed749b91a7e82ec40675a015df563f1e31773dade9ffe743342e26c2b97f3b49856217b025369ed6d22a78732190fac90e722ff027
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
By [Charlie Reese](https://charliereese.ca/about) at [Clientelify](https://clientelify.com)
|
2
|
+
|
1
3
|
# BlogBoi
|
2
4
|
|
3
|
-
BlogBoi is a rails gem / engine that provides out-of-the-box blogging functionality to your rails application
|
5
|
+
BlogBoi is a rails gem / engine that provides out-of-the-box blogging functionality to your rails application.
|
6
|
+
|
7
|
+
It requires active_storage for photo upload / storage.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -10,8 +14,6 @@ BlogBoi is a rails gem / engine that provides out-of-the-box blogging functional
|
|
10
14
|
gem 'blog_boi', '~> 0'
|
11
15
|
```
|
12
16
|
|
13
|
-
_Note: path may move to github and not be relative_
|
14
|
-
|
15
17
|
2. Add these lines to your config/application.rb file:
|
16
18
|
|
17
19
|
```ruby
|
@@ -28,6 +30,7 @@ ActiveStorage::Engine.config
|
|
28
30
|
```bash
|
29
31
|
$ bundle
|
30
32
|
$ rake active_storage:install `# If hasn't been run yet`
|
33
|
+
$ rake active_storage:update # if upgrading to rails 6
|
31
34
|
$ rails blog_boi:install:migrations `# not needed for dummy test application`
|
32
35
|
$ rails db:migrate
|
33
36
|
```
|
@@ -36,12 +39,12 @@ Your storage.yml file should now have this code:
|
|
36
39
|
|
37
40
|
```
|
38
41
|
test:
|
39
|
-
|
40
|
-
|
42
|
+
service: Disk
|
43
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
41
44
|
|
42
45
|
local:
|
43
|
-
|
44
|
-
|
46
|
+
service: Disk
|
47
|
+
root: <%= Rails.root.join("storage") %>
|
45
48
|
```
|
46
49
|
|
47
50
|
_Note: $ rails railties:install:migrations to copy all new migrations_
|
@@ -61,18 +64,18 @@ mount BlogBoi::Engine, at: "/blog"
|
|
61
64
|
BlogBoi.author_class = "User" # name of active record model containing authors with property called name (for author's name)
|
62
65
|
```
|
63
66
|
|
64
|
-
See lib/blog_boi.rb for all customization options.
|
67
|
+
See lib/blog_boi.rb for all customization options (like setting your Blog's meta description / image).
|
65
68
|
|
66
69
|
7. Finally, your parent application must define the method `admin_signed_in?`. If you are using Devise, this method may already exist. It should return true if the blog admin is signed in, and false if not. When it returns true, you may create, update, and destroy blog articles. It should be available in controllers and views; it should be defined in ApplicationController, and should be marked a helper method. E.g.
|
67
70
|
|
68
71
|
```
|
69
72
|
class ApplicationController < ActionController::Base
|
70
73
|
|
71
|
-
|
74
|
+
helper_method :admin_signed_in?
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
+
def admin_signed_in?
|
77
|
+
...
|
78
|
+
end
|
76
79
|
|
77
80
|
end
|
78
81
|
```
|
@@ -91,6 +94,11 @@ To override SCSS bootstrap mixins / styles, add a file in parent application cal
|
|
91
94
|
|
92
95
|
Override the header or footer by placing your own files at `views/layouts/_header` or `views/layouts/_footer`
|
93
96
|
|
97
|
+
Further, you can add your own css classes / ids to your markup:
|
98
|
+
- https://kramdown.gettalong.org/quickref.html
|
99
|
+
- https://about.gitlab.com/blog/2016/07/19/markdown-kramdown-tips-and-tricks/
|
100
|
+
- `{: .cls}`
|
101
|
+
|
94
102
|
## Running tests
|
95
103
|
|
96
104
|
- Run all tests other than system: `rake app:test`
|
@@ -109,9 +117,7 @@ The gem is currently available as open source software under the terms of the [M
|
|
109
117
|
|
110
118
|
## Contributing
|
111
119
|
|
112
|
-
|
113
|
-
|
114
|
-
With that in mind, if you'd like to make a fix / change, please create a pull request (and when I have a moment - probably in a couple weeks time - I'll have a look)!
|
120
|
+
If you'd like to make a fix / change, please create a pull request; when I have a moment, I'll have a look!
|
115
121
|
|
116
122
|
## Updating gem version (for maintainers)
|
117
123
|
|
@@ -129,5 +135,8 @@ In `lib/blog_boi/version.rb` update version.
|
|
129
135
|
|
130
136
|
**4. Tag GitHub**
|
131
137
|
|
138
|
+
`git add -A`
|
139
|
+
`git commit -m "Msg"`
|
140
|
+
`git push`
|
132
141
|
`git tag -a vX.X.X -m "Msg"`
|
133
|
-
`git push --tags`
|
142
|
+
`git push --tags`
|
@@ -2,12 +2,5 @@
|
|
2
2
|
// All this logic will automatically be available in application.js.
|
3
3
|
|
4
4
|
$(function() {
|
5
|
-
adjustMainPadding();
|
6
5
|
});
|
7
6
|
|
8
|
-
function adjustMainPadding() {
|
9
|
-
var footerHeight = +$('footer.blog-boi-blog').css('height').slice(0,-2);
|
10
|
-
footerHeight += 10;
|
11
|
-
|
12
|
-
$('main.blog-boi').css('padding-bottom', footerHeight + 'px');
|
13
|
-
}
|
@@ -9,3 +9,32 @@ main.blog-boi.blog.index {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
}
|
12
|
+
|
13
|
+
main.blog-boi.blog.show {
|
14
|
+
|
15
|
+
div.article-body {
|
16
|
+
|
17
|
+
h1, h2, h3, h4, h5, h6 {
|
18
|
+
margin-bottom: 1rem;
|
19
|
+
}
|
20
|
+
|
21
|
+
h1 {
|
22
|
+
margin-top: 2.5rem;
|
23
|
+
margin-bottom: 1.25rem;
|
24
|
+
}
|
25
|
+
|
26
|
+
h2, h3 {
|
27
|
+
margin-top: 2rem;
|
28
|
+
}
|
29
|
+
|
30
|
+
h4, h5 {
|
31
|
+
margin-top: 1.4rem;
|
32
|
+
}
|
33
|
+
|
34
|
+
h6 {
|
35
|
+
margin-top: 1rem;
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
@@ -9,12 +9,17 @@ module BlogBoi
|
|
9
9
|
|
10
10
|
# GET /articles
|
11
11
|
def index
|
12
|
-
@articles = Article.all
|
12
|
+
@articles = Article.all.where({hidden: false})
|
13
|
+
@articles_hidden = Article.all.where({hidden: true})
|
13
14
|
end
|
14
15
|
|
15
16
|
# GET /articles/1
|
16
17
|
def show
|
17
|
-
@meta_tags
|
18
|
+
@meta_tags = {
|
19
|
+
title: @article.title,
|
20
|
+
description: @article.description,
|
21
|
+
image: @article.image.attached? ? main_app.url_for(@article.image) : nil,
|
22
|
+
}
|
18
23
|
end
|
19
24
|
|
20
25
|
# GET /articles/new
|
@@ -54,7 +59,7 @@ module BlogBoi
|
|
54
59
|
|
55
60
|
# GET /articles/category/cool_category
|
56
61
|
def category_index
|
57
|
-
@articles = Article.with_category_name(params[:category_name])
|
62
|
+
@articles = Article.with_category_name(params[:category_name]).where(hidden: false)
|
58
63
|
@category_title = params[:category_name].titleize
|
59
64
|
render :index
|
60
65
|
end
|
@@ -71,7 +76,7 @@ module BlogBoi
|
|
71
76
|
|
72
77
|
# Only allow a trusted parameter "white list" through.
|
73
78
|
def article_params
|
74
|
-
params.require(:article).permit(:title, :text, :author_name, :category_names, :slug, :description, :image)
|
79
|
+
params.require(:article).permit(:title, :text, :author_name, :category_names, :slug, :description, :image, :hidden)
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<div class="col-12 col-md-9 col-lg-
|
1
|
+
<div class="col-12 col-md-9 col-lg-7 d-block mx-auto mt-4">
|
2
2
|
|
3
3
|
<%= render partial: 'category', collection: article.categories %>
|
4
4
|
|
5
5
|
<a class="d-block article mt-2"
|
6
|
-
href="
|
6
|
+
href="<%= root_url + article.slug %>">
|
7
7
|
|
8
8
|
<h2 class="text-blue mb-0">
|
9
9
|
<%= article.title %>
|
@@ -15,12 +15,8 @@
|
|
15
15
|
|
16
16
|
<ul class="list-inline mb-0">
|
17
17
|
|
18
|
-
<li class="list-inline-item">
|
19
|
-
<%= article.author.name %>
|
20
|
-
</li>
|
21
|
-
|
22
|
-
<li class="list-inline-item">
|
23
|
-
<%= article.updated_at.strftime("%B %e, %Y") %>
|
18
|
+
<li class="list-inline-item text-muted">
|
19
|
+
by <%= article.author.name %> on <%= article.updated_at.strftime("%B %e, %Y") %>
|
24
20
|
</li>
|
25
21
|
|
26
22
|
</ul>
|
@@ -38,4 +34,4 @@
|
|
38
34
|
|
39
35
|
<% end %>
|
40
36
|
|
41
|
-
</div>
|
37
|
+
</div>
|
@@ -24,11 +24,21 @@
|
|
24
24
|
<%= form.text_field :title, placeholder: 'e.g. Great Title: 3 Reasons Why', class: 'form-control' %>
|
25
25
|
</div>
|
26
26
|
|
27
|
+
<div class="field mt-3">
|
28
|
+
<%= form.label :description %>
|
29
|
+
<%= form.text_field :description, placeholder: 'e.g. The 3 reasons why you must use the BlogBoi engine', class: 'form-control' %>
|
30
|
+
</div>
|
31
|
+
|
27
32
|
<div class="field mt-3">
|
28
33
|
<%= form.label :slug %>
|
29
34
|
<%= form.text_field :slug, placeholder: 'e.g. appointment-reminders-for-dentists', class: 'form-control' %>
|
30
35
|
</div>
|
31
36
|
|
37
|
+
<div class="field mt-3">
|
38
|
+
<%= form.check_box :hidden %>
|
39
|
+
<%= form.label :hidden %>
|
40
|
+
</div>
|
41
|
+
|
32
42
|
<div class="field mt-3">
|
33
43
|
<%= form.label :category_names %>
|
34
44
|
<%= form.text_field :category_names, placeholder: 'e.g. no-shows, sales growth', class: 'form-control' %>
|
@@ -9,12 +9,24 @@
|
|
9
9
|
<% if is_admin? %>
|
10
10
|
|
11
11
|
<div class="col-12 mt-4">
|
12
|
-
<%= link_to 'New Article', new_article_path, class: 'btn-primary rounded' %>
|
12
|
+
<%= link_to 'New Article', new_article_path, class: 'btn btn-primary rounded' %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<%= render @articles %>
|
18
|
+
|
19
|
+
<% if is_admin? %>
|
20
|
+
|
21
|
+
<h1 class="text-center col-12 mt-5">Hidden articles:</h1>
|
22
|
+
|
23
|
+
<% @articles_hidden && @articles_hidden.each do |article_hidden| %>
|
24
|
+
|
25
|
+
<%= render 'article', article: article_hidden %>
|
26
|
+
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% end %>
|
18
30
|
|
19
31
|
</div>
|
20
32
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<main class="blog-boi blog
|
1
|
+
<main class="blog-boi blog show">
|
2
2
|
|
3
3
|
<div class="bg-primary">
|
4
4
|
|
@@ -22,11 +22,11 @@
|
|
22
22
|
|
23
23
|
</div>
|
24
24
|
|
25
|
-
<div class="container mt-md-125-sm-50">
|
25
|
+
<div class="container <%= @article.image.attached? ? 'mt-md-125-sm-50' : '' %>">
|
26
26
|
|
27
27
|
<div class="row">
|
28
28
|
|
29
|
-
<div class="col-12 col-md-10 col-lg-7 mx-auto text-center mt-
|
29
|
+
<div class="col-12 col-md-10 col-lg-7 mx-auto text-center mt-5">
|
30
30
|
|
31
31
|
<div>
|
32
32
|
<%= render partial: 'category', collection: @article.categories %>
|
@@ -37,8 +37,8 @@
|
|
37
37
|
</h1>
|
38
38
|
|
39
39
|
<div class="mt-3 text-muted">
|
40
|
-
<%= @article.author.name
|
41
|
-
<%= @article.updated_at.strftime("%B %e, %Y") %>
|
40
|
+
by <%= @article.author.name %>
|
41
|
+
on <%= @article.updated_at.strftime("%B %e, %Y") %>
|
42
42
|
</div>
|
43
43
|
|
44
44
|
<%= render 'article_body' %>
|
@@ -1,21 +1,17 @@
|
|
1
|
-
<footer class="blog-boi-blog">
|
1
|
+
<footer class="blog-boi-blog pt-5">
|
2
2
|
|
3
|
-
|
3
|
+
<div class="container">
|
4
4
|
|
5
|
-
|
5
|
+
<div class="row">
|
6
|
+
|
7
|
+
<div class="col-12 py-3 text-center text-muted">
|
8
|
+
|
9
|
+
<div>© <%= company_name %> <%= Time.current.year %></div>
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
<div class="col-12 py-3 text-center">
|
10
|
-
|
11
|
-
<div>© <%= company_name %> <%= Time.current.year %></div>
|
11
|
+
</div>
|
12
12
|
|
13
|
-
|
13
|
+
</div>
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
</div>
|
18
|
-
|
19
|
-
</div>
|
15
|
+
</div>
|
20
16
|
|
21
17
|
</footer>
|
@@ -1,7 +1,12 @@
|
|
1
|
-
<title
|
1
|
+
<title>
|
2
|
+
<%= @meta_tags[:title] || company_name + ' Blog' %>
|
3
|
+
</title>
|
2
4
|
<meta property="og:title" content="<%= @meta_tags[:title] || blog_seo_title %>" />
|
3
5
|
|
6
|
+
<meta name="description" content="<%= @meta_tags[:description] || blog_seo_description %>" />
|
7
|
+
<meta property="og:description" content="<%= @meta_tags[:description] || blog_seo_description %>" />
|
8
|
+
|
4
9
|
<meta property="og:site_name" content="<%= company_name %>" />
|
10
|
+
<meta property="og:type" content="article">
|
5
11
|
|
6
|
-
<meta
|
7
|
-
<meta property="og:description" content="<%= @meta_tags[:description] || blog_seo_description %>" />
|
12
|
+
<meta property="og:image" content="<%= @meta_tags[:image] %>"/>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
<div class="col-12 col-md-6 col-lg-5 text-primary-light font-weight-light mt-3 mt-md-0">
|
18
18
|
<em>
|
19
|
-
Brought to you by <a href="/" class="text-orange"><%= company_name %></a>,
|
19
|
+
Brought to you by <a href="/" class="text-orange"><%= company_name %></a>, <%= company_description %>
|
20
20
|
</em>
|
21
21
|
</div>
|
22
22
|
|
data/lib/blog_boi.rb
CHANGED
@@ -3,7 +3,7 @@ require "blog_boi/error_classes"
|
|
3
3
|
|
4
4
|
module BlogBoi
|
5
5
|
mattr_accessor :author_class, :company_name, :company_logo_path, :company_description, :blog_description,
|
6
|
-
:blog_seo_description, :blog_seo_title
|
6
|
+
:blog_seo_description, :blog_seo_title, :blog_meta_image
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def author_class
|
@@ -20,11 +20,12 @@ module BlogBoi
|
|
20
20
|
|
21
21
|
# Company info
|
22
22
|
self.company_name = 'SaaSy'
|
23
|
-
self.company_description = 'business that does xyz'
|
23
|
+
self.company_description = 'A business that does xyz'
|
24
24
|
self.company_logo_path = 'blog_boi/logo'
|
25
25
|
|
26
26
|
# Blog info
|
27
27
|
self.blog_description = 'We help your business reduce no-shows, get more reviews, and increase sales and productivity: detailed tutorials and insight from business owners and experts'
|
28
28
|
self.blog_seo_description = blog_description
|
29
29
|
self.blog_seo_title = blog_seo_title
|
30
|
+
self.blog_meta_image = 'blog_boi/logo'
|
30
31
|
end
|
data/lib/blog_boi/engine.rb
CHANGED
data/lib/blog_boi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blog_boi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Reese
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 5.0.0.alpha1
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: 5.0.0.alpha1
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: jquery-rails
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,8 +112,7 @@ dependencies:
|
|
112
112
|
- - "~>"
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
|
-
description:
|
116
|
-
WARNING: v0.0.1 and v0.0.2 are not yet stable / production ready.'
|
115
|
+
description: Easily add blogging functionality to your rails project using BlogBoi.
|
117
116
|
email:
|
118
117
|
- j.charles.reese@gmail.com
|
119
118
|
executables: []
|
@@ -169,6 +168,7 @@ files:
|
|
169
168
|
- db/migrate/20190729022622_create_join_table_article_category.rb
|
170
169
|
- db/migrate/20190820235901_add_description_to_blog_boi_articles.rb
|
171
170
|
- db/migrate/20190911003115_add_slug_to_article.rb
|
171
|
+
- db/migrate/20191007141852_add_hidden_column_to_articles.rb
|
172
172
|
- db/seeds.rb
|
173
173
|
- lib/blog_boi.rb
|
174
174
|
- lib/blog_boi/engine.rb
|
@@ -180,7 +180,7 @@ licenses:
|
|
180
180
|
- MIT
|
181
181
|
metadata:
|
182
182
|
source_code_uri: https://github.com/charliereese/blog_boi
|
183
|
-
post_install_message:
|
183
|
+
post_install_message:
|
184
184
|
rdoc_options: []
|
185
185
|
require_paths:
|
186
186
|
- lib
|
@@ -195,9 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
|
199
|
-
|
200
|
-
signing_key:
|
198
|
+
rubygems_version: 3.1.4
|
199
|
+
signing_key:
|
201
200
|
specification_version: 4
|
202
201
|
summary: BlogBoi is a rails engine for adding blogging functionality to your rails
|
203
202
|
project.
|