imagine_cms 4.2.4 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/.ruby-version +1 -1
- data/Dockerfile +61 -0
- data/README.md +50 -0
- data/app/assets/javascripts/imagine_cms/core.js +4 -2
- data/app/assets/javascripts/imagine_cms/legacy/misc.js +29 -31
- data/app/controllers/cms/content_controller.rb +29 -25
- data/app/controllers/manage/application_controller.rb +4 -0
- data/app/controllers/manage/cms_controller.rb +13 -0
- data/app/controllers/{management/cms_controller.rb → manage/cms_pages_controller.rb} +625 -711
- data/app/controllers/manage/cms_snippets_controller.rb +67 -0
- data/app/controllers/manage/cms_templates_controller.rb +71 -0
- data/app/controllers/management/application_controller.rb +1 -1
- data/app/controllers/management/user_controller.rb +7 -6
- data/app/controllers/management/users_controller.rb +56 -56
- data/app/controllers/util_controller.rb +0 -1
- data/app/helpers/cms_application_helper.rb +17 -19
- data/app/mailers/imagine_cms_mailer.rb +16 -0
- data/app/models/cms_page.rb +8 -23
- data/app/models/user.rb +1 -1
- data/app/sweepers/cms_content_sweeper.rb +3 -3
- data/app/views/cms/content/_photo_gallery.html.erb +4 -4
- data/app/views/cms/content/_search_result.html.erb +1 -1
- data/app/views/imagine_cms/_header.html.erb +1 -1
- data/app/views/imagine_cms/_toolbar.html.erb +12 -12
- data/app/views/imagine_cms_mailer/request_review.text.erb +10 -0
- data/app/views/layouts/management.html.erb +29 -5
- data/app/views/manage/cms/index.html.erb +7 -0
- data/app/views/{management/cms → manage/cms_pages}/_complete_gallery.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_create_file_link.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_crop_feature_image.html.erb +20 -5
- data/app/views/{management/cms → manage/cms_pages}/_crop_image.html.erb +20 -5
- data/app/views/{management/cms → manage/cms_pages}/_crop_results.html.erb +0 -0
- data/app/views/manage/cms_pages/_crop_results_feature_image.html.erb +1 -0
- data/app/views/manage/cms_pages/_crop_results_thumb.html.erb +1 -0
- data/app/views/{management/cms → manage/cms_pages}/_crop_thumb.html.erb +20 -5
- data/app/views/{management/cms → manage/cms_pages}/_edit_page.html.erb +37 -49
- data/app/views/{management/cms → manage/cms_pages}/_gallery_index.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_gallery_setup.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_image.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_image_details.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_image_draggable.html.erb +0 -0
- data/app/views/manage/cms_pages/_list_page.html.erb +8 -0
- data/app/views/{management/cms → manage/cms_pages}/_list_page_select.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_list_pages.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_list_pages_select.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_page_attribute.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_page_list.html.erb +2 -2
- data/app/views/{management/cms → manage/cms_pages}/_page_list_source_folder.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_page_list_source_tag.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_select_gallery.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_sort_images.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_template_options.html.erb +3 -3
- data/app/views/{management/cms → manage/cms_pages}/_upload_feature_image.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_upload_file.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/_upload_image.html.erb +1 -1
- data/app/views/{management/cms → manage/cms_pages}/_upload_thumb.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/edit_page_content.html.erb +7 -0
- data/app/views/{management/cms → manage/cms_pages}/gallery_management.html.erb +1 -1
- data/app/views/{management/cms/pages.html.erb → manage/cms_pages/index.html.erb} +1 -1
- data/app/views/{management/cms/page_tags_for_lookup.html.erb → manage/cms_pages/page_tags_for_lookup.js.erb} +0 -0
- data/app/views/{management/cms → manage/cms_pages}/select_page.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/toolbar_edit.html.erb +0 -0
- data/app/views/{management/cms → manage/cms_pages}/toolbar_preview.html.erb +6 -6
- data/app/views/manage/cms_snippets/_cms_snippet.html.erb +3 -0
- data/app/views/manage/cms_snippets/edit.html.erb +25 -0
- data/app/views/{management/cms/snippets.html.erb → manage/cms_snippets/index.html.erb} +2 -2
- data/app/views/manage/cms_templates/_cms_template.html.erb +3 -0
- data/app/views/{management/cms → manage/cms_templates}/_template_reference.html.erb +2 -2
- data/app/views/manage/cms_templates/edit.html.erb +26 -0
- data/app/views/{management/cms/templates.html.erb → manage/cms_templates/index.html.erb} +2 -2
- data/app/views/management/default/index.html.erb +3 -1
- data/app/views/management/users/edit.html.erb +2 -2
- data/app/views/management/users/index.html.erb +2 -2
- data/app/views/management/users/new.html.erb +1 -1
- data/config/initializers/constants.rb +3 -0
- data/config/routes.rb +57 -10
- data/db/migrate/20121108004747_add_settings_table.rb +8 -12
- data/db/migrate/20121108005110_add_tasks_table.rb +7 -11
- data/db/migrate/20121115083748_add_logs_table.rb +13 -18
- data/db/migrate/20121115083811_add_users_tables.rb +26 -26
- data/db/migrate/20121115084028_add_cms_tables.rb +91 -90
- data/db/migrate/20140423085357_add_redirect_fields_to_cms_pages.rb +2 -2
- data/db/migrate/20140423085358_add_redirect_fields_to_cms_page_versions.rb +2 -2
- data/docker-compose.override.yml.example +43 -0
- data/docker-compose.yml +21 -0
- data/docker/conf/.my.cnf +3 -0
- data/docker/conf/my.local.cnf +14 -0
- data/docker/conf/my.prod.cnf +9 -0
- data/docker/conf/nginx-vhost.conf +14 -0
- data/docker/services/memcached.sh +3 -0
- data/docker/services/sidekiq.sh +3 -0
- data/docker/services/webpack.sh +3 -0
- data/docker/startup/101_mkdir.sh +15 -0
- data/docker/startup/201_bundler.sh +4 -0
- data/docker/startup/211_yarn.sh +4 -0
- data/imagine_cms.gemspec +12 -11
- data/lib/extensions/action_controller_extensions.rb +4 -2
- data/lib/imagine_cms/engine.rb +6 -7
- data/lib/imagine_cms/version.rb +1 -1
- data/lib/upload_progress/lib/upload_progress.rb +3 -3
- data/test/dummy/app/assets/javascripts/application.js +0 -1
- metadata +94 -74
- data/.ruby-gemset +0 -1
- data/README.rdoc +0 -98
- data/app/views/management/cms/_crop_results_feature_image.html.erb +0 -1
- data/app/views/management/cms/_crop_results_thumb.html.erb +0 -1
- data/app/views/management/cms/_list_page.html.erb +0 -8
- data/app/views/management/cms/_snippet.html.erb +0 -3
- data/app/views/management/cms/_temp.html.erb +0 -3
- data/app/views/management/cms/edit_master.html.erb +0 -48
- data/app/views/management/cms/edit_snippet.html.erb +0 -25
- data/app/views/management/cms/edit_template.html.erb +0 -25
- data/app/views/management/cms/index.html.erb +0 -7
- data/app/views/management/cms/permission_denied.html.erb +0 -1
- data/lib/hash_object.rb +0 -39
- data/lib/hash_wrapper.rb +0 -17
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class ImagineCmsMailer < ActionMailer::Base
|
|
2
|
+
|
|
3
|
+
def request_review(page_url, page_title, page_version, recipient, sender, change_description)
|
|
4
|
+
@page_url = page_url
|
|
5
|
+
@page_title = page_title
|
|
6
|
+
@page_version = page_version
|
|
7
|
+
@recipient = recipient
|
|
8
|
+
@sender = sender
|
|
9
|
+
@change_description = change_description
|
|
10
|
+
|
|
11
|
+
mail(to: recipient.email_address, reply_to: (sender.email_address.blank? ? nil : sender.email_address),
|
|
12
|
+
from: "#{sender.first_name} #{sender.last_name} <#{CmsRequestReviewEmailSender}>",
|
|
13
|
+
subject: "Request for web site update review")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
data/app/models/cms_page.rb
CHANGED
|
@@ -106,7 +106,7 @@ class CmsPage < ActiveRecord::Base
|
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
self.search_index =
|
|
109
|
+
self.search_index = ActionController::Base.helpers.strip_tags(content.gsub('><', '> <'))
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def update_index!
|
|
@@ -124,33 +124,18 @@ class CmsPage < ActiveRecord::Base
|
|
|
124
124
|
self.valid?
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
+
# pass a hash to set page attributes in bulk
|
|
128
|
+
def set_page_attributes(attrs)
|
|
129
|
+
attrs.each do |key, value|
|
|
130
|
+
objects.find_or_initialize_by(name: key, obj_type: 'attribute').update_attributes(content: value)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
127
134
|
|
|
128
135
|
def article_date_month ; article_date.strftime("%B") ; end
|
|
129
136
|
def article_date_mon ; article_date.strftime("%b") ; end
|
|
130
137
|
def article_date_day ; article_date.strftime("%d").to_i ; end
|
|
131
138
|
def article_date_year ; article_date.strftime("%Y").to_i ; end
|
|
132
139
|
def article_date_yr ; article_date.strftime("%y").to_i ; end
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
protected
|
|
136
|
-
|
|
137
|
-
def sanitize_index(html)
|
|
138
|
-
return html if html.blank?
|
|
139
|
-
if html.index("<")
|
|
140
|
-
text = ""
|
|
141
|
-
tokenizer = HTML::Tokenizer.new(html)
|
|
142
|
-
|
|
143
|
-
while token = tokenizer.next
|
|
144
|
-
node = HTML::Node.parse(nil, 0, 0, token, false)
|
|
145
|
-
# result is only the content of any Text nodes
|
|
146
|
-
text << ' ' + node.to_s if node.class == HTML::Text
|
|
147
|
-
end
|
|
148
|
-
# strip any comments, and if they have a newline at the end (ie. line with
|
|
149
|
-
# only a comment) strip that too, as well as any erb stuff
|
|
150
|
-
text.gsub(/<!--(.*?)-->[\n]?/m, "").gsub(/\<%.*?%\>/m, '').gsub(/&\w+;/, '').strip
|
|
151
|
-
else
|
|
152
|
-
html # already plain text
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
140
|
|
|
156
141
|
end
|
data/app/models/user.rb
CHANGED
|
@@ -20,7 +20,7 @@ class User < ActiveRecord::Base # :nodoc:
|
|
|
20
20
|
|
|
21
21
|
def password=(val) # :nodoc:
|
|
22
22
|
@password = val
|
|
23
|
-
self.password_hash =
|
|
23
|
+
self.password_hash = self.class.hash_password(val) unless val.blank?
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def self.hash_password(val, salt = '') # :nodoc:
|
|
@@ -10,7 +10,7 @@ class CmsContentSweeper < ActionController::Caching::Sweeper
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def delete_all_cached_pages
|
|
13
|
-
cache_dir = File.expand_path(
|
|
13
|
+
cache_dir = File.expand_path(Manage::CmsPagesController.page_cache_directory)
|
|
14
14
|
public_dir = File.expand_path("#{Rails.root}/public")
|
|
15
15
|
|
|
16
16
|
# this could throw Errno::ENOENT
|
|
@@ -46,7 +46,7 @@ class CmsContentSweeper < ActionController::Caching::Sweeper
|
|
|
46
46
|
expire_page controller: 'cms/content', action: 'show', content_path: page.path.split('/')
|
|
47
47
|
|
|
48
48
|
# then attempt to remove entire directory tree, after sanity check
|
|
49
|
-
path = File.expand_path(File.join(
|
|
49
|
+
path = File.expand_path(File.join(Manage::CmsPagesController.page_cache_directory, page.path))
|
|
50
50
|
Dir.chdir Rails.root
|
|
51
51
|
Dir.glob(Pathname.new(path).relative_path_from(Pathname.new(Rails.root)).to_s, File::FNM_CASEFOLD).each do |path|
|
|
52
52
|
path = File.realpath(File.expand_path(path, Rails.root))
|
|
@@ -62,7 +62,7 @@ class CmsContentSweeper < ActionController::Caching::Sweeper
|
|
|
62
62
|
else
|
|
63
63
|
FileUtils.rm_r(Dir.glob("#{cache_dir}/*")) rescue Errno::ENOENT
|
|
64
64
|
end
|
|
65
|
-
rescue
|
|
65
|
+
rescue StandardError => e
|
|
66
66
|
Rails.logger.error "Error while clearing cache: #{e.message}" unless e.is_a?(NoMethodError)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%-
|
|
2
2
|
timeout ||= 0
|
|
3
3
|
captions = []
|
|
4
|
-
settings =
|
|
4
|
+
settings = OpenStruct.new({})
|
|
5
5
|
path = File.join(Rails.root, 'public', 'assets', 'content', @pg.path, name)
|
|
6
6
|
|
|
7
7
|
begin
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
timeout = 6
|
|
14
14
|
|
|
15
15
|
begin
|
|
16
|
-
settings =
|
|
16
|
+
settings = OpenStruct.new(YAML.load(File.open(File.join(path, 'settings.yml')).read))
|
|
17
17
|
timeout = settings.slide_duration.to_i
|
|
18
18
|
autoplay = (settings.autoplay == 'true')
|
|
19
19
|
rescue
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<table width="100%" id="<%= name %>_image_<%= index %>" class="<%= name %>_image imagine_cms-gallery-image" border="0" cellpadding="0" cellspacing="2" style="<%= index > 0 ? 'display: none;' : '' %>">
|
|
31
31
|
<tr>
|
|
32
32
|
<td align="center" style="vertical-align:middle;">
|
|
33
|
-
<%= image_tag '
|
|
33
|
+
<%= image_tag "/#{image}?#{File.mtime(File.join(Rails.root, 'public', image)).to_i}", style: "border: 7px solid white" %>
|
|
34
34
|
</td>
|
|
35
35
|
</tr>
|
|
36
36
|
</table>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<div class="imagine_cms-gallery-thumbs">
|
|
71
71
|
<%- thumbs.each_with_index do |thumb, index| -%>
|
|
72
72
|
<div id="<%= name %>_thumb_<%= index %>" class="<%= name %>_thumb imagine_cms-gallery-thumb<%= index == 0 ? ' current' : '' %>" onmouseover="$(this).addClassName('current');" onmouseout="$(this).removeClassName('current');" onclick="changeGalleryImage('<%= name %>', <%= index %>);">
|
|
73
|
-
<%= image_tag '
|
|
73
|
+
<%= image_tag "/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}", size: '39x39', style: 'float: left;' %>
|
|
74
74
|
</div>
|
|
75
75
|
<%- end -%>
|
|
76
76
|
<br clear="all" />
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<%- for feed in [].concat(@rss_feeds || []) -%>
|
|
37
|
-
<%= auto_discovery_link_tag(:rss, { :
|
|
37
|
+
<%= auto_discovery_link_tag(:rss, { controller: '/cms/content', action: 'rss_feed', page_id: @pg.id, page_list_name: feed }, title: feed) if @pg && @pg.id %>
|
|
38
38
|
<%- end -%>
|
|
39
39
|
|
|
40
40
|
<%=raw @cms_head %>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<%- if params[:action] != 'preview_template' -%>
|
|
2
2
|
<style type="text/css">
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
#imagine_cms-toolbar { font-family: Arial; font-size: 12px; font-weight: normal; text-transform: none; line-height: 1.2; color: black; }
|
|
4
|
+
#imagine_cms-toolbar a { text-transform: none; font-weight: normal; color: black; }
|
|
5
5
|
</style>
|
|
6
|
-
<
|
|
7
|
-
<%- if [ 'content', '
|
|
8
|
-
<tr>
|
|
9
|
-
<td>
|
|
6
|
+
<div id="imagine_cms-toolbar" style="display: none;">
|
|
7
|
+
<%- if [ 'cms/content', 'manage/cms_pages' ].include?(controller.controller_path) && params[:action] != 'preview_template' -%>
|
|
10
8
|
<%- if is_editing_page? -%>
|
|
11
9
|
<div dojoType="Editor2" widgetId="main_toolbar" useActiveX="false" htmlEditing="true" focusOnLoad="false"
|
|
12
|
-
toolbarTemplatePath="<%= url_for :
|
|
10
|
+
toolbarTemplatePath="<%= url_for controller: '/manage/cms_pages', action: 'toolbar_edit', id: @pg, version: params[:version] %>"
|
|
13
11
|
toolbarTemplateCssPath="/assets/dojo/src/widget/templates/EditorToolbarFullFeature.css"
|
|
14
12
|
toolbarAlwaysVisible="true" style="height: 22px; vertical-align: middle" toolbarGroup="main">
|
|
15
13
|
</div>
|
|
16
14
|
<%- else -%>
|
|
17
15
|
<div dojoType="Editor2" widgetId="main_toolbar" useActiveX="false" htmlEditing="false" focusOnLoad="false"
|
|
18
|
-
toolbarTemplatePath="<%= url_for :
|
|
16
|
+
toolbarTemplatePath="<%= url_for controller: '/manage/cms_pages', action: 'toolbar_preview', id: @pg, version: params[:version] %>"
|
|
19
17
|
toolbarTemplateCssPath="/assets/dojo/src/widget/templates/EditorToolbarFullFeature.css"
|
|
20
18
|
toolbarAlwaysVisible="true" style="height: 25px; vertical-align: middle">
|
|
21
19
|
</div>
|
|
22
20
|
<%- end -%>
|
|
23
|
-
</td>
|
|
24
|
-
</tr>
|
|
25
21
|
<%- end -%>
|
|
26
|
-
</
|
|
27
|
-
|
|
22
|
+
</div>
|
|
23
|
+
<script type="text/javascript">
|
|
24
|
+
if (loggedIn()) {
|
|
25
|
+
document.getElementById('imagine_cms-toolbar').style.display = 'block';
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
28
|
<%- end -%>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= @sender.name %> (<%= @sender.username %>) has made a change to the web site and requests that the site administrators review and publish the change. (A copy of this request has been sent to each site administrator with a valid email address on file.)
|
|
2
|
+
|
|
3
|
+
Title: <%= @page_title %>
|
|
4
|
+
URL: <%= @page_url %>
|
|
5
|
+
Version: <%= @page_version %>
|
|
6
|
+
Description of change:
|
|
7
|
+
<%= @change_description %>
|
|
8
|
+
|
|
9
|
+
View/approve this change:
|
|
10
|
+
<%= @page_url %>/version/<%= @page_version %>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<%-
|
|
2
|
-
@nav_sections
|
|
3
|
-
@subnav_sections
|
|
2
|
+
@nav_sections ||= []
|
|
3
|
+
@subnav_sections ||= []
|
|
4
4
|
|
|
5
5
|
if is_logged_in_user?
|
|
6
6
|
if user_has_permission?(:manage_cms)
|
|
7
|
-
@nav_sections << [ 'Pages',
|
|
8
|
-
@nav_sections << [ 'Templates',
|
|
9
|
-
@nav_sections << [ 'Snippets',
|
|
7
|
+
@nav_sections << [ 'Pages', manage_cms_pages_path ]
|
|
8
|
+
@nav_sections << [ 'Templates', manage_cms_templates_path ]
|
|
9
|
+
@nav_sections << [ 'Snippets', manage_cms_snippets_path ]
|
|
10
10
|
end
|
|
11
11
|
if user_has_permission?(:manage_users)
|
|
12
12
|
@nav_sections << [ 'Users', { controller: '/management/users', action: 'index' } ]
|
|
@@ -16,6 +16,30 @@
|
|
|
16
16
|
if defined?(ImagineCmsAdditionalNavSections)
|
|
17
17
|
@nav_sections += ImagineCmsAdditionalNavSections.is_a?(Proc) ? ImagineCmsAdditionalNavSections.call(self) : ImagineCmsAdditionalNavSections
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
if defined?(ImagineCmsAdditionalSubnavSections)
|
|
21
|
+
@subnav_sections += ImagineCmsAdditionalSubnavSections.is_a?(Proc) ? ImagineCmsAdditionalSubnavSections.call(self) : ImagineCmsAdditionalSubnavSections
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# how to use a Proc to add nav sections:
|
|
26
|
+
#
|
|
27
|
+
# ImagineCmsAdditionalNavSections = Proc.new { |context|
|
|
28
|
+
# addl_sections = []
|
|
29
|
+
#
|
|
30
|
+
# context.instance_eval {
|
|
31
|
+
# if is_logged_in_user?
|
|
32
|
+
# if user_has_permission?(:manage_cms)
|
|
33
|
+
# nav_sections << [ 'Recipes', { controller: '/management/recipes', action: 'index' } ]
|
|
34
|
+
# end
|
|
35
|
+
# if user_has_permission?(:manage_members)
|
|
36
|
+
# nav_sections << [ 'Members', { controller: '/management/members', action: 'index' } ]
|
|
37
|
+
# end
|
|
38
|
+
# end
|
|
39
|
+
# }
|
|
40
|
+
#
|
|
41
|
+
# addl_sections
|
|
42
|
+
# }
|
|
19
43
|
-%>
|
|
20
44
|
<!DOCTYPE html>
|
|
21
45
|
<html>
|
|
File without changes
|
|
File without changes
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
if (cropper) cropper.remove();
|
|
8
8
|
} catch (e) {}
|
|
9
9
|
|
|
10
|
+
deselectAllPresets = function() {
|
|
11
|
+
jQuery('input[type=radio].image-size-preset').attr('checked', false);
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
onEndCrop = function (coords, dimensions) {
|
|
11
15
|
if (dimensions.width > 0 && dimensions.height > 0) {
|
|
12
16
|
var size_changed = false;
|
|
@@ -159,13 +163,24 @@ Pressing "Save Feature Image" will crop the image and set it as the new feature
|
|
|
159
163
|
</fieldset>
|
|
160
164
|
|
|
161
165
|
<fieldset style="padding: 10px 15px; text-align: center;">
|
|
162
|
-
<legend>
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
<legend>Output Image Dimensions</legend>
|
|
167
|
+
|
|
168
|
+
<%- if defined?(CmsFeatureImageCropPresets) -%>
|
|
169
|
+
<div style="text-align: left; margin-bottom: 20px;">
|
|
170
|
+
<strong>Presets:</strong><br>
|
|
171
|
+
<%- CmsFeatureImageCropPresets.each do |name, dimensions| -%>
|
|
172
|
+
<label><input type="radio" class="image-size-preset" onclick="jQuery('#image_max_width').val(<%= dimensions[0] %>); jQuery('#image_max_height').val(<%= dimensions[1] %>); lockImageSize();">
|
|
173
|
+
<%= "#{name} (#{dimensions[0]}x#{dimensions[1]})" %></label><br>
|
|
174
|
+
<%- end -%>
|
|
175
|
+
</div>
|
|
176
|
+
<%- end -%>
|
|
177
|
+
|
|
178
|
+
<%= text_field :image, :max_width, :size => 3, :value => @width, :onchange => "deselectAllPresets(); recalculateHeight();" %>
|
|
179
|
+
x <%= text_field :image, :max_height, :size => 3, :value => @height, :onchange => "deselectAllPresets(); recalculateWidth();" %>
|
|
165
180
|
<%= javascript_tag "$('image_max_width').onkeydown = disableEnterKey; $('image_max_height').onkeydown = disableEnterKey;" %>
|
|
166
181
|
|
|
167
|
-
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "lockImageSize();") %>
|
|
168
|
-
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "unlockImageSize();", :style => 'display: none;') %>
|
|
182
|
+
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "deselectAllPresets(); lockImageSize();") %>
|
|
183
|
+
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "deselectAllPresets(); unlockImageSize();", :style => 'display: none;') %>
|
|
169
184
|
|
|
170
185
|
<%= link_to_function "Apply", "resizeCropperScaled();" %> |
|
|
171
186
|
<%= link_to_function "Reset", "cropper.reset(); resize_ratio = 1.0;" %>
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
if (cropper) cropper.remove();
|
|
8
8
|
} catch (e) {}
|
|
9
9
|
|
|
10
|
+
deselectAllPresets = function() {
|
|
11
|
+
jQuery('input[type=radio].image-size-preset').attr('checked', false);
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
onEndCrop = function (coords, dimensions) {
|
|
11
15
|
if (dimensions.width > 0 && dimensions.height > 0) {
|
|
12
16
|
var size_changed = false;
|
|
@@ -159,13 +163,24 @@ Pressing "Save Image" will crop the image and insert it into the page.
|
|
|
159
163
|
</fieldset>
|
|
160
164
|
|
|
161
165
|
<fieldset style="padding: 10px 15px; text-align: center;">
|
|
162
|
-
<legend>
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
<legend>Output Image Dimensions</legend>
|
|
167
|
+
|
|
168
|
+
<%- if defined?(CmsImageCropPresets) -%>
|
|
169
|
+
<div style="text-align: left; margin-bottom: 20px;">
|
|
170
|
+
<strong>Presets:</strong><br>
|
|
171
|
+
<%- CmsImageCropPresets.each do |name, dimensions| -%>
|
|
172
|
+
<label><input type="radio" class="image-size-preset" onclick="jQuery('#image_max_width').val(<%= dimensions[0] %>); jQuery('#image_max_height').val(<%= dimensions[1] %>); lockImageSize();">
|
|
173
|
+
<%= "#{name} (#{dimensions[0]}x#{dimensions[1]})" %></label><br>
|
|
174
|
+
<%- end -%>
|
|
175
|
+
</div>
|
|
176
|
+
<%- end -%>
|
|
177
|
+
|
|
178
|
+
<%= text_field :image, :max_width, :size => 3, :value => @width, :onchange => "deselectAllPresets(); recalculateHeight();" %>
|
|
179
|
+
x <%= text_field :image, :max_height, :size => 3, :value => @height, :onchange => "deselectAllPresets(); recalculateWidth();" %>
|
|
165
180
|
<%= javascript_tag "$('image_max_width').onkeydown = disableEnterKey; $('image_max_height').onkeydown = disableEnterKey;" %>
|
|
166
181
|
|
|
167
|
-
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "lockImageSize();") %>
|
|
168
|
-
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "unlockImageSize();", :style => 'display: none;') %>
|
|
182
|
+
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "deselectAllPresets(); lockImageSize();") %>
|
|
183
|
+
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "deselectAllPresets(); unlockImageSize();", :style => 'display: none;') %>
|
|
169
184
|
|
|
170
185
|
<%= link_to_function "Apply", "resizeCropperScaled();" %> |
|
|
171
186
|
<%= link_to_function "Reset", "cropper.reset(); resize_ratio = 1.0;" %>
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= javascript_tag "jQuery('#pg_feature_image_path').val('#{page_image_path(@pg, @image_file)}'); jQuery('#feature_image_preview').css({ 'background-image': 'url(\\\'#{page_image_path(@pg, @image_file)}\\\')' }); cancelSelectThumbnail();" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= javascript_tag "jQuery('#pg_thumbnail_path').val('#{page_image_path(@pg, @image_file)}'); jQuery('#thumbnail_preview').css({ 'background-image': 'url(\\\'#{page_image_path(@pg, @image_file)}\\\')' }); cancelSelectThumbnail();" %>
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
if (cropper) cropper.remove();
|
|
8
8
|
} catch (e) {}
|
|
9
9
|
|
|
10
|
+
deselectAllPresets = function() {
|
|
11
|
+
jQuery('input[type=radio].image-size-preset').attr('checked', false);
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
onEndCrop = function (coords, dimensions) {
|
|
11
15
|
if (dimensions.width > 0 && dimensions.height > 0) {
|
|
12
16
|
var size_changed = false;
|
|
@@ -159,13 +163,24 @@ Pressing "Save Thumbnail" will crop the thumbnail and set it as the new thumbnai
|
|
|
159
163
|
</fieldset>
|
|
160
164
|
|
|
161
165
|
<fieldset style="padding: 10px 15px; text-align: center;">
|
|
162
|
-
<legend>
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
<legend>Output Image Dimensions</legend>
|
|
167
|
+
|
|
168
|
+
<%- if defined?(CmsThumbnailCropPresets) -%>
|
|
169
|
+
<div style="text-align: left; margin-bottom: 20px;">
|
|
170
|
+
<strong>Presets:</strong><br>
|
|
171
|
+
<%- CmsThumbnailCropPresets.each do |name, dimensions| -%>
|
|
172
|
+
<label><input type="radio" class="image-size-preset" onclick="jQuery('#image_max_width').val(<%= dimensions[0] %>); jQuery('#image_max_height').val(<%= dimensions[1] %>); lockImageSize();">
|
|
173
|
+
<%= "#{name} (#{dimensions[0]}x#{dimensions[1]})" %></label><br>
|
|
174
|
+
<%- end -%>
|
|
175
|
+
</div>
|
|
176
|
+
<%- end -%>
|
|
177
|
+
|
|
178
|
+
<%= text_field :image, :max_width, :size => 3, :value => @width, :onchange => "deselectAllPresets(); recalculateHeight();" %>
|
|
179
|
+
x <%= text_field :image, :max_height, :size => 3, :value => @height, :onchange => "deselectAllPresets(); recalculateWidth();" %>
|
|
165
180
|
<%= javascript_tag "$('image_max_width').onkeydown = disableEnterKey; $('image_max_height').onkeydown = disableEnterKey;" %>
|
|
166
181
|
|
|
167
|
-
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "lockImageSize();") %>
|
|
168
|
-
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "unlockImageSize();", :style => 'display: none;') %>
|
|
182
|
+
<%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "deselectAllPresets(); lockImageSize();") %>
|
|
183
|
+
<%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "deselectAllPresets(); unlockImageSize();", :style => 'display: none;') %>
|
|
169
184
|
|
|
170
185
|
<%= link_to_function "Apply", "resizeCropperScaled();" %> |
|
|
171
186
|
<%= link_to_function "Reset", "cropper.reset(); resize_ratio = 1.0;" %>
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
|
|
17
17
|
<div id="save_errors" class="error"></div>
|
|
18
18
|
|
|
19
|
-
<%= form_remote_tag :
|
|
20
|
-
:
|
|
19
|
+
<%= form_remote_tag url: { action: 'edit_page', id: @pg },
|
|
20
|
+
loading: "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';" do %>
|
|
21
21
|
<table id="dlg-page-properties">
|
|
22
22
|
<col width="120"><col width="*"><col width="5">
|
|
23
|
-
<%- if
|
|
23
|
+
<%- if @pg.id != 1 -%>
|
|
24
24
|
<tr>
|
|
25
25
|
<td>Name (for URL):</td>
|
|
26
26
|
<td>
|
|
27
|
-
<%= text_field :pg, :name, :
|
|
28
|
-
<%= text_field_tag :original_name, @pg.name, :
|
|
29
|
-
<%= text_field :pg, :parent_id, :
|
|
27
|
+
<%= text_field :pg, :name, class: 'form', style: 'margin-bottom: 0; width: 150px', onchange: (@pg.new_record? ? '' : "if (!confirm('Are you sure you want to change the name of this page? Any bookmarks or links to this page will no longer work if you proceed with this change.')) { this.value = $('original_name').value; };") %><br/>
|
|
28
|
+
<%= text_field_tag :original_name, @pg.name, style: 'display: none' %>
|
|
29
|
+
<%= text_field :pg, :parent_id, style: 'display: none' %>
|
|
30
30
|
</td>
|
|
31
31
|
</tr>
|
|
32
32
|
<%- end -%>
|
|
33
33
|
<tr>
|
|
34
34
|
<td>Page Title:</td>
|
|
35
|
-
<td><%= text_field :pg, :title, :
|
|
35
|
+
<td><%= text_field :pg, :title, class: 'form', style: 'width: 100%;' %></td>
|
|
36
36
|
</tr>
|
|
37
37
|
<%- if @pg.respond_to?(:redirect_enabled) -%>
|
|
38
38
|
<tr>
|
|
@@ -60,18 +60,11 @@
|
|
|
60
60
|
<tr class="page-field">
|
|
61
61
|
<td valign="top"><div style="margin-top: 4px;">Template:</div></td>
|
|
62
62
|
<td>
|
|
63
|
-
<%= select :pg, :cms_template_id, CmsTemplate.order(:name).map { |t| [ t.name, t.id ] }, {}, :
|
|
63
|
+
<%= select :pg, :cms_template_id, CmsTemplate.order(:name).map { |t| [ t.name, t.id ] }, {}, class: 'form', style: 'width: 100%;' %>
|
|
64
64
|
|
|
65
65
|
<div id="edit_page_template_options">
|
|
66
|
-
<%= render :
|
|
66
|
+
<%= render partial: 'template_options' %>
|
|
67
67
|
</div>
|
|
68
|
-
<script type="text/javascript">
|
|
69
|
-
jQuery('#pg_cms_template_id').change(function () {
|
|
70
|
-
jQuery.get('<%= url_for(:action => 'show_template_options', :id => @pg) %>?template_id=' + jQuery(this).val(), function (data) {
|
|
71
|
-
jQuery('#edit_page_template_options').html(data);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
</script>
|
|
75
68
|
</td>
|
|
76
69
|
</tr>
|
|
77
70
|
<tr>
|
|
@@ -80,10 +73,10 @@
|
|
|
80
73
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
81
74
|
<tr>
|
|
82
75
|
<td width="115">
|
|
83
|
-
<%= date_picker :pg, :article_date, :
|
|
76
|
+
<%= date_picker :pg, :article_date, default_value: (@pg.article_date || @pg.created_on || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 5.years.from_now %>
|
|
84
77
|
</td>
|
|
85
78
|
<td width="120">
|
|
86
|
-
<div id="div_article_end_date"<%= @pg.article_end_date && @pg.article_date != @pg.article_end_date ? '' : 'style="display: none"'.html_safe %>>– <%= date_picker :pg, :article_end_date, :
|
|
79
|
+
<div id="div_article_end_date"<%= @pg.article_end_date && @pg.article_date != @pg.article_end_date ? '' : 'style="display: none"'.html_safe %>>– <%= date_picker :pg, :article_end_date, default_value: (@pg.article_end_date || @pg.article_date || @pg.created_on || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 5.years.from_now %></div>
|
|
87
80
|
</td>
|
|
88
81
|
<td align="right" width="180">
|
|
89
82
|
<input type="checkbox" id="use_article_date_range" name="use_article_date_range" value="1" onclick="$('div_article_end_date').toggle();"<%= @pg.article_end_date && @pg.article_date != @pg.article_end_date ? ' checked="checked"' : '' %> /><label for="use_article_date_range">Use date range</label>
|
|
@@ -94,20 +87,20 @@
|
|
|
94
87
|
</tr>
|
|
95
88
|
<tr>
|
|
96
89
|
<td valign="middle">Tags:</td>
|
|
97
|
-
<td><%= text_field_tag :tags, @tags, :
|
|
90
|
+
<td><%= text_field_tag :tags, @tags, class: 'form', style: 'width: 100%' %></td>
|
|
98
91
|
</tr>
|
|
99
92
|
<tr class="page-field">
|
|
100
93
|
<td>Publish Version:</td>
|
|
101
|
-
<td><%= select :pg, :published_version, [ [ '[ None (offline) ]', -1 ], [ '[ Latest ]', 0 ] ].concat(@pg.versions.reverse.map { |pg| [ "#{pg.version} - #{ts_to_str pg.updated_on}#{" by #{pg.updated_by_username}" unless pg.updated_by_username.blank? }", pg.version ] }), {}, :
|
|
94
|
+
<td><%= select :pg, :published_version, [ [ '[ None (offline) ]', -1 ], [ '[ Latest ]', 0 ] ].concat(@pg.versions.reverse.map { |pg| [ "#{pg.version} - #{ts_to_str pg.updated_on}#{" by #{pg.updated_by_username}" unless pg.updated_by_username.blank? }", pg.version ] }), {}, class: 'form', style: 'width: 100%' %></td>
|
|
102
95
|
</tr>
|
|
103
96
|
<tr>
|
|
104
97
|
<td>Publish Date:</td>
|
|
105
98
|
<td>
|
|
106
99
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
107
100
|
<tr>
|
|
108
|
-
<td width="120"><%= date_picker :pg, :published_date, :
|
|
101
|
+
<td width="120"><%= date_picker :pg, :published_date, default_value: (@pg.published_date || @pg.created_on || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 2.years.from_now %></td>
|
|
109
102
|
<td width="60">Position:</td>
|
|
110
|
-
<td><%= text_field :pg, :position, :
|
|
103
|
+
<td><%= text_field :pg, :position, class: 'form', style: 'width: 20px' %></td>
|
|
111
104
|
</tr>
|
|
112
105
|
</table>
|
|
113
106
|
</td>
|
|
@@ -118,33 +111,27 @@
|
|
|
118
111
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
119
112
|
<tr>
|
|
120
113
|
<td width="100"><%= check_box :pg, :expires, {}, 'true', 'false' %><label>Expires on:</label></td>
|
|
121
|
-
<td width="120"><%= date_picker :pg, :expiration_date, :
|
|
114
|
+
<td width="120"><%= date_picker :pg, :expiration_date, default_value: (@pg.expiration_date || @pg.published_date || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 2.years.from_now %></td>
|
|
122
115
|
</tr>
|
|
123
116
|
</table>
|
|
124
117
|
</td>
|
|
125
118
|
</tr>
|
|
126
119
|
<tr class="page-field">
|
|
127
120
|
<td valign="top"><div style="margin-top: 4px;">Summary:</div></td>
|
|
128
|
-
<td><%= text_area :pg, :summary, :
|
|
121
|
+
<td><%= text_area :pg, :summary, class: 'form', style: 'width: 100%; height: 50px;' %></td>
|
|
129
122
|
</tr>
|
|
130
123
|
<tr>
|
|
131
|
-
<td>Thumbnail:</td>
|
|
124
|
+
<td style="vertical-align: top;">Thumbnail:</td>
|
|
132
125
|
<td>
|
|
133
126
|
<%- if @pg.new_record? -%>
|
|
134
127
|
A thumbnail cannot be added until you save this page.
|
|
135
128
|
<%- else -%>
|
|
136
|
-
<div id="thumbnail_preview" style="width:
|
|
137
|
-
<%- if @pg.thumbnail_path.blank? -%>
|
|
138
|
-
<!-- no thumbnail image selected -->
|
|
139
|
-
<%- else -%>
|
|
140
|
-
<%= image_tag(@pg.thumbnail_path, onclick: "jQuery('#pg_thumbnail_path').toggle();") %>
|
|
141
|
-
<%- end -%>
|
|
142
|
-
</div>
|
|
129
|
+
<div id="thumbnail_preview" style="width: 100%; height: 120px; background: url('<%= @pg.thumbnail_path %>') left top no-repeat; background-size: contain;" onclick="jQuery('#pg_thumbnail_path').toggle();"></div>
|
|
143
130
|
<%= button_to_function "Select Thumbnail...",
|
|
144
131
|
"selectThumbnail('#{url_for action: 'upload_thumb', id: @pg}');",
|
|
145
132
|
class: 'form_button' %>
|
|
146
133
|
<%- if @pg.thumbnail_path.present? -%>
|
|
147
|
-
<%= button_to_function "Remove", "jQuery('#thumbnail_preview
|
|
134
|
+
<%= button_to_function "Remove", "jQuery('#thumbnail_preview').css({ 'background-image': 'none' }); jQuery('#pg_thumbnail_path').val(''); jQuery(this).remove();", class: 'form_button' %>
|
|
148
135
|
<%- end -%>
|
|
149
136
|
<%= text_field :pg, :thumbnail_path, class: 'form', style: 'width: 100%; display: none;' %>
|
|
150
137
|
<%- end -%>
|
|
@@ -152,23 +139,17 @@
|
|
|
152
139
|
</tr>
|
|
153
140
|
<%- if @pg.respond_to?(:feature_image_path) -%>
|
|
154
141
|
<tr>
|
|
155
|
-
<td>Feature Image:</td>
|
|
142
|
+
<td style="vertical-align: top;">Feature Image:</td>
|
|
156
143
|
<td>
|
|
157
144
|
<%- if @pg.new_record? -%>
|
|
158
145
|
A feature image cannot be added until you save this page.
|
|
159
146
|
<%- else -%>
|
|
160
|
-
<div id="feature_image_preview" style="width:
|
|
161
|
-
<%- if @pg.feature_image_path.blank? -%>
|
|
162
|
-
<!-- no feature image selected -->
|
|
163
|
-
<%- else -%>
|
|
164
|
-
<%= image_tag(@pg.feature_image_path, onclick: "jQuery('#pg_feature_image_path').toggle();") %>
|
|
165
|
-
<%- end -%>
|
|
166
|
-
</div>
|
|
147
|
+
<div id="feature_image_preview" style="width: 100%; height: 120px; background: url('<%= @pg.feature_image_path %>') left top no-repeat; background-size: contain;" onclick="jQuery('#pg_feature_image_path').toggle();"></div>
|
|
167
148
|
<%= button_to_function "Select Feature Image...",
|
|
168
149
|
"selectThumbnail('#{url_for action: 'upload_feature_image', id: @pg}');",
|
|
169
150
|
class: 'form_button' %>
|
|
170
151
|
<%- if @pg.feature_image_path.present? -%>
|
|
171
|
-
<%= button_to_function "Remove", "jQuery('#feature_image_preview
|
|
152
|
+
<%= button_to_function "Remove", "jQuery('#feature_image_preview')..css({ 'background-image': 'none' }); jQuery('#pg_feature_image_path').val(''); jQuery(this).remove();", class: 'form_button' %>
|
|
172
153
|
<%- end -%>
|
|
173
154
|
<%= text_field :pg, :feature_image_path, class: 'form', style: 'width: 100%; display: none;' %>
|
|
174
155
|
<%- end -%>
|
|
@@ -178,7 +159,7 @@
|
|
|
178
159
|
<%- if @pg.respond_to?(:html_head) -%>
|
|
179
160
|
<tr class="page-field">
|
|
180
161
|
<td valign="top"><div style="margin-top: 4px;">HTML Head:<br>(advanced)</div></td>
|
|
181
|
-
<td><%= text_area :pg, :html_head, :
|
|
162
|
+
<td><%= text_area :pg, :html_head, class: 'form', style: 'width: 100%; height: 35px; overflow: auto;' %></td>
|
|
182
163
|
</tr>
|
|
183
164
|
<%- end -%>
|
|
184
165
|
<tr>
|
|
@@ -189,29 +170,36 @@
|
|
|
189
170
|
<td>Add an attribute: </td>
|
|
190
171
|
<td>
|
|
191
172
|
<div style="position: relative;">
|
|
192
|
-
<%= text_field_tag :custom_attribute_name, '', :
|
|
173
|
+
<%= text_field_tag :custom_attribute_name, '', class: 'form', style: 'margin-bottom: 4px;', placeholder: '[ attribute name ]' %>
|
|
193
174
|
<div id="custom_attribute_name_auto_complete" class="auto_complete" style="display: none;"></div>
|
|
194
175
|
<%= javascript_tag "$('custom_attribute_name').onkeydown = disableEnterKey; new Autocompleter.Local('custom_attribute_name', 'custom_attribute_name_auto_complete', attrlist, { frequency: 0.1, minChars: 1 });" %>
|
|
195
176
|
|
|
196
|
-
<%= button_to_function 'Add', "new Ajax.Updater('custom_attributes', '/manage/
|
|
177
|
+
<%= button_to_function 'Add', "new Ajax.Updater('custom_attributes', '#{url_for(controller: '/manage/cms_pages', action: 'page_attribute')}?name=' + $('custom_attribute_name').value, {asynchronous:true, method:'get', evalScripts:true, insertion:Insertion.Bottom}); $('custom_attribute_name').value = ''; return false;", class: 'form_button', style: 'margin-bottom: 5px;' %>
|
|
197
178
|
</div>
|
|
198
179
|
</td>
|
|
199
180
|
</tr>
|
|
200
181
|
</table>
|
|
201
182
|
<div id="custom_attributes" style="background-color: white; min-height: 40px; overflow: auto; border: 1px solid #aaaaaa">
|
|
202
|
-
<%- @page_objects.each do |key,val| -%>
|
|
183
|
+
<%- @page_objects.to_h.each do |key, val| -%>
|
|
203
184
|
<%- key =~ /^obj-(\w+?)-(.+?)$/ -%>
|
|
204
|
-
<%= render :
|
|
185
|
+
<%= render partial: 'page_attribute', locals: { name: $2 } if $1 == 'attribute' %>
|
|
205
186
|
<%- end -%>
|
|
206
187
|
</div>
|
|
207
188
|
</td>
|
|
208
189
|
<tr>
|
|
209
190
|
<td></td>
|
|
210
191
|
<td>
|
|
211
|
-
<%= submit_tag 'Save', :
|
|
212
|
-
<%= link_to_function 'Cancel', "cancelEditProperties();", :
|
|
192
|
+
<%= submit_tag 'Save', id: 'btn_save', class: 'form_button', style: 'width: 70px;' %>
|
|
193
|
+
<%= link_to_function 'Cancel', "cancelEditProperties();", style: 'font-weight: normal;' %>
|
|
213
194
|
<%= hidden_field_tag 'return_to', params[:return_to] %>
|
|
214
195
|
</td>
|
|
215
196
|
</tr>
|
|
216
197
|
</table>
|
|
217
198
|
<% end -%>
|
|
199
|
+
<<script type="text/javascript">
|
|
200
|
+
jQuery('#pg_cms_template_id').change(function () {
|
|
201
|
+
jQuery.get('<%= url_for(action: 'show_template_options', id: @pg) %>?template_id=' + jQuery(this).val(), null, function (data) {
|
|
202
|
+
jQuery('#edit_page_template_options').html(data);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
</script>
|