spree_static_content 0.30.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CONTRIBUTORS.textile +7 -0
- data/README.rdoc +33 -0
- data/Rakefile +111 -0
- data/app/controllers/admin/pages_controller.rb +21 -0
- data/app/controllers/static_content_controller.rb +25 -0
- data/app/models/page.rb +50 -0
- data/app/views/admin/pages/_form.html.erb +77 -0
- data/app/views/admin/pages/edit.html.erb +12 -0
- data/app/views/admin/pages/index.html.erb +40 -0
- data/app/views/admin/pages/new.html.erb +12 -0
- data/app/views/static_content/show.html.erb +18 -0
- data/config/locales/en-GB.yml +22 -0
- data/config/locales/es-ES.yml +17 -0
- data/config/locales/nl-BE.yml +22 -0
- data/config/locales/nl-NL.yml +22 -0
- data/config/locales/pl.yml +20 -0
- data/config/locales/pt-BR.yml +14 -0
- data/config/locales/ru-RU.yml +21 -0
- data/config/routes.rb +9 -0
- data/spec/controllers/admin/pages_controller_spec.rb +5 -0
- data/spec/controllers/content_controller_spec.rb +18 -0
- data/spec/models/page_spec.rb +20 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +28 -0
- metadata +107 -0
data/.gitignore
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
h2. Contributors list - Thanks guys!
|
2
|
+
|
3
|
+
|Maxim Filatov|http://github.com/Bregor|
|
4
|
+
|Marcin Raczkowski|http://github.com/swistak|
|
5
|
+
|Roman Smirnov|http://github.com/romul|
|
6
|
+
|Eliot Sykes|http://github.com/eliotsykes|
|
7
|
+
|Oliver Azevedo Barnes|http://github.com/oliverbarnes|
|
data/README.rdoc
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= Static Content
|
2
|
+
|
3
|
+
Good, clean content management of pages for Spree. You can use this to:
|
4
|
+
|
5
|
+
- Add and manage static pages such as an 'About' page.
|
6
|
+
- Show a static page instead of existing dynamic pages such as the home page,
|
7
|
+
products pages, and taxon pages.
|
8
|
+
|
9
|
+
To override a dynamic page, use the path of that dynamic page as the slug when
|
10
|
+
you create your page in the Spree Administration area, including the
|
11
|
+
leading slash. For example:
|
12
|
+
|
13
|
+
- to override the home page, use a path of '/' (without quotes).
|
14
|
+
- to override a product page, use its path, e.g. '/products/apache-baseball-jersey' (without quotes).
|
15
|
+
|
16
|
+
The dynamic page can be made available again if you delete the static page or change its slug.
|
17
|
+
|
18
|
+
Create your own copy of the app/views/content/show.html.erb template in your site
|
19
|
+
extension to change the layout of the static pages.
|
20
|
+
|
21
|
+
=== Example to use the static pages inside a menu
|
22
|
+
<ul>
|
23
|
+
<% for page in Page.header_links do %>
|
24
|
+
<li><%= link_to page.title, page.link %></li>
|
25
|
+
<% end %>
|
26
|
+
</ul>
|
27
|
+
|
28
|
+
== Installation
|
29
|
+
|
30
|
+
1. Add `gem "spree_static_content"` to your Gemfile
|
31
|
+
1. Run `bundle install`
|
32
|
+
1. Run `rails g spree_static_content:install`
|
33
|
+
1. Run `rake db:migrate`
|
data/Rakefile
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
rescue LoadError
|
6
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
#gem 'rdoc', '= 2.2'
|
10
|
+
require 'rdoc'
|
11
|
+
require 'rake'
|
12
|
+
require 'rake/testtask'
|
13
|
+
require 'rake/rdoctask'
|
14
|
+
require 'rake/packagetask'
|
15
|
+
require 'rake/gempackagetask'
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |s|
|
18
|
+
s.name = "spree_static_content"
|
19
|
+
s.summary = "Extention to manage the static pages for your Spree shop."
|
20
|
+
s.description = s.summary
|
21
|
+
#s.email = ""
|
22
|
+
s.homepage = "http://github.com/spree/spree-static-content"
|
23
|
+
s.authors = ["Peter Berkenbosch", "Roman Smirnov"]
|
24
|
+
s.add_dependency 'spree_core', ['>= 0.30.0.beta1']
|
25
|
+
#s.has_rdoc = false
|
26
|
+
#s.extra_rdoc_files = [ "README.rdoc"]
|
27
|
+
#s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
|
28
|
+
#s.test_files = Dir['test/**/*.{yml,rb}']
|
29
|
+
end
|
30
|
+
Jeweler::GemcutterTasks.new
|
31
|
+
|
32
|
+
|
33
|
+
require 'spec/rake/spectask'
|
34
|
+
# require 'spec/translator'
|
35
|
+
|
36
|
+
extension_root = File.expand_path(File.dirname(__FILE__))
|
37
|
+
|
38
|
+
task :default => :spec
|
39
|
+
task :stats => "spec:statsetup"
|
40
|
+
|
41
|
+
desc "Run all specs in spec directory"
|
42
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
43
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
44
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
45
|
+
end
|
46
|
+
|
47
|
+
namespace :spec do
|
48
|
+
desc "Run all specs in spec directory with RCov"
|
49
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
50
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
51
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
52
|
+
t.rcov = true
|
53
|
+
t.rcov_opts = ['--exclude', 'spec', '--rails']
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Print Specdoc for all specs"
|
57
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
58
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
59
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
60
|
+
end
|
61
|
+
|
62
|
+
[:models, :controllers, :views, :helpers].each do |sub|
|
63
|
+
desc "Run the specs under spec/#{sub}"
|
64
|
+
Spec::Rake::SpecTask.new(sub) do |t|
|
65
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
66
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Hopefully no one has written their extensions in pre-0.9 style
|
71
|
+
# desc "Translate specs from pre-0.9 to 0.9 style"
|
72
|
+
# task :translate do
|
73
|
+
# translator = ::Spec::Translator.new
|
74
|
+
# dir = RAILS_ROOT + '/spec'
|
75
|
+
# translator.translate(dir, dir)
|
76
|
+
# end
|
77
|
+
|
78
|
+
# Setup specs for stats
|
79
|
+
task :statsetup do
|
80
|
+
require 'code_statistics'
|
81
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models)
|
82
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views)
|
83
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
|
84
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
|
85
|
+
::CodeStatistics::TEST_TYPES << "Model specs"
|
86
|
+
::CodeStatistics::TEST_TYPES << "View specs"
|
87
|
+
::CodeStatistics::TEST_TYPES << "Controller specs"
|
88
|
+
::CodeStatistics::TEST_TYPES << "Helper specs"
|
89
|
+
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
desc 'Generate documentation for the static_content extension.'
|
94
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
95
|
+
rdoc.rdoc_dir = 'rdoc'
|
96
|
+
rdoc.title = 'StaticContentExtension'
|
97
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
98
|
+
rdoc.rdoc_files.include('README')
|
99
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
100
|
+
end
|
101
|
+
|
102
|
+
# For extensions that are in transition
|
103
|
+
desc 'Test the static_content extension.'
|
104
|
+
Rake::TestTask.new(:test) do |t|
|
105
|
+
t.libs << 'lib'
|
106
|
+
t.pattern = 'test/**/*_test.rb'
|
107
|
+
t.verbose = true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Load any custom rakefiles for extension
|
111
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Admin::PagesController < Admin::BaseController
|
2
|
+
resource_controller
|
3
|
+
|
4
|
+
update.response do |wants|
|
5
|
+
wants.html { redirect_to collection_url }
|
6
|
+
end
|
7
|
+
|
8
|
+
update.after do
|
9
|
+
expire_page :controller => 'static_content', :action => 'show', :path => @page.slug
|
10
|
+
Rails.cache.delete('page_not_exist/'+@page.slug)
|
11
|
+
end
|
12
|
+
|
13
|
+
create.response do |wants|
|
14
|
+
wants.html { redirect_to collection_url }
|
15
|
+
end
|
16
|
+
|
17
|
+
create.after do
|
18
|
+
Rails.cache.delete('page_not_exist/'+@page.slug)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class StaticContentController < Spree::BaseController
|
2
|
+
caches_action :show
|
3
|
+
|
4
|
+
def show
|
5
|
+
path = case params[:path]
|
6
|
+
when Array
|
7
|
+
'/' + params[:path].join("/")
|
8
|
+
when String
|
9
|
+
params[:path]
|
10
|
+
when nil
|
11
|
+
request.path
|
12
|
+
end
|
13
|
+
|
14
|
+
unless @page = Page.visible.find_by_slug(path)
|
15
|
+
render :file => "#{RAILS_ROOT}/public/404.html", :layout => false, :status => 404
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def accurate_title
|
22
|
+
@page ? @page.title : nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/app/models/page.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class Page < ActiveRecord::Base
|
2
|
+
default_scope :order => "position ASC"
|
3
|
+
|
4
|
+
validates_presence_of :title
|
5
|
+
validates_presence_of [:slug, :body], :if => :not_using_foreign_link?
|
6
|
+
|
7
|
+
scope :header_links, where(["show_in_header = ?", true])
|
8
|
+
scope :footer_links, where(["show_in_footer = ?", true])
|
9
|
+
scope :sidebar_links, where(["show_in_sidebar = ?", true])
|
10
|
+
scope :visible, where(:visible => true)
|
11
|
+
|
12
|
+
before_save :update_positions_and_slug
|
13
|
+
|
14
|
+
def initialize(*args)
|
15
|
+
super(*args)
|
16
|
+
last_page = Page.last
|
17
|
+
self.position = last_page ? last_page.position + 1 : 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def link
|
21
|
+
foreign_link.blank? ? slug_link : foreign_link
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def update_positions_and_slug
|
27
|
+
unless new_record?
|
28
|
+
return unless prev_position = Page.find(self.id).position
|
29
|
+
if prev_position > self.position
|
30
|
+
Page.update_all("position = position + 1", ["? <= position AND position < ?", self.position, prev_position])
|
31
|
+
elsif prev_position < self.position
|
32
|
+
Page.update_all("position = position - 1", ["? < position AND position <= ?", prev_position, self.position])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
self.slug = slug_link
|
37
|
+
end
|
38
|
+
|
39
|
+
def not_using_foreign_link?
|
40
|
+
foreign_link.blank?
|
41
|
+
end
|
42
|
+
|
43
|
+
def slug_link
|
44
|
+
ensure_slash_prefix slug
|
45
|
+
end
|
46
|
+
|
47
|
+
def ensure_slash_prefix(str)
|
48
|
+
str.index('/') == 0 ? str : '/' + str
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
|
3
|
+
<%= javascript_include_tag 'wymeditor/jquery.wymeditor.js' %>
|
4
|
+
|
5
|
+
<script type="text/javascript" charset="utf-8">
|
6
|
+
|
7
|
+
var $j = jQuery.noConflict();
|
8
|
+
$j(function() {
|
9
|
+
$j('.wymeditor').wymeditor({
|
10
|
+
xhtmlParser: 'xhtml_parser.js',
|
11
|
+
cssParser: 'wym_css_parser.js',
|
12
|
+
stylesheet: '/stylesheets/static.css?v='+Math.random(),
|
13
|
+
containersItems: [
|
14
|
+
{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'},
|
15
|
+
{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'},
|
16
|
+
{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'},
|
17
|
+
{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'},
|
18
|
+
{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'},
|
19
|
+
{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'},
|
20
|
+
],
|
21
|
+
lang: '<%= I18n.locale.to_s.split("-").first %>'
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
25
|
+
</script>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<table class="admin-report" width="545">
|
29
|
+
<tr>
|
30
|
+
<td valign="top"><%=t("ext_static_content_title")%>:</td>
|
31
|
+
<td><%= f.text_field :title, {"style" => "width:500px"} %></td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td valign="top"><%=t("ext_static_content_slug")%>:</td>
|
35
|
+
<td><%= f.text_field :slug, {"style" => "width:500px"} %></td>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<td valign="top"><%=t("ext_static_content_body")%>:</td>
|
39
|
+
<td><%= f.text_area :body, {"style" => "width:500px", "class"=> "wymeditor"} %> </td>
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
<td valign="top"><%=t("ext_static_content_foreign_link")%>:</td>
|
43
|
+
<td><%= f.text_field :foreign_link, {"style" => "width:500px"} %></td>
|
44
|
+
</tr>
|
45
|
+
<tr>
|
46
|
+
<td valign="top"><%=t("ext_static_content_meta_keywords")%>:</td>
|
47
|
+
<td><%= f.text_field :meta_keywords, {"style" => "width:500px"} %></td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td valign="top"><%=t("ext_static_content_meta_description")%>:</td>
|
51
|
+
<td><%= f.text_field :meta_description, {"style" => "width:500px"} %></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td valign="top"><%=t("ext_static_content_show_in_sidebar")%>:</td>
|
55
|
+
<td><%= f.check_box :show_in_sidebar %></td>
|
56
|
+
</tr>
|
57
|
+
<tr>
|
58
|
+
<td valign="top"><%=t("ext_static_content_show_in_header")%>:</td>
|
59
|
+
<td><%= f.check_box :show_in_header %></td>
|
60
|
+
</tr>
|
61
|
+
<tr>
|
62
|
+
<td valign="top"><%=t("ext_static_content_show_in_footer")%>:</td>
|
63
|
+
<td><%= f.check_box :show_in_footer %></td>
|
64
|
+
</tr>
|
65
|
+
<tr>
|
66
|
+
<td valign="top"><%=t("ext_static_content_position")%>:</td>
|
67
|
+
<td><%= f.text_field :position %></td>
|
68
|
+
</tr>
|
69
|
+
<tr>
|
70
|
+
<td valign="top"><%=t("ext_static_content_layout")%>:</td>
|
71
|
+
<td><%= f.text_field :layout %></td>
|
72
|
+
</tr>
|
73
|
+
<tr>
|
74
|
+
<td valign="top"><%=t("ext_static_content_visible")%>:</td>
|
75
|
+
<td><%= f.check_box :visible %></td>
|
76
|
+
</tr>
|
77
|
+
</table>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render :partial => 'admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<h1><%= t("ext_static_content_editing_page") %></h1>
|
4
|
+
<%= render "shared/error_messages", :target => @page %>
|
5
|
+
|
6
|
+
<% form_for(:page, :url => object_url, :html => { :method => :put }) do |f| -%>
|
7
|
+
<%= render :partial => "form", :locals => { :f => f } %>
|
8
|
+
<p class="form-buttons">
|
9
|
+
<%= button t("actions.update"), nil, 'submit', {"class" => "wymupdate"} %>
|
10
|
+
<%= t("or") %> <%= link_to t("actions.cancel"), collection_url %>
|
11
|
+
</p>
|
12
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%= render :partial => 'admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<div class='toolbar'>
|
4
|
+
<ul class='actions'>
|
5
|
+
<li id="new_product_link">
|
6
|
+
<%= button_link_to t("ext_static_content_new_page"), new_object_url, {:icon => 'add'} %>
|
7
|
+
</li>
|
8
|
+
</ul>
|
9
|
+
<br class='clear' />
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<h1><%=t("ext_static_content_static_pages") %></h1>
|
13
|
+
|
14
|
+
<table class="index">
|
15
|
+
<tr>
|
16
|
+
<th><%=t("ext_static_content_title")%></th>
|
17
|
+
<th><%=t("ext_static_content_link")%></th>
|
18
|
+
<th><%=t("ext_static_content_visible")%></th>
|
19
|
+
<th><%=t("action")%></th>
|
20
|
+
</tr>
|
21
|
+
<tbody>
|
22
|
+
<% @pages.each do |page| %>
|
23
|
+
<tr class="<%= cycle('even', 'odd') %>" id="<%= dom_id page %>">
|
24
|
+
<td>
|
25
|
+
<%= page.title %>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<%= link_to page.link, page.link %>
|
29
|
+
</td>
|
30
|
+
<td>
|
31
|
+
<%= page.visible %>
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
<%= link_to_edit page %>
|
35
|
+
<%= link_to_delete page %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<% end %>
|
39
|
+
</tbody>
|
40
|
+
</table>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render :partial => 'admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<h1><%= t("ext_static_content_new_page") %></h1>
|
4
|
+
<%= render "shared/error_messages", :target => @page %>
|
5
|
+
|
6
|
+
<% form_for(:page, :url => collection_url) do |f| %>
|
7
|
+
<%= render :partial => "form", :locals => { :f => f } %>
|
8
|
+
<p class="form-buttons">
|
9
|
+
<%= button t("actions.create"), nil, 'submit', {"class" => "wymupdate"} %>
|
10
|
+
<%= t("or") %> <%= link_to t("actions.cancel"), collection_url %>
|
11
|
+
</p>
|
12
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% content_for :head do -%>
|
2
|
+
<meta name="title" content="<%=@page.title%>">
|
3
|
+
<% if @page.attribute_present? :meta_keywords -%>
|
4
|
+
<meta name="keywords" content="<%=@page.meta_keywords%>">
|
5
|
+
<% end -%>
|
6
|
+
<% if @page.attribute_present? :meta_description -%>
|
7
|
+
<meta name="description" content="<%=@page.meta_description%>">
|
8
|
+
<% end -%>
|
9
|
+
<% end -%>
|
10
|
+
<% content_for :sidebar do %>
|
11
|
+
<% if "products" == @current_controller && @taxon %>
|
12
|
+
<%= render :partial => "shared/filters" %>
|
13
|
+
<% else %>
|
14
|
+
<%= render :partial => "shared/taxonomies" %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<h1><%= @page.title %></h1>
|
18
|
+
<%= raw @page.body %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
en-GB:
|
3
|
+
pages: Pages
|
4
|
+
ext_static_content_static_pages: Static pages
|
5
|
+
ext_static_content_static_pages_desc: Manage static page with WYSIWYG editor.
|
6
|
+
ext_static_content_title: Title
|
7
|
+
ext_static_content_slug: Slug
|
8
|
+
ext_static_content_body: Body
|
9
|
+
ext_static_content_new_page: New page
|
10
|
+
ext_static_content_editing_page: Editing page
|
11
|
+
ext_static_content_foreign_link: Foreign link (URL)
|
12
|
+
ext_static_content_show_in_sidebar: Show in sidebar
|
13
|
+
ext_static_content_show_in_header: Show in header
|
14
|
+
ext_static_content_show_in_footer: Show in footer
|
15
|
+
ext_static_content_position: Position
|
16
|
+
ext_static_content_visible: Visible
|
17
|
+
ext_static_content_confirm_delete: Are you sure?
|
18
|
+
ext_static_content_link: Link
|
19
|
+
ext_static_content_meta_title: Meta Title
|
20
|
+
ext_static_content_meta_keywords: Meta Keywords
|
21
|
+
ext_static_content_meta_description: Meta Description
|
22
|
+
ext_static_content_layout: Layout
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
es-ES:
|
3
|
+
pages: Pages
|
4
|
+
ext_static_content_static_pages: Páginas estáticas
|
5
|
+
ext_static_content_static_pages_desc: Administrar página estática con el editor WYSIWYG.
|
6
|
+
ext_static_content_title: Título
|
7
|
+
ext_static_content_slug: Slug
|
8
|
+
ext_static_content_body: Cuerpo
|
9
|
+
ext_static_content_new_page: Nueva página
|
10
|
+
ext_static_content_editing_page: Edición de página
|
11
|
+
ext_static_content_foreign_link: Enlace externo (URL)
|
12
|
+
ext_static_content_show_in_header: Mostrar en la cabecera
|
13
|
+
ext_static_content_show_in_footer: Mostrar en el pié de página
|
14
|
+
ext_static_content_position: Posición
|
15
|
+
ext_static_content_visible: Visible
|
16
|
+
ext_static_content_confirm_delete: ¿ Estás seguro ?
|
17
|
+
ext_static_content_link: Enlace
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
nl-BE:
|
3
|
+
pages: Statische pagina's
|
4
|
+
ext_static_content_static_pages: Statische pagina's
|
5
|
+
ext_static_content_static_pages_desc: Beheer statische pagina's met een WYSIWYG editor.
|
6
|
+
ext_static_content_title: Titel
|
7
|
+
ext_static_content_slug: Slug
|
8
|
+
ext_static_content_body: Body
|
9
|
+
ext_static_content_new_page: Nieuwe pagina
|
10
|
+
ext_static_content_editing_page: Pagina bewerken
|
11
|
+
ext_static_content_foreign_link: Externe link (URL)
|
12
|
+
ext_static_content_show_in_header: Toon in header
|
13
|
+
ext_static_content_show_in_footer: Toon in footer
|
14
|
+
ext_static_content_position: Positie
|
15
|
+
ext_static_content_visible: Zichtbaar?
|
16
|
+
ext_static_content_confirm_delete: Weet u zeker dat u deze pagina wilt verwijderen ?
|
17
|
+
ext_static_content_link: Link
|
18
|
+
ext_static_content_meta_title: Meta Titel
|
19
|
+
ext_static_content_meta_keywords: Meta Keywords
|
20
|
+
ext_static_content_meta_description: Meta Description
|
21
|
+
ext_static_content_layout: Layout
|
22
|
+
ext_static_content_show_in_sidebar: Toon in zijbalk?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
nl-NL:
|
3
|
+
pages: Statische pagina's
|
4
|
+
ext_static_content_static_pages: Statische pagina's
|
5
|
+
ext_static_content_static_pages_desc: Beheer statische pagina's met een WYSIWYG editor.
|
6
|
+
ext_static_content_title: Titel
|
7
|
+
ext_static_content_slug: Slug
|
8
|
+
ext_static_content_body: Body
|
9
|
+
ext_static_content_new_page: Nieuwe pagina
|
10
|
+
ext_static_content_editing_page: Pagina bewerken
|
11
|
+
ext_static_content_foreign_link: Externe link (URL)
|
12
|
+
ext_static_content_show_in_header: Toon in header
|
13
|
+
ext_static_content_show_in_footer: Toon in footer
|
14
|
+
ext_static_content_position: Positie
|
15
|
+
ext_static_content_visible: Zichtbaar?
|
16
|
+
ext_static_content_confirm_delete: Weet u zeker dat u deze pagina wilt verwijderen ?
|
17
|
+
ext_static_content_link: Link
|
18
|
+
ext_static_content_meta_title: Meta Titel
|
19
|
+
ext_static_content_meta_keywords: Meta Keywords
|
20
|
+
ext_static_content_meta_description: Meta Description
|
21
|
+
ext_static_content_layout: Layout
|
22
|
+
ext_static_content_show_in_sidebar: Toon in zijbalk?
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
pl:
|
3
|
+
pages: Strony statyczne
|
4
|
+
ext_static_content_static_pages: Strony statyczne
|
5
|
+
ext_static_content_static_pages_desc: Zarządzaj stronami statycznymi.
|
6
|
+
ext_static_content_title: Tytuł
|
7
|
+
ext_static_content_slug: Skrót
|
8
|
+
ext_static_content_body: Zawartość
|
9
|
+
ext_static_content_new_page: Nowa strona
|
10
|
+
ext_static_content_editing_page: Edycja strony
|
11
|
+
ext_static_content_foreign_link: Odnośnik zewnętrzny
|
12
|
+
ext_static_content_show_in_header: Pokaż w nagłówku
|
13
|
+
ext_static_content_show_in_footer: Pokaż w stopce
|
14
|
+
ext_static_content_position: Pozycja
|
15
|
+
ext_static_content_visible: Widoczna
|
16
|
+
ext_static_content_confirm_delete: Jesteś pewien ?
|
17
|
+
ext_static_content_link: Odnośnik
|
18
|
+
ext_static_content_meta_title: Tytół (w nagłówku przeglądarki)
|
19
|
+
ext_static_content_meta_keywords: Słowa kluczowe (SEO)
|
20
|
+
ext_static_content_meta_description: Skrócony opis (SEO)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
pt-BR:
|
3
|
+
pages: Páginas
|
4
|
+
ext_static_content_static_pages: Páginas estáticas
|
5
|
+
ext_static_content_static_pages_desc: Administrar página estática com editor visual (WYSIWYG).
|
6
|
+
ext_static_content_title: Título
|
7
|
+
ext_static_content_slug: Slug
|
8
|
+
ext_static_content_body: Corpo
|
9
|
+
ext_static_content_new_page: Nova página
|
10
|
+
ext_static_content_editing_page: Editando página
|
11
|
+
ext_static_content_foreign_link: Link externo (URL)
|
12
|
+
ext_static_content_show_in_header: Mostrar no cabeçalho
|
13
|
+
ext_static_content_show_in_footer: Mostrar no rodapé
|
14
|
+
ext_static_content_position: Posição
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
ru-RU:
|
3
|
+
pages: "Страницы"
|
4
|
+
ext_static_content_static_pages: "Статические страницы"
|
5
|
+
ext_static_content_static_pages_desc: "Управление статическими страницами"
|
6
|
+
ext_static_content_title: "Заголовок"
|
7
|
+
ext_static_content_slug: "Постоянная ссылка"
|
8
|
+
ext_static_content_body: "Основной текст"
|
9
|
+
ext_static_content_new_page: "Новая страница"
|
10
|
+
ext_static_content_editing_page: "Редактирование страницы"
|
11
|
+
ext_static_content_foreign_link: "Внешняя ссылка (URL)"
|
12
|
+
ext_static_content_show_in_header: "Отображать в верхнем меню"
|
13
|
+
ext_static_content_show_in_footer: "Отображать в нижнем меню"
|
14
|
+
ext_static_content_position: "Позиция в меню"
|
15
|
+
ext_static_content_visible: "Публиковать"
|
16
|
+
ext_static_content_confirm_delete: "Вы уверены, что хотите удалить страницу?"
|
17
|
+
ext_static_content_link: "Ссылка"
|
18
|
+
ext_static_content_meta_title: "Мета заголовок"
|
19
|
+
ext_static_content_meta_keywords: "Ключевые слова"
|
20
|
+
ext_static_content_meta_description: "Описание"
|
21
|
+
ext_static_content_layout: "Макет"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe ContentController do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@page = mock("page")
|
7
|
+
|
8
|
+
# Generally, prefer stub! over should_receive in setup.
|
9
|
+
@page.stub!(:slug).and_return('/test')
|
10
|
+
@page.stub!(:title).and_return('Testing 123')
|
11
|
+
@page.stub!(:body).and_return('This is a test... cooool')
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should use the catch all route to place path in path variable" do
|
15
|
+
params_from(:get, "/foobar").should == {:controller => "content", :action => "show", :path=>["foobar"]}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Page do
|
4
|
+
before(:each) do
|
5
|
+
@page = Page.create(
|
6
|
+
:title => 'test page',
|
7
|
+
:slug => 'test-page',
|
8
|
+
:body => 'this is a test page'
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be valid" do
|
13
|
+
@page.should be_valid
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should add an / to the slug" do
|
17
|
+
@page.slug.should == "/test-page"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
+
# from the project root directory.
|
3
|
+
ENV["RAILS_ENV"] ||= 'test'
|
4
|
+
require File.expand_path("#{::Rails.root}/config/environment", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'fabrication'
|
7
|
+
|
8
|
+
# Requires supporting files with custom matchers and macros, etc,
|
9
|
+
# in ./support/ and its subdirectories.
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
# == Mock Framework
|
14
|
+
#
|
15
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
16
|
+
#
|
17
|
+
# config.mock_with :mocha
|
18
|
+
# config.mock_with :flexmock
|
19
|
+
# config.mock_with :rr
|
20
|
+
config.mock_with :rspec
|
21
|
+
|
22
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
23
|
+
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, comment the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_static_content
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 30
|
8
|
+
- 0
|
9
|
+
- beta1
|
10
|
+
version: 0.30.0.beta1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Peter Berkenbosch
|
14
|
+
- Roman Smirnov
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-09-15 00:00:00 +04:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: spree_core
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 30
|
32
|
+
- 0
|
33
|
+
- beta1
|
34
|
+
version: 0.30.0.beta1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Extention to manage the static pages for your Spree shop.
|
38
|
+
email:
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files:
|
44
|
+
- README.rdoc
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- CONTRIBUTORS.textile
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- app/controllers/admin/pages_controller.rb
|
51
|
+
- app/controllers/static_content_controller.rb
|
52
|
+
- app/models/page.rb
|
53
|
+
- app/views/admin/pages/_form.html.erb
|
54
|
+
- app/views/admin/pages/edit.html.erb
|
55
|
+
- app/views/admin/pages/index.html.erb
|
56
|
+
- app/views/admin/pages/new.html.erb
|
57
|
+
- app/views/static_content/show.html.erb
|
58
|
+
- config/locales/en-GB.yml
|
59
|
+
- config/locales/es-ES.yml
|
60
|
+
- config/locales/nl-BE.yml
|
61
|
+
- config/locales/nl-NL.yml
|
62
|
+
- config/locales/pl.yml
|
63
|
+
- config/locales/pt-BR.yml
|
64
|
+
- config/locales/ru-RU.yml
|
65
|
+
- config/routes.rb
|
66
|
+
- spec/controllers/admin/pages_controller_spec.rb
|
67
|
+
- spec/controllers/content_controller_spec.rb
|
68
|
+
- spec/models/page_spec.rb
|
69
|
+
- spec/spec.opts
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
has_rdoc: true
|
72
|
+
homepage: http://github.com/spree/spree-static-content
|
73
|
+
licenses: []
|
74
|
+
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --charset=UTF-8
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
segments:
|
92
|
+
- 1
|
93
|
+
- 3
|
94
|
+
- 1
|
95
|
+
version: 1.3.1
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.6
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Extention to manage the static pages for your Spree shop.
|
103
|
+
test_files:
|
104
|
+
- spec/models/page_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
- spec/controllers/content_controller_spec.rb
|
107
|
+
- spec/controllers/admin/pages_controller_spec.rb
|