spree_essential_cms 0.3.0.rc1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.travis.yml +15 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +64 -5
- data/Versionfile +8 -0
- data/app/controllers/spree/admin/contents_controller.rb +4 -4
- data/app/controllers/spree/admin/pages_controller.rb +6 -12
- data/app/controllers/spree/base_controller_decorator.rb +15 -0
- data/app/controllers/spree/home_controller_decorator.rb +23 -0
- data/app/controllers/spree/pages_controller.rb +2 -11
- data/app/models/spree/content.rb +40 -39
- data/app/models/spree/page.rb +21 -10
- data/app/models/spree/page_image.rb +10 -15
- data/app/views/spree/admin/contents/_form.html.erb +9 -4
- data/app/views/spree/admin/contents/edit.html.erb +0 -2
- data/app/views/spree/admin/contents/index.html.erb +22 -23
- data/app/views/spree/admin/contents/new.html.erb +0 -2
- data/app/views/spree/admin/contents/show.html.erb +0 -1
- data/app/views/spree/admin/page_images/edit.html.erb +1 -3
- data/app/views/spree/admin/page_images/index.html.erb +25 -25
- data/app/views/spree/admin/page_images/new.html.erb +3 -1
- data/app/views/spree/admin/pages/edit.html.erb +0 -2
- data/app/views/spree/admin/pages/index.html.erb +26 -26
- data/app/views/spree/admin/pages/new.html.erb +1 -1
- data/app/views/spree/admin/pages/show.html.erb +0 -2
- data/app/views/spree/pages/home.html.erb +10 -0
- data/app/views/spree/shared/_main_menu.html.erb +3 -7
- data/app/views/spree/shared/_main_menu_items.html.erb +6 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/it.yml +63 -0
- data/config/routes.rb +10 -12
- data/{lib/generators/templates/db/migrate/create_pages.rb → db/migrate/20120306185628_create_pages.rb} +0 -0
- data/{lib/generators/templates/db/migrate/create_contents.rb → db/migrate/20120306185638_create_contents.rb} +0 -0
- data/{lib/generators/templates/db/migrate/add_spree_namespace.rb → db/migrate/20120306185648_add_spree_namespace.rb} +0 -0
- data/lib/generators/spree_essentials/cms_generator.rb +3 -8
- data/lib/spree_essential_cms.rb +5 -19
- data/lib/spree_essential_cms/engine.rb +16 -0
- data/lib/spree_essential_cms/version.rb +1 -1
- data/lib/tasks/sample.rake +9 -13
- data/spree_essential_cms.gemspec +34 -0
- data/test/dummy_hooks/after_app_generator.rb +17 -0
- data/test/dummy_hooks/after_migrate.rb.sample +1 -0
- data/test/dummy_hooks/before_migrate.rb +11 -0
- data/test/dummy_hooks/templates/assets/javascripts/admin/all.js +1 -0
- data/test/dummy_hooks/templates/assets/javascripts/store/all.js +1 -0
- data/test/dummy_hooks/templates/assets/stylesheets/admin/all.css +3 -0
- data/test/dummy_hooks/templates/assets/stylesheets/store/all.css +3 -0
- data/test/dummy_hooks/templates/assets/stylesheets/store/screen.css +749 -0
- data/test/dummy_hooks/templates/initializers/spree_user_error_fix.rb +3 -0
- data/test/dummy_hooks/templates/overrides/main_menu.rb +6 -0
- data/test/integration/spree/admin/contents_integration_test.rb +116 -0
- data/test/integration/spree/admin/page_images_integration_test.rb +94 -0
- data/test/integration/spree/admin/pages_integration_test.rb +131 -0
- data/test/integration/spree/home_integration_test.rb +54 -0
- data/test/integration/spree/pages_integration_test.rb +122 -0
- data/test/support/factories.rb +21 -0
- data/test/support/files/1.jpg +0 -0
- data/test/support/files/2.jpg +0 -0
- data/test/support/helpers.rb +13 -0
- data/test/test_helper.rb +19 -0
- data/test/unit/spree/content_test.rb +39 -0
- data/test/unit/spree/essential_test.rb +9 -0
- data/test/unit/spree/page_image_test.rb +47 -0
- data/test/unit/spree/page_test.rb +53 -0
- metadata +117 -48
- data/app/assets/stylesheets/essentials/cms.css +0 -39
- data/app/controllers/spree/page_controller.rb +0 -20
- data/app/controllers/spree/spree_base_controller_decorator.rb +0 -12
@@ -1,15 +1,19 @@
|
|
1
1
|
class Spree::PageImage < Spree::Asset
|
2
2
|
|
3
|
-
|
3
|
+
attr_accessible :viewable, :attachment, :alt
|
4
4
|
|
5
|
+
validates_attachment_presence :attachment
|
6
|
+
|
5
7
|
has_attached_file :attachment,
|
6
8
|
:styles => Proc.new{ |clip| clip.instance.attachment_sizes },
|
7
|
-
:default_style => :medium
|
8
|
-
|
9
|
+
:default_style => :medium,
|
10
|
+
:url => '/spree/pages/:id/:style/:basename.:extension',
|
11
|
+
:path => ':rails_root/public/spree/pages/:id/:style/:basename.:extension'
|
12
|
+
|
9
13
|
def image_content?
|
10
|
-
attachment_content_type.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
|
14
|
+
attachment_content_type.to_s.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
|
11
15
|
end
|
12
|
-
|
16
|
+
|
13
17
|
def attachment_sizes
|
14
18
|
sizes = {}
|
15
19
|
if image_content?
|
@@ -18,14 +22,5 @@ class Spree::PageImage < Spree::Asset
|
|
18
22
|
end
|
19
23
|
sizes
|
20
24
|
end
|
21
|
-
|
22
|
-
def no_attachement_errors
|
23
|
-
unless attachment.errors.empty?
|
24
|
-
# uncomment this to get rid of the less-than-useful interrim messages
|
25
|
-
errors.clear
|
26
|
-
errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
|
27
|
-
false
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
25
|
+
|
31
26
|
end
|
@@ -32,7 +32,14 @@
|
|
32
32
|
<%= error_message_on :content, :attachment %>
|
33
33
|
<% end %>
|
34
34
|
|
35
|
-
<% if @content.
|
35
|
+
<% if @content.attachment.exists?(:mini) %>
|
36
|
+
<%= form.field_container :delete_attachment do %>
|
37
|
+
<%= form.check_box :delete_attachment %>
|
38
|
+
<%= form.label :delete_attachment, t('content.delete_attachment') %><br />
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<% if @content.attachment.exists?(:mini) %>
|
36
43
|
<p><%= image_tag @content.attachment.url(:mini) %></p>
|
37
44
|
<% end %>
|
38
45
|
|
@@ -57,8 +64,6 @@
|
|
57
64
|
</div>
|
58
65
|
|
59
66
|
<% content_for :head do %>
|
60
|
-
<%= stylesheet_link_tag "markitup.css" %>
|
61
|
-
<%= javascript_include_tag 'jquery.markitup.js', 'markdown.set.js' %>
|
62
67
|
<script type="text/javascript">
|
63
68
|
//<![CDATA[
|
64
69
|
$(document).ready(function() {
|
@@ -71,4 +76,4 @@
|
|
71
76
|
});
|
72
77
|
//]]>
|
73
78
|
</script>
|
74
|
-
<% end %>
|
79
|
+
<% end %>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<%= render :partial => 'spree/admin/shared/contents_sub_menu' %>
|
2
|
-
|
3
1
|
<div class='toolbar'>
|
4
2
|
<ul class='actions'>
|
5
3
|
<li>
|
@@ -13,13 +11,13 @@
|
|
13
11
|
|
14
12
|
<h2><%= t('.listing_contents') %></h2>
|
15
13
|
|
16
|
-
<table class="index sortable">
|
14
|
+
<table class="index sortable" data-sortable-link="<%= update_positions_admin_page_contents_url(@page) -%>">
|
17
15
|
<thead>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
<tr>
|
17
|
+
<th><%= sort_link @search, :title, t("content.title") %></th>
|
18
|
+
<th><%= sort_link @search, :context, t("content.context") %></th>
|
19
|
+
<th><%= t("action") %></th>
|
20
|
+
</tr>
|
23
21
|
</thead>
|
24
22
|
<tbody>
|
25
23
|
<%- @collection.each do |content|%>
|
@@ -27,8 +25,8 @@
|
|
27
25
|
<td><span class="handle"> </span> <%= link_to content.title, object_url(content) %></td>
|
28
26
|
<td><%= content.context %>
|
29
27
|
<td>
|
30
|
-
|
31
|
-
|
28
|
+
<%= link_to_edit content %>
|
29
|
+
<%= link_to_delete content %>
|
32
30
|
</td>
|
33
31
|
</tr>
|
34
32
|
<% end %>
|
@@ -38,17 +36,18 @@
|
|
38
36
|
<%= paginate @collection %>
|
39
37
|
|
40
38
|
<% content_for :sidebar do %>
|
41
|
-
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
39
|
+
<div class="box">
|
40
|
+
<h3><%= t(:search) %></h3>
|
41
|
+
<%= search_form_for [:admin, @page, @search] do |f| %>
|
42
|
+
<p>
|
43
|
+
<%= f.label :title_cont, t('content.title') %><br />
|
44
|
+
<%= f.text_field :title_cont, :size => 25 %>
|
45
|
+
</p>
|
46
|
+
<p>
|
47
|
+
<%= f.label :context_cont, t('content.context') %><br />
|
48
|
+
<%= f.text_field :context_cont, :size => 25 %>
|
49
|
+
</p>
|
50
|
+
<p><%= button t("search") %></p>
|
51
|
+
<% end %>
|
52
|
+
</div>
|
54
53
|
<% end %>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<%= render :partial => 'spree/admin/shared/contents_sub_menu' %>
|
2
|
-
|
3
1
|
<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => "Images"} %>
|
4
2
|
|
5
3
|
<% if @page_image.try(:errors).present? %>
|
@@ -17,4 +15,4 @@
|
|
17
15
|
<%= button t("update") %>
|
18
16
|
or <%= link_to t("cancel"), admin_page_images_url(@page), :id => "cancel_link" %>
|
19
17
|
</p>
|
20
|
-
<% end %>
|
18
|
+
<% end %>
|
@@ -1,26 +1,26 @@
|
|
1
|
-
<%= render :partial => 'spree/admin/shared/contents_sub_menu' %>
|
2
|
-
|
3
1
|
<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => "Images"} %>
|
4
2
|
|
5
|
-
<table class="index sortable">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<% @page.images.each do |image| %>
|
13
|
-
<tr id="<%= dom_id(image).sub('page_', '') %>">
|
14
|
-
<td><span class="handle"> </span> <%= link_to(image_tag(image.attachment.url(:mini)), image.attachment.url(:large)) %></td>
|
15
|
-
<td><%= image.alt %></td>
|
16
|
-
<td class="actions">
|
17
|
-
<%= link_to_with_icon('edit', t("edit"), edit_admin_page_image_url(@page, image)) %>
|
18
|
-
|
19
|
-
<%= link_to_delete image, {:url => admin_page_image_url(@page, image) }%>
|
20
|
-
</td>
|
3
|
+
<table class="index sortable" data-sortable-link="<%= update_positions_admin_page_images_url(@page) -%>">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th><%= t("thumbnail") %></th>
|
7
|
+
<th><%= t("alt_text") %></th>
|
8
|
+
<th><%= t("action") %></th>
|
21
9
|
</tr>
|
22
|
-
|
23
|
-
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% @page.images.each do |image| %>
|
13
|
+
<tr id="<%= dom_id(image) %>">
|
14
|
+
<td><span class="handle"> </span> <%= link_to(image_tag(image.attachment.url(:mini)), image.attachment.url(:large)) %></td>
|
15
|
+
<td><%= image.alt %></td>
|
16
|
+
<td class="actions">
|
17
|
+
<%= link_to_with_icon('edit', t("edit"), edit_admin_page_image_url(@page, image)) %>
|
18
|
+
|
19
|
+
<%= link_to_delete image, {:url => admin_page_image_url(@page, image) }%>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
24
|
</table>
|
25
25
|
|
26
26
|
<div id="images"></div>
|
@@ -31,14 +31,14 @@
|
|
31
31
|
|
32
32
|
<% content_for :head do %>
|
33
33
|
<script type="text/javascript">
|
34
|
-
jQuery(document).ready(function(){
|
35
|
-
|
36
|
-
jQuery('#new_image_link').click(function (event) {
|
34
|
+
jQuery(document).ready(function(){
|
35
|
+
|
36
|
+
jQuery('#new_image_link').click(function (event) {
|
37
37
|
event.preventDefault();
|
38
38
|
jQuery(this).hide();
|
39
39
|
jQuery.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}), success: function(r){ jQuery('#images').html(r);} });
|
40
40
|
});
|
41
|
-
|
41
|
+
|
42
42
|
});
|
43
43
|
</script>
|
44
|
-
<% end %>
|
44
|
+
<% end %>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => "Images"} unless request.xhr? %>
|
2
|
+
|
1
3
|
<h3><%= t("new_image") %></h3>
|
2
4
|
|
3
5
|
<%= render 'spree/shared/error_messages', :target => @page_image %>
|
@@ -17,4 +19,4 @@
|
|
17
19
|
jQuery('#new_image_link').show();
|
18
20
|
jQuery('#images').html('');
|
19
21
|
});
|
20
|
-
</script>
|
22
|
+
</script>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<%= render :partial => 'spree/admin/shared/contents_sub_menu' %>
|
2
|
-
|
3
1
|
<div class='toolbar'>
|
4
2
|
<ul class='actions'>
|
5
3
|
<li>
|
@@ -11,15 +9,15 @@
|
|
11
9
|
|
12
10
|
<h1><%= t('.listing_pages') %></h1>
|
13
11
|
|
14
|
-
<table class="index sortable">
|
12
|
+
<table class="index sortable" data-sortable-link="<%= update_positions_admin_pages_url -%>">
|
15
13
|
<thead>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
<tr>
|
15
|
+
<th><%= sort_link @search, :title, t("page.title") %></th>
|
16
|
+
<th><%= sort_link @search, :path, t("page.path") %></th>
|
17
|
+
<th><%= sort_link @search, :accessible, t("page.accessible") %></th>
|
18
|
+
<th><%= sort_link @search, :visible, t("page.visible") %></th>
|
19
|
+
<th><%= t("action") %></th>
|
20
|
+
</tr>
|
23
21
|
</thead>
|
24
22
|
<tbody>
|
25
23
|
<%- @collection.each do |page|%>
|
@@ -29,10 +27,10 @@
|
|
29
27
|
<td><%= page.accessible %></td>
|
30
28
|
<td><%= page.visible %></td>
|
31
29
|
<td>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
<%= link_to_with_icon :accept, t('preview'), page.path, :onclick => 'window.open(this.href);return false;' %>
|
31
|
+
<%= link_to_with_icon :pages, t('page.contents'), admin_page_contents_path(page) %>
|
32
|
+
<%= link_to_edit page %>
|
33
|
+
<%= link_to_delete page %>
|
36
34
|
</td>
|
37
35
|
</tr>
|
38
36
|
<% end %>
|
@@ -42,16 +40,18 @@
|
|
42
40
|
<%= paginate @collection %>
|
43
41
|
|
44
42
|
<% content_for :sidebar do %>
|
45
|
-
<div class="box">
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
43
|
+
<div class="box">
|
44
|
+
<h3><%= t(:search) %></h3>
|
45
|
+
<%= search_form_for [:admin, @search] do |f| %>
|
46
|
+
<p>
|
47
|
+
<%= f.label :title_cont, t('page.title') %><br />
|
48
|
+
<%= f.text_field :title_cont, :size => 25 %>
|
49
|
+
</p>
|
50
|
+
<p>
|
51
|
+
<%= f.label :path_cont, t('page.path') %><br />
|
52
|
+
<%= f.text_field :path_cont, :size => 25 %>
|
53
|
+
</p>
|
54
|
+
<p><%= button t("search") %></p>
|
55
|
+
<% end %>
|
56
|
+
</div>
|
57
57
|
<% end %>
|
@@ -26,3 +26,13 @@
|
|
26
26
|
</div>
|
27
27
|
<% end %>
|
28
28
|
</div>
|
29
|
+
|
30
|
+
<% content_for :sidebar do %>
|
31
|
+
<div data-hook="homepage_sidebar_navigation">
|
32
|
+
<%= render :partial => 'spree/shared/taxonomies' %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<div data-hook="homepage_products">
|
37
|
+
<%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
|
38
|
+
</div>
|
@@ -1,7 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<li<%= ' class="active"'.html_safe if page.matches?(request.path) %>><%= link_to page.nav_title, page.path %></li>
|
5
|
-
<% end %>
|
6
|
-
</ul>
|
7
|
-
<% end %>
|
1
|
+
<ul id="main-menu">
|
2
|
+
<%= render "spree/shared/main_menu_items" %>
|
3
|
+
</ul>
|
data/config/locales/en.yml
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
it:
|
2
|
+
page:
|
3
|
+
model_name: Pagina
|
4
|
+
contents: Contenuti
|
5
|
+
title: Titolo
|
6
|
+
nav_title: Titolo navigazione
|
7
|
+
path: Percorso
|
8
|
+
meta_title: Titolo (metadato)
|
9
|
+
meta_description: Descrizione (metadato)
|
10
|
+
meta_keywords: Parole chiave (metadato)
|
11
|
+
accessible: Accessibile
|
12
|
+
visible: Visibile
|
13
|
+
explain_accessible: le pagine non accessibili devono essere messe in un controller personalizzato
|
14
|
+
explain_visible: le pagine visibili verranno mostrate nel menù principale
|
15
|
+
|
16
|
+
content:
|
17
|
+
model_name: Contenuto
|
18
|
+
page_title: Titolo pagina
|
19
|
+
page: Pagina
|
20
|
+
title: Titolo
|
21
|
+
body: Corpo
|
22
|
+
attachment: Allegato
|
23
|
+
link: URL del collegamento
|
24
|
+
link_text: Testo del collegamento
|
25
|
+
context: Contesto
|
26
|
+
hide_title: Nascondi titolo
|
27
|
+
delete_attachment: Cancella gli allegati correnti
|
28
|
+
|
29
|
+
pages: Pagine
|
30
|
+
|
31
|
+
spree:
|
32
|
+
admin:
|
33
|
+
subnav:
|
34
|
+
pages: Pagine
|
35
|
+
shared:
|
36
|
+
contents_tab:
|
37
|
+
content: Contenuto
|
38
|
+
page_tabs:
|
39
|
+
editing_page: Modifica pagina
|
40
|
+
page_details: Dettagli della pagina
|
41
|
+
contents: Contenuti
|
42
|
+
images: Immagini
|
43
|
+
pages:
|
44
|
+
index:
|
45
|
+
title: Titolo
|
46
|
+
listing_pages: Elenco pagine
|
47
|
+
new_page: Nuova pagina
|
48
|
+
title_contains: Titolo
|
49
|
+
new:
|
50
|
+
new_page: Nuova pagina
|
51
|
+
|
52
|
+
contents:
|
53
|
+
index:
|
54
|
+
new_content: Nuovo contenuto
|
55
|
+
listing_contents: Elenca contenuti
|
56
|
+
new:
|
57
|
+
new_content: Nuovo contenuto
|
58
|
+
edit:
|
59
|
+
edit_content: Modifica contenuto
|
60
|
+
|
61
|
+
uploads:
|
62
|
+
index:
|
63
|
+
new_upload: Carica un nuovo allegato
|