solidus_static_content 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +35 -0
- data/.gem_release.yml +5 -0
- data/.gitignore +17 -6
- data/.rspec +2 -3
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +80 -0
- data/Gemfile +26 -6
- data/{LICENSE.md → LICENSE} +0 -0
- data/README.md +81 -68
- data/Rakefile +4 -13
- data/app/assets/stylesheets/spree/frontend/solidus_static_content.css +7 -0
- data/app/assets/stylesheets/spree/frontend/spree_static_content.css +2 -7
- data/app/models/solidus_static_content/permission_sets/page_display.rb +11 -0
- data/app/models/solidus_static_content/permission_sets/page_management.rb +11 -0
- data/app/models/spree/page.rb +16 -21
- data/bin/console +17 -0
- data/bin/r +8 -0
- data/bin/rails +6 -6
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +84 -0
- data/bin/sandbox_rails +8 -0
- data/bin/setup +8 -0
- data/config/locales/de.yml +7 -5
- data/config/locales/en.yml +9 -7
- data/config/locales/es-MX.yml +38 -0
- data/config/locales/es.yml +6 -5
- data/config/locales/et.yml +6 -5
- data/config/locales/fr.yml +7 -5
- data/config/locales/it.yml +6 -5
- data/config/locales/nl.yml +7 -5
- data/config/locales/pl.yml +6 -5
- data/config/locales/pt-BR.yml +6 -5
- data/config/locales/pt.yml +7 -5
- data/config/locales/ro.yml +11 -9
- data/config/locales/ru.yml +7 -5
- data/config/locales/sv.yml +7 -5
- data/config/routes.rb +9 -2
- data/db/migrate/20081216193152_create_pages.rb +1 -1
- data/db/migrate/20090625125735_extend_pages.rb +1 -1
- data/db/migrate/20090814113100_add_visible_to_pages.rb +1 -1
- data/db/migrate/20090814142845_add_default_true_to_visible_for_page.rb +1 -1
- data/db/migrate/20090829000527_add_index_for_page.rb +1 -1
- data/db/migrate/20091219021134_add_meta_fields_to_pages.rb +1 -1
- data/db/migrate/20100204105222_add_layout_to_pages.rb +1 -1
- data/db/migrate/20100323085528_add_show_in_sidebar_option_to_pages.rb +1 -1
- data/db/migrate/20110717103112_add_meta_title_to_page.rb +1 -1
- data/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb +1 -1
- data/db/migrate/20140926121757_add_pages_stores.rb +1 -1
- data/db/migrate/20180305193240_update_spree_page_position.rb +13 -0
- data/lib/controllers/backend/spree/admin/pages_controller.rb +16 -0
- data/{app/controllers → lib/controllers/frontend}/spree/static_content_controller.rb +7 -3
- data/lib/generators/solidus_static_content/install/install_generator.rb +7 -5
- data/lib/solidus_static_content.rb +6 -18
- data/lib/solidus_static_content/engine.rb +35 -0
- data/lib/solidus_static_content/factories.rb +18 -0
- data/lib/solidus_static_content/route_matcher.rb +11 -0
- data/lib/solidus_static_content/version.rb +5 -0
- data/lib/views/backend/spree/admin/pages/_form.html.erb +119 -0
- data/lib/views/backend/spree/admin/pages/edit.html.erb +32 -0
- data/lib/views/backend/spree/admin/pages/index.html.erb +68 -0
- data/lib/views/backend/spree/admin/pages/new.html.erb +31 -0
- data/lib/views/backend/spree/admin/shared/_pages_tabs.html.erb +9 -0
- data/{app/views → lib/views/frontend}/spree/static_content/_static_content_footer.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/static_content/_static_content_header.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/static_content/_static_content_list.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/static_content/_static_content_sidebar.html.erb +1 -1
- data/lib/views/frontend/spree/static_content/show.html.erb +18 -0
- data/solidus_static_content.gemspec +36 -31
- data/spec/controllers/spree/admin/pages_controller_spec.rb +11 -0
- data/spec/controllers/{static_content_controller_spec.rb → spree/static_content_controller_spec.rb} +9 -12
- data/spec/features/{admin → spree/admin}/pages_spec.rb +8 -5
- data/spec/features/{static_content_spec.rb → spree/static_content_spec.rb} +6 -4
- data/spec/helpers/{page_helper_spec.rb → spree/page_helper_spec.rb} +0 -0
- data/spec/lib/solidus_static_content/engine_spec.rb +14 -0
- data/spec/lib/{spree_static.content_spec.rb → solidus_static_content/route_matcher_spec.rb} +4 -13
- data/spec/models/{page_spec.rb → spree/page_spec.rb} +22 -7
- data/spec/spec_helper.rb +17 -40
- metadata +85 -177
- data/.travis.yml +0 -21
- data/app/assets/javascripts/spree/backend/spree_static_content.js +0 -1
- data/app/assets/javascripts/spree/frontend/spree_static_content.js +0 -1
- data/app/assets/stylesheets/spree/backend/spree_static_content.css +0 -3
- data/app/controllers/spree/admin/pages_controller.rb +0 -3
- data/app/overrides/pages_in_menu.rb +0 -5
- data/app/views/spree/admin/pages/_form.html.erb +0 -98
- data/app/views/spree/admin/pages/edit.html.erb +0 -18
- data/app/views/spree/admin/pages/index.html.erb +0 -51
- data/app/views/spree/admin/pages/new.html.erb +0 -18
- data/app/views/spree/static_content/show.html.erb +0 -26
- data/lib/spree_static_content/engine.rb +0 -17
- data/spec/factories/page_factory.rb +0 -18
@@ -1,98 +0,0 @@
|
|
1
|
-
<div data-hook="admin_page_form_fields">
|
2
|
-
<div class="left eight columns alpha" data-hook="admin_page_form_left">
|
3
|
-
|
4
|
-
<%= f.field_container :title do %>
|
5
|
-
<%= f.label :title %> <span class="required">*</span><br />
|
6
|
-
<%= f.text_field :title, :class => 'fullwidth title' %>
|
7
|
-
<%= f.error_message_on :title %>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<%= f.field_container :slug do %>
|
11
|
-
<%= f.label :slug %> <span class="required">*</span><br />
|
12
|
-
<%= f.text_field :slug, :class => 'fullwidth title' %>
|
13
|
-
<%= f.error_message_on :slug %>
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
<%= f.field_container :body do %>
|
17
|
-
<%= f.label :body %> <span class="required">*</span><br />
|
18
|
-
<%= f.text_area :body, {rows: 12, :class => 'fullwidth'} %>
|
19
|
-
<%= f.error_message_on :body %>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
</div>
|
23
|
-
<div class="right four columns omega" data-hook="admin_page_form_right">
|
24
|
-
|
25
|
-
<%= f.field_container :layout do %>
|
26
|
-
<%= f.label :layout %><br />
|
27
|
-
<%= f.text_field :layout, :class => 'fullwidth title' %>
|
28
|
-
<% end %>
|
29
|
-
|
30
|
-
<%= f.field_container :foreign_link do %>
|
31
|
-
<%= f.label :foreign_link %><br />
|
32
|
-
<%= f.text_field :foreign_link, :class => 'fullwidth title' %>
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
<%= f.field_container :position do %>
|
36
|
-
<%= f.label :position %><br />
|
37
|
-
<%= f.number_field :position, :min => 0, :class => 'fullwidth title' %>
|
38
|
-
<% end %>
|
39
|
-
|
40
|
-
<%= f.field_container :show_in_sidebar do %>
|
41
|
-
<%= f.check_box :show_in_sidebar %>
|
42
|
-
<%= f.label :show_in_sidebar %>
|
43
|
-
<% end %>
|
44
|
-
|
45
|
-
<%= f.field_container :show_in_heade do %>
|
46
|
-
<%= f.check_box :show_in_header %>
|
47
|
-
<%= f.label :show_in_header %>
|
48
|
-
<% end %>
|
49
|
-
|
50
|
-
<%= f.field_container :show_in_footer do %>
|
51
|
-
<%= f.check_box :show_in_footer %>
|
52
|
-
<%= f.label :show_in_footer %>
|
53
|
-
<% end %>
|
54
|
-
|
55
|
-
<%= f.field_container :visible do %>
|
56
|
-
<%= f.check_box :visible %>
|
57
|
-
<%= f.label :visible %>
|
58
|
-
<% end %>
|
59
|
-
|
60
|
-
<%= f.field_container :render_layout_as_partial do %>
|
61
|
-
<%= f.check_box :render_layout_as_partial %>
|
62
|
-
<%= f.label :render_layout_as_partial %>
|
63
|
-
<% end %>
|
64
|
-
|
65
|
-
<%= f.field_container :stores do %>
|
66
|
-
<%= f.label :stores, Spree.t(:stores)%><br />
|
67
|
-
<% Spree::Store.all.each do |store| %>
|
68
|
-
<%= check_box_tag "page[store_ids][]", store.id, @page.stores.include?(store) %> <%= store.name %>
|
69
|
-
<% end %>
|
70
|
-
<% end %>
|
71
|
-
|
72
|
-
</div>
|
73
|
-
|
74
|
-
<div data-hook="admin_page_form_meta" class="alpha omega twelve columns">
|
75
|
-
|
76
|
-
<%= f.field_container :meta_title do %>
|
77
|
-
<%= f.label :meta_title %><br />
|
78
|
-
<%= f.text_field :meta_title, :class => 'fullwidth title' %>
|
79
|
-
<%= f.error_message_on :meta_title %>
|
80
|
-
<% end %>
|
81
|
-
|
82
|
-
<%= f.field_container :meta_keywords do %>
|
83
|
-
<%= f.label :meta_keywords %><br />
|
84
|
-
<%= f.text_field :meta_keywords, :class => 'fullwidth title' %>
|
85
|
-
<%= f.error_message_on :meta_keywords %>
|
86
|
-
<% end %>
|
87
|
-
|
88
|
-
<%= f.field_container :meta_description do %>
|
89
|
-
<%= f.label :meta_description %><br />
|
90
|
-
<%= f.text_field :meta_description, :class => 'fullwidth title' %>
|
91
|
-
<%= f.error_message_on :meta_description %>
|
92
|
-
<% end %>
|
93
|
-
|
94
|
-
</div>
|
95
|
-
<div class="clear"></div>
|
96
|
-
<div data-hook="admin_page_form_additional_fields"></div>
|
97
|
-
<div class="clear"></div>
|
98
|
-
</div>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= render 'spree/admin/shared/configuration_menu' %>
|
2
|
-
|
3
|
-
<% content_for :page_title do %>
|
4
|
-
<%= Spree.t("static_content.static_pages") %> <i class="icon-arrow-right"></i> <%= Spree.t("static_content.editing_page") %> "<%= @page.title%>"
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<% content_for :page_actions do %>
|
8
|
-
<li><%= button_link_to Spree.t(:back_to_static_pages_list), spree.admin_pages_url, :icon => 'icon-arrow-left' %></li>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= render "spree/shared/error_messages", :target => @page %>
|
12
|
-
|
13
|
-
<%= form_for [:admin, @page] do |f| %>
|
14
|
-
<fieldset class="no-border-top">
|
15
|
-
<%= render :partial => 'form', :locals => { :f => f } %>
|
16
|
-
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
17
|
-
</fieldset>
|
18
|
-
<% end %>
|
@@ -1,51 +0,0 @@
|
|
1
|
-
<% content_for :page_actions do %>
|
2
|
-
<li><%= button_link_to Spree.t("static_content.new_page"), new_object_url, :icon => 'icon-plus', :id => 'admin_new_page' %></li>
|
3
|
-
<% end %>
|
4
|
-
|
5
|
-
<% content_for :page_title do %>
|
6
|
-
<%= Spree.t("static_content.static_pages") %>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<% if @pages.any? %>
|
10
|
-
<table class="index responsive" id="listing_pages" data-hook>
|
11
|
-
<colgroup>
|
12
|
-
<col style="width: 40%">
|
13
|
-
<col style="width: 35%">
|
14
|
-
<col style="width: 10%">
|
15
|
-
<col style="width: 15%">
|
16
|
-
</colgroup>
|
17
|
-
<thead>
|
18
|
-
<tr data-hook="admin_pages_index_headers">
|
19
|
-
<th><%= Spree::Page.human_attribute_name(:title) %></th>
|
20
|
-
<th><%= Spree.t("static_content.link") %></th>
|
21
|
-
<th><%= Spree::Page.human_attribute_name(:visible) %></th>
|
22
|
-
<th data-hook="admin_pages_index_header_actions" class="actions"></th>
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
|
26
|
-
<tbody>
|
27
|
-
<% @pages.each do |page| %>
|
28
|
-
<tr data-hook="admin_pages_index_rows" class="<%= cycle('odd', 'even') %>" id="<%= dom_id page %>">
|
29
|
-
<td>
|
30
|
-
<%= page.title %>
|
31
|
-
</td>
|
32
|
-
<td>
|
33
|
-
<%= link_to page.link, page.link, :target => '_blank' %>
|
34
|
-
</td>
|
35
|
-
<td class="align-center">
|
36
|
-
<%= content_tag(:i, '', :class => 'icon-ok green') if page.visible %>
|
37
|
-
</td>
|
38
|
-
<td class="actions" data-hook="admin_pages_index_row_actions">
|
39
|
-
<%= link_to_edit page, :no_text => true %>
|
40
|
-
<%= link_to_delete page, :no_text => true %>
|
41
|
-
</td>
|
42
|
-
</tr>
|
43
|
-
<% end %>
|
44
|
-
</tbody>
|
45
|
-
</table>
|
46
|
-
<% else %>
|
47
|
-
<div class="alpha twelve columns no-objects-found">
|
48
|
-
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/page')) %>,
|
49
|
-
<%= link_to Spree.t(:add_one), spree.new_admin_page_path %>!
|
50
|
-
</div>
|
51
|
-
<% end %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= render 'spree/admin/shared/configuration_menu' %>
|
2
|
-
|
3
|
-
<% content_for :page_title do %>
|
4
|
-
<%= Spree.t("static_content.static_pages") %> <i class="icon-arrow-right"></i> <%= Spree.t("static_content.new_page") %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<% content_for :page_actions do %>
|
8
|
-
<li><%= button_link_to Spree.t(:back_to_static_pages_list), spree.admin_pages_url, :icon => 'icon-arrow-left' %></li>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= render "spree/shared/error_messages", :target => @page %>
|
12
|
-
|
13
|
-
<%= form_for [:admin, @page] do |f| %>
|
14
|
-
<fieldset class="no-border-top">
|
15
|
-
<%= render :partial => 'form', :locals => { :f => f } %>
|
16
|
-
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
17
|
-
</fieldset>
|
18
|
-
<% end %>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<% if @page.layout.present? and @page.render_layout_as_partial? %>
|
2
|
-
<%= render :partial => @page.layout %>
|
3
|
-
<% else %>
|
4
|
-
<% content_for :head do -%>
|
5
|
-
<%- if @page.meta_title.present? -%>
|
6
|
-
<meta name="title" content="<%=@page.meta_title%>">
|
7
|
-
<%- else -%>
|
8
|
-
<meta name="title" content="<%=@page.title%>">
|
9
|
-
<%- end -%>
|
10
|
-
<meta name="keywords" content="<%=@page.meta_keywords%>">
|
11
|
-
<meta name="description" content="<%=@page.meta_description%>">
|
12
|
-
<% end -%>
|
13
|
-
|
14
|
-
<% content_for :sidebar do %>
|
15
|
-
<% if defined? @products && defined? @taxon %>
|
16
|
-
<%= render :partial => "spree/shared/filters" %>
|
17
|
-
<% elsif defined? @taxonomies %>
|
18
|
-
<%= render :partial => "spree/shared/taxonomies" %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<h1><%= @page.title %></h1>
|
23
|
-
<div id="page_content">
|
24
|
-
<%= raw @page.body %>
|
25
|
-
</div>
|
26
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module SpreeStaticContent
|
2
|
-
class Engine < Rails::Engine
|
3
|
-
require 'spree/core'
|
4
|
-
isolate_namespace Spree
|
5
|
-
engine_name 'spree_static_content'
|
6
|
-
|
7
|
-
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
-
|
9
|
-
def self.activate
|
10
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
|
11
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
config.to_prepare &method(:activate).to_proc
|
16
|
-
end
|
17
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :page, class: Spree::Page do
|
3
|
-
title { generate(:random_string) }
|
4
|
-
body { generate(:random_description) }
|
5
|
-
|
6
|
-
sequence(:slug) { |n| "/page#{n}" }
|
7
|
-
|
8
|
-
trait :with_foreign_link do
|
9
|
-
foreign_link do
|
10
|
-
if defined?(FFaker)
|
11
|
-
FFaker::Internet.http_url
|
12
|
-
else
|
13
|
-
Faker::Internet.http_url
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|