refinerycms-pages 1.0.11 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/refinery/admin/page_parts_controller.rb +26 -0
- data/app/controllers/refinery/admin/pages_controller.rb +77 -0
- data/app/controllers/refinery/admin/pages_dialogs_controller.rb +91 -0
- data/app/controllers/refinery/page_sweeper.rb +29 -0
- data/app/controllers/refinery/pages_controller.rb +103 -0
- data/app/helpers/refinery/pages/content_pages_helper.rb +26 -0
- data/app/helpers/refinery/pages_helper.rb +4 -0
- data/app/models/refinery/page.rb +467 -0
- data/app/models/refinery/page_part.rb +33 -0
- data/app/presenters/refinery/page_presenter.rb +7 -0
- data/app/views/admin/pages/_sortable_list.html.erb +7 -4
- data/app/views/{admin → refinery/admin}/pages/_actions.html.erb +5 -4
- data/app/views/refinery/admin/pages/_form.html.erb +63 -0
- data/app/views/{admin → refinery/admin}/pages/_form_advanced_options.html.erb +35 -16
- data/app/views/refinery/admin/pages/_form_advanced_options_seo.html.erb +3 -0
- data/app/views/{admin → refinery/admin}/pages/_form_fields_after_title.html.erb +0 -0
- data/app/views/{admin → refinery/admin}/pages/_form_new_page_parts.html.erb +5 -7
- data/app/views/{admin → refinery/admin}/pages/_form_page_parts.html.erb +19 -11
- data/app/views/{admin → refinery/admin}/pages/_locale_picker.html.erb +3 -3
- data/app/views/refinery/admin/pages/_page.html.erb +48 -0
- data/app/views/{admin → refinery/admin}/pages/_page_part_field.html.erb +1 -1
- data/app/views/refinery/admin/pages/_records.html.erb +14 -0
- data/app/views/refinery/admin/pages/_sortable_list.html.erb +4 -0
- data/app/views/refinery/admin/pages/children.html.erb +1 -0
- data/app/views/refinery/admin/pages/edit.html.erb +1 -0
- data/app/views/refinery/admin/pages/index.html.erb +9 -0
- data/app/views/refinery/admin/pages/new.html.erb +1 -0
- data/app/views/refinery/admin/pages_dialogs/_page_link.html.erb +20 -0
- data/app/views/{admin → refinery/admin}/pages_dialogs/link_to.html.erb +31 -36
- data/app/views/refinery/pages/home.html.erb +1 -0
- data/app/views/refinery/pages/show.html.erb +1 -0
- data/config/locales/bg.yml +81 -73
- data/config/locales/cs.yml +71 -72
- data/config/locales/da.yml +69 -72
- data/config/locales/de.yml +69 -72
- data/config/locales/el.yml +70 -72
- data/config/locales/en.yml +88 -73
- data/config/locales/es.yml +70 -73
- data/config/locales/fi.yml +70 -73
- data/config/locales/fr.yml +69 -72
- data/config/locales/it.yml +92 -89
- data/config/locales/ja.yml +72 -0
- data/config/locales/ko.yml +83 -0
- data/config/locales/lt.yml +71 -73
- data/config/locales/lv.yml +71 -74
- data/config/locales/nb.yml +69 -72
- data/config/locales/nl.yml +68 -71
- data/config/locales/pl.yml +70 -73
- data/config/locales/pt-BR.yml +70 -73
- data/config/locales/pt-PT.yml +75 -0
- data/config/locales/rs.yml +69 -72
- data/config/locales/ru.yml +77 -96
- data/config/locales/sk.yml +69 -72
- data/config/locales/sl.yml +68 -71
- data/config/locales/sv.yml +69 -72
- data/config/locales/vi.yml +69 -72
- data/config/locales/zh-CN.yml +75 -72
- data/config/locales/zh-TW.yml +69 -72
- data/config/routes.rb +10 -5
- data/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +49 -43
- data/db/seeds.rb +41 -0
- data/lib/generators/refinery/pages/pages_generator.rb +21 -0
- data/lib/generators/refinery/pages/templates/config/initializers/refinery/pages.rb.erb +44 -0
- data/lib/refinery/pages/admin/instance_methods.rb +10 -8
- data/lib/refinery/pages/configuration.rb +44 -0
- data/lib/refinery/pages/content_page_presenter.rb +33 -0
- data/lib/refinery/pages/content_presenter.rb +56 -0
- data/lib/refinery/pages/engine.rb +73 -0
- data/lib/refinery/pages/instance_methods.rb +12 -26
- data/lib/refinery/pages/page_part_section_presenter.rb +19 -0
- data/lib/refinery/pages/section_presenter.rb +69 -0
- data/lib/{pages/tabs.rb → refinery/pages/tab.rb} +0 -0
- data/lib/refinery/pages/title_section_presenter.rb +14 -0
- data/lib/refinery/pages/type.rb +17 -0
- data/lib/refinery/pages/types.rb +32 -0
- data/lib/refinery/pages.rb +55 -0
- data/lib/refinerycms-pages.rb +1 -61
- data/refinerycms-pages.gemspec +17 -118
- data/spec/factories/pages.rb +5 -0
- data/spec/helpers/refinery/pages/content_pages_helper_spec.rb +44 -0
- data/spec/lib/generators/refinery/pages/pages_generator_spec.rb +29 -0
- data/spec/lib/pages/content_page_presenter_spec.rb +43 -0
- data/spec/lib/pages/content_presenter_spec.rb +97 -0
- data/spec/lib/pages/page_part_section_presenter_spec.rb +35 -0
- data/spec/lib/pages/section_presenter_spec.rb +86 -0
- data/spec/lib/pages/title_section_presenter_spec.rb +21 -0
- data/spec/lib/pages_spec.rb +26 -0
- data/spec/models/refinery/page_spec.rb +415 -0
- data/spec/requests/refinery/admin/pages_spec.rb +581 -0
- data/spec/requests/refinery/pages_spec.rb +302 -0
- metadata +162 -153
- data/app/controllers/admin/page_parts_controller.rb +0 -24
- data/app/controllers/admin/pages_controller.rb +0 -68
- data/app/controllers/admin/pages_dialogs_controller.rb +0 -85
- data/app/controllers/pages_controller.rb +0 -33
- data/app/helpers/pages_helper.rb +0 -2
- data/app/models/page.rb +0 -391
- data/app/models/page_part.rb +0 -29
- data/app/presenters/page_presenter.rb +0 -7
- data/app/views/admin/pages/_form.html.erb +0 -61
- data/app/views/admin/pages/_form_advanced_options_seo.html.erb +0 -4
- data/app/views/admin/pages/_page.html.erb +0 -33
- data/app/views/admin/pages/_records.html.erb +0 -14
- data/app/views/admin/pages/edit.html.erb +0 -1
- data/app/views/admin/pages/index.html.erb +0 -11
- data/app/views/admin/pages/new.html.erb +0 -1
- data/app/views/admin/pages_dialogs/_page_link.html.erb +0 -14
- data/app/views/pages/home.html.erb +0 -1
- data/app/views/pages/show.html.erb +0 -1
- data/config/locales/jp.yml +0 -75
- data/config/locales/lolcat.yml +0 -76
- data/db/migrate/20101214040815_translate_page_plugin.rb +0 -29
- data/db/migrate/20101216194133_remove_cached_slug_from_pages.rb +0 -11
- data/db/migrate/20110307025652_translate_custom_title_on_pages.rb +0 -26
- data/db/migrate/20110314213540_remove_translated_fields_from_pages.rb +0 -13
- data/db/migrate/20110329080451_create_seo_meta.rb +0 -89
- data/db/seeds/pages.rb +0 -42
- data/features/manage_pages.feature +0 -48
- data/features/step_definitions/page_steps.rb +0 -72
- data/features/support/paths.rb +0 -28
- data/features/translate_pages.feature +0 -40
- data/features/visit_pages.feature +0 -68
- data/lib/gemspec.rb +0 -40
- data/lib/generators/refinerycms_pages_generator.rb +0 -8
- data/lib/pages/marketable_routes.rb +0 -12
- data/spec/models/page_spec.rb +0 -235
@@ -2,40 +2,26 @@ module Refinery
|
|
2
2
|
module Pages
|
3
3
|
module InstanceMethods
|
4
4
|
|
5
|
+
def self.included(base)
|
6
|
+
base.send :helper_method, :refinery_menu_pages
|
7
|
+
end
|
8
|
+
|
5
9
|
def error_404(exception=nil)
|
6
|
-
if (@page = ::Page.where(:menu_match =>
|
10
|
+
if (@page = ::Refinery::Page.where(:menu_match => "^/404$").includes(:parts).first).present?
|
7
11
|
# render the application's custom 404 page with layout and meta.
|
8
|
-
render :template => '/pages/show',
|
9
|
-
|
10
|
-
:status => 404
|
12
|
+
render :template => '/refinery/pages/show', :formats => [:html], :status => 404
|
13
|
+
return false
|
11
14
|
else
|
12
15
|
super
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
16
|
-
|
17
|
-
def
|
18
|
-
|
19
|
-
# We need to join to the page's slug to avoid multiple queries.
|
20
|
-
pages = ::Page.live.in_menu.includes(:slug).order('lft ASC')
|
21
|
-
|
22
|
-
# Now we only want to select particular columns to avoid any further queries.
|
23
|
-
# Title is retrieved in the next block below so it's not here.
|
24
|
-
%w(id depth parent_id lft rgt link_url menu_match).each do |column|
|
25
|
-
pages = pages.select(::Page.arel_table[column.to_sym])
|
26
|
-
end
|
27
|
-
|
28
|
-
# If we have translations then we get the title from that table.
|
29
|
-
if ::Page.respond_to?(:translation_class)
|
30
|
-
pages = pages.joins(:translations).select("#{::Page.translation_class.table_name}.title as page_title")
|
31
|
-
else
|
32
|
-
pages = pages.select('title as page_title')
|
33
|
-
end
|
34
|
-
|
35
|
-
# Compile the menu
|
36
|
-
@menu_pages = ::Refinery::Menu.new(pages)
|
19
|
+
# Compiles the default menu.
|
20
|
+
def refinery_menu_pages
|
21
|
+
::Refinery::Menu.new(::Refinery::Page.fast_menu)
|
37
22
|
end
|
38
23
|
|
24
|
+
protected
|
39
25
|
def render(*args)
|
40
26
|
present(@page) unless admin? or @meta.present?
|
41
27
|
super
|
@@ -45,7 +31,7 @@ module Refinery
|
|
45
31
|
def store_current_location!
|
46
32
|
return super if admin?
|
47
33
|
|
48
|
-
session[:website_return_to] = url_for(@page.url) if @page.
|
34
|
+
session[:website_return_to] = refinery.url_for(@page.url) if @page && @page.persisted?
|
49
35
|
end
|
50
36
|
|
51
37
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Pages
|
3
|
+
# A type of SectionPresenter which knows how to render a section which displays
|
4
|
+
# a PagePart model.
|
5
|
+
class PagePartSectionPresenter < SectionPresenter
|
6
|
+
def initialize(page_part)
|
7
|
+
super()
|
8
|
+
self.fallback_html = page_part.body.html_safe if page_part.body
|
9
|
+
self.id = convert_title_to_id(page_part.title) if page_part.title
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def convert_title_to_id(title)
|
15
|
+
title.to_s.gsub(/\ /, '').underscore.to_sym
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Pages
|
3
|
+
# Knows how to build the html for a section. A section is part of the visible html, that has
|
4
|
+
# content wrapped in some particular markup. Construct with the relevant options, and then
|
5
|
+
# call wrapped_html to get the resultant html.
|
6
|
+
#
|
7
|
+
# The content rendered will usually be the value of fallback_html, unless an override_html
|
8
|
+
# is specified. However, on rendering, you can elect not display sections that have no
|
9
|
+
# override_html by passing in false for can_use_fallback.
|
10
|
+
#
|
11
|
+
# Sections may be hidden, in which case they wont display at all.
|
12
|
+
class SectionPresenter
|
13
|
+
include ActionView::Helpers::TagHelper
|
14
|
+
|
15
|
+
def initialize(initial_hash = {})
|
16
|
+
initial_hash.map do |key, value|
|
17
|
+
send("#{key}=", value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :id, :fallback_html, :hidden
|
22
|
+
alias_method :hidden?, :hidden
|
23
|
+
attr_accessor :override_html
|
24
|
+
|
25
|
+
def visible?
|
26
|
+
!hidden?
|
27
|
+
end
|
28
|
+
|
29
|
+
def has_content?(can_use_fallback = true)
|
30
|
+
visible? && content_html(can_use_fallback).present?
|
31
|
+
end
|
32
|
+
|
33
|
+
def wrapped_html(can_use_fallback = true)
|
34
|
+
return if hidden?
|
35
|
+
|
36
|
+
content = content_html(can_use_fallback)
|
37
|
+
if content.present?
|
38
|
+
wrap_content_in_tag(content)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def hide
|
43
|
+
self.hidden = true
|
44
|
+
end
|
45
|
+
|
46
|
+
def not_present_css_class
|
47
|
+
"no_#{id}"
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
def content_html(can_use_fallback)
|
53
|
+
override_html.present? ? override_html : html_from_fallback(can_use_fallback)
|
54
|
+
end
|
55
|
+
|
56
|
+
def html_from_fallback(can_use_fallback)
|
57
|
+
fallback_html if fallback_html.present? && can_use_fallback
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
attr_writer :id, :fallback_html, :hidden
|
63
|
+
|
64
|
+
def wrap_content_in_tag(content)
|
65
|
+
content_tag(:section, content_tag(:div, content, :class => 'inner'), :id => id)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Pages
|
3
|
+
# A type of SectionPresenter which knows how to render a section which displays
|
4
|
+
# a title. These are much like normal sections except they are wrapped in
|
5
|
+
# a h1 tag rather than a div.
|
6
|
+
class TitleSectionPresenter < SectionPresenter
|
7
|
+
private
|
8
|
+
|
9
|
+
def wrap_content_in_tag(content)
|
10
|
+
content_tag(:h1, content, :id => id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Pages
|
3
|
+
class Types < Array
|
4
|
+
|
5
|
+
def register(name, &block)
|
6
|
+
self.class.register(name, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def find_by_name(name)
|
10
|
+
detect {|type| type.name.to_s.downcase == name.to_s.downcase}
|
11
|
+
end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def register(name, &block)
|
15
|
+
type = Type.new
|
16
|
+
type.name = name
|
17
|
+
|
18
|
+
yield type if block_given?
|
19
|
+
|
20
|
+
raise "A page type must have a name: #{self.inspect}" if type.name.blank?
|
21
|
+
|
22
|
+
registered << type
|
23
|
+
end
|
24
|
+
|
25
|
+
def registered
|
26
|
+
@registered_types ||= new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'refinerycms-core'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
autoload :PagesGenerator, 'generators/refinery/pages/pages_generator'
|
5
|
+
|
6
|
+
module Pages
|
7
|
+
require 'refinery/pages/engine'
|
8
|
+
require 'refinery/pages/tab'
|
9
|
+
require 'refinery/pages/type'
|
10
|
+
require 'refinery/pages/types'
|
11
|
+
|
12
|
+
# Load configuration last so that everything above is available to it.
|
13
|
+
require 'refinery/pages/configuration'
|
14
|
+
|
15
|
+
autoload :InstanceMethods, 'refinery/pages/instance_methods'
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def root
|
19
|
+
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
|
20
|
+
end
|
21
|
+
|
22
|
+
def factory_paths
|
23
|
+
@factory_paths ||= [ root.join('spec', 'factories').to_s ]
|
24
|
+
end
|
25
|
+
|
26
|
+
def valid_templates(*pattern)
|
27
|
+
[Rails.root, Refinery::Plugins.registered.pathnames].flatten.uniq.map { |p|
|
28
|
+
p.join(*pattern)
|
29
|
+
}.map(&:to_s).map { |p|
|
30
|
+
Dir[p]
|
31
|
+
}.select(&:any?).flatten.map { |f|
|
32
|
+
File.basename(f)
|
33
|
+
}.map { |p|
|
34
|
+
p.split('.').first
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def default_parts_for(page)
|
39
|
+
return default_parts unless page.view_template.present?
|
40
|
+
|
41
|
+
types.find_by_name(page.view_template).parts.map &:titleize
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module Admin
|
46
|
+
autoload :InstanceMethods, 'refinery/pages/admin/instance_methods'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
require 'awesome_nested_set'
|
52
|
+
require 'globalize3'
|
53
|
+
require 'friendly_id'
|
54
|
+
require 'seo_meta'
|
55
|
+
require 'babosa'
|
data/lib/refinerycms-pages.rb
CHANGED
@@ -1,61 +1 @@
|
|
1
|
-
require '
|
2
|
-
require 'awesome_nested_set'
|
3
|
-
require 'globalize3'
|
4
|
-
require 'friendly_id'
|
5
|
-
require 'seo_meta'
|
6
|
-
|
7
|
-
module Refinery
|
8
|
-
module Pages
|
9
|
-
|
10
|
-
autoload :InstanceMethods, File.expand_path('../refinery/pages/instance_methods', __FILE__)
|
11
|
-
module Admin
|
12
|
-
autoload :InstanceMethods, File.expand_path('../refinery/pages/admin/instance_methods', __FILE__)
|
13
|
-
end
|
14
|
-
|
15
|
-
class << self
|
16
|
-
attr_accessor :root
|
17
|
-
def root
|
18
|
-
@root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Engine < ::Rails::Engine
|
23
|
-
initializer 'serve static assets' do |app|
|
24
|
-
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
25
|
-
end
|
26
|
-
|
27
|
-
config.to_prepare do
|
28
|
-
require File.expand_path('../pages/tabs', __FILE__)
|
29
|
-
end
|
30
|
-
|
31
|
-
refinery.after_inclusion do
|
32
|
-
::ApplicationController.send :include, ::Refinery::Pages::InstanceMethods
|
33
|
-
::Admin::BaseController.send :include, ::Refinery::Pages::Admin::InstanceMethods
|
34
|
-
end
|
35
|
-
|
36
|
-
config.after_initialize do
|
37
|
-
::Refinery::Plugin.register do |plugin|
|
38
|
-
plugin.pathname = root
|
39
|
-
plugin.name = 'refinery_pages'
|
40
|
-
plugin.directory = 'pages'
|
41
|
-
plugin.version = %q{1.0.0}
|
42
|
-
plugin.menu_match = /(refinery|admin)\/page(_part)?s(_dialogs)?$/
|
43
|
-
plugin.activity = {
|
44
|
-
:class => Page,
|
45
|
-
:url_prefix => 'edit',
|
46
|
-
:title => 'title',
|
47
|
-
:created_image => 'page_add.png',
|
48
|
-
:updated_image => 'page_edit.png'
|
49
|
-
}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
initializer 'add marketable routes' do |app|
|
54
|
-
app.routes_reloader.paths << File.expand_path('../pages/marketable_routes.rb', __FILE__)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
::Refinery.engines << 'pages'
|
1
|
+
require 'refinery/pages'
|
data/refinerycms-pages.gemspec
CHANGED
@@ -1,130 +1,29 @@
|
|
1
1
|
# Encoding: UTF-8
|
2
|
-
|
2
|
+
$:.push File.expand_path('../../core/lib', __FILE__)
|
3
|
+
require 'refinery/version'
|
4
|
+
|
5
|
+
version = Refinery::Version.to_s
|
3
6
|
|
4
7
|
Gem::Specification.new do |s|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
5
9
|
s.name = %q{refinerycms-pages}
|
6
|
-
s.version =
|
7
|
-
s.summary = %q{Pages
|
8
|
-
s.description = %q{The default content
|
9
|
-
s.date = %q{
|
10
|
+
s.version = version
|
11
|
+
s.summary = %q{Pages extension for Refinery CMS}
|
12
|
+
s.description = %q{The default content extension of Refinery CMS. This extension handles the administration and display of user-editable pages.}
|
13
|
+
s.date = %q{2011-10-12}
|
10
14
|
s.email = %q{info@refinerycms.com}
|
11
15
|
s.homepage = %q{http://refinerycms.com}
|
12
16
|
s.rubyforge_project = %q{refinerycms}
|
13
|
-
s.authors = ['
|
17
|
+
s.authors = ['Philip Arndt', 'Uģis Ozols', 'David Jones', 'Steven Heidel']
|
14
18
|
s.license = %q{MIT}
|
15
19
|
s.require_paths = %w(lib)
|
16
|
-
s.executables = %w()
|
17
20
|
|
18
|
-
s.files =
|
19
|
-
|
20
|
-
|
21
|
-
'app/controllers/admin',
|
22
|
-
'app/controllers/admin/page_parts_controller.rb',
|
23
|
-
'app/controllers/admin/pages_controller.rb',
|
24
|
-
'app/controllers/admin/pages_dialogs_controller.rb',
|
25
|
-
'app/controllers/pages_controller.rb',
|
26
|
-
'app/helpers',
|
27
|
-
'app/helpers/pages_helper.rb',
|
28
|
-
'app/models',
|
29
|
-
'app/models/page.rb',
|
30
|
-
'app/models/page_part.rb',
|
31
|
-
'app/presenters',
|
32
|
-
'app/presenters/page_presenter.rb',
|
33
|
-
'app/views',
|
34
|
-
'app/views/admin',
|
35
|
-
'app/views/admin/pages',
|
36
|
-
'app/views/admin/pages/_actions.html.erb',
|
37
|
-
'app/views/admin/pages/_form.html.erb',
|
38
|
-
'app/views/admin/pages/_form_advanced_options.html.erb',
|
39
|
-
'app/views/admin/pages/_form_advanced_options_seo.html.erb',
|
40
|
-
'app/views/admin/pages/_form_fields_after_title.html.erb',
|
41
|
-
'app/views/admin/pages/_form_new_page_parts.html.erb',
|
42
|
-
'app/views/admin/pages/_form_page_parts.html.erb',
|
43
|
-
'app/views/admin/pages/_locale_picker.html.erb',
|
44
|
-
'app/views/admin/pages/_page.html.erb',
|
45
|
-
'app/views/admin/pages/_page_part_field.html.erb',
|
46
|
-
'app/views/admin/pages/_records.html.erb',
|
47
|
-
'app/views/admin/pages/_sortable_list.html.erb',
|
48
|
-
'app/views/admin/pages/edit.html.erb',
|
49
|
-
'app/views/admin/pages/index.html.erb',
|
50
|
-
'app/views/admin/pages/new.html.erb',
|
51
|
-
'app/views/admin/pages_dialogs',
|
52
|
-
'app/views/admin/pages_dialogs/_page_link.html.erb',
|
53
|
-
'app/views/admin/pages_dialogs/link_to.html.erb',
|
54
|
-
'app/views/pages',
|
55
|
-
'app/views/pages/home.html.erb',
|
56
|
-
'app/views/pages/show.html.erb',
|
57
|
-
'config',
|
58
|
-
'config/locales',
|
59
|
-
'config/locales/bg.yml',
|
60
|
-
'config/locales/cs.yml',
|
61
|
-
'config/locales/da.yml',
|
62
|
-
'config/locales/de.yml',
|
63
|
-
'config/locales/el.yml',
|
64
|
-
'config/locales/en.yml',
|
65
|
-
'config/locales/es.yml',
|
66
|
-
'config/locales/fi.yml',
|
67
|
-
'config/locales/fr.yml',
|
68
|
-
'config/locales/it.yml',
|
69
|
-
'config/locales/jp.yml',
|
70
|
-
'config/locales/lolcat.yml',
|
71
|
-
'config/locales/lt.yml',
|
72
|
-
'config/locales/lv.yml',
|
73
|
-
'config/locales/nb.yml',
|
74
|
-
'config/locales/nl.yml',
|
75
|
-
'config/locales/pl.yml',
|
76
|
-
'config/locales/pt-BR.yml',
|
77
|
-
'config/locales/rs.yml',
|
78
|
-
'config/locales/ru.yml',
|
79
|
-
'config/locales/sk.yml',
|
80
|
-
'config/locales/sl.yml',
|
81
|
-
'config/locales/sv.yml',
|
82
|
-
'config/locales/vi.yml',
|
83
|
-
'config/locales/zh-CN.yml',
|
84
|
-
'config/locales/zh-TW.yml',
|
85
|
-
'config/routes.rb',
|
86
|
-
'db',
|
87
|
-
'db/migrate',
|
88
|
-
'db/migrate/20100913234708_create_refinerycms_pages_schema.rb',
|
89
|
-
'db/migrate/20101214040815_translate_page_plugin.rb',
|
90
|
-
'db/migrate/20101216194133_remove_cached_slug_from_pages.rb',
|
91
|
-
'db/migrate/20110307025652_translate_custom_title_on_pages.rb',
|
92
|
-
'db/migrate/20110314213540_remove_translated_fields_from_pages.rb',
|
93
|
-
'db/migrate/20110329080451_create_seo_meta.rb',
|
94
|
-
'db/seeds',
|
95
|
-
'db/seeds/pages.rb',
|
96
|
-
'features',
|
97
|
-
'features/manage_pages.feature',
|
98
|
-
'features/step_definitions',
|
99
|
-
'features/step_definitions/page_steps.rb',
|
100
|
-
'features/support',
|
101
|
-
'features/support/paths.rb',
|
102
|
-
'features/translate_pages.feature',
|
103
|
-
'features/visit_pages.feature',
|
104
|
-
'lib',
|
105
|
-
'lib/gemspec.rb',
|
106
|
-
'lib/generators',
|
107
|
-
'lib/generators/refinerycms_pages_generator.rb',
|
108
|
-
'lib/pages',
|
109
|
-
'lib/pages/marketable_routes.rb',
|
110
|
-
'lib/pages/tabs.rb',
|
111
|
-
'lib/refinery',
|
112
|
-
'lib/refinery/pages',
|
113
|
-
'lib/refinery/pages/admin',
|
114
|
-
'lib/refinery/pages/admin/instance_methods.rb',
|
115
|
-
'lib/refinery/pages/instance_methods.rb',
|
116
|
-
'lib/refinerycms-pages.rb',
|
117
|
-
'license.md',
|
118
|
-
'refinerycms-pages.gemspec',
|
119
|
-
'spec',
|
120
|
-
'spec/models',
|
121
|
-
'spec/models/page_spec.rb'
|
122
|
-
]
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
123
24
|
|
124
|
-
s.add_dependency '
|
125
|
-
s.add_dependency '
|
126
|
-
s.add_dependency '
|
127
|
-
s.add_dependency '
|
128
|
-
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
129
|
-
s.add_dependency 'seo_meta', '~> 1.1'
|
25
|
+
s.add_dependency 'awesome_nested_set', '~> 2.1.0'
|
26
|
+
s.add_dependency 'seo_meta', '~> 1.2.0'
|
27
|
+
s.add_dependency 'refinerycms-core', version
|
28
|
+
s.add_dependency 'babosa', '!= 0.3.6'
|
130
29
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe ContentPagesHelper do
|
6
|
+
let(:content_presenter) { double(ContentPresenter, :hide_sections => nil, :fetch_template_overrides => nil, :to_html => nil) }
|
7
|
+
|
8
|
+
describe "when rendering content presenter" do
|
9
|
+
it "asks to content presenter to hide sections if told to" do
|
10
|
+
content_presenter.should_receive(:hide_sections).with(['foo', 'bar'])
|
11
|
+
render_content_presenter(content_presenter, :hide_sections => ['foo', 'bar'])
|
12
|
+
end
|
13
|
+
|
14
|
+
it "attempts to fetch template overrides declared elsewhere via content_for" do
|
15
|
+
content_presenter.should_receive(:fetch_template_overrides).and_yield(12)
|
16
|
+
self.should_receive(:content_for).with(12)
|
17
|
+
render_content_presenter(content_presenter)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "outputs the html rendered by the content presenter" do
|
21
|
+
content_presenter.should_receive(:to_html).and_return('foobar')
|
22
|
+
render_content_presenter(content_presenter).should == 'foobar'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "passes can_use_fallback option through to html rendering" do
|
26
|
+
content_presenter.should_receive(:to_html).with(true)
|
27
|
+
render_content_presenter(content_presenter, :can_use_fallback => true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "when rendering page" do
|
32
|
+
let(:page) { double(Page) }
|
33
|
+
|
34
|
+
it "builds a content page presenter and returns its html" do
|
35
|
+
self.should_receive(:page_title).and_return('some title')
|
36
|
+
Refinery::Pages::ContentPagePresenter.should_receive(:new).with(page, 'some title').and_return(content_presenter)
|
37
|
+
content_presenter.should_receive(:to_html).and_return('barfoo')
|
38
|
+
|
39
|
+
render_content_page(page).should == 'barfoo'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generator_spec/test_case'
|
3
|
+
require 'generators/refinery/pages/pages_generator'
|
4
|
+
|
5
|
+
module Refinery
|
6
|
+
describe PagesGenerator do
|
7
|
+
include GeneratorSpec::TestCase
|
8
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
prepare_destination
|
12
|
+
run_generator
|
13
|
+
end
|
14
|
+
|
15
|
+
specify do
|
16
|
+
destination_root.should have_structure {
|
17
|
+
directory "config" do
|
18
|
+
directory "initializers" do
|
19
|
+
directory "refinery" do
|
20
|
+
file "pages.rb" do
|
21
|
+
contains "Refinery::Pages.configure"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe ContentPagePresenter do
|
6
|
+
let(:part) { double(PagePart, :body => 'part_body', :title => 'A Wonderful Page Part') }
|
7
|
+
let(:part2) { double(PagePart, :body => 'part_body2', :title => 'Another Wonderful Page Part') }
|
8
|
+
let(:title) { 'This Great Page' }
|
9
|
+
|
10
|
+
describe "when building for page" do
|
11
|
+
let(:page_with_one_part) { double(Page, :parts => [part]) }
|
12
|
+
|
13
|
+
it "adds page title section before page parts" do
|
14
|
+
content = ContentPagePresenter.new(page_with_one_part, title)
|
15
|
+
content.get_section(0).fallback_html.should == title
|
16
|
+
end
|
17
|
+
|
18
|
+
it "adds a section for each page part" do
|
19
|
+
page = double(Page, :parts => [part, part2])
|
20
|
+
content = ContentPagePresenter.new(page, title)
|
21
|
+
content.get_section(1).fallback_html.should == 'part_body'
|
22
|
+
content.get_section(2).fallback_html.should == 'part_body2'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "adds body content left and right after page parts" do
|
26
|
+
content = ContentPagePresenter.new(page_with_one_part, title)
|
27
|
+
content.get_section(2).id.should == :body_content_left
|
28
|
+
content.get_section(3).id.should == :body_content_right
|
29
|
+
end
|
30
|
+
|
31
|
+
it "doesnt add page parts if page is nil" do
|
32
|
+
content = ContentPagePresenter.new(nil, title)
|
33
|
+
content.get_section(1).id.should == :body_content_left
|
34
|
+
end
|
35
|
+
|
36
|
+
it "doesnt add title if it is blank" do
|
37
|
+
content = ContentPagePresenter.new(nil, '')
|
38
|
+
content.get_section(0).id.should == :body_content_left
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|