blogo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +29 -16
- data/app/assets/javascripts/blogo/ckeditor/config.js.erb +1 -1
- data/app/controllers/blogo/admin/posts_controller.rb +3 -3
- data/app/controllers/blogo/application_controller.rb +1 -0
- data/app/helpers/blogo/application_helper.rb +6 -4
- data/app/views/blogo/admin/posts/_form.html.erb +1 -1
- data/app/views/blogo/admin/posts/_post_li.html.erb +3 -3
- data/app/views/blogo/admin/posts/edit.html.erb +1 -1
- data/app/views/blogo/admin/posts/new.html.erb +1 -1
- data/app/views/blogo/admin/sessions/new.html.erb +1 -1
- data/app/views/blogo/admin/shared/_nav_bar.html.erb +4 -4
- data/app/views/blogo/posts/_icons.html.erb +1 -1
- data/app/views/blogo/posts/_post_header.html.erb +1 -1
- data/app/views/blogo/posts/show.html.erb +1 -1
- data/app/views/blogo/shared/_aside.html.erb +1 -1
- data/app/views/blogo/shared/_disqus_comments.html.erb +19 -17
- data/app/views/layouts/blogo/blog.html.erb +2 -2
- data/config/environment.rb +0 -0
- data/lib/blogo.rb +1 -0
- data/lib/blogo/routes.rb +38 -0
- data/lib/blogo/version.rb +1 -1
- metadata +5 -4
- data/config/routes.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5d5e94faa7fd7ef4024abe6af2d124bdf42ea9
|
4
|
+
data.tar.gz: 6986ac3ac73f001163bbceae1f1e4f1b3103a632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9014979dad91d0d792a39e53aa30bddad628f5df5ee2c39d87784893bb8ba9c48e3d4af7cb2104e96705cc7ce4006c4966a700affacb70ea19109a95a68c7a10
|
7
|
+
data.tar.gz: 499b77ec8f1d2aaf30d9f8f0bdccc130058066c722a9e94edee8e0beb9bfca4449c47060094e1d5957131d7f9df7a5c3167f19ab006cdfea2483ac14014343fa
|
data/README.markdown
CHANGED
@@ -2,21 +2,34 @@
|
|
2
2
|
|
3
3
|
Mountable blog engine for Ruby on Rails 4.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Blog:
|
8
|
-
|
9
|
-
<a href="http://i1078.photobucket.com/albums/w484/greyblake/blogo_mountable_blog_rails_engine.png" target="_blank">
|
10
|
-
<img src="http://i1078.photobucket.com/albums/w484/greyblake/th_blogo_mountable_blog_rails_engine.png" border="0" title="Blogo - mountable blog engine for Ruby on Rails" alt="Blogo - mountable blog engine for Ruby on Rails" style=""></a>
|
11
|
-
</a>
|
12
|
-
|
5
|
+
[![Build Status](https://travis-ci.org/greyblake/blogo.png?branch=master)](https://travis-ci.org/greyblake/blogo)
|
6
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/greyblake/blogo/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
13
7
|
|
8
|
+
## How it looks like?
|
14
9
|
|
15
|
-
|
10
|
+
<table cellspacing="0">
|
11
|
+
<thread>
|
12
|
+
<tr>
|
13
|
+
<th>Blog</th>
|
14
|
+
<th>Admin</th>
|
15
|
+
</tr>
|
16
|
+
</thread>
|
17
|
+
<tbody>
|
18
|
+
<tr>
|
19
|
+
<td>
|
20
|
+
<a href="http://i1078.photobucket.com/albums/w484/greyblake/blogo_mountable_blog_rails_engine.png" target="blog">
|
21
|
+
<img src="http://i1078.photobucket.com/albums/w484/greyblake/th_blogo_mountable_blog_rails_engine.png" border="0" title="Blogo - mountable blog engine for Ruby on Rails" alt="Blogo - mountable blog engine for Ruby on Rails" style=""></a>
|
22
|
+
</a>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<a href="http://i1078.photobucket.com/albums/w484/greyblake/blogo_admin_mountable_blog_rails_engine.png" target="admin">
|
26
|
+
<img src="http://i1078.photobucket.com/albums/w484/greyblake/th_blogo_admin_mountable_blog_rails_engine.png" border="0" title="Blogo - mountable blog engine for Ruby on Rails(admin)" alt="Blogo - mountable blog engine for Ruby on Rails" style=""></a>
|
27
|
+
</a>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
16
32
|
|
17
|
-
<a href="http://i1078.photobucket.com/albums/w484/greyblake/blogo_admin_mountable_blog_rails_engine.png" target="_blank">
|
18
|
-
<img src="http://i1078.photobucket.com/albums/w484/greyblake/th_blogo_admin_mountable_blog_rails_engine.png" border="0" title="Blogo - mountable blog engine for Ruby on Rails(admin)" alt="Blogo - mountable blog engine for Ruby on Rails" style=""></a>
|
19
|
-
</a>
|
20
33
|
|
21
34
|
## Quick start
|
22
35
|
|
@@ -36,8 +49,8 @@ bundle install
|
|
36
49
|
Install blogo migrations and run them:
|
37
50
|
|
38
51
|
```
|
39
|
-
|
40
|
-
|
52
|
+
rake blogo:install:migrations
|
53
|
+
rake db:migrate
|
41
54
|
```
|
42
55
|
|
43
56
|
|
@@ -47,10 +60,10 @@ Create a user:
|
|
47
60
|
rake blogo:create_user[user_name,user@email.com,password]
|
48
61
|
```
|
49
62
|
|
50
|
-
Mount the blog
|
63
|
+
Mount the blog routes to you rails application in `config/routes.rb`
|
51
64
|
|
52
65
|
```
|
53
|
-
|
66
|
+
Blogo::Routes.mount_to(self, at: '/blog')
|
54
67
|
```
|
55
68
|
|
56
69
|
Run the rails application and go to http://localhost:3000/blog/admin to create you first post!
|
@@ -32,7 +32,7 @@ CKEDITOR.editorConfig = function( config ) {
|
|
32
32
|
config.extraPlugins = 'wpmore';
|
33
33
|
|
34
34
|
// URL to upload images with image plugin
|
35
|
-
config.filebrowserUploadUrl = '<%=
|
35
|
+
config.filebrowserUploadUrl = '<%= Rails.application.routes.url_helpers.blogo_admin_images_path %>';
|
36
36
|
|
37
37
|
// Height
|
38
38
|
config.height = '350px';
|
@@ -15,7 +15,7 @@ module Blogo::Admin
|
|
15
15
|
if service.create!
|
16
16
|
@post = service.post
|
17
17
|
flash[:notice] = "The post is created"
|
18
|
-
redirect_to
|
18
|
+
redirect_to blogo_admin_posts_path
|
19
19
|
else
|
20
20
|
@post = service.post
|
21
21
|
render 'new'
|
@@ -32,7 +32,7 @@ module Blogo::Admin
|
|
32
32
|
|
33
33
|
if service.update!
|
34
34
|
flash[:notice] = "The post is updated"
|
35
|
-
redirect_to
|
35
|
+
redirect_to blogo_admin_posts_path
|
36
36
|
else
|
37
37
|
render 'edit'
|
38
38
|
end
|
@@ -43,7 +43,7 @@ module Blogo::Admin
|
|
43
43
|
Blogo::DestroyPostService.new(post).destroy!
|
44
44
|
|
45
45
|
flash[:notice] = "The post is removed"
|
46
|
-
redirect_to
|
46
|
+
redirect_to blogo_admin_posts_path
|
47
47
|
end
|
48
48
|
|
49
49
|
def preview
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module Blogo
|
2
2
|
# Note, +_path+ postfix is avoided to not mess helper methods and routes.
|
3
3
|
module ApplicationHelper
|
4
|
+
include Rails.application.routes.url_helpers
|
5
|
+
|
4
6
|
# Path to a post with year prefix.
|
5
7
|
#
|
6
8
|
# @param post [Blogo::Post]
|
7
9
|
#
|
8
10
|
# @return [String]
|
9
11
|
def path_to_post(post)
|
10
|
-
|
12
|
+
blogo_post_path(:permalink => post.permalink)
|
11
13
|
end
|
12
14
|
|
13
15
|
def url_to_post(post)
|
14
|
-
|
16
|
+
blogo_post_url(:permalink => post.permalink)
|
15
17
|
end
|
16
18
|
|
17
19
|
# Path to a page or a page in scope of a particular tag.
|
@@ -22,9 +24,9 @@ module Blogo
|
|
22
24
|
# @retun [String]
|
23
25
|
def path_to_page(page, tag = nil)
|
24
26
|
if tag
|
25
|
-
|
27
|
+
blogo_tag_page_path(tag, page)
|
26
28
|
else
|
27
|
-
|
29
|
+
blogo_page_path(page)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
|
52
52
|
$('#post-title').titleToUrl('#permalink')
|
53
53
|
|
54
|
-
var preview = new PostPreview('button-preview', 'post-form', '<%=
|
54
|
+
var preview = new PostPreview('button-preview', 'post-form', '<%= blogo_admin_post_preview_path %>', 'modal-preview');
|
55
55
|
preview.init();
|
56
56
|
})
|
57
57
|
</script>
|
@@ -3,12 +3,12 @@
|
|
3
3
|
%>
|
4
4
|
|
5
5
|
<tr>
|
6
|
-
<td><%= link_to post.title,
|
6
|
+
<td><%= link_to post.title, edit_blogo_admin_post_path(post) %></td>
|
7
7
|
<td><%= post.status %></td>
|
8
8
|
<td><%= post.user.name %></td>
|
9
9
|
<td><%= post.published_at.to_date %></td>
|
10
10
|
<td>
|
11
|
-
<%= link_to 'edit',
|
12
|
-
<%= link_to 'delete',
|
11
|
+
<%= link_to 'edit', edit_blogo_admin_post_path(post), class: "pure-button button-secondary" %>
|
12
|
+
<%= link_to 'delete', blogo_admin_post_path(post), method: :delete, data: {confirm: confirm_message}, class: "pure-button button-warning" %>
|
13
13
|
</td>
|
14
14
|
</tr>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1 class="admin-header">Edit post</h1>
|
2
2
|
|
3
|
-
<%= blogo_form_for [:admin, @post], method: :patch, html: {id: 'post-form', class: 'pure-form pure-form-stacked'} do |f| %>
|
3
|
+
<%= blogo_form_for [:blogo, :admin, @post], method: :patch, html: {id: 'post-form', class: 'pure-form pure-form-stacked'} do |f| %>
|
4
4
|
<%= render partial: 'form', locals: {f: f} %>
|
5
5
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1 class="admin-header">Add a new post</h1>
|
2
2
|
|
3
|
-
<%= blogo_form_for @post, :url =>
|
3
|
+
<%= blogo_form_for @post, :url => blogo_admin_posts_path, html: {id: 'post-form', class: 'pure-form pure-form-stacked'} do |f| %>
|
4
4
|
<%= render partial: 'form', locals: {f: f} %>
|
5
5
|
<% end %>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<div class="pure-menu pure-menu-open pure-menu-horizontal nav">
|
2
2
|
<ul>
|
3
|
-
<li><%= link_to "Blogo",
|
4
|
-
<li><%= link_to "New Post",
|
5
|
-
<li><%= link_to "Comments",
|
3
|
+
<li><%= link_to "Blogo" , blogo_admin_path %> </li>
|
4
|
+
<li><%= link_to "New Post", new_blogo_admin_post_path %></li>
|
5
|
+
<li><%= link_to "Comments", blogo_admin_comments_path %></li>
|
6
6
|
</ul>
|
7
7
|
<ul class="pull-right">
|
8
|
-
<li><%= link_to "Sign out",
|
8
|
+
<li><%= link_to "Sign out", blogo_admin_logout_path %></li>
|
9
9
|
</ul>
|
10
10
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
<div class="article-tags">
|
15
15
|
<% post.tag_names.each do |tag_name| %>
|
16
|
-
<%= link_to tag_name,
|
16
|
+
<%= link_to tag_name, blogo_tag_path(tag_name), class: 'tag pure-button button-secondary' %>
|
17
17
|
<% end %>
|
18
18
|
</div>
|
19
19
|
</div>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
</header>
|
19
19
|
<div class="tags">
|
20
20
|
<% @tags.each do |tag| %>
|
21
|
-
<%= link_to tag.name,
|
21
|
+
<%= link_to tag.name, blogo_tag_path(tag), class: 'tag pure-button button-secondary' %>
|
22
22
|
<% end %>
|
23
23
|
<div>
|
24
24
|
</aside>
|
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<% if Blogo.config.disqus_shortname %>
|
2
|
+
<section id='disqus-comments'>
|
3
|
+
<h1> Comments </h1>
|
4
|
+
<div id="disqus_thread" aria-live="polite"></div>
|
5
|
+
<noscript>Please enable JavaScript to view the comments.</noscript>
|
6
|
+
</section>
|
6
7
|
|
7
8
|
|
8
|
-
<script type="text/javascript">
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
<script type="text/javascript">
|
10
|
+
var disqus_shortname = '<%= Blogo.config.disqus_shortname %>';
|
11
|
+
var disqus_identifier = 'blog-post-<%= @post.id %>';
|
12
|
+
var disqus_url = '<%= url_to_post(@post) %>';
|
13
|
+
var disqus_title = '<%= @post.title %>';
|
14
|
+
var disqus_script = 'embed.js';
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
</script>
|
16
|
+
(function () {
|
17
|
+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
18
|
+
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
|
19
|
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
20
|
+
}());
|
21
|
+
</script>
|
22
|
+
<% end %>
|
@@ -8,14 +8,14 @@
|
|
8
8
|
<%= csrf_meta_tags %>
|
9
9
|
<%= stylesheet_link_tag "blogo/blog" %>
|
10
10
|
|
11
|
-
<%= auto_discovery_link_tag :atom,
|
11
|
+
<%= auto_discovery_link_tag :atom, blogo_feed_path %>
|
12
12
|
<%= render 'blogo/shared/google_analytics' %>
|
13
13
|
</head>
|
14
14
|
<body>
|
15
15
|
<div id="container">
|
16
16
|
<header class="blogo-header">
|
17
17
|
<div class='header-titles'>
|
18
|
-
<h1><%= link_to Blogo.config.site_title,
|
18
|
+
<h1><%= link_to Blogo.config.site_title, blogo_root_path %></h1>
|
19
19
|
<h2><%= Blogo.config.site_subtitle %></h2>
|
20
20
|
</div>
|
21
21
|
|
File without changes
|
data/lib/blogo.rb
CHANGED
data/lib/blogo/routes.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Blogo
|
2
|
+
module Routes
|
3
|
+
def self.mount_to(context, opts)
|
4
|
+
blog_scope = opts[:at] || '/blogo'
|
5
|
+
|
6
|
+
context.instance_eval do
|
7
|
+
scope(path: blog_scope, module: 'blogo', as: 'blogo') do
|
8
|
+
|
9
|
+
namespace :admin do
|
10
|
+
# blogo_admin_path
|
11
|
+
get "/" => "posts#index", as: ""
|
12
|
+
get "logout" => "sessions#destroy"
|
13
|
+
get "login" => "sessions#new", as: 'login'
|
14
|
+
|
15
|
+
post '/posts/preview' => 'posts#preview', as: :post_preview
|
16
|
+
patch '/posts/preview' => 'posts#preview'
|
17
|
+
|
18
|
+
resources :sessions, only: %w(new create destroy)
|
19
|
+
resources :posts, except: %w(show)
|
20
|
+
resources :users
|
21
|
+
resources 'comments', only: %w(index)
|
22
|
+
resources 'images' , only: %w(create)
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/' => "posts#index", as: 'root'
|
26
|
+
get '/page/:page' => 'posts#index', as: 'page'
|
27
|
+
get '/tag/:tag' => 'posts#index', as: 'tag'
|
28
|
+
get '/tag/:tag/page/:page' => 'posts#index', as: 'tag_page'
|
29
|
+
get '/feed' => 'posts#feed' , as: 'feed', defaults: { format: 'atom' }
|
30
|
+
get ":permalink" => "posts#show" , as: "post"
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/blogo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blogo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Potapov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -120,7 +120,7 @@ files:
|
|
120
120
|
- app/views/blogo/shared/_post.html.erb
|
121
121
|
- app/views/layouts/blogo/admin.html.erb
|
122
122
|
- app/views/layouts/blogo/blog.html.erb
|
123
|
-
- config/
|
123
|
+
- config/environment.rb
|
124
124
|
- db/migrate/20140218134508_create_blogo_users.rb
|
125
125
|
- db/migrate/20140218134512_create_blogo_tags.rb
|
126
126
|
- db/migrate/20140218134550_create_blogo_posts.rb
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/blogo/renderer/base.rb
|
135
135
|
- lib/blogo/renderer/html.rb
|
136
136
|
- lib/blogo/renderer/markdown.rb
|
137
|
+
- lib/blogo/routes.rb
|
137
138
|
- lib/blogo/version.rb
|
138
139
|
- lib/tasks/blogo_tasks.rake
|
139
140
|
- vendor/assets/images/blogo/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png
|
@@ -411,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
411
412
|
version: '0'
|
412
413
|
requirements: []
|
413
414
|
rubyforge_project:
|
414
|
-
rubygems_version: 2.2.
|
415
|
+
rubygems_version: 2.2.0
|
415
416
|
signing_key:
|
416
417
|
specification_version: 4
|
417
418
|
summary: Mountable blog engine for Ruby on Rails
|
data/config/routes.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
Blogo::Engine.routes.draw do
|
2
|
-
|
3
|
-
namespace :admin do
|
4
|
-
get "/" => "posts#index", as: "" # responds to admin_url and admin_path
|
5
|
-
get "logout" => "sessions#destroy"
|
6
|
-
get "login" => "sessions#new", as: 'login'
|
7
|
-
|
8
|
-
post '/posts/preview' => 'posts#preview', as: :post_preview
|
9
|
-
patch '/posts/preview' => 'posts#preview'
|
10
|
-
|
11
|
-
resources :sessions, only: %i(new create destroy)
|
12
|
-
resources :posts, except: %i(show)
|
13
|
-
resources :users
|
14
|
-
resources 'comments', only: %w(index)
|
15
|
-
resources 'images' , only: %w(create)
|
16
|
-
end
|
17
|
-
|
18
|
-
root to: "posts#index"
|
19
|
-
get '/page/:page' => 'posts#index', as: 'page'
|
20
|
-
get '/tag/:tag' => 'posts#index', as: 'tag'
|
21
|
-
get '/tag/:tag/page/:page' => 'posts#index', as: 'tag_page'
|
22
|
-
|
23
|
-
get '/feed' => 'posts#feed', as: 'feed', defaults: { format: 'atom' }
|
24
|
-
|
25
|
-
|
26
|
-
get ":permalink" => "posts#show", as: "post"
|
27
|
-
end
|