refinerycms-pages 2.1.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/refinery/admin/page_parts_controller.rb +6 -1
- data/app/controllers/refinery/admin/pages_controller.rb +53 -45
- data/app/controllers/refinery/pages/admin/preview_controller.rb +12 -3
- data/app/controllers/refinery/pages_controller.rb +12 -12
- data/app/helpers/refinery/admin/pages_helper.rb +5 -4
- data/app/helpers/refinery/pages/content_pages_helper.rb +6 -1
- data/app/models/refinery/page.rb +115 -141
- data/app/models/refinery/page_part.rb +32 -7
- data/app/presenters/refinery/pages/content_presenter.rb +7 -5
- data/app/presenters/refinery/pages/menu_presenter.rb +41 -15
- data/app/presenters/refinery/pages/page_part_section_presenter.rb +1 -7
- data/app/presenters/refinery/pages/section_presenter.rb +2 -6
- data/app/views/refinery/admin/pages/_actions.html.erb +4 -13
- data/app/views/refinery/admin/pages/_form.html.erb +7 -10
- data/app/views/refinery/admin/pages/_form_advanced_options.html.erb +5 -3
- data/app/views/refinery/admin/pages/_form_extra_fields_for_more_options.html.erb +1 -0
- data/app/views/refinery/admin/pages/_form_new_page_parts.html.erb +8 -0
- data/app/views/refinery/admin/pages/_form_page_parts.html.erb +10 -21
- data/app/views/refinery/admin/pages/_page.html.erb +31 -31
- data/app/views/refinery/admin/pages/_page_part_field.html.erb +2 -1
- data/app/views/refinery/admin/pages/_records.html.erb +3 -3
- data/app/views/refinery/admin/pages/_save_and_continue_callback.html.erb +1 -0
- data/app/views/refinery/admin/pages/index.html.erb +2 -4
- data/app/views/refinery/admin/pages_dialogs/link_to.html.erb +1 -1
- data/config/locales/bg.yml +1 -2
- data/config/locales/ca.yml +85 -0
- data/config/locales/cs.yml +13 -3
- data/config/locales/da.yml +1 -2
- data/config/locales/de.yml +0 -1
- data/config/locales/el.yml +41 -29
- data/config/locales/en.yml +2 -2
- data/config/locales/es.yml +2 -4
- data/config/locales/fi.yml +1 -4
- data/config/locales/fr.yml +2 -2
- data/config/locales/hu.yml +1 -2
- data/config/locales/it.yml +15 -16
- data/config/locales/ja.yml +1 -3
- data/config/locales/ko.yml +1 -4
- data/config/locales/lt.yml +1 -3
- data/config/locales/lv.yml +0 -2
- data/config/locales/nb.yml +1 -4
- data/config/locales/nl.yml +1 -2
- data/config/locales/pl.yml +1 -13
- data/config/locales/pt-BR.yml +1 -3
- data/config/locales/pt.yml +1 -2
- data/config/locales/rs.yml +1 -3
- data/config/locales/ru.yml +8 -5
- data/config/locales/sk.yml +1 -2
- data/config/locales/sl.yml +1 -3
- data/config/locales/sv.yml +1 -3
- data/config/locales/tr.yml +1 -2
- data/config/locales/uk.yml +1 -5
- data/config/locales/vi.yml +1 -3
- data/config/locales/zh-CN.yml +1 -4
- data/config/locales/zh-TW.yml +1 -3
- data/config/routes.rb +16 -16
- data/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +28 -11
- data/db/migrate/20140105190324_add_custom_slug_to_refinery_pages.rb +20 -0
- data/db/migrate/20150130044643_add_slug_to_refinery_page_parts.rb +6 -0
- data/db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb +13 -0
- data/db/seeds.rb +42 -36
- data/lib/generators/refinery/pages/templates/config/initializers/refinery/pages.rb.erb +12 -0
- data/lib/refinery/pages.rb +4 -3
- data/lib/refinery/pages/admin/instance_methods.rb +3 -3
- data/lib/refinery/pages/configuration.rb +7 -1
- data/lib/refinery/pages/engine.rb +19 -18
- data/lib/refinery/pages/finder.rb +179 -0
- data/lib/refinery/pages/instance_methods.rb +3 -14
- data/lib/refinery/pages/tab.rb +2 -2
- data/lib/refinery/pages/types.rb +1 -1
- data/lib/refinery/pages/url.rb +15 -3
- data/license.md +1 -1
- data/refinerycms-pages.gemspec +8 -5
- data/spec/controllers/refinery/admin/pages_controller_spec.rb +53 -0
- data/spec/controllers/refinery/pages_controller_spec.rb +1 -1
- data/spec/factories/pages.rb +1 -1
- data/spec/features/refinery/admin/pages_spec.rb +274 -290
- data/spec/features/refinery/pages_spec.rb +123 -138
- data/spec/helpers/refinery/pages/admin/pages_helper_spec.rb +15 -11
- data/spec/helpers/refinery/pages/content_pages_helper_spec.rb +11 -11
- data/spec/lib/generators/refinery/pages/pages_generator_spec.rb +1 -1
- data/spec/lib/pages_spec.rb +2 -2
- data/spec/lib/refinery/pages/tab_spec.rb +9 -9
- data/spec/lib/refinery/pages/url_spec.rb +12 -12
- data/spec/models/refinery/page_finder_spec.rb +72 -0
- data/spec/models/refinery/page_menu_spec.rb +107 -0
- data/spec/models/refinery/page_meta_data_spec.rb +49 -0
- data/spec/models/refinery/page_part_spec.rb +67 -0
- data/spec/models/refinery/page_spec.rb +16 -534
- data/spec/models/refinery/page_url_spec.rb +320 -0
- data/spec/presenters/refinery/pages/content_page_presenter_spec.rb +9 -9
- data/spec/presenters/refinery/pages/content_presenter_spec.rb +20 -20
- data/spec/presenters/refinery/pages/menu_presenter_spec.rb +44 -6
- data/spec/presenters/refinery/pages/page_part_section_presenter_spec.rb +12 -12
- data/spec/presenters/refinery/pages/section_presenter_spec.rb +22 -22
- data/spec/presenters/refinery/pages/title_section_presenter_spec.rb +4 -4
- data/spec/support/refinery/pages/caching_helpers.rb +2 -2
- metadata +55 -25
- data/app/helpers/refinery/admin/page_parts_helper.rb +0 -6
- data/app/helpers/refinery/admin/pages_dialogs_helper.rb +0 -6
- data/app/sweepers/refinery/pages/page_sweeper.rb +0 -29
- data/lib/refinery/pages/caching.rb +0 -60
- data/spec/lib/refinery/pages/caching_spec.rb +0 -90
- data/spec/support/refinery/pages/caching.rb +0 -19
@@ -1,16 +1,18 @@
|
|
1
1
|
module Refinery
|
2
2
|
class PagePart < Refinery::Core::BaseModel
|
3
3
|
|
4
|
-
attr_accessible :title, :content, :position, :body, :refinery_page_id
|
5
4
|
belongs_to :page, :foreign_key => :refinery_page_id
|
6
5
|
|
7
|
-
|
6
|
+
before_validation :set_default_slug
|
7
|
+
|
8
|
+
validates :title, :presence => true
|
9
|
+
validates :slug, :presence => true, :uniqueness => {:scope => :refinery_page_id}
|
8
10
|
alias_attribute :content, :body
|
9
11
|
|
10
|
-
translates :body
|
12
|
+
translates :body
|
11
13
|
|
12
14
|
def to_param
|
13
|
-
"page_part_#{
|
15
|
+
"page_part_#{slug.downcase.gsub(/\W/, '_')}"
|
14
16
|
end
|
15
17
|
|
16
18
|
def body=(value)
|
@@ -19,14 +21,37 @@ module Refinery
|
|
19
21
|
normalise_text_fields
|
20
22
|
end
|
21
23
|
|
22
|
-
|
24
|
+
def slug_matches?(other_slug)
|
25
|
+
slug.present? && (# protecting against the problem that occurs when have two nil slugs
|
26
|
+
slug == other_slug.to_s ||
|
27
|
+
parameterized_slug == parameterize(other_slug.to_s)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def title_matches?(other_title)
|
32
|
+
Refinery.deprecate("Refinery::PagePart#title_matches?", when: "3.1", replacement: "slug_matches?")
|
33
|
+
slug_matches?(other_title.to_s.parameterize.underscore)
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
23
37
|
|
24
|
-
protected
|
25
38
|
def normalise_text_fields
|
26
|
-
if body
|
39
|
+
if body? && body !~ %r{^<}
|
27
40
|
self.body = "<p>#{body.gsub("\r\n\r\n", "</p><p>").gsub("\r\n", "<br/>")}</p>"
|
28
41
|
end
|
29
42
|
end
|
30
43
|
|
44
|
+
private
|
45
|
+
def parameterize(string)
|
46
|
+
string.downcase.gsub(" ", "_")
|
47
|
+
end
|
48
|
+
|
49
|
+
def parameterized_slug
|
50
|
+
parameterize(slug)
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_default_slug
|
54
|
+
self.slug = title.to_s.parameterize.underscore.presence if self.slug.blank?
|
55
|
+
end
|
31
56
|
end
|
32
57
|
end
|
@@ -12,16 +12,17 @@ module Refinery
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def blank_section_css_classes(can_use_fallback = true)
|
15
|
-
@sections.reject {|section| section.has_content?(can_use_fallback)}
|
15
|
+
@sections.reject { |section| section.has_content?(can_use_fallback)}
|
16
|
+
.map(&:not_present_css_class)
|
16
17
|
end
|
17
18
|
|
18
19
|
def hide_sections(*ids_to_hide)
|
19
20
|
ids_to_hide.flatten!
|
20
|
-
@sections.select {|section| ids_to_hide.include?(section.id)}.each(&:hide) if ids_to_hide.any?
|
21
|
+
@sections.select { |section| ids_to_hide.include?(section.id)}.each(&:hide) if ids_to_hide.any?
|
21
22
|
end
|
22
23
|
|
23
24
|
def hidden_sections
|
24
|
-
@sections.select
|
25
|
+
@sections.select(&:hidden?)
|
25
26
|
end
|
26
27
|
|
27
28
|
def fetch_template_overrides
|
@@ -47,7 +48,8 @@ module Refinery
|
|
47
48
|
private
|
48
49
|
|
49
50
|
def sections_html(can_use_fallback)
|
50
|
-
@sections.map { |section| section.wrapped_html(can_use_fallback) }
|
51
|
+
@sections.map { |section| section.wrapped_html(can_use_fallback) }
|
52
|
+
.compact.join("\n").html_safe
|
51
53
|
end
|
52
54
|
|
53
55
|
def add_section_if_missing(options)
|
@@ -55,7 +57,7 @@ module Refinery
|
|
55
57
|
end
|
56
58
|
|
57
59
|
def has_section?(id)
|
58
|
-
@sections.detect {|section| section.id == id}
|
60
|
+
@sections.detect { |section| section.id == id}
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
@@ -11,15 +11,19 @@ module Refinery
|
|
11
11
|
include ActiveSupport::Configurable
|
12
12
|
|
13
13
|
config_accessor :roots, :menu_tag, :list_tag, :list_item_tag, :css, :dom_id,
|
14
|
-
:max_depth, :selected_css, :first_css, :last_css
|
14
|
+
:max_depth, :active_css, :selected_css, :first_css, :last_css, :list_tag_css,
|
15
|
+
:link_tag_css
|
15
16
|
self.dom_id = 'menu'
|
16
17
|
self.css = 'menu clearfix'
|
17
18
|
self.menu_tag = :nav
|
18
19
|
self.list_tag = :ul
|
19
20
|
self.list_item_tag = :li
|
21
|
+
self.active_css = :active
|
20
22
|
self.selected_css = :selected
|
21
23
|
self.first_css = :first
|
22
24
|
self.last_css = :last
|
25
|
+
self.list_tag_css = 'nav'
|
26
|
+
|
23
27
|
def roots
|
24
28
|
config.roots.presence || collection.roots
|
25
29
|
end
|
@@ -45,7 +49,7 @@ module Refinery
|
|
45
49
|
|
46
50
|
def render_menu_items(menu_items)
|
47
51
|
if menu_items.present?
|
48
|
-
content_tag(list_tag) do
|
52
|
+
content_tag(list_tag, :class => list_tag_css) do
|
49
53
|
menu_items.each_with_index.inject(ActiveSupport::SafeBuffer.new) do |buffer, (item, index)|
|
50
54
|
buffer << render_menu_item(item, index)
|
51
55
|
end
|
@@ -53,10 +57,14 @@ module Refinery
|
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
60
|
+
def render_menu_item_link(menu_item)
|
61
|
+
link_to(menu_item.title, context.refinery.url_for(menu_item.url), :class => link_tag_css)
|
62
|
+
end
|
63
|
+
|
56
64
|
def render_menu_item(menu_item, index)
|
57
65
|
content_tag(list_item_tag, :class => menu_item_css(menu_item, index)) do
|
58
66
|
buffer = ActiveSupport::SafeBuffer.new
|
59
|
-
buffer <<
|
67
|
+
buffer << render_menu_item_link(menu_item)
|
60
68
|
buffer << render_menu_items(menu_item_children(menu_item))
|
61
69
|
buffer
|
62
70
|
end
|
@@ -70,26 +78,20 @@ module Refinery
|
|
70
78
|
end
|
71
79
|
|
72
80
|
def selected_item_or_descendant_item_selected?(item)
|
81
|
+
Refinery.deprecate('Refinery::Pages::MenuPresenter#selected_item_or_descendant_item_selected?', when: '3.1')
|
73
82
|
selected_item?(item) || descendant_item_selected?(item)
|
74
83
|
end
|
75
84
|
|
76
85
|
# Determine whether the supplied item is the currently open item according to Refinery.
|
77
86
|
def selected_item?(item)
|
78
|
-
path = context.request.path
|
79
|
-
path = path.force_encoding('utf-8') if path.respond_to?(:force_encoding)
|
80
|
-
|
81
87
|
# Ensure we match the path without the locale, if present.
|
82
|
-
|
83
|
-
path = path.split(%r{^/#{::I18n.locale}}).last.presence || "/"
|
84
|
-
end
|
88
|
+
path = match_locale_for(encoded_path)
|
85
89
|
|
86
90
|
# First try to match against a "menu match" value, if available.
|
87
|
-
return true if item
|
91
|
+
return true if menu_match_is_available?(item, path)
|
88
92
|
|
89
93
|
# Find the first url that is a string.
|
90
|
-
url =
|
91
|
-
url << ['', item.url[:path]].compact.flatten.join('/') if item.url.respond_to?(:keys)
|
92
|
-
url = url.last.match(%r{^/#{::I18n.locale.to_s}(/.*)}) ? $1 : url.detect{|u| u.is_a?(String)}
|
94
|
+
url = find_url_for(item)
|
93
95
|
|
94
96
|
# Now use all possible vectors to try to find a valid match
|
95
97
|
[path, URI.decode(path)].include?(url) || path == "/#{item.original_id}"
|
@@ -98,7 +100,8 @@ module Refinery
|
|
98
100
|
def menu_item_css(menu_item, index)
|
99
101
|
css = []
|
100
102
|
|
101
|
-
css <<
|
103
|
+
css << active_css if descendant_item_selected?(menu_item)
|
104
|
+
css << selected_css if selected_item?(menu_item)
|
102
105
|
css << first_css if index == 0
|
103
106
|
css << last_css if index == menu_item.shown_siblings.length
|
104
107
|
|
@@ -113,6 +116,29 @@ module Refinery
|
|
113
116
|
!max_depth || menu_item.depth < max_depth
|
114
117
|
end
|
115
118
|
|
119
|
+
def encoded_path
|
120
|
+
path = context.request.path
|
121
|
+
path.force_encoding('utf-8') if path.respond_to?(:force_encoding)
|
122
|
+
path
|
123
|
+
end
|
124
|
+
|
125
|
+
def match_locale_for(path)
|
126
|
+
if %r{^/#{::I18n.locale}/} === path
|
127
|
+
path.split(%r{^/#{::I18n.locale}}).last.presence || "/"
|
128
|
+
else
|
129
|
+
path
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def menu_match_is_available?(item, path)
|
134
|
+
item.try(:menu_match).present? && path =~ Regexp.new(item.menu_match)
|
135
|
+
end
|
136
|
+
|
137
|
+
def find_url_for(item)
|
138
|
+
url = [item.url]
|
139
|
+
url << ['', item.url[:path]].compact.flatten.join('/') if item.url.respond_to?(:keys)
|
140
|
+
url.last.match(%r{^/#{::I18n.locale.to_s}(/.*)}) ? $1 : url.detect{ |u| u.is_a?(String) }
|
141
|
+
end
|
116
142
|
end
|
117
143
|
end
|
118
|
-
end
|
144
|
+
end
|
@@ -6,13 +6,7 @@ module Refinery
|
|
6
6
|
def initialize(page_part)
|
7
7
|
super()
|
8
8
|
self.fallback_html = page_part.body.html_safe if page_part.body
|
9
|
-
self.id =
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def convert_title_to_id(title)
|
15
|
-
title.to_s.gsub(/\ /, '').underscore.to_sym
|
9
|
+
self.id = page_part.slug.to_sym if page_part.slug
|
16
10
|
end
|
17
11
|
end
|
18
12
|
end
|
@@ -50,15 +50,11 @@ module Refinery
|
|
50
50
|
protected
|
51
51
|
|
52
52
|
def content_html(can_use_fallback)
|
53
|
-
|
54
|
-
override_html
|
55
|
-
else
|
56
|
-
html_from_fallback(can_use_fallback)
|
57
|
-
end
|
53
|
+
override_html.presence || html_from_fallback(can_use_fallback)
|
58
54
|
end
|
59
55
|
|
60
56
|
def html_from_fallback(can_use_fallback)
|
61
|
-
fallback_html if
|
57
|
+
fallback_html.presence if can_use_fallback
|
62
58
|
end
|
63
59
|
|
64
60
|
private
|
@@ -1,21 +1,12 @@
|
|
1
1
|
<ul>
|
2
|
+
<li><%= render '/refinery/admin/search', url: refinery.admin_pages_path -%></li>
|
2
3
|
<li>
|
3
|
-
<%=
|
4
|
-
</li>
|
5
|
-
<li>
|
6
|
-
<%= link_to t('.create_new_page'), refinery.new_admin_page_path,
|
7
|
-
:class => "add_icon" %>
|
4
|
+
<%= action_label :add, refinery.new_admin_page_path, t('.create_new_page') %>
|
8
5
|
</li>
|
9
6
|
<% if @pages.many? and !searching? %>
|
10
7
|
<li>
|
11
|
-
<%=
|
12
|
-
|
13
|
-
:class => "reorder_icon" %>
|
14
|
-
|
15
|
-
<%= link_to t('.reorder_pages_done'), refinery.admin_pages_path,
|
16
|
-
:id => "reorder_action_done",
|
17
|
-
:style => "display: none;",
|
18
|
-
:class => "reorder_icon" %>
|
8
|
+
<%= action_label :reorder, refinery.admin_pages_path, t('.reorder_pages'), id: 'reorder_action'%>
|
9
|
+
<%= action_label :reorder_done, refinery.admin_pages_path, t('.reorder_pages_done'), id: 'reorder_action_done', class: 'hidden'%>
|
19
10
|
</li>
|
20
11
|
<% end %>
|
21
12
|
</ul>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= form_for [refinery, :admin, @page],
|
2
|
-
:url => (refinery.
|
2
|
+
:url => (refinery.admin_update_page_path(@page.nested_url) if @page.persisted?) do |f| %>
|
3
3
|
|
4
4
|
<%= render '/refinery/admin/error_messages', :object => @page, :include_object_name => true %>
|
5
5
|
|
@@ -45,18 +45,15 @@
|
|
45
45
|
);
|
46
46
|
|
47
47
|
$("#preview-button").click(function(e) {
|
48
|
-
var form = $(this).parents('form');
|
49
|
-
var prev_url = form.attr('action');
|
50
|
-
var prev_target = form.attr('target');
|
51
|
-
form.attr({
|
48
|
+
var $form = $(this).parents('form');
|
49
|
+
var prev_url = $form.attr('action');
|
50
|
+
var prev_target = $form.attr('target') || '';
|
51
|
+
$form.attr({
|
52
52
|
'action': '<%= @page.persisted? ? refinery.pages_admin_preview_page_path(@page.nested_url) : refinery.pages_admin_preview_pages_path %>'
|
53
53
|
, 'target': '_blank'
|
54
54
|
});
|
55
|
-
form.submit();
|
56
|
-
form.attr({
|
57
|
-
'action': prev_url
|
58
|
-
, 'target': prev_target
|
59
|
-
});
|
55
|
+
$form.submit();
|
56
|
+
$form.attr({'action': prev_url, 'target': prev_target});
|
60
57
|
e.preventDefault();
|
61
58
|
});
|
62
59
|
});
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<div class='field'>
|
7
7
|
<span class='label_with_help'>
|
8
8
|
<%= f.label :parent_id, t('.parent_page') %>
|
9
|
-
<%= refinery_help_tag t('.parent_page_help')
|
9
|
+
<%= refinery_help_tag t('.parent_page_help')%>
|
10
10
|
</span>
|
11
11
|
<%= f.select :parent_id, parent_id_nested_set_options(@page), :include_blank => true %>
|
12
12
|
</div>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%= f.label :layout_template, t('.layout_template') %>
|
17
17
|
<%= refinery_help_tag t('.layout_template_help') %>
|
18
18
|
</span>
|
19
|
-
<%= f.select :layout_template,
|
19
|
+
<%= f.select :layout_template, valid_layout_templates,
|
20
20
|
template_options(:layout_template, @page) %>
|
21
21
|
</div>
|
22
22
|
<% end %>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<%= f.label :view_template, t('.view_template') %>
|
26
26
|
<%= refinery_help_tag t('.view_template_help') %>
|
27
27
|
</span>
|
28
|
-
<%= f.select :view_template,
|
28
|
+
<%= f.select :view_template, valid_view_templates.map { |t| [t.titleize, t] },
|
29
29
|
template_options(:view_template, @page) %>
|
30
30
|
</div>
|
31
31
|
|
@@ -78,6 +78,8 @@
|
|
78
78
|
<%= f.label :show_in_menu, t('.show_in_menu_description'),
|
79
79
|
:class => "stripped" %>
|
80
80
|
</div>
|
81
|
+
|
82
|
+
<%= render 'form_extra_fields_for_more_options', :f => f %>
|
81
83
|
</div>
|
82
84
|
|
83
85
|
<%= render 'form_advanced_options_seo', :f => f %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%# Intentionally empty, useful override point to add extra fields. %>
|
@@ -2,6 +2,10 @@
|
|
2
2
|
<div class='field'>
|
3
3
|
<label for='new_page_part_title'><%= t('.title') %></label>
|
4
4
|
<input id='new_page_part_title' value='' class='larger widest' />
|
5
|
+
|
6
|
+
<label for='new_page_part_slug'><%= t('.slug') %></label>
|
7
|
+
<input id='new_page_part_slug' value='' class='larger widest' />
|
8
|
+
|
5
9
|
<input id='new_page_part_index' type='hidden' value='<%= @page.parts.size %>' />
|
6
10
|
</div>
|
7
11
|
<%= render '/refinery/admin/form_actions', :f => f,
|
@@ -10,3 +14,7 @@
|
|
10
14
|
:cancel_button_id => "new_page_part_cancel",
|
11
15
|
:hide_delete => true %>
|
12
16
|
</div>
|
17
|
+
|
18
|
+
<% content_for :after_javascript_libraries do %>
|
19
|
+
<%= javascript_include_tag 'speakingurl' %>
|
20
|
+
<% end %>
|
@@ -1,28 +1,17 @@
|
|
1
1
|
<% if ::Refinery::Pages.new_page_parts %>
|
2
2
|
<ul id="page_parts_controls">
|
3
|
-
|
4
|
-
<%=
|
5
|
-
|
6
|
-
:title => t('.reorder_content_section') %>
|
7
|
-
<%= link_to refinery_icon_tag('tick.png'), "",
|
8
|
-
:id => 'reorder_page_part_done',
|
9
|
-
:title => t('.reorder_content_section_done'),
|
10
|
-
:style => "display: none;" %>
|
3
|
+
<li>
|
4
|
+
<%= action_icon(:reorder_h, '#', t('.reorder_content_section'), id: 'reorder_page_part' ) %>
|
5
|
+
<%= action_icon(:reorder_done, '#', t('.reorder_content_section_done'), id: 'reorder_page_part_done')%>
|
11
6
|
</li>
|
12
7
|
<li>
|
13
|
-
<%=
|
14
|
-
:id => 'add_page_part',
|
15
|
-
:title => t('.create_content_section') %>
|
16
|
-
</li>
|
8
|
+
<%= action_icon(:add, '#', t('.create_content_section'), id: 'add_page_part')%>
|
17
9
|
<li>
|
18
|
-
<%=
|
19
|
-
:title => t('.delete_content_section'),
|
20
|
-
:class => 'delete_page_part',
|
21
|
-
:name => t('.delete_content_section'),
|
22
|
-
:id => 'delete_page_part' %>
|
10
|
+
<%= action_icon(:delete_section, '#', t('.delete_content_section'), id: 'delete_page_part', class: 'delete_page_part' ) %>
|
23
11
|
</li>
|
24
12
|
</ul>
|
25
13
|
<% end %>
|
14
|
+
|
26
15
|
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
27
16
|
<ul id='page_parts'>
|
28
17
|
<% @page.parts.each_with_index do |part, part_index| %>
|
@@ -41,13 +30,13 @@
|
|
41
30
|
<% part_index = -1 %>
|
42
31
|
<%= f.fields_for :parts do |p| %>
|
43
32
|
<%= render 'page_part_field',
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
33
|
+
part: p.object,
|
34
|
+
part_index: (part_index += 1),
|
35
|
+
new_part: @page.new_record? -%>
|
47
36
|
<% end %>
|
48
37
|
<% ::Refinery::Pages.tabs_for_template(@page.view_template).each_with_index do |tab, tab_index| %>
|
49
38
|
<div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'>
|
50
|
-
<%= render tab.partial, :
|
39
|
+
<%= render tab.partial, f: f %>
|
51
40
|
</div>
|
52
41
|
<% end %>
|
53
42
|
</div>
|
@@ -1,52 +1,52 @@
|
|
1
|
-
|
1
|
+
<% # setup params for various action links
|
2
|
+
add_url = refinery.new_admin_page_path(parent_id: page.id)
|
3
|
+
edit_url = refinery.admin_edit_page_path(page.nested_url, switch_locale: (page.translations.first.locale unless page.translated_to_default_locale?))
|
4
|
+
delete_url = refinery.admin_delete_page_path(page.nested_url)
|
5
|
+
delete_options = {
|
6
|
+
class: "cancel confirm-delete",
|
7
|
+
data: {confirm: t('message', scope: 'refinery.admin.delete', title: page_title_with_translations(page))}
|
8
|
+
}
|
9
|
+
%>
|
10
|
+
|
11
|
+
<li class='clearfix record items' id="<%= dom_id(page) -%>">
|
2
12
|
<div class='clearfix'>
|
3
13
|
<% if page.children.present? %>
|
4
|
-
<span class="icon toggle <%= 'expanded' if Refinery::Pages.auto_expand_admin_tree %>"
|
14
|
+
<span class="item icon toggle <%= 'expanded' if Refinery::Pages.auto_expand_admin_tree %>"
|
15
|
+
title="<%= t('expand_collapse', scope: 'refinery.admin.pages')%>">
|
16
|
+
</span>
|
5
17
|
<% else %>
|
6
|
-
<span class="
|
18
|
+
<span class="item"></span>
|
7
19
|
<% end %>
|
8
20
|
|
9
21
|
<span class='title <%= 'toggle' if page.children.present? %>'>
|
10
22
|
<%= page_title_with_translations page %>
|
11
23
|
<%= page_meta_information page %>
|
12
24
|
</span>
|
25
|
+
|
13
26
|
<% if Refinery::I18n.frontend_locales.many? %>
|
14
27
|
<span class='locales'>
|
15
|
-
<% page.translations.sort_by{|t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
|
16
|
-
|
17
|
-
|
18
|
-
|
28
|
+
<% page.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
|
29
|
+
<% if translation.title.present? %>
|
30
|
+
<%= link_to refinery.admin_edit_page_path(page.nested_url, switch_locale: translation.locale),
|
31
|
+
class: 'locale', title: translation.locale.upcase do %>
|
32
|
+
|
33
|
+
<div class="<%=translation.locale %> locale_marker">
|
34
|
+
<%= locale_text_icon(translation.locale.upcase) %>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
19
38
|
<% end %>
|
20
39
|
</span>
|
21
40
|
<% end %>
|
22
41
|
|
23
42
|
<span class='actions'>
|
24
|
-
<%=
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
<%= link_to refinery_icon_tag('page_add.png'),
|
29
|
-
refinery.new_admin_page_path(:parent_id => page.id),
|
30
|
-
:title => t('new', :scope => 'refinery.admin.pages') %>
|
31
|
-
|
32
|
-
<%= link_to refinery_icon_tag('application_edit.png'),
|
33
|
-
refinery.edit_admin_page_path(page.nested_url, :switch_locale => (page.translations.first.locale unless page.translated_to_default_locale?)),
|
34
|
-
:title => t('edit', :scope => 'refinery.admin.pages') %>
|
35
|
-
|
36
|
-
<%= link_to refinery_icon_tag('delete.png'),
|
37
|
-
refinery.admin_page_path(page.nested_url),
|
38
|
-
:class => "cancel confirm-delete",
|
39
|
-
:title => t('delete', :scope => 'refinery.admin.pages'),
|
40
|
-
:data => {
|
41
|
-
:confirm => t('message',
|
42
|
-
:scope => 'refinery.admin.delete',
|
43
|
-
:title => page_title_with_translations(page)
|
44
|
-
)
|
45
|
-
},
|
46
|
-
:method => :delete if page.deletable? %>
|
43
|
+
<%= action_icon(:preview, page.url, t('.view_live_html')) %>
|
44
|
+
<%= action_icon(:add, add_url, t('new', scope: 'refinery.admin.pages' ) ) %>
|
45
|
+
<%= action_icon(:edit, edit_url , t('edit', scope: 'refinery.admin.pages' ) ) %>
|
46
|
+
<%= action_icon(:delete, delete_url, t('delete', scope: 'refinery.admin.pages' ), delete_options ) if page.deletable? %>
|
47
47
|
</span>
|
48
48
|
</div>
|
49
49
|
<ul class='nested' data-ajax-content="<%= refinery.admin_children_pages_path(page.nested_url) %>">
|
50
|
-
<%= render(:
|
50
|
+
<%= render(partial: 'page', collection: page.children) if Refinery::Pages.auto_expand_admin_tree %>
|
51
51
|
</ul>
|
52
52
|
</li>
|