go_blog 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +36 -0
- data/app/assets/config/go_blog_manifest.js +0 -0
- data/app/assets/javascripts/blog/posts.js +2 -0
- data/app/assets/stylesheets/blog/posts.css +4 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/controllers/blog/posts_controller.rb +60 -0
- data/app/decorator/blog/post_decorator.rb +37 -0
- data/app/helpers/blog/posts_helper.rb +2 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/blog.rb +5 -0
- data/app/models/blog/post.rb +5 -0
- data/app/views/blog/posts/_collection.html.erb +20 -0
- data/app/views/blog/posts/_form.html.erb +33 -0
- data/app/views/blog/posts/edit.html.erb +26 -0
- data/app/views/blog/posts/index.html.erb +43 -0
- data/app/views/blog/posts/new.html.erb +27 -0
- data/app/views/blog/posts/show.html.erb +87 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20171008203759_create_blog_posts.rb +16 -0
- data/lib/go_blog.rb +5 -0
- data/lib/go_blog/engine.rb +15 -0
- data/lib/go_blog/version.rb +3 -0
- data/lib/tasks/go_blog_tasks.rake +4 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 66386a0030665aeafe236665935310fec35c7e3a
|
4
|
+
data.tar.gz: 7780815768e5d48000941acec49390170c155488
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c8a3dc36c7356c1692dae49703001364e7e5061c1fadbd17158c36ca3bfccfcbab4ee25aef850c664407375eb20ab5b3202f498ce34576268b5407a216d6bce
|
7
|
+
data.tar.gz: f6ec866827416f3a4060d561b749d4cd0ca138bf59365736c8999ed5b9c264a5db9122b851a3946190a220991614d7565a48c7a69fddc460bdc8c539c4c2de87
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 João Carlos Ottobboni
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# GoBlog
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'go_blog'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install go_blog
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'GoBlog'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
File without changes
|
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, p, ol, ul, td {
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
a:hover {
|
28
|
+
color: #fff;
|
29
|
+
background-color: #000;
|
30
|
+
}
|
31
|
+
|
32
|
+
th {
|
33
|
+
padding-bottom: 5px;
|
34
|
+
}
|
35
|
+
|
36
|
+
td {
|
37
|
+
padding: 0 5px 7px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.field,
|
41
|
+
div.actions {
|
42
|
+
margin-bottom: 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#notice {
|
46
|
+
color: green;
|
47
|
+
}
|
48
|
+
|
49
|
+
.field_with_errors {
|
50
|
+
padding: 2px;
|
51
|
+
background-color: red;
|
52
|
+
display: table;
|
53
|
+
}
|
54
|
+
|
55
|
+
#error_explanation {
|
56
|
+
width: 450px;
|
57
|
+
border: 2px solid red;
|
58
|
+
padding: 7px 7px 0;
|
59
|
+
margin-bottom: 20px;
|
60
|
+
background-color: #f0f0f0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#error_explanation h2 {
|
64
|
+
text-align: left;
|
65
|
+
font-weight: bold;
|
66
|
+
padding: 5px 5px 5px 15px;
|
67
|
+
font-size: 12px;
|
68
|
+
margin: -7px -7px 0;
|
69
|
+
background-color: #c00;
|
70
|
+
color: #fff;
|
71
|
+
}
|
72
|
+
|
73
|
+
#error_explanation ul li {
|
74
|
+
font-size: 12px;
|
75
|
+
list-style: square;
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
display: block;
|
80
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Blog
|
2
|
+
class PostsController < ApplicationController
|
3
|
+
before_action :set_blog_post, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
# GET /blog/posts
|
6
|
+
def index
|
7
|
+
@blog_posts = Post.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /blog/posts/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /blog/posts/new
|
15
|
+
def new
|
16
|
+
@blog_post = Post.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /blog/posts/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /blog/posts
|
24
|
+
def create
|
25
|
+
@blog_post = Post.new(blog_post_params)
|
26
|
+
|
27
|
+
if @blog_post.save
|
28
|
+
redirect_to @blog_post, notice: 'Post was successfully created.'
|
29
|
+
else
|
30
|
+
render :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /blog/posts/1
|
35
|
+
def update
|
36
|
+
if @blog_post.update(blog_post_params)
|
37
|
+
redirect_to @blog_post, notice: 'Post was successfully updated.'
|
38
|
+
else
|
39
|
+
render :edit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE /blog/posts/1
|
44
|
+
def destroy
|
45
|
+
@blog_post.destroy
|
46
|
+
redirect_to blog_posts_url, notice: 'Post was successfully destroyed.'
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
51
|
+
def set_blog_post
|
52
|
+
@blog_post = Post.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Only allow a trusted parameter "white list" through.
|
56
|
+
def blog_post_params
|
57
|
+
params.require(:blog_post).permit(:title, :teaser, :body, :draft, :published_at, :user_id, :custom_url, :access_count)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Blog
|
2
|
+
class PostDecorator < Draper::Decorator
|
3
|
+
delegate_all
|
4
|
+
|
5
|
+
def link_to_show
|
6
|
+
h.link_to h.blog_post_path(id: self.id),
|
7
|
+
class: 'tn btn-info btn-sm',
|
8
|
+
title: 'Visualizar',
|
9
|
+
style: 'color: #FFF; float: none;' do
|
10
|
+
h.content_tag :span, class: 'fa fa-search' do
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def link_to_edit
|
16
|
+
h.link_to h.edit_blog_post_path(id: self.id),
|
17
|
+
class: 'tn btn-warning btn-sm',
|
18
|
+
title: 'Alterar',
|
19
|
+
style: 'color: #FFF; float: none;' do
|
20
|
+
h.content_tag :span, class: 'fa fa-pencil' do
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def link_to_delete
|
26
|
+
h.link_to h.blog_post_path(id: self.id),
|
27
|
+
method: 'delete',
|
28
|
+
class: 'tn btn-danger btn-sm',
|
29
|
+
title: 'Excluir',
|
30
|
+
confirm: 'Deseja realmente excluir o registro?',
|
31
|
+
style: 'color: #FFF; float: none;' do
|
32
|
+
h.content_tag :span, class: 'fa fa-trash-o' do
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/app/models/blog.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<% collection.each do |resource| %>
|
2
|
+
<tr id="<%= dom_id(resource) %>">
|
3
|
+
<td><%= resource.title %></td>
|
4
|
+
<td><%= resource.teaser %></td>
|
5
|
+
<td><%= resource.body %></td>
|
6
|
+
<td><%= resource.draft %></td>
|
7
|
+
<td><%= resource.published_at %></td>
|
8
|
+
<td><%= resource.user_id %></td>
|
9
|
+
<td><%= resource.custom_url %></td>
|
10
|
+
<td><%= resource.access_count %></td>
|
11
|
+
<td class="text-center">
|
12
|
+
<% if current_user and current_user.admin? %>
|
13
|
+
<%= resource.decorate.link_to_show %>
|
14
|
+
<%= resource.decorate.link_to_edit %>
|
15
|
+
<%= resource.decorate.link_to_delete %>
|
16
|
+
<% end %>
|
17
|
+
</td>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= simple_form_for(@blog_post) do |f| %>
|
2
|
+
<%= f.error_notification %>
|
3
|
+
|
4
|
+
<%= f.hidden_field :user_id, id: :blog_post_user_id %>
|
5
|
+
|
6
|
+
<%= f.input :title, id: :blog_post_title %>
|
7
|
+
|
8
|
+
<%= f.input :teaser, id: :blog_post_teaser, class: 'summernote_description', :id => 'description' %>
|
9
|
+
|
10
|
+
<%= f.input :body, id: :blog_post_body, class: 'summernote_description', :id => 'description' %>
|
11
|
+
|
12
|
+
<%= f.input :draft, id: :blog_post_draft %>
|
13
|
+
|
14
|
+
<%= f.input :published_at, id: :blog_post_published_at %>
|
15
|
+
|
16
|
+
|
17
|
+
<%= f.input :custom_url, id: :blog_post_custom_url %>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<div class="form-group form-actions">
|
22
|
+
<%= link_to I18n.t('misc.action.back'), links_path, class: 'btn btn-sm btn-square btn-default' %>
|
23
|
+
<%= f.button :submit, class: 'btn btn-sm btn-square btn-primary' %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
$(document).ready(function () {
|
29
|
+
$('.blog_post_teaser').summernote();
|
30
|
+
$('.blog_post_body').summernote();
|
31
|
+
});
|
32
|
+
</script>
|
33
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('blog_posts.new.header') %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= link_to t('activerecord.models.blog_post.other'), links_path %></li>
|
4
|
+
<li><%=t 'blog_posts.new.header' %></li>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<main id="main-container" style="min-height: 530px;">
|
8
|
+
<div class="content bg-gray-lighter">
|
9
|
+
<div class="row items-push">
|
10
|
+
<div class="col-sm-7">
|
11
|
+
<h1 class="page-heading">
|
12
|
+
<%= I18n.t('blog_posts.new.title') %>
|
13
|
+
</h1>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="content">
|
18
|
+
<div class="block">
|
19
|
+
<div class="block-content">
|
20
|
+
<%= render 'form' %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</main>
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('blog_post.index.header') %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= I18n.t('activerecord.models.blog_post.other') %></li>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<main id="main-container" style="min-height: 530px;">
|
7
|
+
<div class="content bg-gray-lighter">
|
8
|
+
<div class="row items-push">
|
9
|
+
<div class="col-sm-7">
|
10
|
+
<h1 class="page-heading">
|
11
|
+
<%= t('blog_posts.index.title') %>
|
12
|
+
</h1>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="content">
|
17
|
+
<div class="block">
|
18
|
+
<div class="block-header text-right">
|
19
|
+
<h3 class="block-title">
|
20
|
+
</h3>
|
21
|
+
<span >
|
22
|
+
<%= link_to I18n.t('blog_post.new.header'), new_blog_post_path, class: 'btn btn-sm btn-square btn-success' %>
|
23
|
+
|
24
|
+
</span>
|
25
|
+
</div>
|
26
|
+
<div class="block-content">
|
27
|
+
<table class="table table-striped">
|
28
|
+
<thead>
|
29
|
+
<tr>
|
30
|
+
<th><%=t 'activerecord.attributes.blog_post.name' %></th>
|
31
|
+
<th><%=t 'activerecord.attributes.blog_post.link' %></th>
|
32
|
+
<th><%=t 'activerecord.attributes.blog_post.link_category' %></th>
|
33
|
+
<th class="text-center" style="width: 150px;"><%=t 'misc.actions' %></th>
|
34
|
+
</tr>
|
35
|
+
</thead>
|
36
|
+
<tbody id='blog_posts'>
|
37
|
+
<%= render 'collection', collection: @blog_posts %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</main>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<%= provide :page_title, I18n.t('blog_posts.new.header') %>
|
4
|
+
<%= provide :breadcrumb do %>
|
5
|
+
<li><%= link_to t('activerecord.models.blog_post.other'), links_path %></li>
|
6
|
+
<li><%=t 'blog_posts.new.header' %></li>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<main id="main-container" style="min-height: 530px;">
|
10
|
+
<div class="content bg-gray-lighter">
|
11
|
+
<div class="row items-push">
|
12
|
+
<div class="col-sm-7">
|
13
|
+
<h1 class="page-heading">
|
14
|
+
<%= I18n.t('blog_posts.new.title') %>
|
15
|
+
</h1>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<div class="content">
|
20
|
+
<div class="block">
|
21
|
+
<div class="block-content">
|
22
|
+
<%= render 'form' %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</main>
|
27
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('blog_posts.show.header', resource: @blog_post.try(:id)) %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= link_to I18n.t('activerecord.models.blog_posts.other'), links_path %></li>
|
4
|
+
<li><%= link_to @blog_post.try(:id), @blog_post %></li>
|
5
|
+
<li><%= I18n.t('blog_posts.show.header', resource: @blog_post.try(:id)) %></li>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<main id="main-container" style="min-height: 530px;">
|
9
|
+
<div class="content bg-gray-lighter">
|
10
|
+
<div class="row items-push">
|
11
|
+
<div class="col-sm-7">
|
12
|
+
<h1 class="page-heading">
|
13
|
+
<%= t('blog_posts.show.title') %>
|
14
|
+
</h1>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="content">
|
19
|
+
<div class="block">
|
20
|
+
<div class="block-header text-right">
|
21
|
+
<h3 class="block-title">
|
22
|
+
</h3>
|
23
|
+
<span>
|
24
|
+
<%= link_to I18n.t('blog_posts.new.new'), new_blog_post_path, class: 'btn btn-sm btn-square btn-success' %>
|
25
|
+
</span>
|
26
|
+
</div>
|
27
|
+
<div class="block-content">
|
28
|
+
<div class="row">
|
29
|
+
|
30
|
+
<div class="col-sm-12">
|
31
|
+
<table class="table table-striped">
|
32
|
+
<thead>
|
33
|
+
</thead>
|
34
|
+
<tbody>
|
35
|
+
<tr>
|
36
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.title' %>:</strong></td>
|
37
|
+
<td><%= @blog_post.title %></td>
|
38
|
+
</tr>
|
39
|
+
|
40
|
+
<tr>
|
41
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.teaser' %>:</strong></td>
|
42
|
+
<td><%= @blog_post.teaser %></td>
|
43
|
+
</tr>
|
44
|
+
|
45
|
+
<tr>
|
46
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.body' %>:</strong></td>
|
47
|
+
<td><%= @blog_post.body %></td>
|
48
|
+
</tr>
|
49
|
+
|
50
|
+
<tr>
|
51
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.draft' %>:</strong></td>
|
52
|
+
<td><%= @blog_post.draft %></td>
|
53
|
+
</tr>
|
54
|
+
|
55
|
+
<tr>
|
56
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.published_at' %>:</strong></td>
|
57
|
+
<td><%= @blog_post.published_at %></td>
|
58
|
+
</tr>
|
59
|
+
|
60
|
+
<tr>
|
61
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.custom_url' %>:</strong></td>
|
62
|
+
<td><%= @blog_post.custom_url %></td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr>
|
66
|
+
<td><strong><%= t 'activerecord.attributes.blog_post.access_count' %>:</strong></td>
|
67
|
+
<td><%= @blog_post.access_count %></td>
|
68
|
+
</tr>
|
69
|
+
|
70
|
+
|
71
|
+
</tbody>
|
72
|
+
</table>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
<div class="row">
|
76
|
+
|
77
|
+
<div class="col-sm-4 ">
|
78
|
+
<%= link_to I18n.t('misc.action.back'), blog_posts_path, class: 'btn btn-default' %>
|
79
|
+
<%= link_to I18n.t('misc.action.edit'), edit_blog_post_path(@blog_post), class: 'btn btn-warning' %>
|
80
|
+
<%= link_to I18n.t('misc.action.destroy'), blog_post_path(@blog_post), method: :destroy, data: {confirm: I18n.t('blog_post.show.remover')}, class: 'btn btn-danger' %>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</main>
|
87
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateBlogPosts < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :blog_posts do |t|
|
4
|
+
t.string :title
|
5
|
+
t.text :teaser
|
6
|
+
t.text :body, null: false
|
7
|
+
t.boolean :draft,default: false
|
8
|
+
t.datetime :published_at
|
9
|
+
t.integer :user_id, null: false
|
10
|
+
t.string :custom_url
|
11
|
+
t.integer :access_count,default: 0
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/go_blog.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
require 'rails/all'
|
3
|
+
module GoBlog
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
initializer :append_migrations do |app|
|
6
|
+
# This prevents migrations from being loaded twice from the inside of the
|
7
|
+
# gem itself (dummy test app)
|
8
|
+
if app.root.to_s !~ /#{root}/
|
9
|
+
config.paths['db/migrate'].expanded.each do |migration_path|
|
10
|
+
app.config.paths['db/migrate'] << migration_path
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: go_blog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- João Carlos Ottobboni
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: draper
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
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'
|
69
|
+
description: blog engine
|
70
|
+
email:
|
71
|
+
- jcottobboni@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- MIT-LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- app/assets/config/go_blog_manifest.js
|
80
|
+
- app/assets/javascripts/blog/posts.js
|
81
|
+
- app/assets/stylesheets/blog/posts.css
|
82
|
+
- app/assets/stylesheets/scaffold.css
|
83
|
+
- app/controllers/blog/posts_controller.rb
|
84
|
+
- app/decorator/blog/post_decorator.rb
|
85
|
+
- app/helpers/blog/posts_helper.rb
|
86
|
+
- app/models/application_record.rb
|
87
|
+
- app/models/blog.rb
|
88
|
+
- app/models/blog/post.rb
|
89
|
+
- app/views/blog/posts/_collection.html.erb
|
90
|
+
- app/views/blog/posts/_form.html.erb
|
91
|
+
- app/views/blog/posts/edit.html.erb
|
92
|
+
- app/views/blog/posts/index.html.erb
|
93
|
+
- app/views/blog/posts/new.html.erb
|
94
|
+
- app/views/blog/posts/show.html.erb
|
95
|
+
- config/routes.rb
|
96
|
+
- db/migrate/20171008203759_create_blog_posts.rb
|
97
|
+
- lib/go_blog.rb
|
98
|
+
- lib/go_blog/engine.rb
|
99
|
+
- lib/go_blog/version.rb
|
100
|
+
- lib/tasks/go_blog_tasks.rake
|
101
|
+
homepage: http://www.gorails.com.br
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.6.13
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: blog engine
|
125
|
+
test_files: []
|