spree_cms 0.0.3 → 0.0.4

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 CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in how_are_we_doing.gemspec
4
3
  gemspec
@@ -34,10 +34,15 @@ class Admin::PagesController < Admin::BaseController
34
34
  # base_scope = base_scope.not_deleted
35
35
  #end
36
36
 
37
- @search = Page.search(params[:search])
38
- @search.order ||= "ascend_by_title"
37
+ @search = Page.searchlogic(params[:search])
39
38
 
40
- @collection = @search.paginate(:page => params[:page])
39
+ # @search = Post.search(params[:search])
40
+ # @search.order ||= "ascend_by_title"
41
+
42
+ @collection = @search.do_search.paginate(
43
+ :per_page => (Spree::Config[:per_page]||50),
44
+ :page => params[:page]
45
+ )
41
46
  else
42
47
  @collection = Page.title_contains(params[:q]).all(:include => includes, :limit => 10)
43
48
  @collection.uniq!
@@ -33,11 +33,16 @@ class Admin::PostsController < Admin::BaseController
33
33
  #if params[:search].nil? || params[:search][:deleted_at_not_null].blank?
34
34
  # base_scope = base_scope.not_deleted
35
35
  #end
36
+
37
+ @search = Post.searchlogic(params[:search])
36
38
 
37
- @search = Post.search(params[:search])
38
- @search.order ||= "ascend_by_title"
39
+ # @search = Post.search(params[:search])
40
+ # @search.order ||= "ascend_by_title"
39
41
 
40
- @collection = @search.paginate( :page => params[:page] )
42
+ @collection = @search.do_search.paginate(
43
+ :per_page => (Spree::Config[:per_page]||50),
44
+ :page => params[:page]
45
+ )
41
46
  else
42
47
  @collection = Post.title_contains(params[:q]).all(:include => includes, :limit => 10)
43
48
  @collection.uniq!
@@ -2,7 +2,7 @@
2
2
 
3
3
  <h1><%= t('cms.settings') %></h1>
4
4
 
5
- <% form_tag(admin_cms_settings_path, :method => :put) do -%>
5
+ <%= form_tag(admin_cms_settings_path, :method => :put) do -%>
6
6
 
7
7
 
8
8
 
@@ -10,6 +10,22 @@
10
10
  <label><%= t('cms.posts_per_page') %></label>
11
11
  <%= text_field_tag('preferences[cms_posts_per_page]', Spree::Config[:cms_posts_per_page]) %>
12
12
  </p>
13
+
14
+ <!-- <p>
15
+ <label><%= t("cms.disqus.account") %></label>
16
+ <%= text_field_tag('preferences[cms_disqus_account]', Spree::Config[:cms_disqus_account]) %>
17
+ </p>
18
+
19
+ <p>
20
+ <label><%= t("cms.disqus.api_key") %></label>
21
+ <%= text_field_tag('preferences[cms_disqus_api_key]', Spree::Config[:cms_disqus_api_key]) %>
22
+ </p>
23
+
24
+ <p>
25
+ <label><%= t("cms.disqus.developer") %></label>
26
+ <%= text_field_tag('preferences[cms_disqus_developer]', Spree::Config[:cms_disqus_developer]) %>
27
+ </p> -->
28
+
13
29
  <p>
14
30
  <label><%= t('cms.posts_recent') %></label>
15
31
  <%= text_field_tag('preferences[cms_posts_recent]', Spree::Config[:cms_posts_recent])%>
@@ -1,20 +1,20 @@
1
1
  <div class="yui-gc">
2
2
  <div class="yui-u first">
3
3
  <%- locals = {:f => f} -%>
4
- <% hook :admin_page_form_left, locals do %>
5
- <% f.field_container :title do %>
4
+ <%= hook :admin_page_form_left, locals do %>
5
+ <%= f.field_container :title do %>
6
6
  <%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
7
7
  <%= f.text_field :title, :class => 'fullwidth title' %>
8
8
  <%= f.error_message_on :title %>
9
9
  <% end %>
10
10
 
11
- <% f.field_container :permalink do %>
11
+ <%= f.field_container :permalink do %>
12
12
  <%= f.label :permalink, t("cms.permalink") %> <span class="required">*</span><br />
13
13
  <%= f.text_field :permalink, :class => 'fullwidth title' %>
14
14
  <%= f.error_message_on :permalink %>
15
15
  <% end %>
16
16
 
17
- <% f.field_container :body_raw do %>
17
+ <%= f.field_container :body_raw do %>
18
18
  <%= f.label :body_raw, t("cms.body")%><br />
19
19
  <%= f.text_area :body_raw, {:cols => 60, :rows => 4, :class => 'fullwidth'} %>
20
20
  <%= f.error_message_on :body_raw %>
@@ -22,7 +22,7 @@
22
22
  <% end %>
23
23
  </div>
24
24
  <div class="yui-u">
25
- <% hook :admin_page_form_right, locals do %>
25
+ <%= hook :admin_page_form_right, locals do %>
26
26
 
27
27
  <p>
28
28
  <%= f.label :is_active, t("cms.status")%><br />
@@ -32,7 +32,7 @@
32
32
  <%= f.error_message_on :is_active%>
33
33
  </p>
34
34
  <h2><%= t("metadata") %></h2>
35
- <% hook :admin_page_form_meta, locals do %>
35
+ <%= hook :admin_page_form_meta, locals do %>
36
36
  <p>
37
37
  <%= f.label :meta_keywords, t("cms.meta_keywords")%><br />
38
38
  <%= f.text_field :meta_keywords, :class => 'fullwidth' %>
@@ -1,6 +1,6 @@
1
1
  <h1><%= t("cms.editing_page") + " &ldquo;#{@page.title}&rdquo;" %></h1>
2
2
 
3
- <% form_for(@page, :url => object_url, :html => { :method => :put, :multipart => true }) do |f| %>
3
+ <%= form_for(@page, admin_post_path(@page), :html => { :method => :put, :multipart => true }) do |f| %>
4
4
  <%= render :partial => 'form', :locals => {:f => f} %>
5
5
  <%= render :partial => 'admin/shared/edit_resource_links' %>
6
6
  <% end %>
@@ -1,10 +1,10 @@
1
1
  <div class='toolbar'>
2
2
  <ul class='actions'>
3
3
  <li id="new_ot_link">
4
- <%= button_link_to_remote t("cms.new_page"),
5
- {:url => new_object_url,
6
- :method => :get,
7
- :update => "new-page"}, :icon => 'add' %>
4
+ <%= button_link_to t("cms.new_page"), new_object_url,
5
+ {:remote => true,
6
+ :icon => 'add',
7
+ 'data-update' => 'new-page'} %>
8
8
  </li>
9
9
  </ul>
10
10
  <br class='clear' />
@@ -18,7 +18,7 @@
18
18
 
19
19
  <table class="index">
20
20
  <tr>
21
- <% hook :admin_pages_index_headers do %>
21
+ <%= hook :admin_pages_index_headers do %>
22
22
  <th><%= order @search, :by => :title, :as => t("cms.title") %></th>
23
23
  <th><%= order @search, :by => :date, :as => t("cms.date") %></th>
24
24
  <% end %>
@@ -30,12 +30,12 @@
30
30
  <% @collection.each do |page| %>
31
31
  <%- locals = {:page => page} -%>
32
32
  <tr>
33
- <% hook :admin_pages_index_rows, locals do %>
33
+ <%= hook :admin_pages_index_rows, locals do %>
34
34
  <td><%= link_to h(page.title), [:edit,:admin,page] %> (<%= page.is_active == 1 ? t("cms.published") : t("cms.draft") %>) </td>
35
35
  <td><%= (page.published_at.blank? ? page.updated_at : page.published_at).strftime("%B %d, %Y at %I:%M%p") %></td>
36
36
  <% end %>
37
37
  <td class="actions">
38
- <% hook :admin_pages_index_row_actions, locals do %>
38
+ <%= hook :admin_pages_index_row_actions, locals do %>
39
39
  <%= link_to_edit page %>
40
40
  &nbsp;
41
41
  <%= link_to_delete page %>
@@ -46,14 +46,14 @@
46
46
  </table>
47
47
  <%= will_paginate(:previous_label => "&#171; #{t('previous')}", :next_label => "#{t('next')} &#187;") %>
48
48
 
49
- <% content_for :sidebar do %>
49
+ <%= content_for :sidebar do %>
50
50
 
51
- <% form_for @search do |f| %>
51
+ <%= form_for @search do |f| %>
52
52
  <div class="box">
53
53
  <h3><%= t(:search) %></h3>
54
54
 
55
55
  <%- locals = {:f => f} -%>
56
- <% hook :admin_pages_index_search, locals do %>
56
+ <%= hook :admin_pages_index_search, locals do %>
57
57
  <p>
58
58
  <label><%= t("cms.title") %></label><br />
59
59
  <%= f.text_field :title_contains, :size => 15 %>
@@ -79,7 +79,7 @@
79
79
  </p>
80
80
  <% end %>
81
81
 
82
- <% hook :admin_pages_index_search_buttons, locals do %>
82
+ <%= hook :admin_pages_index_search_buttons, locals do %>
83
83
  <p class="form-buttons">
84
84
  <%= button t("search") %>
85
85
  </p>
@@ -1,9 +1,9 @@
1
- <%= error_messages_for :page %>
1
+ <%= render "shared/error_messages", :target => @page %>
2
2
 
3
- <% form_for(:page, :url => collection_url, :html => { :multipart => true }) do |f| %>
3
+ <%= form_for(:page, :url => collection_url, :html => { :multipart => true }) do |f| %>
4
4
  <fieldset>
5
5
 
6
- <% f.field_container :title do %>
6
+ <%= f.field_container :title do %>
7
7
  <%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
8
8
  <%= f.text_field :title, :class => 'fullwidth title' %>
9
9
  <%= f.error_message_on :title %>
@@ -12,7 +12,7 @@
12
12
  <div class="yui-gb">
13
13
  <div class="yui-u first">
14
14
 
15
- <% f.field_container :body_raw do %>
15
+ <%= f.field_container :body_raw do %>
16
16
  <%= f.label :body_raw, t("cms.body")%> <span class="required">*</span><br />
17
17
  <%= f.text_area :body_raw, {:cols => 120, :rows => 4, :class => 'fullwidth'} %>
18
18
  <%= f.error_message_on :body_raw %>
@@ -1,26 +1,26 @@
1
1
  <div class="yui-gc">
2
2
  <div class="yui-u first">
3
3
  <%- locals = {:f => f} -%>
4
- <% hook :admin_post_form_left, locals do %>
5
- <% f.field_container :title do %>
4
+ <%= hook :admin_post_form_left, locals do %>
5
+ <%= f.field_container :title do %>
6
6
  <%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
7
7
  <%= f.text_field :title, :class => 'fullwidth title' %>
8
8
  <%= f.error_message_on :title %>
9
9
  <% end %>
10
10
 
11
- <% f.field_container :permalink do %>
11
+ <%= f.field_container :permalink do %>
12
12
  <%= f.label :permalink, t("cms.permalink") %> <span class="required">*</span><br />
13
13
  <%= f.text_field :permalink, :class => 'fullwidth title' %>
14
14
  <%= f.error_message_on :permalink %>
15
15
  <% end %>
16
16
 
17
- <% f.field_container :excerpt do %>
17
+ <%= f.field_container :excerpt do %>
18
18
  <%= f.label :excerpt, t("cms.excerpt")%><br />
19
19
  <%= f.text_area :excerpt, {:cols => 120, :rows => 3, :class => 'fullwidth'} %>
20
20
  <%= f.error_message_on :excerpt %>
21
21
  <% end %>
22
22
 
23
- <% f.field_container :body_raw do %>
23
+ <%= f.field_container :body_raw do %>
24
24
  <%= f.label :body_raw, t("cms.body")%> <span class="required">*</span><br />
25
25
  <%= f.text_area :body_raw, {:cols => 120, :rows => 4, :class => 'fullwidth'} %>
26
26
  <%= f.error_message_on :body_raw %>
@@ -28,11 +28,11 @@
28
28
  <% end %>
29
29
  </div>
30
30
  <div class="yui-u">
31
- <% hook :admin_post_form_right, locals do %>
31
+ <%= hook :admin_post_form_right, locals do %>
32
32
 
33
33
  <p>
34
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")} %>
35
+ <%= f.collection_select :user_id, User.roles_name_equals("admin"), :id, :display_name, {:prompt => t("cms.select_author")} %>
36
36
  <%= f.error_message_on :user_id %>
37
37
  </p>
38
38
 
@@ -51,7 +51,7 @@
51
51
  </p>
52
52
 
53
53
  <h2><%= t("cms.metadata") %></h2>
54
- <% hook :admin_page_form_meta, locals do %>
54
+ <%= hook :admin_page_form_meta, locals do %>
55
55
  <p>
56
56
  <%= f.label :meta_keywords, t("cms.meta_keywords")%><br />
57
57
  <%= f.text_field :meta_keywords, :class => 'fullwidth' %>
@@ -1,4 +1,4 @@
1
- <% content_for :sub_menu do %>
1
+ <%= content_for :sub_menu do %>
2
2
  <ul id="sub_nav">
3
3
  <%= tab :cms_settings, :label => 'cms.settings' %>
4
4
  <%= tab :posts %>
@@ -1,8 +1,8 @@
1
1
  <%= render :partial => 'sub_menu' %>
2
2
 
3
- <h1><%= t("cms.editing_post") + " &ldquo;#{@post.title}&rdquo;" %></h1>
4
-
5
- <% form_for(@post, :url => object_url, :html => { :method => :put, :multipart => true }) do |f| %>
3
+ <h1><%= raw t("cms.editing_post") + " &ldquo;#{@post.title}&rdquo;" %></h1>
4
+ d
5
+ <%= form_for([:admin,@post], :html => { :method => :put, :multipart => true }) do |f| %>
6
6
  <%= render :partial => 'form', :locals => {:f => f} %>
7
7
  <%= render :partial => 'admin/shared/edit_resource_links' %>
8
8
  <% end %>
@@ -3,10 +3,10 @@
3
3
  <div class='toolbar'>
4
4
  <ul class='actions'>
5
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' %>
6
+ <%= button_link_to t("cms.new_post"), new_object_url,
7
+ {:remote => true,
8
+ 'data-update' => 'new-post',
9
+ :icon => 'add'} %>
10
10
  </li>
11
11
  </ul>
12
12
  <br class='clear' />
@@ -20,7 +20,7 @@
20
20
 
21
21
  <table class="index">
22
22
  <tr>
23
- <% hook :admin_posts_index_headers do %>
23
+ <%= hook :admin_posts_index_headers do %>
24
24
  <th><%= order @search, :by => :title, :as => t("cms.title") %></th>
25
25
  <th><%= order @search, :by => :author, :as => t("cms.author") %></th>
26
26
  <th><%= t("cms.tags") %></th>
@@ -34,13 +34,13 @@
34
34
  <% @collection.each do |post| %>
35
35
  <%- locals = {:post => post} -%>
36
36
  <tr>
37
- <% hook :admin_posts_index_rows, locals do %>
37
+ <%= hook :admin_posts_index_rows, locals do %>
38
38
  <td><%= link_to h(post.title), [:edit,:admin,post] %> (<%= post.is_active == 1 ? t("cms.published") : t("cms.draft") %>) </td>
39
39
  <td><%= link_to post.user.display_name, [:admin, post.user] %></td>
40
40
  <td><%= post.tag_list %></td>
41
41
  <td><%= (post.published_at.blank? ? post.updated_at : post.published_at).strftime("%B %d, %Y at %I:%M%p") %></td>
42
42
  <td class="actions">
43
- <% hook :admin_pages_index_row_actions, locals do %>
43
+ <%= hook :admin_pages_index_row_actions, locals do %>
44
44
  <%= link_to_edit post %>
45
45
  &nbsp;
46
46
  <%= link_to_delete post %>
@@ -53,14 +53,14 @@
53
53
 
54
54
  <%= will_paginate(:previous_label => "&#171; #{t('previous')}", :next_label => "#{t('next')} &#187;") %>
55
55
 
56
- <% content_for :sidebar do %>
56
+ <%= content_for :sidebar do %>
57
57
 
58
- <% form_for @search do |f| %>
58
+ <%= form_for @search do |f| %>
59
59
  <div class="box">
60
60
  <h3><%= t(:search) %></h3>
61
61
 
62
62
  <%- locals = {:f => f} -%>
63
- <% hook :admin_posts_index_search, locals do %>
63
+ <%= hook :admin_posts_index_search, locals do %>
64
64
  <p>
65
65
  <label><%= t("cms.title") %></label><br />
66
66
  <%= f.text_field :title_contains, :size => 15 %>
@@ -80,7 +80,7 @@
80
80
 
81
81
  <p>
82
82
  <label><%= t("cms.author") %></label><br />
83
- <%= f.select :user_id_equals, User.all.collect {|r| [ r.display_name, r.id]} %></p>
83
+ <%= collection_select( :user, :user_id, User.roles_name_equals("admin"), :id, :display_name) %></p>
84
84
  </p>
85
85
  <p>
86
86
  <%= f.check_box :is_active, {:style => "vertical-align:middle;"}, "1", "" %>
@@ -90,7 +90,7 @@
90
90
  </p>
91
91
  <% end %>
92
92
 
93
- <% hook :admin_posts_index_search_buttons, locals do %>
93
+ <%= hook :admin_posts_index_search_buttons, locals do %>
94
94
  <p class="form-buttons">
95
95
  <%= button t("search") %>
96
96
  </p>
@@ -1,11 +1,11 @@
1
- <%= render :partial => 'sub_menu' %>
1
+ <%= render "shared/error_messages", :target => @post %>
2
2
 
3
- <%= error_messages_for :post %>
3
+ <%= render :partial => 'sub_menu' %>
4
4
 
5
- <% form_for(:post, :url => collection_url, :html => { :multipart => true }) do |f| %>
5
+ <%= form_for(:post, :url => collection_url, :html => { :multipart => true }) do |f| %>
6
6
  <fieldset>
7
7
 
8
- <% f.field_container :title do %>
8
+ <%= f.field_container :title do %>
9
9
  <%= f.label :title, t("cms.title") %> <span class="required">*</span><br />
10
10
  <%= f.text_field :title, :class => 'fullwidth title' %>
11
11
  <%= f.error_message_on :title %>
@@ -14,7 +14,7 @@
14
14
  <div class="yui-gb">
15
15
  <div class="yui-u first">
16
16
 
17
- <% f.field_container :body_raw do %>
17
+ <%= f.field_container :body_raw do %>
18
18
  <%= f.label :body_raw, t("cms.body")%> <span class="required">*</span><br />
19
19
  <%= f.text_area :body_raw, {:cols => 120, :rows => 4, :class => 'fullwidth'} %>
20
20
  <%= f.error_message_on :body_raw %>
@@ -29,7 +29,7 @@
29
29
  <%= f.collection_select :user_id, User.all, :id, :display_name, {:include_blank => false} %>
30
30
  </p>
31
31
 
32
- <% f.field_container :permalink do %>
32
+ <%= f.field_container :permalink do %>
33
33
  <%= f.label :permalink, t("cms.permalink") %><br />
34
34
  <%= f.text_field :permalink, :class => 'fullwidth title' %>
35
35
  <%= f.error_message_on :permalink %>
@@ -1,5 +1,5 @@
1
- <h2><%=@page.title%></h2>
1
+ <h2><%= @page.title %></h2>
2
2
 
3
3
  <div class="content">
4
- <%= @page.body %>
4
+ <%= raw @page.body %>
5
5
  </div>
@@ -5,9 +5,9 @@
5
5
  <div class="post-meta">
6
6
  <% unless post.user.display_name.blank? %>By <%= post.user.display_name %> <% end %> - <%= link_to "comments", post_path(post, :anchor => "disqus_thread") %>
7
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>
8
+ <div class="post-content"><%= raw post.body %></div>
9
+ <div class="post-meta"><% unless post.tags.empty? %><%= t("cms.tags") %>: <%= raw linked_tag_list(post.tags) %><% end %></div>
10
10
  </div>
11
11
 
12
12
 
13
- <%= disqus_comment_counts %>
13
+ <%= raw disqus_comment_counts %>
@@ -1,4 +1,4 @@
1
- <% content_for :head do %>
1
+ <%= content_for :head do %>
2
2
  <link rel="alternate" type="application/rss+xml" title="<%= t("posts") %> RSS" href="<%= posts_url(:format => 'rss') %>" />
3
3
  <% end %>
4
4
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  <% if @post.commentable == 1 %>
7
7
  <div id="comments">
8
- <%= disqus_thread %>
8
+ <%= raw disqus_thread %>
9
9
  </div>
10
10
  <% end %>
@@ -1,7 +1,7 @@
1
- <% content_for :head do %>
2
- <%= stylesheet_tags 'compiled/cms' %>
1
+ <%= content_for :head do %>
2
+ <%= stylesheet_tags 'sass/cms' %>
3
3
  <% end %>
4
4
 
5
- <% content_for :sidebar do %>
5
+ <%= content_for :sidebar do %>
6
6
  <%= render :partial => 'shared/recent_articles'%>
7
7
  <% end %>
@@ -3,5 +3,5 @@
3
3
  <% post_link_list().each do |link| -%>
4
4
  <li><%= link_to link.name, link.url %></li>
5
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>
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
7
  </ul>
@@ -4,6 +4,7 @@ en:
4
4
  posts: Posts
5
5
  page: Page
6
6
  pages: Pages
7
+ recent_posts: Recent Posts
7
8
  cms:
8
9
  date: Date
9
10
  published_date_range: Published Date Range
@@ -26,6 +27,10 @@ en:
26
27
  author: Author
27
28
  publish_post: Publish Post
28
29
  comment_status: Comment Status
30
+ status: Status
31
+ metadata: Metadata
32
+ meta_keywords: Meta Keywords
33
+ meta_description: Meta Description
29
34
  tags: Tags
30
35
  tags_hint: Enter tags separated by a comma
31
36
  settings: Blog Settings
@@ -0,0 +1,10 @@
1
+ Rails.application.routes.draw do
2
+ resources :posts
3
+ match "#{Spree::Config[:cms_permalink]}/tags/:tag_name" => "posts#tags", :as => "tag_posts"
4
+ resources :pages
5
+ namespace :admin do
6
+ resource :cms_settings
7
+ resources :posts
8
+ resources :pages
9
+ end
10
+ end
@@ -17,22 +17,26 @@ module SpreeCms
17
17
  directory "public", "public"
18
18
  end
19
19
 
20
+ def copy_config_files
21
+ copy_file "config/disqus_config.yml", "config/disqus_config.yml"
22
+ end
23
+
20
24
  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
+ migration_template "db/migrate/create_pages.rb", "db/migrate/create_pages.rb" rescue true
26
+ migration_template "db/migrate/create_posts.rb", "db/migrate/create_posts.rb" rescue true
27
+ migration_template "db/migrate/add_display_name_to_user.rb", "db/migrate/add_display_name_to_user.rb" rescue true
28
+ migration_template "db/migrate/is_taggable_migration.rb", "db/migrate/is_taggable_migration.rb" rescue true
25
29
  end
26
30
 
27
31
  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')
32
+ # route('resources :posts')
33
+ # route('match "'+Spree::Config[:cms_permalink]+'/tags/:tag_name" => "posts#tags", :as => "tag_posts"')
34
+ # route('resources :pages')
35
+ # route('namespace :admin do
36
+ # resource :cms_settings
37
+ # resources :posts
38
+ # resources :pagess
39
+ # end')
36
40
  end
37
41
 
38
42
  end
@@ -0,0 +1,18 @@
1
+ development:
2
+ account: ""
3
+ api_key: ""
4
+ developer: ""
5
+
6
+ test:
7
+ domain: test.host
8
+
9
+ staging:
10
+ account: ""
11
+ api_key: ""
12
+ developer: ""
13
+
14
+ production:
15
+ account: ""
16
+ api_key: ""
17
+ developer: ""
18
+
@@ -0,0 +1,53 @@
1
+ .posts .post {
2
+ border-bottom: solid 1px #cccccc; }
3
+
4
+ .post {
5
+ padding-bottom: 10px;
6
+ margin-bottom: 20px;
7
+ font-size: 14px; }
8
+ .post .post-content p {
9
+ padding: 0 0 0.5em 0;
10
+ margin: 0.5em 0 0; }
11
+ .post h2.post-title {
12
+ margin: 0;
13
+ line-height: 1em;
14
+ text-transform: none; }
15
+ .post h2.post-title padding {
16
+ bottom: 10px; }
17
+ .post h2.post-title a,
18
+ .post h2.post-title a:visited {
19
+ color: #333333;
20
+ text-decoration: none;
21
+ font-weight: normal; }
22
+ .post h2.post-title a:hover {
23
+ color: #333333;
24
+ text-decoration: underline; }
25
+ .post .post-date {
26
+ margin: 0 0 0.5em 0;
27
+ font-size: 11px;
28
+ padding: 0;
29
+ color: #a5a5a5; }
30
+ .post .post-date a {
31
+ text-decoration: none; }
32
+
33
+ .post .post-meta {
34
+ margin: 3px 0 1.5em 0;
35
+ font-size: 12px; }
36
+ .post .post-meta a {
37
+ color: #999999;
38
+ font-weight: normal; }
39
+
40
+ #comments {
41
+ border-top: solid 5px #999999;
42
+ padding-top: 10px; }
43
+
44
+ .comment {
45
+ padding-top: 5px;
46
+ margin-bottom: 20px;
47
+ border-top: solid 1px #cccccc; }
48
+ .comment p {
49
+ padding: 5px 0; }
50
+ .comment .meta span {
51
+ padding-left: 5px;
52
+ font-size: 11px;
53
+ color: #999999; }
@@ -1,21 +1,33 @@
1
1
  require 'spree_core'
2
+ require 'disqus'
3
+ require 'rails'
2
4
  require 'spree_cms_hooks'
5
+ require 'is_taggable'
6
+ require 'RedCloth'
3
7
 
4
8
  module SpreeCms
5
9
  class Engine < Rails::Engine
6
-
7
10
  config.autoload_paths += %W(#{config.root}/lib)
8
11
 
9
12
  initializer "cms" do
10
13
  require 'extensions/string'
11
14
  end
12
15
 
16
+ initializer 'load_disqus_config' do
17
+ if File.exists?("#{Rails.root}/config/disqus_config.yml")
18
+ raw_config = File.read("#{Rails.root}/config/disqus_config.yml")
19
+ DISQUS_CONFIG = YAML.load(raw_config)[Rails.env].symbolize_keys
20
+ else
21
+ DISQUS_CONFIG = {}
22
+ end
23
+ end
24
+
13
25
  def self.activate
14
26
 
15
- Disqus::defaults[:account] = "my_disqus_account_name"
27
+ ::Disqus::defaults[:account] = DISQUS_CONFIG[:account]
16
28
  # Optional, only if you're using the API
17
- Disqus::defaults[:api_key] = "my_disqus_api_key"
18
- Disqus::defaults[:developer] = (RAILS.env != "production")
29
+ ::Disqus::defaults[:api_key] = DISQUS_CONFIG[:api_key]
30
+ ::Disqus::defaults[:developer] = DISQUS_CONFIG[:developer]
19
31
 
20
32
  Spree::BaseController.class_eval do
21
33
  helper CmsHelper
@@ -51,12 +63,15 @@ module SpreeCms
51
63
  preference :cms_page_status_default, :integer, :default => 0
52
64
  preference :cms_page_comment_default, :integer, :default => 0
53
65
  preference :cms_rss_description, :string, :default => 'description about your main post rss.'
66
+ preference :cms_disqus_account
67
+ preference :cms_disqus_api_key
68
+ preference :cms_disqus_developer
54
69
  end
55
70
 
56
71
  User.class_eval do
57
- has_many :posts
72
+ has_many :posts
58
73
 
59
- attr_accessible :display_name
74
+ attr_accessible :display_name
60
75
  end
61
76
 
62
77
  end
@@ -1,3 +1,3 @@
1
1
  module SpreeCms
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
Binary file
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_cms
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 3
9
- version: 0.0.3
4
+ prerelease:
5
+ version: 0.0.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Gunner Technology, Cody Swann
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 1
31
- - 0
32
24
  version: 0.1.0
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ~>
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 4
45
- - 2
46
- - 7
47
35
  version: 4.2.7
48
36
  type: :runtime
49
37
  version_requirements: *id002
@@ -55,10 +43,6 @@ dependencies:
55
43
  requirements:
56
44
  - - ~>
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 0
61
- - 4
62
46
  version: 1.0.4
63
47
  type: :runtime
64
48
  version_requirements: *id003
@@ -105,18 +89,22 @@ files:
105
89
  - app/views/shared/_recent_articles.html.erb
106
90
  - app/views/shared/_store_menu.html.erb
107
91
  - config/locales/en.yml
92
+ - config/routes.rb
108
93
  - lib/extensions/string.rb
109
94
  - lib/generators/spree_cms/USAGE
110
95
  - lib/generators/spree_cms/install/install_generator.rb
96
+ - lib/generators/spree_cms/install/templates/config/disqus_config.yml
111
97
  - lib/generators/spree_cms/install/templates/db/migrate/add_display_name_to_user.rb
112
98
  - lib/generators/spree_cms/install/templates/db/migrate/create_pages.rb
113
99
  - lib/generators/spree_cms/install/templates/db/migrate/create_posts.rb
114
100
  - lib/generators/spree_cms/install/templates/db/migrate/is_taggable_migration.rb
115
101
  - lib/generators/spree_cms/install/templates/public/images/icons/feed.gif
102
+ - lib/generators/spree_cms/install/templates/public/stylesheets/sass/cms.css
116
103
  - lib/generators/spree_cms/install/templates/public/stylesheets/sass/cms.sass
117
104
  - lib/spree_cms.rb
118
105
  - lib/spree_cms/version.rb
119
106
  - lib/spree_cms_hooks.rb
107
+ - pkg/spree_cms-0.0.3.gem
120
108
  - spree_cms.gemspec
121
109
  has_rdoc: true
122
110
  homepage: ""
@@ -132,21 +120,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
120
  requirements:
133
121
  - - ">="
134
122
  - !ruby/object:Gem::Version
135
- segments:
136
- - 0
137
123
  version: "0"
138
124
  required_rubygems_version: !ruby/object:Gem::Requirement
139
125
  none: false
140
126
  requirements:
141
127
  - - ">="
142
128
  - !ruby/object:Gem::Version
143
- segments:
144
- - 0
145
129
  version: "0"
146
130
  requirements: []
147
131
 
148
132
  rubyforge_project: spree_cms
149
- rubygems_version: 1.3.7
133
+ rubygems_version: 1.6.0
150
134
  signing_key:
151
135
  specification_version: 3
152
136
  summary: Adds a simple CMS to your Spree Store with Disqus commenting