spree_cms 0.0.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/Gemfile +4 -0
- data/README.markdown +108 -0
- data/Rakefile +2 -0
- data/app/controllers/admin/cms_settings_controller.rb +11 -0
- data/app/controllers/admin/pages_controller.rb +54 -0
- data/app/controllers/admin/posts_controller.rb +55 -0
- data/app/controllers/pages_controller.rb +4 -0
- data/app/controllers/posts_controller.rb +26 -0
- data/app/helpers/cms_helper.rb +21 -0
- data/app/models/page.rb +38 -0
- data/app/models/post.rb +73 -0
- data/app/views/admin/cms_settings/edit.html.erb +40 -0
- data/app/views/admin/cms_settings/show.html.erb +42 -0
- data/app/views/admin/pages/_form.html.erb +51 -0
- data/app/views/admin/pages/edit.html.erb +7 -0
- data/app/views/admin/pages/index.html.erb +90 -0
- data/app/views/admin/pages/new.html.erb +28 -0
- data/app/views/admin/posts/_form.html.erb +66 -0
- data/app/views/admin/posts/_sub_menu.html.erb +7 -0
- data/app/views/admin/posts/edit.html.erb +9 -0
- data/app/views/admin/posts/index.html.erb +101 -0
- data/app/views/admin/posts/new.html.erb +45 -0
- data/app/views/admin/users/_display_name.html.erb +4 -0
- data/app/views/pages/show.html.erb +5 -0
- data/app/views/posts/_post.html.erb +13 -0
- data/app/views/posts/index.html.erb +14 -0
- data/app/views/posts/index.rss.builder +19 -0
- data/app/views/posts/show.html.erb +10 -0
- data/app/views/posts/tags.html.erb +18 -0
- data/app/views/shared/_cms_content_for.html.erb +7 -0
- data/app/views/shared/_recent_articles.html.erb +7 -0
- data/app/views/shared/_store_menu.html.erb +5 -0
- data/config/locales/en.yml +48 -0
- data/lib/extensions/string.rb +20 -0
- data/lib/generators/spree_cms/USAGE +8 -0
- data/lib/generators/spree_cms/install/install_generator.rb +40 -0
- data/lib/generators/spree_cms/install/templates/db/migrate/add_display_name_to_user.rb +9 -0
- data/lib/generators/spree_cms/install/templates/db/migrate/create_pages.rb +23 -0
- data/lib/generators/spree_cms/install/templates/db/migrate/create_posts.rb +26 -0
- data/lib/generators/spree_cms/install/templates/db/migrate/is_taggable_migration.rb +24 -0
- data/lib/generators/spree_cms/install/templates/public/images/icons/feed.gif +0 -0
- data/lib/generators/spree_cms/install/templates/public/stylesheets/sass/cms.sass +60 -0
- data/lib/spree_cms/version.rb +3 -0
- data/lib/spree_cms.rb +66 -0
- data/lib/spree_cms_hooks.rb +11 -0
- data/spree_cms.gemspec +25 -0
- metadata +154 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
<div class="yui-gc">
|
2
|
+
<div class="yui-u first">
|
3
|
+
<%- locals = {:f => f} -%>
|
4
|
+
<% hook :admin_post_form_left, locals do %>
|
5
|
+
<% f.field_container :title do %>
|
6
|
+
<%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
|
7
|
+
<%= f.text_field :title, :class => 'fullwidth title' %>
|
8
|
+
<%= f.error_message_on :title %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% f.field_container :permalink do %>
|
12
|
+
<%= f.label :permalink, t("cms.permalink") %> <span class="required">*</span><br />
|
13
|
+
<%= f.text_field :permalink, :class => 'fullwidth title' %>
|
14
|
+
<%= f.error_message_on :permalink %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% f.field_container :excerpt do %>
|
18
|
+
<%= f.label :excerpt, t("cms.excerpt")%><br />
|
19
|
+
<%= f.text_area :excerpt, {:cols => 120, :rows => 3, :class => 'fullwidth'} %>
|
20
|
+
<%= f.error_message_on :excerpt %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% f.field_container :body_raw do %>
|
24
|
+
<%= f.label :body_raw, t("cms.body")%> <span class="required">*</span><br />
|
25
|
+
<%= f.text_area :body_raw, {:cols => 120, :rows => 4, :class => 'fullwidth'} %>
|
26
|
+
<%= f.error_message_on :body_raw %>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
<div class="yui-u">
|
31
|
+
<% hook :admin_post_form_right, locals do %>
|
32
|
+
|
33
|
+
<p>
|
34
|
+
<%= f.label :user_id, t("cms.author")%><br />
|
35
|
+
<%= f.collection_select :user_id, User.roles_name_equals("cms.admin"), :id, :display_name, {:prompt => t("cms.select_author")} %>
|
36
|
+
<%= f.error_message_on :user_id %>
|
37
|
+
</p>
|
38
|
+
|
39
|
+
<p>
|
40
|
+
<%= f.label :is_active, t("cms.status")%><br />
|
41
|
+
<%= f.radio_button :is_active, 1 %><%= t("cms.publish") %>
|
42
|
+
<%= f.radio_button :is_active, 0 %><%= t("cms.draft") %>
|
43
|
+
<%= f.error_message_on :is_active %>
|
44
|
+
</p>
|
45
|
+
|
46
|
+
<p>
|
47
|
+
<%= f.label :commentable, t("cms.comment_status") %>: <%= f.radio_button :commentable, 1 %><%= t("cms.open") %> <%= f.radio_button :commentable, 0 %><%= t("cms.closed") %>
|
48
|
+
</p>
|
49
|
+
<p>
|
50
|
+
<%= f.label :tag_list, "#{t('cms.tags')} (#{t('cms.tags_hint')}):" %> <br/> <%= f.text_field :tag_list %>
|
51
|
+
</p>
|
52
|
+
|
53
|
+
<h2><%= t("cms.metadata") %></h2>
|
54
|
+
<% hook :admin_page_form_meta, locals do %>
|
55
|
+
<p>
|
56
|
+
<%= f.label :meta_keywords, t("cms.meta_keywords")%><br />
|
57
|
+
<%= f.text_field :meta_keywords, :class => 'fullwidth' %>
|
58
|
+
</p>
|
59
|
+
<p>
|
60
|
+
<%= f.label :meta_description, t("cms.meta_description")%><br />
|
61
|
+
<%= f.text_field :meta_description, :class => 'fullwidth' %>
|
62
|
+
</p>
|
63
|
+
<% end %>
|
64
|
+
<% end %>
|
65
|
+
</div>
|
66
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= render :partial => 'sub_menu' %>
|
2
|
+
|
3
|
+
<h1><%= t("cms.editing_post") + " “#{@post.title}”" %></h1>
|
4
|
+
|
5
|
+
<% form_for(@post, :url => object_url, :html => { :method => :put, :multipart => true }) do |f| %>
|
6
|
+
<%= render :partial => 'form', :locals => {:f => f} %>
|
7
|
+
<%= render :partial => 'admin/shared/edit_resource_links' %>
|
8
|
+
<% end %>
|
9
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<%= render :partial => 'sub_menu' %>
|
2
|
+
|
3
|
+
<div class='toolbar'>
|
4
|
+
<ul class='actions'>
|
5
|
+
<li id="new_ot_link">
|
6
|
+
<%= button_link_to_remote t("cms.new_post"),
|
7
|
+
{:url => new_object_url,
|
8
|
+
:method => :get,
|
9
|
+
:update => "new-post"}, :icon => 'add' %>
|
10
|
+
</li>
|
11
|
+
</ul>
|
12
|
+
<br class='clear' />
|
13
|
+
</div>
|
14
|
+
|
15
|
+
|
16
|
+
<h1><%= "#{t('actions.listing')} #{t('posts')}" %></h1>
|
17
|
+
|
18
|
+
<%= image_tag "spinner.gif", :plugin=>"spree", :style => "display:none", :id => 'busy_indicator' %>
|
19
|
+
<div id="new-post"></div>
|
20
|
+
|
21
|
+
<table class="index">
|
22
|
+
<tr>
|
23
|
+
<% hook :admin_posts_index_headers do %>
|
24
|
+
<th><%= order @search, :by => :title, :as => t("cms.title") %></th>
|
25
|
+
<th><%= order @search, :by => :author, :as => t("cms.author") %></th>
|
26
|
+
<th><%= t("cms.tags") %></th>
|
27
|
+
<th><%= order @search, :by => :date, :as => t("cms.date") %></th>
|
28
|
+
<% end %>
|
29
|
+
<th>
|
30
|
+
<%= hook :admin_posts_index_header_actions %>
|
31
|
+
</th>
|
32
|
+
</tr>
|
33
|
+
|
34
|
+
<% @collection.each do |post| %>
|
35
|
+
<%- locals = {:post => post} -%>
|
36
|
+
<tr>
|
37
|
+
<% hook :admin_posts_index_rows, locals do %>
|
38
|
+
<td><%= link_to h(post.title), [:edit,:admin,post] %> (<%= post.is_active == 1 ? t("cms.published") : t("cms.draft") %>) </td>
|
39
|
+
<td><%= link_to post.user.display_name, [:admin, post.user] %></td>
|
40
|
+
<td><%= post.tag_list %></td>
|
41
|
+
<td><%= (post.published_at.blank? ? post.updated_at : post.published_at).strftime("%B %d, %Y at %I:%M%p") %></td>
|
42
|
+
<td class="actions">
|
43
|
+
<% hook :admin_pages_index_row_actions, locals do %>
|
44
|
+
<%= link_to_edit post %>
|
45
|
+
|
46
|
+
<%= link_to_delete post %>
|
47
|
+
<% end %>
|
48
|
+
</td>
|
49
|
+
<% end %>
|
50
|
+
</tr>
|
51
|
+
<% end %>
|
52
|
+
</table>
|
53
|
+
|
54
|
+
<%= will_paginate(:previous_label => "« #{t('previous')}", :next_label => "#{t('next')} »") %>
|
55
|
+
|
56
|
+
<% content_for :sidebar do %>
|
57
|
+
|
58
|
+
<% form_for @search do |f| %>
|
59
|
+
<div class="box">
|
60
|
+
<h3><%= t(:search) %></h3>
|
61
|
+
|
62
|
+
<%- locals = {:f => f} -%>
|
63
|
+
<% hook :admin_posts_index_search, locals do %>
|
64
|
+
<p>
|
65
|
+
<label><%= t("cms.title") %></label><br />
|
66
|
+
<%= f.text_field :title_contains, :size => 15 %>
|
67
|
+
</p>
|
68
|
+
|
69
|
+
<label><%= t("cms.published_date_range") %></label><br />
|
70
|
+
<div class="yui-g date-range-filter">
|
71
|
+
<div class="yui-u sub-field first">
|
72
|
+
<%= f.unobtrusive_date_text_picker :published_at_after %><br />
|
73
|
+
<label class="sub"><%= t("start") %></label>
|
74
|
+
</div>
|
75
|
+
<div class="yui-u sub-field">
|
76
|
+
<%= f.unobtrusive_date_text_picker :published_at_before %><br />
|
77
|
+
<label><%= t("stop") %></label>
|
78
|
+
</div>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<p>
|
82
|
+
<label><%= t("cms.author") %></label><br />
|
83
|
+
<%= f.select :user_id_equals, User.all.collect {|r| [ r.display_name, r.id]} %></p>
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
<%= f.check_box :is_active, {:style => "vertical-align:middle;"}, "1", "" %>
|
87
|
+
<label>
|
88
|
+
<%= t("cms.show_only_published_posts") %>
|
89
|
+
</label>
|
90
|
+
</p>
|
91
|
+
<% end %>
|
92
|
+
|
93
|
+
<% hook :admin_posts_index_search_buttons, locals do %>
|
94
|
+
<p class="form-buttons">
|
95
|
+
<%= button t("search") %>
|
96
|
+
</p>
|
97
|
+
<% end %>
|
98
|
+
</div>
|
99
|
+
<% end %>
|
100
|
+
|
101
|
+
<% end %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<%= render :partial => 'sub_menu' %>
|
2
|
+
|
3
|
+
<%= error_messages_for :post %>
|
4
|
+
|
5
|
+
<% form_for(:post, :url => collection_url, :html => { :multipart => true }) do |f| %>
|
6
|
+
<fieldset>
|
7
|
+
|
8
|
+
<% f.field_container :title do %>
|
9
|
+
<%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
|
10
|
+
<%= f.text_field :title, :class => 'fullwidth title' %>
|
11
|
+
<%= f.error_message_on :title %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="yui-gb">
|
15
|
+
<div class="yui-u first">
|
16
|
+
|
17
|
+
<% f.field_container :body_raw do %>
|
18
|
+
<%= f.label :body_raw, t("cms.body")%> <span class="required">*</span><br />
|
19
|
+
<%= f.text_area :body_raw, {:cols => 120, :rows => 4, :class => 'fullwidth'} %>
|
20
|
+
<%= f.error_message_on :body_raw %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="yui-u">
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<%= f.label :user_id, t("cms.author") %>
|
29
|
+
<%= f.collection_select :user_id, User.all, :id, :display_name, {:include_blank => false} %>
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<% f.field_container :permalink do %>
|
33
|
+
<%= f.label :permalink, t("cms.permalink") %><br />
|
34
|
+
<%= f.text_field :permalink, :class => 'fullwidth title' %>
|
35
|
+
<%= f.error_message_on :permalink %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
</div>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<%= render :partial => 'admin/shared/new_resource_links' %>
|
43
|
+
|
44
|
+
</fieldset>
|
45
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
<div id="post-<%= post.id %>" class="post">
|
3
|
+
<div class="post-date"><%= post.published_at.strftime("%A, %B %d, %Y") %></div>
|
4
|
+
<h2 class="post-title"><%= link_to_unless_current (post.title == '' ? '[Untitled]' : h(post.title)), post, {:title => post.title, :alt => "Link to #{post.title}"} %></h2>
|
5
|
+
<div class="post-meta">
|
6
|
+
<% unless post.user.display_name.blank? %>By <%= post.user.display_name %> <% end %> - <%= link_to "comments", post_path(post, :anchor => "disqus_thread") %>
|
7
|
+
</div>
|
8
|
+
<div class="post-content"><%= post.body %></div>
|
9
|
+
<div class="post-meta"><% unless post.tags.empty? %><%= t("cms.tags") %>: <%= linked_tag_list(post.tags) %><% end %></div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
|
13
|
+
<%= disqus_comment_counts %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
<link rel="alternate" type="application/rss+xml" title="<%= t("posts") %> RSS" href="<%= posts_url(:format => 'rss') %>" />
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= render :partial => 'shared/cms_content_for'%>
|
6
|
+
|
7
|
+
|
8
|
+
<div class="posts">
|
9
|
+
<% for post in @posts %>
|
10
|
+
<%= render :partial => post %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= will_paginate(:prev => "« #{t('previous')}", :next => "#{t('next')} »") %>
|
14
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0"
|
2
|
+
xml.rss :version => "2.0" do
|
3
|
+
xml.channel do
|
4
|
+
xml.title "#{Spree::Config[:site_name]}"
|
5
|
+
xml.description "#{Spree::Config[:cms_rss_description]}"
|
6
|
+
xml.link posts_url(:format => 'rss')
|
7
|
+
|
8
|
+
@posts.each do |post|
|
9
|
+
xml.item do
|
10
|
+
xml.title post.title
|
11
|
+
xml.description post.body
|
12
|
+
xml.author post.user.display_name
|
13
|
+
xml.pubDate post.published_at.to_s(:rfc822)
|
14
|
+
xml.link post_url(:id => post)
|
15
|
+
xml.guid({:isPermaLink => "false"}, post_url(post))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= render :partial => 'shared/cms_content_for'%>
|
2
|
+
|
3
|
+
<h1><%= "'#{params[:tag_name]}' #{t("cms.posts")}" %></h1>
|
4
|
+
|
5
|
+
<div class="posts">
|
6
|
+
<% unless @posts.empty? %>
|
7
|
+
<%= render @posts %>
|
8
|
+
<% else %>
|
9
|
+
<p><%= t("cms.no_posts_found") %>.</p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<% #TODO - Localize this section %>
|
14
|
+
<p class="pagination">
|
15
|
+
<%= link_to h('< Previous Page'), :overwrite_params => { :page => @posts.previous_page } if @posts.previous_page %>
|
16
|
+
<%= "|" if @posts.previous_page && @posts.next_page %>
|
17
|
+
<%= link_to h('Next Page >'), :overwrite_params => { :page => @posts.next_page } if @posts.next_page %>
|
18
|
+
</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<h3><%= t("recent_posts") %></h3>
|
2
|
+
<ul>
|
3
|
+
<% post_link_list().each do |link| -%>
|
4
|
+
<li><%= link_to link.name, link.url %></li>
|
5
|
+
<% end -%>
|
6
|
+
<li><%- link_to posts_path(:format => 'rss') do -%><%= image_tag('icons/feed.gif', :alt => "#{t("posts")} RSS", :size => '16x16') %> RSS Feed <%- end -%></li>
|
7
|
+
</ul>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
post: Post
|
4
|
+
posts: Posts
|
5
|
+
page: Page
|
6
|
+
pages: Pages
|
7
|
+
cms:
|
8
|
+
date: Date
|
9
|
+
published_date_range: Published Date Range
|
10
|
+
show_only_published_pages: Show Only Published Pages
|
11
|
+
show_only_published_posts: Show Only Published Posts
|
12
|
+
editing_post: Editing Post
|
13
|
+
editing_page: Editing Page
|
14
|
+
comma_separated: Comma Separated
|
15
|
+
select_author: Select Author
|
16
|
+
comment: Comment
|
17
|
+
comments: Comments
|
18
|
+
comments_closed: Comments are closed
|
19
|
+
recent_posts: Recent Posts
|
20
|
+
new_post: New Post
|
21
|
+
view: View
|
22
|
+
title: Title
|
23
|
+
permalink: Permalink
|
24
|
+
body: Body
|
25
|
+
excerpt: Excerpt
|
26
|
+
author: Author
|
27
|
+
publish_post: Publish Post
|
28
|
+
comment_status: Comment Status
|
29
|
+
tags: Tags
|
30
|
+
tags_hint: Enter tags separated by a comma
|
31
|
+
settings: Blog Settings
|
32
|
+
permalink: Slug used in url to blog home
|
33
|
+
posts_per_page: Posts displayed on blog home
|
34
|
+
posts_recent: Posts listed in recent post lists
|
35
|
+
post_status_default: Status default for new posts
|
36
|
+
page_status_default: Status default for new pages
|
37
|
+
post_comment_default: Comment status default for new posts
|
38
|
+
publish: Publish
|
39
|
+
published: Published
|
40
|
+
draft: Draft
|
41
|
+
open: Open
|
42
|
+
closed: Closed
|
43
|
+
view_blog: View Blog
|
44
|
+
blog: Blog
|
45
|
+
comments_for: comments for
|
46
|
+
recent: Recent
|
47
|
+
no_posts_found: No posts found
|
48
|
+
new_page: New Page
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Extensions::String
|
2
|
+
def linkify
|
3
|
+
result = self.downcase
|
4
|
+
result.gsub!(/&(\d)+;/, '') # Ditch Entities
|
5
|
+
result.gsub!('&', 'and') # Replace & with 'and'
|
6
|
+
result.gsub!(/['"]/, '') # replace quotes by nothing
|
7
|
+
result.gsub!(/\W/, ' ') # strip all non word chars
|
8
|
+
result.gsub!(/\ +/, '-') # replace all white space sections with a dash
|
9
|
+
result.gsub!(/(-)$/, '') # trim dashes
|
10
|
+
result.gsub!(/^(-)/, '') # trim dashes
|
11
|
+
result.gsub!(/[^a-zA-Z0-9\-]/, '-') # Get rid of anything we don't like
|
12
|
+
result
|
13
|
+
end
|
14
|
+
|
15
|
+
def linkify!
|
16
|
+
self.replace(self.linkify)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
String.send(:include, Extensions::String)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module SpreeCms
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
include ::Rails::Generators::Migration
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(dirname)
|
9
|
+
if ActiveRecord::Base.timestamped_migrations
|
10
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S%L")
|
11
|
+
else
|
12
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def copy_assets
|
17
|
+
directory "public", "public"
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_migrations
|
21
|
+
migration_template "db/migrate/create_pages.rb", "db/migrate/create_pages.rb"
|
22
|
+
migration_template "db/migrate/create_posts.rb", "db/migrate/create_posts.rb"
|
23
|
+
migration_template "db/migrate/add_display_name_to_user.rb", "db/migrate/add_display_name_to_user.rb"
|
24
|
+
migration_template "db/migrate/is_taggable_migration.rb", "db/migrate/is_taggable_migration.rb"
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate_routes
|
28
|
+
route('resources :posts')
|
29
|
+
route('match "'+Spree::Config[:cms_permalink]+'/tags/:tag_name" => "posts#tags", :as => "tag_posts"')
|
30
|
+
route('resources :pages')
|
31
|
+
route('namespace :admin do
|
32
|
+
resource :cms_settings
|
33
|
+
resources :posts
|
34
|
+
resources :pagess
|
35
|
+
end')
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreatePages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :pages do |t|
|
4
|
+
t.string :title, :null => false, :limit => 128
|
5
|
+
t.text :body
|
6
|
+
t.text :body_raw
|
7
|
+
t.integer :is_active, :default => 0
|
8
|
+
t.string :permalink, :null => false, :limit => 128
|
9
|
+
t.datetime :published_at
|
10
|
+
t.string :meta_keywords
|
11
|
+
t.string :meta_description
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
add_index :pages, :published_at, :name => 'pages_published_at_ix'
|
16
|
+
add_index :pages, :permalink, :name => 'pages_permalink_ix'
|
17
|
+
add_index :pages, [:is_active,:published_at], :name => 'pages_is_active_published_at_ix'
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :pages
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreatePosts < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :posts do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.string :title, :null => false, :limit => 128
|
6
|
+
t.text :body
|
7
|
+
t.text :body_raw
|
8
|
+
t.text :excerpt
|
9
|
+
t.integer :is_active, :default => 0
|
10
|
+
t.string :permalink, :null => false, :limit => 128
|
11
|
+
t.datetime :published_at
|
12
|
+
t.integer :commentable, :default => 0
|
13
|
+
t.string :meta_keywords
|
14
|
+
t.string :meta_description
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
add_index :posts, :published_at, :name => 'posts_published_at_ix'
|
19
|
+
add_index :posts, :permalink, :name => 'posts_permalink_ix'
|
20
|
+
add_index :posts, [:is_active,:published_at], :name => 'posts_is_active_published_at_ix'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.down
|
24
|
+
drop_table :posts
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class IsTaggableMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.string :name, :default => ''
|
5
|
+
t.string :kind, :default => ''
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :taggings do |t|
|
9
|
+
t.integer :tag_id
|
10
|
+
|
11
|
+
t.string :taggable_type, :default => ''
|
12
|
+
t.integer :taggable_id
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :tags, [:name, :kind]
|
16
|
+
add_index :taggings, :tag_id
|
17
|
+
add_index :taggings, [:taggable_id, :taggable_type]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :taggings
|
22
|
+
drop_table :tags
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
.posts
|
3
|
+
.post
|
4
|
+
border-bottom: solid 1px #ccc
|
5
|
+
|
6
|
+
.post
|
7
|
+
padding-bottom: 10px
|
8
|
+
margin-bottom: 20px
|
9
|
+
font-size: 14px
|
10
|
+
.post-content
|
11
|
+
p
|
12
|
+
padding: 0 0 .5em 0
|
13
|
+
margin: .5em 0 0
|
14
|
+
h2
|
15
|
+
&.post-title
|
16
|
+
margin: 0
|
17
|
+
padding
|
18
|
+
bottom: 10px
|
19
|
+
line-height: 1em
|
20
|
+
text-transform: none
|
21
|
+
a,
|
22
|
+
a:visited
|
23
|
+
color: #333
|
24
|
+
text-decoration: none
|
25
|
+
font-weight: normal
|
26
|
+
a:hover
|
27
|
+
color: #333
|
28
|
+
text-decoration: underline
|
29
|
+
.post-date
|
30
|
+
margin: 0 0 .5em 0
|
31
|
+
font-size: 11px
|
32
|
+
padding: 0
|
33
|
+
color: #a5a5a5
|
34
|
+
a
|
35
|
+
text-decoration: none
|
36
|
+
|
37
|
+
.post
|
38
|
+
.post-meta
|
39
|
+
margin: 3px 0 1.5em 0
|
40
|
+
font-size: 12px
|
41
|
+
a
|
42
|
+
color: #999999
|
43
|
+
font-weight: normal
|
44
|
+
|
45
|
+
|
46
|
+
#comments
|
47
|
+
border-top: solid 5px #999
|
48
|
+
padding-top: 10px
|
49
|
+
|
50
|
+
.comment
|
51
|
+
padding-top: 5px
|
52
|
+
margin-bottom: 20px
|
53
|
+
border-top: solid 1px #ccc
|
54
|
+
p
|
55
|
+
padding: 5px 0
|
56
|
+
.meta
|
57
|
+
span
|
58
|
+
padding-left: 5px
|
59
|
+
font-size: 11px
|
60
|
+
color: #999
|