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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1742ff32a077f69bc0786edfb895bd09b73ba04
4
- data.tar.gz: 4eb0b1c4c08b70aae5494c18668d5f2635606b13
3
+ metadata.gz: 4a5d5e94faa7fd7ef4024abe6af2d124bdf42ea9
4
+ data.tar.gz: 6986ac3ac73f001163bbceae1f1e4f1b3103a632
5
5
  SHA512:
6
- metadata.gz: ee7b9854089efdf2000f44cb0dccc5446101507b41b25fbf6d4fd068f435176e291d5bb6d881a10f8fa90c4afe87f03d6d8cf395174d14f7a8cd95c8b22681c1
7
- data.tar.gz: 6e1ea9c205975584e3eab3c7f8d49bfaac3e74ab36abc1b6cd6bf9bfa14473be54d5141dc4e3a1348a1827d6541cb5331c641ae2b53c6e3fe887cab466f7989b
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
- ## How it looks like?
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
- Admin:
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
- bundle exec rake blogo:install:migrations
40
- bundle exec rake db:migrate
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 engine to you rails application in `config/routes.rb`:
63
+ Mount the blog routes to you rails application in `config/routes.rb`
51
64
 
52
65
  ```
53
- mount Blogo::Engine, at: '/blog'
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 = '<%= Blogo::Engine.routes.url_helpers.admin_images_path %>';
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 admin_posts_path
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 admin_posts_path
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 admin_posts_path
46
+ redirect_to blogo_admin_posts_path
47
47
  end
48
48
 
49
49
  def preview
@@ -1,2 +1,3 @@
1
1
  class Blogo::ApplicationController < ::ApplicationController
2
+ include Rails.application.routes.url_helpers
2
3
  end
@@ -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
- post_path(:permalink => post.permalink)
12
+ blogo_post_path(:permalink => post.permalink)
11
13
  end
12
14
 
13
15
  def url_to_post(post)
14
- post_url(:permalink => post.permalink)
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
- tag_page_path(tag, page)
27
+ blogo_tag_page_path(tag, page)
26
28
  else
27
- page_path(page)
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', '<%= admin_post_preview_path %>', 'modal-preview');
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, edit_admin_post_path(post) %></td>
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', edit_admin_post_path(post), class: "pure-button button-secondary" %>
12
- <%= link_to 'delete', admin_post_path(post), method: :delete, data: {confirm: confirm_message}, class: "pure-button button-warning" %>
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 => admin_posts_path, html: {id: 'post-form', class: 'pure-form pure-form-stacked'} do |f| %>
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,4 +1,4 @@
1
- <%= form_tag admin_sessions_path, class: 'pure-form pure-form-stacked' do %>
1
+ <%= form_tag blogo_admin_sessions_path, class: 'pure-form pure-form-stacked' do %>
2
2
  <fieldset>
3
3
 
4
4
  <legend>Login</legend>
@@ -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", admin_path %> </li>
4
- <li><%= link_to "New Post", new_admin_post_path %></li>
5
- <li><%= link_to "Comments", admin_comments_path %></li>
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", admin_logout_path %></li>
8
+ <li><%= link_to "Sign out", blogo_admin_logout_path %></li>
9
9
  </ul>
10
10
  </div>
@@ -7,5 +7,5 @@
7
7
  <% end %>
8
8
 
9
9
  <% if Blogo.config.show_rss_icon %>
10
- <%= link_to '', feed_path, class: 'rss-icon', target: 'rss' %>
10
+ <%= link_to '', blogo_feed_path, class: 'rss-icon', target: 'rss' %>
11
11
  <% end %>
@@ -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, tag_path(tag_name), class: 'tag pure-button button-secondary' %>
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>
@@ -1,4 +1,4 @@
1
1
  <div id="main">
2
2
  <%= render 'blogo/shared/post' %>
3
- <%= render 'blogo/shared/disqus_comments' if Blogo.config.disqus_shortname %>
3
+ <%= render 'blogo/shared/disqus_comments' %>
4
4
  </div>
@@ -18,7 +18,7 @@
18
18
  </header>
19
19
  <div class="tags">
20
20
  <% @tags.each do |tag| %>
21
- <%= link_to tag.name, tag_path(tag), class: 'tag pure-button button-secondary' %>
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
- <section id='disqus-comments'>
2
- <h1> Comments </h1>
3
- <div id="disqus_thread" aria-live="polite"></div>
4
- <noscript>Please enable JavaScript to view the comments.</noscript>
5
- </section>
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
- var disqus_shortname = '<%= Blogo.config.disqus_shortname %>';
10
- var disqus_identifier = 'blog-post-<%= @post.id %>';
11
- var disqus_url = '<%= url_to_post(@post) %>';
12
- var disqus_title = '<%= @post.title %>';
13
- var disqus_script = 'embed.js';
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
- (function () {
16
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
17
- dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
18
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
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, feed_path %>
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, root_path %></h1>
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
@@ -2,6 +2,7 @@ require 'blogo/version'
2
2
  require 'blogo/errors'
3
3
  require 'blogo/engine'
4
4
  require 'blogo/config'
5
+ require 'blogo/routes'
5
6
 
6
7
  require 'blogo/renderer'
7
8
  require 'blogo/paginator'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Blogo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-03 00:00:00.000000000 Z
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/routes.rb
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.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