solidus_static_content 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +3 -0
- data/.travis.yml +21 -0
- data/Gemfile +13 -0
- data/Guardfile +9 -0
- data/LICENSE.md +26 -0
- data/README.md +105 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/spree/backend/spree_static_content.js +1 -0
- data/app/assets/javascripts/spree/frontend/spree_static_content.js +1 -0
- data/app/assets/stylesheets/spree/backend/spree_static_content.css +3 -0
- data/app/assets/stylesheets/spree/frontend/spree_static_content.css +7 -0
- data/app/controllers/spree/admin/pages_controller.rb +3 -0
- data/app/controllers/spree/static_content_controller.rb +20 -0
- data/app/helpers/spree/pages_helper.rb +6 -0
- data/app/models/spree/page.rb +54 -0
- data/app/overrides/pages_in_footer.rb +5 -0
- data/app/overrides/pages_in_header.rb +5 -0
- data/app/overrides/pages_in_menu.rb +5 -0
- data/app/overrides/pages_in_sidebar.rb +5 -0
- data/app/views/spree/admin/pages/_form.html.erb +98 -0
- data/app/views/spree/admin/pages/edit.html.erb +18 -0
- data/app/views/spree/admin/pages/index.html.erb +51 -0
- data/app/views/spree/admin/pages/new.html.erb +18 -0
- data/app/views/spree/static_content/_static_content_footer.html.erb +3 -0
- data/app/views/spree/static_content/_static_content_header.html.erb +1 -0
- data/app/views/spree/static_content/_static_content_list.html.erb +6 -0
- data/app/views/spree/static_content/_static_content_sidebar.html.erb +6 -0
- data/app/views/spree/static_content/show.html.erb +26 -0
- data/bin/rails +7 -0
- data/config/locales/de.yml +37 -0
- data/config/locales/en.yml +37 -0
- data/config/locales/es.yml +37 -0
- data/config/locales/et.yml +37 -0
- data/config/locales/fr.yml +37 -0
- data/config/locales/it.yml +37 -0
- data/config/locales/nl.yml +37 -0
- data/config/locales/pl.yml +39 -0
- data/config/locales/pt-BR.yml +37 -0
- data/config/locales/pt.yml +37 -0
- data/config/locales/ro.yml +39 -0
- data/config/locales/ru.yml +39 -0
- data/config/locales/sv.yml +37 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20081216193152_create_pages.rb +15 -0
- data/db/migrate/20090625125735_extend_pages.rb +28 -0
- data/db/migrate/20090814113100_add_visible_to_pages.rb +17 -0
- data/db/migrate/20090814142845_add_default_true_to_visible_for_page.rb +8 -0
- data/db/migrate/20090829000527_add_index_for_page.rb +10 -0
- data/db/migrate/20091219021134_add_meta_fields_to_pages.rb +9 -0
- data/db/migrate/20100204105222_add_layout_to_pages.rb +9 -0
- data/db/migrate/20100323085528_add_show_in_sidebar_option_to_pages.rb +9 -0
- data/db/migrate/20110717103112_add_meta_title_to_page.rb +9 -0
- data/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb +13 -0
- data/db/migrate/20140926121757_add_pages_stores.rb +14 -0
- data/lib/generators/solidus_static_content/install/install_generator.rb +24 -0
- data/lib/solidus_static_content.rb +21 -0
- data/lib/spree_static_content/engine.rb +17 -0
- data/solidus_static_content.gemspec +32 -0
- data/spec/controllers/static_content_controller_spec.rb +37 -0
- data/spec/factories/page_factory.rb +18 -0
- data/spec/features/admin/pages_spec.rb +67 -0
- data/spec/features/static_content_spec.rb +53 -0
- data/spec/helpers/page_helper_spec.rb +14 -0
- data/spec/lib/spree_static.content_spec.rb +34 -0
- data/spec/models/page_spec.rb +46 -0
- data/spec/spec_helper.rb +50 -0
- metadata +294 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
pt-BR:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/page:
|
6
|
+
body: Corpo
|
7
|
+
foreign_link: Link externo (URL)
|
8
|
+
show_in_header: Mostrar no cabeçalho
|
9
|
+
show_in_footer: Mostrar no rodapé
|
10
|
+
position: Posição
|
11
|
+
layout: Traçado
|
12
|
+
meta_description: "Meta Descrição"
|
13
|
+
meta_keywords: "Meta Palavras"
|
14
|
+
meta_title: "Meta Título"
|
15
|
+
render_layout_as_partial: "Renderização layout como parcial"
|
16
|
+
slug: Slug
|
17
|
+
title: Título
|
18
|
+
visible: Visível
|
19
|
+
show_in_sidebar: Mostrar na barra lateral
|
20
|
+
models:
|
21
|
+
spree/page:
|
22
|
+
few: Páginas
|
23
|
+
many: Páginas
|
24
|
+
one: Página
|
25
|
+
other: Páginas
|
26
|
+
spree:
|
27
|
+
admin:
|
28
|
+
tab:
|
29
|
+
pages: Páginas
|
30
|
+
back_to_static_pages_list: "Voltar à lista de páginas estáticas"
|
31
|
+
page: Página
|
32
|
+
pages: Páginas
|
33
|
+
static_content:
|
34
|
+
editing_page: "Editando página"
|
35
|
+
link: Link
|
36
|
+
new_page: "Nova página"
|
37
|
+
static_pages: "Páginas estáticas"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
pt:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/page:
|
6
|
+
body: Corpo
|
7
|
+
foreign_link: "Link externo (URL)"
|
8
|
+
layout: Traçado
|
9
|
+
meta_description: "Meta Descrição"
|
10
|
+
meta_keywords: "Meta Palavras"
|
11
|
+
meta_title: "Meta Título"
|
12
|
+
position: Posição
|
13
|
+
render_layout_as_partial: "Renderização layout como parcial"
|
14
|
+
show_in_footer: "Mostrar no rodapé"
|
15
|
+
show_in_header: "Mostrar no cabeçalho"
|
16
|
+
show_in_sidebar: "Mostrar na barra lateral"
|
17
|
+
slug: Slug
|
18
|
+
title: Título
|
19
|
+
visible: Visível
|
20
|
+
models:
|
21
|
+
spree/page:
|
22
|
+
few: Páginas
|
23
|
+
many: Páginas
|
24
|
+
one: Página
|
25
|
+
other: Páginas
|
26
|
+
spree:
|
27
|
+
admin:
|
28
|
+
tab:
|
29
|
+
pages: Páginas
|
30
|
+
back_to_static_pages_list: "Voltar à lista de páginas estáticas"
|
31
|
+
page: Página
|
32
|
+
pages: Páginas
|
33
|
+
static_content:
|
34
|
+
editing_page: "Editar página"
|
35
|
+
link: Link
|
36
|
+
new_page: "Nova página"
|
37
|
+
static_pages: "Páginas estáticas"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
ro:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/page:
|
6
|
+
title: Titlu
|
7
|
+
slug: Permalink
|
8
|
+
body: Content de bază
|
9
|
+
foreign_link: "Link extern (URL)"
|
10
|
+
show_in_header: "Arată în header"
|
11
|
+
show_in_footer: "Arată în blocul de jos"
|
12
|
+
show_in_sidebar: "Arată în bara laterală"
|
13
|
+
position: "Poziția în meniu"
|
14
|
+
visible: "Vizibilitate"
|
15
|
+
meta_keywords: "Cuvinte Cheie"
|
16
|
+
meta_description: "Descriere"
|
17
|
+
layout: "Machet"
|
18
|
+
render_layout_as_partial: "Utilizează șablonul ca un machet"
|
19
|
+
models:
|
20
|
+
page:
|
21
|
+
one: Pagină
|
22
|
+
few: Pagini
|
23
|
+
many: Pagini
|
24
|
+
spree:
|
25
|
+
page: Pagină
|
26
|
+
pages: Pagine
|
27
|
+
static_content:
|
28
|
+
static_pages: Pagini statice
|
29
|
+
static_pages_desc: Descrierea paginilor statice
|
30
|
+
new_page: Pagină nouă
|
31
|
+
editing_page: Editarea paginii
|
32
|
+
confirm_delete: Sunteți siguri că doriți să ștergeți această pagină?
|
33
|
+
link: Link
|
34
|
+
meta_title: Titlu meta
|
35
|
+
page_navigation_title: Pagini
|
36
|
+
back_to_static_pages_list: Înapoi la lista de pagini
|
37
|
+
admin:
|
38
|
+
tab:
|
39
|
+
pages: Pagini
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
ru:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/page:
|
6
|
+
title: Заголовок
|
7
|
+
slug: Постоянная ссылка
|
8
|
+
body: Основной текст
|
9
|
+
foreign_link: "Внешняя ссылка (URL)"
|
10
|
+
show_in_header: "Отображать в верхнем меню"
|
11
|
+
show_in_footer: "Отображать в нижнем меню"
|
12
|
+
show_in_sidebar: "Отображать в боковом меню"
|
13
|
+
position: "Позиция в меню"
|
14
|
+
visible: "Публиковать"
|
15
|
+
meta_keywords: "Ключевые слова"
|
16
|
+
meta_description: "Описание"
|
17
|
+
layout: "Макет"
|
18
|
+
render_layout_as_partial: "Использовать макет как шаблон страниц"
|
19
|
+
meta_title: "Мета заголовок"
|
20
|
+
page_navigation_title: "Страницы"
|
21
|
+
models:
|
22
|
+
spree/page:
|
23
|
+
one: Страница
|
24
|
+
few: Страницы
|
25
|
+
many: Страниц
|
26
|
+
other: Страницы
|
27
|
+
spree:
|
28
|
+
page: "Страница"
|
29
|
+
pages: "Страницы"
|
30
|
+
static_content:
|
31
|
+
static_pages: "Статические страницы"
|
32
|
+
new_page: "Новая страница"
|
33
|
+
editing_page: "Редактирование страницы"
|
34
|
+
link: "Ссылка"
|
35
|
+
back_to_static_pages_list: "Назад к списку страниц"
|
36
|
+
admin:
|
37
|
+
tab:
|
38
|
+
pages: "Страницы"
|
39
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
sv:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/page:
|
6
|
+
body: Innehåll
|
7
|
+
foreign_link: "Extern länk (URL)"
|
8
|
+
layout: Layout
|
9
|
+
meta_description: "Meta beskrivning"
|
10
|
+
meta_keywords: "Meta referensord"
|
11
|
+
meta_title: "Meta titel"
|
12
|
+
position: Position
|
13
|
+
render_layout_as_partial: "Rendera layouten som del"
|
14
|
+
show_in_footer: "Visa i sidfot"
|
15
|
+
show_in_header: "Visa i huvudet"
|
16
|
+
show_in_sidebar: "Visa i sidomeny"
|
17
|
+
slug: Permalänk
|
18
|
+
title: Rubrik
|
19
|
+
visible: Synlig
|
20
|
+
models:
|
21
|
+
spree/page:
|
22
|
+
few: Sidor
|
23
|
+
many: Sidor
|
24
|
+
one: Sida
|
25
|
+
other: Sidor
|
26
|
+
spree:
|
27
|
+
admin:
|
28
|
+
tab:
|
29
|
+
pages: Sidor
|
30
|
+
back_to_static_pages_list: "Tillbaka till listan med sidor"
|
31
|
+
page: Sida
|
32
|
+
pages: Sidor
|
33
|
+
static_content:
|
34
|
+
editing_page: "Editera sidan"
|
35
|
+
link: Länk
|
36
|
+
new_page: "Ny sida"
|
37
|
+
static_pages: "Statiska sidor"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class ExtendPages < ActiveRecord::Migration
|
2
|
+
class Page < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
|
5
|
+
def self.up
|
6
|
+
change_table :spree_pages do |t|
|
7
|
+
t.boolean :show_in_header, :default => false, :null => false
|
8
|
+
t.boolean :show_in_footer, :default => false, :null => false
|
9
|
+
t.string :foreign_link
|
10
|
+
t.integer :position, :default => 1, :null => false
|
11
|
+
if Page.table_exists?
|
12
|
+
Page.order(:updated_at).each_with_index{|page,x| page.update_attribute(:position, x+1)}
|
13
|
+
else
|
14
|
+
Spree::Page.order(:updated_at).each_with_index{|page,x| page.update_attribute(:position, x+1)}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
change_table :spree_pages do |t|
|
22
|
+
t.remove :show_in_header
|
23
|
+
t.remove :show_in_footer
|
24
|
+
t.remove :foreign_link
|
25
|
+
t.remove :position
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class AddVisibleToPages < ActiveRecord::Migration
|
2
|
+
class Page < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
|
5
|
+
def self.up
|
6
|
+
add_column :spree_pages, :visible, :boolean
|
7
|
+
if Page.table_exists?
|
8
|
+
Page.update_all :visible => true
|
9
|
+
else
|
10
|
+
Spree::Page.update_all :visible => true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
remove_column :spree_pages, :visible
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddRenderAsPartialForLayoutForSpreePages < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless column_exists? :spree_pages, :render_layout_as_partial
|
4
|
+
add_column :spree_pages, :render_layout_as_partial, :boolean, :default => false
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
if column_exists? :spree_pages, :render_layout_as_partial
|
10
|
+
remove_column :spree_pages, :render_layout_as_partial
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddPagesStores < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
create_table :spree_pages_stores, :id => false do |t|
|
5
|
+
t.integer :store_id
|
6
|
+
t.integer :page_id
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :spree_pages_stores, :store_id
|
11
|
+
add_index :spree_pages_stores, :page_id
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module SolidusStaticContent
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
class_option :auto_run_migrations, type: :boolean, default: false
|
5
|
+
|
6
|
+
def add_stylesheets
|
7
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_static_content\n", before: /\*\//, verbose: true
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_migrations
|
11
|
+
run 'bundle exec rake railties:install:migrations FROM=solidus_static_content'
|
12
|
+
end
|
13
|
+
|
14
|
+
def run_migrations
|
15
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
|
16
|
+
if run_migrations
|
17
|
+
run 'bundle exec rake db:migrate'
|
18
|
+
else
|
19
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'solidus_core'
|
2
|
+
require 'solidus_frontend'
|
3
|
+
require 'solidus_backend'
|
4
|
+
require 'deface'
|
5
|
+
require 'spree_static_content/engine'
|
6
|
+
require 'coffee_script'
|
7
|
+
require 'sass/rails'
|
8
|
+
|
9
|
+
module StaticPage
|
10
|
+
def self.remove_spree_mount_point(path)
|
11
|
+
regex = Regexp.new '\A' + Rails.application.routes.url_helpers.spree_path
|
12
|
+
path.sub( regex, '').split('?')[0]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Spree::StaticPage
|
17
|
+
def self.matches?(request)
|
18
|
+
return false if request.path =~ /(^\/+(admin|account|cart|checkout|content|login|pg\/|orders|products|s\/|session|signup|shipments|states|t\/|tax_categories|user)+)/
|
19
|
+
!Spree::Page.visible.find_by_slug(request.path).nil?
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = 'solidus_static_content'
|
4
|
+
s.version = '1.0.0'
|
5
|
+
s.summary = 'Extention to manage the static pages for your Spree shop.'
|
6
|
+
s.description = s.summary
|
7
|
+
s.required_ruby_version = '>= 1.9.3'
|
8
|
+
|
9
|
+
s.authors = [%q{Peter Berkenbosch}, %q{Roman Smirnov}]
|
10
|
+
s.email = 'peter@pero-ict.nl'
|
11
|
+
s.homepage = 'http://spreecommerce.com/extensions/139-static-content'
|
12
|
+
s.license = %q{BSD-3}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
16
|
+
s.require_path = 'lib'
|
17
|
+
s.requirements << 'none'
|
18
|
+
|
19
|
+
s.add_dependency 'solidus', ['>= 1.1', '< 3']
|
20
|
+
s.add_dependency 'deface', '~> 1.0.2'
|
21
|
+
|
22
|
+
s.add_development_dependency 'capybara', '~> 2.7'
|
23
|
+
s.add_development_dependency 'factory_girl', '~> 4.7'
|
24
|
+
s.add_development_dependency 'ffaker'
|
25
|
+
s.add_development_dependency 'database_cleaner', '~> 1.5'
|
26
|
+
s.add_development_dependency 'rspec-rails', '~> 3.5'
|
27
|
+
s.add_development_dependency 'sqlite3', '~> 1.3'
|
28
|
+
s.add_development_dependency 'poltergeist', '~> 1.10'
|
29
|
+
s.add_development_dependency 'simplecov', '~> 0.12'
|
30
|
+
s.add_development_dependency 'pry-rails'
|
31
|
+
s.add_development_dependency 'test-unit'
|
32
|
+
end
|