spree_essential_blog 0.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/.gitignore +7 -0
  2. data/.travis.yml +12 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +27 -0
  5. data/README.md +126 -0
  6. data/Rakefile +21 -0
  7. data/Versionfile +5 -0
  8. data/app/controllers/blog/admin/disqus_settings_controller.rb +22 -0
  9. data/app/controllers/blog/admin/post_categories_controller.rb +20 -0
  10. data/app/controllers/blog/admin/post_images_controller.rb +37 -0
  11. data/app/controllers/blog/admin/post_products_controller.rb +25 -0
  12. data/app/controllers/blog/admin/posts_controller.rb +32 -0
  13. data/app/controllers/blog/post_categories_controller.rb +23 -0
  14. data/app/controllers/blog/posts_controller.rb +60 -0
  15. data/app/controllers/pages_controller_decorator.rb +5 -0
  16. data/app/helpers/blog/posts_helper.rb +24 -0
  17. data/app/models/blog_configuration.rb +10 -0
  18. data/app/models/post.rb +87 -0
  19. data/app/models/post_category.rb +33 -0
  20. data/app/models/post_image.rb +45 -0
  21. data/app/models/post_product.rb +9 -0
  22. data/app/overrides/spree_essential_blog.rb +5 -0
  23. data/app/validators/datetime_validator.rb +6 -0
  24. data/app/views/blog/admin/configurations/_disqus_config.html.erb +4 -0
  25. data/app/views/blog/admin/disqus_settings/edit.html.erb +16 -0
  26. data/app/views/blog/admin/disqus_settings/show.html.erb +14 -0
  27. data/app/views/blog/admin/post_categories/_form.html.erb +8 -0
  28. data/app/views/blog/admin/post_categories/edit.html.erb +11 -0
  29. data/app/views/blog/admin/post_categories/index.html.erb +45 -0
  30. data/app/views/blog/admin/post_categories/new.html.erb +10 -0
  31. data/app/views/blog/admin/post_images/_form.html.erb +8 -0
  32. data/app/views/blog/admin/post_images/edit.html.erb +17 -0
  33. data/app/views/blog/admin/post_images/index.html.erb +40 -0
  34. data/app/views/blog/admin/post_images/new.html.erb +19 -0
  35. data/app/views/blog/admin/post_products/_form.html.erb +8 -0
  36. data/app/views/blog/admin/post_products/_related_products_table.html.erb +18 -0
  37. data/app/views/blog/admin/post_products/edit.html.erb +18 -0
  38. data/app/views/blog/admin/post_products/index.html.erb +50 -0
  39. data/app/views/blog/admin/post_products/new.html.erb +21 -0
  40. data/app/views/blog/admin/posts/_form.html.erb +40 -0
  41. data/app/views/blog/admin/posts/edit.html.erb +12 -0
  42. data/app/views/blog/admin/posts/index.html.erb +54 -0
  43. data/app/views/blog/admin/posts/new.html.erb +14 -0
  44. data/app/views/blog/admin/posts/show.html.erb +17 -0
  45. data/app/views/blog/admin/shared/_post_tabs.html.erb +26 -0
  46. data/app/views/blog/post_categories/show.html.erb +12 -0
  47. data/app/views/blog/posts/archive.html.erb +13 -0
  48. data/app/views/blog/posts/index.html.erb +16 -0
  49. data/app/views/blog/posts/index.rss.builder +17 -0
  50. data/app/views/blog/posts/show.html.erb +37 -0
  51. data/app/views/blog/shared/_archive.html.erb +31 -0
  52. data/app/views/blog/shared/_disqus_comments.html.erb +20 -0
  53. data/app/views/blog/shared/_preview.html.erb +18 -0
  54. data/app/views/blog/shared/_sidebar.html.erb +26 -0
  55. data/config/locales/en.yml +77 -0
  56. data/config/routes.rb +38 -0
  57. data/lib/generators/spree_essentials/blog_generator.rb +20 -0
  58. data/lib/generators/templates/db/migrate/acts_as_taggable_on_posts.rb +32 -0
  59. data/lib/generators/templates/db/migrate/create_post_categories.rb +13 -0
  60. data/lib/generators/templates/db/migrate/create_post_categories_posts.rb +12 -0
  61. data/lib/generators/templates/db/migrate/create_post_products.rb +13 -0
  62. data/lib/generators/templates/db/migrate/create_posts.rb +18 -0
  63. data/lib/spree_essential_blog/version.rb +3 -0
  64. data/lib/spree_essential_blog.rb +34 -0
  65. data/lib/tasks/sample/sailing.jpg +0 -0
  66. data/lib/tasks/sample/sailing2.jpg +0 -0
  67. data/lib/tasks/sample/sailing3.jpg +0 -0
  68. data/lib/tasks/sample.rake +41 -0
  69. data/public/stylesheets/posts.css +65 -0
  70. data/spree_essential_blog.gemspec +32 -0
  71. data/test/dummy_hooks/after_migrate.rb.sample +1 -0
  72. data/test/dummy_hooks/before_migrate.rb +13 -0
  73. data/test/dummy_hooks/templates/admin/all.css +3 -0
  74. data/test/dummy_hooks/templates/admin/all.js +1 -0
  75. data/test/dummy_hooks/templates/store/all.css +3 -0
  76. data/test/dummy_hooks/templates/store/all.js +1 -0
  77. data/test/integration/admin/disqus_integration_test.rb +25 -0
  78. data/test/integration/admin/post_category_integration_test.rb +131 -0
  79. data/test/integration/admin/post_integration_test.rb +80 -0
  80. data/test/integration/post_category_integration_test.rb +43 -0
  81. data/test/integration/post_integration_test.rb +240 -0
  82. data/test/support/factories.rb +15 -0
  83. data/test/test_helper.rb +7 -0
  84. data/test/unit/post_category_test.rb +24 -0
  85. data/test/unit/post_test.rb +33 -0
  86. metadata +236 -0
@@ -0,0 +1,16 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t('blog.settings.disqus') %></h1>
4
+
5
+ <%= form_for(@config, :url => admin_disqus_settings_path) do |form| %>
6
+
7
+ <p>
8
+ <%= form.label :preferred_disqus_shortname, t('blog.settings.disqus_shortname') %>:<br/>
9
+ <%= form.text_field :preferred_disqus_shortname, :class => 'text' %>
10
+ </p>
11
+
12
+ <p class="form-buttons">
13
+ <%= button t('update') %>
14
+ <%= t("or") %> <%= link_to t("cancel"), admin_disqus_settings_url %>
15
+ </p>
16
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t("blog.settings.disqus") %></h1>
4
+
5
+ <ul class="member-list">
6
+ <% @preferences.each do |key| %>
7
+ <li>
8
+ <b><%= t("blog.settings.#{key}") %>:</b>
9
+ <h3><%= @config.preferences[key].inspect %></h3>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+
14
+ <p><%= link_to_with_icon 'edit', t("edit"), edit_admin_disqus_settings_path, :id => 'admin_disqus_settings_link' %></p>
@@ -0,0 +1,8 @@
1
+ <p>
2
+ <%= form.label :name %>:<br/>
3
+ <%= form.text_field :name, :class => 'text' %>
4
+ </p>
5
+ <p>
6
+ <%= form.label :permalink %>:<br/>
7
+ <%= form.text_field :permalink, :class => 'text' %>
8
+ </p>
@@ -0,0 +1,11 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Categories"} %>
2
+
3
+ <h3><%= t(".edit_category") %></h3>
4
+
5
+ <%= form_for([:admin, @post, @post_category], :url => admin_post_category_path(@post, @post_category.id)) do |form| %>
6
+ <%= render "form", :form => form %>
7
+ <p class="form-buttons">
8
+ <%= hidden_field_tag :post_id, @post.path, :class => 'hidden' %>
9
+ <%= button t("update") %>
10
+ </p>
11
+ <% end %>
@@ -0,0 +1,45 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Categories"} %>
2
+
3
+ <div id="categories-box">
4
+ <%= form_for([:admin, @post]) do |f| %>
5
+ <fieldset>
6
+ <legend><%= t('.manage_categories') %></legend>
7
+ <table class="index">
8
+ <% @post_categories.each_with_index do |category, index| -%>
9
+ <tr id="<%= dom_id(category) %>" class="<%= index % 2 == 0 ? 'alt' : 'row' %>">
10
+ <td>
11
+ <%= check_box_tag "post[post_category_ids][]", category.id, @post.post_categories.include?(category), :id => "post_category_id_#{index}" -%>
12
+ <%= label_tag "post_category_id_#{index}", category.name -%>
13
+ </td>
14
+ <td class="options" style="width: 120px">
15
+ <%= link_to_with_icon('edit', t("edit"), edit_admin_post_category_url(@post, category.id)) %> &nbsp;
16
+ <%= link_to_delete category, {:url => admin_post_category_url(@post, category.id)} %>
17
+ </td>
18
+ </tr>
19
+ <% end -%>
20
+ </table>
21
+ <%= hidden_field_tag "post[post_category_ids][]", 0 %>
22
+ <%= hidden_field_tag :redirect_to, request.fullpath %>
23
+ <%= button t("update") %>
24
+ </fieldset>
25
+ <% end %>
26
+ </div>
27
+
28
+ <div id="new_category"></div>
29
+
30
+ <p><%= link_to icon('add') + ' ' + t("new_category"), new_admin_post_category_url(@post), :id => "btn_new_category" %></p>
31
+
32
+
33
+ <% content_for :head do %>
34
+ <script type="text/javascript">
35
+ jQuery(document).ready(function(){
36
+
37
+ jQuery('#btn_new_category').click(function (event) {
38
+ event.preventDefault();
39
+ jQuery(this).hide();
40
+ jQuery.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}), success: function(r){ jQuery('#new_category').html(r);} });
41
+ });
42
+
43
+ });
44
+ </script>
45
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Categories"} unless request.xhr? %>
2
+
3
+ <h3><%= t("new_category") %></h3>
4
+
5
+ <%= form_for(@post_category, :url => admin_post_categories_path(@post)) do |form| %>
6
+ <%= render "form", :form => form %>
7
+ <p class="form-buttons">
8
+ <%= button t("create") %>
9
+ </p>
10
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <p>
2
+ <%= form.label :attachment %>:<br/>
3
+ <%= form.file_field :attachment %>
4
+ </p>
5
+ <p>
6
+ <%= form.label :alt %>:<br/>
7
+ <%= form.text_field :alt, :class => 'text' %>
8
+ </p>
@@ -0,0 +1,17 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Images"} %>
2
+
3
+ <% if @post_image.try(:errors).present? %>
4
+ <%= render 'shared/error_messages', :target => @post_image %>
5
+ <% end %>
6
+
7
+ <%= form_for([:admin, @post.id, @post_image], :url => admin_post_image_url(@post, @post_image), :html => { :multipart => true }) do |f| %>
8
+ <p>
9
+ <%= label_tag ("thumbnail") %>:<br/>
10
+ <%= link_to(image_tag(@post_image.attachment.url(:mini)), @post_image.attachment.url(:product)) %>
11
+ </p>
12
+ <%= render "form", :form => f %>
13
+ <p class="form-buttons">
14
+ <%= button t("update") %>
15
+ or <%= link_to t("cancel"), admin_post_images_url(@post), :id => "cancel_link" %>
16
+ </p>
17
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Images"} %>
2
+
3
+ <table class="index">
4
+ <tr>
5
+ <th><%= t("thumbnail") %></th>
6
+ <th><%= t("action") %></th>
7
+ </tr>
8
+
9
+ <% @post.images.each do |image| %>
10
+ <tr id="<%= dom_id(image) %>">
11
+ <td><%= link_to(image_tag(image.attachment.url(:mini)), image.attachment.url(:large)) %></td>
12
+ <td class="actions">
13
+ <%= link_to_with_icon('edit', t("edit"), edit_admin_post_image_url(@post, image)) %>
14
+ &nbsp;
15
+ <%= link_to_delete image, {:url => admin_post_image_url(@post, image) }%>
16
+ </td>
17
+ </tr>
18
+ <% end %>
19
+
20
+ </table>
21
+
22
+ <div id="images"></div>
23
+ <br/>
24
+ <p>
25
+ <%= link_to icon('add') + ' ' + t("new_image"), new_admin_post_image_url(@post), :id => "new_image_link" %>
26
+ </p>
27
+
28
+ <% content_for :head do %>
29
+ <script type="text/javascript">
30
+ jQuery(document).ready(function(){
31
+
32
+ jQuery('#new_image_link').click(function (event) {
33
+ event.preventDefault();
34
+ jQuery(this).hide();
35
+ jQuery.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}), success: function(r){ jQuery('#images').html(r);} });
36
+ });
37
+
38
+ });
39
+ </script>
40
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <h3><%= t("new_image") %></h3>
2
+
3
+ <%= form_for(@post_image, :url => admin_post_images_path(@post), :html => { :multipart => true }) do |form| %>
4
+ <%= render "form", :form => form %>
5
+ <p class="form-buttons">
6
+ <%= button t("create") %>
7
+ or <%= link_to t("cancel"), "#", :id => "cancel_link" %>
8
+ </p>
9
+ <% end %>
10
+
11
+ <script type="text/javascript">
12
+ jQuery('#cancel_link').click(function (event) {
13
+ jQuery('#new_image_link').show();
14
+ jQuery('#images').html('');
15
+ });
16
+ </script>
17
+
18
+
19
+
@@ -0,0 +1,8 @@
1
+ <p>
2
+ <%= form.label :attachment %>:<br/>
3
+ <%= form.file_field :attachment %>
4
+ </p>
5
+ <p>
6
+ <%= form.label :alt %>:<br/>
7
+ <%= form.text_field :alt %>
8
+ </p>
@@ -0,0 +1,18 @@
1
+ <table class="index">
2
+ <thead>
3
+ <tr>
4
+ <th><%= t('name') %></th>
5
+ <th></th>
6
+ </tr>
7
+ </thead>
8
+ <tbody>
9
+ <% post.post_products.each do |post_product| %>
10
+ <tr id="<%= dom_id post_product %>">
11
+ <td><%= post_product.product.name %></td>
12
+ <td width="70px">
13
+ <%= link_to_delete post_product, {:url => admin_post_product_url(post, post_product)} %>
14
+ </td>
15
+ </tr>
16
+ <% end %>
17
+ </tbody>
18
+ </table>
@@ -0,0 +1,18 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Images"} %>
2
+
3
+ <% if @post_product.try(:errors).present? %>
4
+ <%= render 'shared/error_messages', :target => @post_product %>
5
+ <% end %>
6
+
7
+ <% form_for([:admin, @post.id, @post_product], :url => admin_post_product_url(@post, @post_product), :html => { :multipart => true }) do |f| %>
8
+ <p>
9
+ <%= label_tag ("thumbnail") %>:<br/>
10
+ <%= link_to(product_tag(@post_product.attachment.url(:mini)), @post_product.attachment.url(:product)) %>
11
+ </p>
12
+ <%= render "form", :form => f %>
13
+ </table>
14
+ <p class="form-buttons">
15
+ <%= button t("update") %>
16
+ or <%= link_to t("cancel"), admin_post_products_url(@post), :id => "cancel_link" %>
17
+ </p>
18
+ <% end %>
@@ -0,0 +1,50 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Related Products"} %>
2
+
3
+ <div id="add-line-item">
4
+ <fieldset>
5
+ <legend><%= t('.add_related_product') %></legend>
6
+ <div style="float:left;width:55%;margin-right:5%;">
7
+ <%= label_tag :add_product_name, t("name_or_sku") %>
8
+ <%= text_field_tag :add_product_name, '', :class => 'fullwidth title' %>
9
+ <%= hidden_field_tag :add_variant_id %>
10
+ </div>
11
+ <div style="float: left; width: 15%; padding-top: 17px;">
12
+ <%= link_to text_for_button_link(t("add"), :icon => 'add'),
13
+ admin_post_products_path(@post),
14
+ :id => "add_related_product", :class => 'button' %>
15
+ </div>
16
+ </fieldset>
17
+ </div>
18
+
19
+ <div id="products-table-wrapper">
20
+ <%= render :partial => "related_products_table", :locals => { :post => @post } %>
21
+ </div>
22
+
23
+ <% content_for :head do %>
24
+
25
+ <%= csrf_meta_tag %>
26
+ <%= javascript_tag "var expand_variants = false;" %>
27
+
28
+ <script type="text/javascript">
29
+
30
+ jQuery(document).ready(function(){
31
+
32
+ $("#add_product_name").product_autocomplete();
33
+
34
+ $("#add_related_product").live("click", function(){
35
+ if($('#add_variant_id').val() == ''){ return false; }
36
+ jQuery.ajax({ url: this.href, type: "POST",
37
+ data: { 'variant_id' : $('#add_variant_id').val() },
38
+ success: function(data){
39
+ $('#products-table-wrapper').html(data);
40
+ $('#add_product_name').val('');
41
+ $('#add_variant_id').val('');
42
+ }
43
+ });
44
+ return false;
45
+ });
46
+
47
+
48
+ });
49
+ </script>
50
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <h3><%= t("new_product") %></h3>
2
+
3
+ <% form_for(@post_product, :url => admin_post_products_path(@post), :html => { :multipart => true }) do |form| %>
4
+ <table class="basic-table">
5
+ <%= render "form", :form => form %>
6
+ </table>
7
+ <p class="form-buttons">
8
+ <%= button t("create") %>
9
+ or <%= link_to t("cancel"), "#", :id => "cancel_link" %>
10
+ </p>
11
+ <% end %>
12
+
13
+ <script type="text/javascript">
14
+ jQuery('#cancel_link').click(function (event) {
15
+ jQuery('#new_product_link').show();
16
+ jQuery('#products').html('');
17
+ });
18
+ </script>
19
+
20
+
21
+
@@ -0,0 +1,40 @@
1
+ <%= form.field_container :title do %>
2
+ <%= form.label :title, t("post.title") %><br />
3
+ <%= form.text_field :title, :class => 'title' %>
4
+ <%= error_message_on :post, :title%>
5
+ <% end %>
6
+
7
+ <%= form.field_container :posted_at do %>
8
+ <%= form.label :posted_at, t("post.posted_at") %><br />
9
+ <%= form.text_field :posted_at, :class => 'text', :value => (@post.posted_at.to_s(:long) unless @post.new_record?) %><br />
10
+ <%= error_message_on :post, :posted_at %>
11
+ <% end %>
12
+
13
+ <%= form.field_container :body do %>
14
+ <%= form.label :body, t("post.body") %><%= markdown_helper %><br />
15
+ <%= form.text_area :body %>
16
+ <%= error_message_on :post, :body %>
17
+ <% end %>
18
+
19
+ <%= form.field_container :tag_list do %>
20
+ <%= form.label :tag_list, t("post.tags") %><br />
21
+ <%= form.text_field :tag_list, :class => 'text' %><br />
22
+ <%= error_message_on :post, :tag_list %>
23
+ <% end %>
24
+
25
+ <%= form.field_container :live do %>
26
+ <%= form.check_box :live %> <%= form.label :live, t("post.live") %><br />
27
+ <% end %>
28
+
29
+ <% content_for :head do %>
30
+ <%= stylesheet_link_tag "markitup.css" %>
31
+ <%= javascript_include_tag 'date.js', 'jquery.autodate.js', 'jquery.markitup.js', 'markdown.set.js' %>
32
+ <script type="text/javascript">
33
+ //<![CDATA[
34
+ $(document).ready(function() {
35
+ $('#post_posted_at').autodate();
36
+ $('#post_body').markItUp(markdownSettings);
37
+ });
38
+ //]]>
39
+ </script>
40
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Post Details"} %>
2
+
3
+ <% if @post.try(:errors).present? %>
4
+ <%= render 'shared/error_messages', :target => @post %>
5
+ <% end %>
6
+
7
+ <%= form_for([:admin, @post]) do |f| %>
8
+ <%= render "form", :form => f %>
9
+ <p class="form-buttons">
10
+ <%= button t("update") %> <%= t('or') %> <%= link_to t('cancel'), collection_url %>
11
+ </p>
12
+ <% end %>
@@ -0,0 +1,54 @@
1
+ <%= render :partial => 'admin/shared/contents_sub_menu' %>
2
+
3
+ <div class='toolbar'>
4
+ <ul class='actions'>
5
+ <li>
6
+ <p><%= button_link_to "New Post", new_object_url, :icon => 'add' %></p>
7
+ </li>
8
+ </ul>
9
+ <br class='clear' />
10
+ </div>
11
+
12
+
13
+ <h1>Listing Posts</h1>
14
+
15
+
16
+ <table class="index">
17
+ <thead>
18
+ <tr>
19
+ <th><%= sort_link @search, :title, t("post.title") %></th>
20
+ <th><%= sort_link @search, :posted_at, t("post.posted_at") %></th>
21
+ <th><%= sort_link @search, :live, t("post.live") %></th>
22
+ <th><%= t("action") %></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <%- @collection.each do |post|%>
27
+ <tr id="<%= dom_id post %>">
28
+ <td><%=link_to post.title, object_url(post) %></td>
29
+ <td><%=link_to post.posted_at.strftime('%x %X'), object_url(post) %></td>
30
+ <td><%= t(post.live ? 'yes' : 'no')%></td>
31
+ <td>
32
+ <%= link_to_edit post %> &nbsp;
33
+ <%= link_to_delete post %>
34
+ </td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+
40
+ <%= paginate @collection %>
41
+
42
+ <% content_for :sidebar do %>
43
+ <div class="box">
44
+ <h3><%= t(:search) %></h3>
45
+ <% @post = Post.metasearch %>
46
+ <%= form_for [:admin, @post] do |f| %>
47
+ <p>
48
+ <label><%= t 'post.title' %></label><br />
49
+ <%= f.text_field :title_like, :size => 25 %>
50
+ </p>
51
+ <p><%= button t("search") %></p>
52
+ <% end %>
53
+ </div>
54
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= render :partial => 'admin/shared/contents_sub_menu' %>
2
+
3
+ <h1><%= t('.new_post') %></h1>
4
+
5
+ <% if @post.try(:errors).present? %>
6
+ <%= render 'shared/error_messages', :target => @post %>
7
+ <% end %>
8
+
9
+ <%= form_for([:admin, @post]) do |f| %>
10
+ <%= render "form", :form => f %>
11
+ <p class="form-buttons">
12
+ <%= button t("create") %> <%= t('or') %> <%= link_to t('cancel'), collection_url %>
13
+ </p>
14
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <%= render :partial => 'blog/admin/shared/post_tabs', :locals => {:current => "Post Details"} %>
2
+
3
+ <h5><%= h @post.posted_at.strftime('%A %B %d, %Y at %I:%M%p').gsub(/\s0/, ' ') %></h5>
4
+ <br/>
5
+
6
+ <% for image in @post.images do %>
7
+ <%= image_tag image.attachment.url(:small), :alt => @post.title %>
8
+ <% end %>
9
+
10
+ <%= RDiscount.new(@post.body).to_html.html_safe %>
11
+
12
+ <br class="clear" />
13
+
14
+ <p>
15
+ <%= link_to_edit @user %> &nbsp;
16
+ <%= link_to t('back'), collection_url %>
17
+ </p>
@@ -0,0 +1,26 @@
1
+ <%= render :partial => 'admin/shared/contents_sub_menu' %>
2
+
3
+ <h1><%== t(".editing_post") + " &ldquo;#{@post.title}&rdquo;".html_safe %></h1>
4
+
5
+ <% content_for :sidebar do %>
6
+
7
+ <h3 class="name"><%= @post.title %><span class='sku'><%= (@post.posted_at || Time.now).strftime('%x') %></span></h3>
8
+ <br clear="clear" />
9
+
10
+ <ul class="sidebar post-menu">
11
+ <li<%= ' class="active"'.html_safe if current == "Post Details" %>>
12
+ <%= link_to t(".post_details"), edit_admin_post_url(@post) %>
13
+ </li>
14
+ <li<%= ' class="active"'.html_safe if current == "Images" %>>
15
+ <%= link_to t("images"), admin_post_images_url(@post) %>
16
+ </li>
17
+ <li<%= ' class="active"'.html_safe if current == "Related Products" %>>
18
+ <%= link_to t(".related_products"), admin_post_products_url(@post) %>
19
+ </li>
20
+ <li<%= ' class="active"'.html_safe if current == "Categories" %>>
21
+ <%= link_to t(".post_categories"), admin_post_categories_url(@post) %>
22
+ </li>
23
+ </ul>
24
+ <br clear="clear" />
25
+
26
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <div class="posts">
2
+ <%= render :partial => 'blog/shared/preview', :collection => @posts, :as => :post %>
3
+
4
+ <br class="clear"/>
5
+
6
+ <%= paginate @posts %>
7
+
8
+ </div>
9
+
10
+ <% content_for :sidebar do %>
11
+ <%= render :partial => 'blog/shared/sidebar' %>
12
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <h1>Archive</h1>
2
+
3
+ <div class="archive" style="width: auto;">
4
+
5
+ <%= render 'blog/shared/archive', :posts => @posts %>
6
+
7
+ <h4><%= t('.where_to_next') %></h4>
8
+ <p class="action">
9
+ <%= link_to t('.go_to_store'), products_path %> <%= t('or') %>
10
+ <%= link_to t('.back_to_posts'), posts_path %>
11
+ </p>
12
+
13
+ </div>
@@ -0,0 +1,16 @@
1
+ <div class="posts">
2
+ <% if @posts.blank? %>
3
+ <h1><%= t('blog.no_posts') %></h1>
4
+ <% else %>
5
+ <%= render :partial => 'blog/shared/preview', :collection => @posts, :as => :post %>
6
+ <% end %>
7
+ <br class="clear"/>
8
+
9
+ <%= link_to(image_tag('blog/rss.png', :alt => t('.rss')) + t('.rss'), posts_path(:format => 'rss'), :id => "posts-rss") %>
10
+ <%= paginate @posts %>
11
+
12
+ </div>
13
+
14
+ <% content_for :sidebar do %>
15
+ <%= render :partial => 'blog/shared/sidebar' %>
16
+ <% end %>
@@ -0,0 +1,17 @@
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]} - Blog"
5
+ xml.description "#{Spree::Config[:site_url]} - Blog"
6
+ xml.link posts_url
7
+
8
+ for post in @posts
9
+ xml.item do
10
+ xml.title post.title
11
+ xml.description post_rss(post)
12
+ xml.pubDate post.posted_at.to_s(:rfc822)
13
+ xml.link post_seo_path(post)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ <% content_for :sidebar do %>
2
+ <%= render :partial => 'blog/shared/sidebar' %>
3
+ <% end %>
4
+
5
+ <div class="post">
6
+
7
+ <div class="post-title">
8
+ <h5><%= h @post.posted_at.strftime('%A %B %d, %Y').gsub(/\s0/, ' ') %></h5>
9
+ <h1><%=h @post.title %></h1>
10
+ </div>
11
+
12
+ <% if @post.has_images? %>
13
+ <div class="post-images">
14
+ <% @post.images.each_with_index do |image, index| %>
15
+ <p><%= link_to image_tag(image.attachment.url(:medium), :alt => image.has_alt? ? image.alt : "#{@post.title} - Photo #{index + 1}"), image.attachment.url(:large), :id => "photo_#{index}" %></p>
16
+ <% end %>
17
+ </div>
18
+ <% end %>
19
+
20
+ <%= @post.rendered_body %>
21
+
22
+ <br class="clear"/>
23
+
24
+ <div class="post-tags">
25
+ <h5>Tagged:</h5>
26
+ <p><%= @post.tags.collect{|tag| link_to(tag.name, search_posts_path(tag.name)) }.join(", ").html_safe %></p>
27
+ </div>
28
+
29
+ <% unless @post.products.empty? %>
30
+ <div class="post-products">
31
+ <%= render 'shared/products', :products => @post.products %>
32
+ </div>
33
+ <% end %>
34
+
35
+ <%= render "blog/shared/disqus_comments" if @blog_config %>
36
+
37
+ </div>
@@ -0,0 +1,31 @@
1
+ <div class="post-archive">
2
+ <% posts.group_by(&:year).each do |year, posts_by_year| %>
3
+ <h4 class="year"><%= link_to year, post_date_path(year) %></h4>
4
+ <% index = 0 %>
5
+ <% posts_by_year.group_by(&:month).each do |month, posts_by_month| %>
6
+ <div class="month<%= ' alt' if (index += 1) % 2 == 0 %>">
7
+ <h5 class="month"><%= link_to "#{Date::MONTHNAMES[month]} #{year}", post_date_path(year, month) %></h5>
8
+ <ul class="archive">
9
+ <% posts_by_month.group_by(&:day).each do |day, posts_by_day| %>
10
+ <li>
11
+ <span class="day">
12
+ <%= link_to day, post_date_path(year, month, day) %>
13
+ </span>
14
+ <ul class="posts">
15
+ <% posts_by_day.each_with_index do |post, index| %>
16
+ <li><%= link_to h(post.title), post_seo_path(post) %></li>
17
+ <% end %>
18
+ </ul>
19
+ <br class="clear"/>
20
+ </li>
21
+ <% end %>
22
+ </ul>
23
+ </div>
24
+ <% end %>
25
+ <br class="clear"/>
26
+ <% end %>
27
+ </div>
28
+
29
+ <% content_for :head do %>
30
+ <%= stylesheet_link_tag 'posts' %>
31
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% disqus_short_name = @blog_config.preferred_disqus_shortname %>
2
+ <% if !disqus_short_name.blank? %>
3
+ <div class="post-comments">
4
+ <h3><%= t('blog.comments') %></h3>
5
+ <div id="disqus_thread"></div>
6
+ <script type="text/javascript">
7
+ var disqus_shortname = <%== disqus_short_name.inspect %>;
8
+ var disqus_identifier = <%== @post.path.inspect %>;
9
+ var disqus_url = <%== request.url.inspect %>;
10
+ /* * * DON'T EDIT BELOW THIS LINE * * */
11
+ (function() {
12
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
13
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
14
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
15
+ })();
16
+ </script>
17
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
18
+ <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
19
+ </div>
20
+ <% end %>