activeadmin-mongoid-blog 0.3.2 → 0.3.3

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.
data/README.md CHANGED
@@ -6,7 +6,7 @@ Blog app on the top of activeadmin and mongoid, using redactor and select2 plugi
6
6
 
7
7
  Replace `new_blog` name with the real one and run:
8
8
 
9
- export $project_name=new_blog ; curl https://raw.github.com/alexkravets/activeadmin-mongoid-blog/master/install.sh | sh
9
+ export project_name=new_blog ; curl https://raw.github.com/alexkravets/activeadmin-mongoid-blog/master/install.sh | sh
10
10
 
11
11
  ### Start a new rails project
12
12
 
@@ -65,6 +65,43 @@ Install default views templates to `/app/views/blog`:
65
65
 
66
66
  $ rails g active_admin:blog:views blog
67
67
 
68
+ ### Default style
69
+
70
+ By default blog is comming with a Twitter Bootstrap typography, to enable it add to `Gemfile`:
71
+
72
+ gem "twitter-bootstrap-rails", :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git"
73
+
74
+ Install required bootstrap assets:
75
+
76
+ rails g bootstrap:install
77
+
78
+ Remove `reuire_self` line from `application.js` and `application.css` these are added by bootstrap intall and will break the layout with activeadmin styles.
79
+
80
+ In `application.js` include:
81
+
82
+ //= require bootstrap
83
+
84
+ In `application.css` include:
85
+
86
+ /*
87
+ *= require bootstrap_and_overrides
88
+ *= require_self
89
+ */
90
+
91
+ // Tuning styles for kaminari pagination
92
+ .pagination .page.current {
93
+ float:left;
94
+ padding:0 14px;
95
+ line-height:34px;
96
+ text-decoration:none;
97
+ border:1px solid #DDD;
98
+ border-left-width:0;
99
+ color:#999;
100
+ cursor:default;
101
+ background-color:whiteSmoke;
102
+ }
103
+ .pagination span:first-child, .pagination .first a { border-left-width:1px; }
104
+
68
105
  ### The End
69
106
 
70
107
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'activeadmin-mongoid-blog'
6
- gem.version = '0.3.2'
6
+ gem.version = '0.3.3'
7
7
  gem.summary = 'Blog app on the top of activeadmin and mongoid, using redactor and select2 plugins.'
8
8
  gem.description = ''
9
9
  gem.license = 'MIT'
@@ -0,0 +1,6 @@
1
+ <footer>
2
+ <form class="well form-search" action="<%= blog_path %>" method="GET">
3
+ <input name="search" type="text" class="input-medium search-query">
4
+ <button type="submit" class="btn">Search</button>
5
+ </form>
6
+ </footer>
@@ -1,8 +1,11 @@
1
- <header>
2
- <a href="<%= blog_path %>" title="Blog Title"><h1>Blog Title</h1></a>
3
- <ul>
4
- <% BlogCategory.all.each do |c| %>
5
- <li><a href="<%= blog_path %>?category=<%= c.permalink %>" title="<%= c.name %>"><%= c.name %></a></li>
6
- <% end %>
7
- </ul>
8
- </header>
1
+ <header style="margin-bottom:2em;">
2
+ <h1>This is a new blog</h1>
3
+ <p>
4
+ <ul>
5
+ <li><a href="<%= blog_path %>" title="All Posts">All Posts</a></li>
6
+ <% BlogCategory.all.each do |c| %>
7
+ <li><a href="<%= blog_path %>?category=<%= c.permalink %>" title="<%= c.name %>"><%= c.name %></a></li>
8
+ <% end %>
9
+ </ul>
10
+ </p>
11
+ </header>
@@ -1,19 +1,18 @@
1
- <div>
1
+ <div style="margin-bottom:2em;">
2
2
  <!-- TITLE -->
3
- <h2><%= post.title %></h2>
3
+ <a href="<%= blog_post_path(post) %>" title="Read this post"><h2><%= post.title %></h2></a>
4
4
 
5
- <!-- DATE -->
6
- <span>Date: <%= post.date %></span>
7
-
8
- <!-- CATEGORIES -->
9
- <% if post.categories.size > 0 %>
10
- <span>Posted in:</span>
11
- <ul>
12
- <% post.categories.each do |c| %>
13
- <li><a href='<% blog_path() + "?category=#{c.name}"%>' title="<%= c.name %>"><%= c.name %></a></li>
14
- <% end %>
15
- </ul>
16
- <% end %>
5
+ <!-- DATE & CATEGORIES -->
6
+ <p>
7
+ <span>Published at <em><%= post.date %></em> <% if post.categories.size > 0 %>in:<% end %></span>
8
+ <% if post.categories.size > 0 %>
9
+ <ul>
10
+ <% post.categories.each do |c| %>
11
+ <li><a href='<% blog_path() + "?category=#{c.name}"%>' title="<%= c.name %>"><%= c.name %></a></li>
12
+ <% end %>
13
+ </ul>
14
+ <% end %>
15
+ </p>
17
16
 
18
17
  <!-- FEATURED IMAGE LINK --!>
19
18
  <% if post.has_featured_image? %>
@@ -25,6 +24,6 @@
25
24
  <!-- EXCERPT -->
26
25
  <p><%= post.excerpt %></p>
27
26
 
28
- <!-- READ MORE --!>
27
+ <!-- READ MORE -->
29
28
  <a href="<%= blog_post_path(post) %>" title="Read More">Read More</a>
30
29
  </div>
@@ -1,3 +1,9 @@
1
- <%= render :partial => "header" %>
1
+ <div class="container">
2
+ <%= render :partial => "header" %>
2
3
 
3
- <%= render :partial => "post", :collection => @posts %>
4
+ <%= render :partial => "post", :collection => @posts %>
5
+
6
+ <%= paginate @posts %>
7
+
8
+ <%= render :partial => "footer" %>
9
+ </div>
@@ -1,22 +1,35 @@
1
- <%= render :partial => "header" %>
1
+ <div class="container">
2
+ <%= render :partial => "header" %>
2
3
 
3
- <div>
4
- <!-- TITLE -->
5
- <h2><%= @post.title %></h2>
4
+ <div style="margin-bottom:2em;">
5
+ <!-- TITLE -->
6
+ <h2><%= @post.title %></h2>
6
7
 
7
- <!-- DATE -->
8
- <span>Date: <%= @post.date %></span>
9
-
10
- <!-- CATEGORIES -->
11
- <% if @post.categories.size > 0 %>
12
- <span>Posted in:</span>
13
- <ul>
14
- <% @post.categories.each do |c| %>
15
- <li><a href='<% blog_path() + "?category=#{c.name}"%>' title="<%= c.name %>"><%= c.name %></a></li>
8
+ <!-- DATE & CATEGORIES -->
9
+ <p>
10
+ <span>Published at <em><%= @post.date %></em> <% if @post.categories.size > 0 %>in:<% end %></span>
11
+ <% if @post.categories.size > 0 %>
12
+ <ul>
13
+ <% @post.categories.each do |c| %>
14
+ <li><a href='<% blog_path() + "?category=#{c.name}"%>' title="<%= c.name %>"><%= c.name %></a></li>
15
+ <% end %>
16
+ </ul>
16
17
  <% end %>
17
- </ul>
18
- <% end %>
18
+ </p>
19
+
20
+ <!-- CONTENT -->
21
+ <div><%= @post.content.html_safe %></div>
22
+
23
+ <!-- TAGS -->
24
+ <% if @post.tags? %>
25
+ <span>Tags:</span>
26
+ <ul>
27
+ <% @post.tags.split(',').each do |t| %>
28
+ <li><%= link_to t, blog_path() + "?tag=#{t}" %></li>
29
+ <% end %>
30
+ </ul>
31
+ <% end %>
32
+ </div>
19
33
 
20
- <!-- CONTENT -->
21
- <div><%= @post.content.html_safe %></div>
22
- </div>
34
+ <%= render :partial => "footer" %>
35
+ </div>
data/install.sh CHANGED
@@ -9,7 +9,7 @@
9
9
  # select2 plugins. Could be useful for almost every activeadmin based project.
10
10
  #
11
11
  # Installation:
12
- # export $project_name=new_blog ; curl https://raw.github.com/alexkravets/activeadmin-mongoid-blog/master/install.sh | sh
12
+ # export project_name=new_blog ; curl https://raw.github.com/alexkravets/activeadmin-mongoid-blog/master/install.sh | sh
13
13
 
14
14
 
15
15
  set -e
@@ -24,7 +24,8 @@ echo '
24
24
  gem "mongoid"
25
25
  gem "devise"
26
26
  gem "activeadmin-mongoid"
27
- gem "activeadmin-mongoid-blog"' >> Gemfile
27
+ gem "activeadmin-mongoid-blog"
28
+ gem "twitter-bootstrap-rails"' >> Gemfile
28
29
 
29
30
 
30
31
  bundle
@@ -52,7 +53,36 @@ cat temp_file.tmp >> app/assets/stylesheets/active_admin.css.scss
52
53
  rm temp_file.tmp
53
54
 
54
55
 
56
+ rails g bootstrap:install
57
+
58
+ echo '/*
59
+ *= require bootstrap_and_overrides
60
+ *= require_self
61
+ */
62
+
63
+ .pagination .page.current {
64
+ float:left;
65
+ padding:0 14px;
66
+ line-height:34px;
67
+ text-decoration:none;
68
+ border:1px solid #DDD;
69
+ border-left-width:0;
70
+ color:#999;
71
+ cursor:default;
72
+ background-color:whiteSmoke;
73
+ }
74
+ .pagination span:first-child, .pagination .first a { border-left-width:1px; }' > app/assets/stylesheets/application.css
75
+
76
+ echo '//= require jquery
77
+ //= require jquery_ujs
78
+ //= require twitter/bootstrap
79
+ //= require bootstrap
80
+ ' > app/assets/stylesheets/application.js
81
+
82
+
55
83
  echo "\n\n\n"
56
84
  echo "$ rails c"
57
85
  echo ">> AdminUser.create :email => 'admin@example.com', :password => 'password', :password_confirmation => 'password'"
58
86
  echo "\n\n\n"
87
+
88
+
@@ -38,6 +38,10 @@ class BlogPost
38
38
  false
39
39
  end
40
40
 
41
+ def tags?
42
+ tags.size > 0
43
+ end
44
+
41
45
  def excerpt
42
46
  html = Nokogiri::HTML(content)
43
47
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-mongoid-blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -21,9 +21,9 @@ files:
21
21
  - README.md
22
22
  - Rakefile
23
23
  - activeadmin-mongoid-blog.gemspec
24
+ - app/views/blog/_footer.html.erb
24
25
  - app/views/blog/_header.html.erb
25
26
  - app/views/blog/_post.html.erb
26
- - app/views/blog/_sidebar.html.erb
27
27
  - app/views/blog/feed.rss.builder
28
28
  - app/views/blog/index.html.erb
29
29
  - app/views/blog/post.html.erb
@@ -55,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  segments:
57
57
  - 0
58
- hash: 3461903809420542268
58
+ hash: -3250487328109526247
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  none: false
61
61
  requirements:
@@ -1,3 +0,0 @@
1
- <header>
2
- <a href="<%= blog_path %>" title="Blog Title"><h1>Blog Title</h1></a>
3
- </header>