imagine_cms 3.0.31 → 3.0.32
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 +4 -4
- data/.ruby-version +1 -1
- data/app/assets/javascripts/imagine_cms.js +1402 -0
- data/app/controllers/cms/content_controller.rb +6 -1
- data/app/controllers/management/cms_controller.rb +1 -0
- data/app/helpers/cms_application_helper.rb +1 -1
- data/app/models/cms_page.rb +3 -2
- data/app/views/management/cms/_edit_page.html.erb +43 -17
- data/app/views/management/cms/_template_options.html.erb +22 -26
- data/db/migrate/20140423085357_add_redirect_fields_to_cms_pages.rb +6 -0
- data/lib/extensions/action_controller.rb +2 -1
- data/lib/imagine_cms/version.rb +1 -1
- metadata +4 -2
|
@@ -157,6 +157,11 @@ module Cms # :nodoc:
|
|
|
157
157
|
end
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
+
# redirect if redirect enabled
|
|
161
|
+
if @pg.redirect_enabled
|
|
162
|
+
redirect_to @pg.redirect_to and return true
|
|
163
|
+
end
|
|
164
|
+
|
|
160
165
|
# load appropriate page version and associated objects
|
|
161
166
|
# if we had to authenticate, load_page_objects = false, but return true so we don't call not_found
|
|
162
167
|
load_page_objects or return true
|
|
@@ -187,7 +192,7 @@ module Cms # :nodoc:
|
|
|
187
192
|
|
|
188
193
|
render :inline => template_content
|
|
189
194
|
|
|
190
|
-
if
|
|
195
|
+
if UseCmsPageCaching && @allow_caching && perform_caching && request.format == Mime::HTML
|
|
191
196
|
cache_page
|
|
192
197
|
end
|
|
193
198
|
|
|
@@ -205,6 +205,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
|
205
205
|
end
|
|
206
206
|
@pg.updated_by ||= session[:user_id]
|
|
207
207
|
@pg.updated_by_username ||= session[:user_username]
|
|
208
|
+
@pg.published_version = 0 if @pg.redirect_enabled
|
|
208
209
|
|
|
209
210
|
save_function = @pg.new_record? ? 'save' : 'save_without_revision'
|
|
210
211
|
|
|
@@ -864,7 +864,7 @@ module CmsApplicationHelper
|
|
|
864
864
|
"'&method_prefix=#{method_prefix}', {method:'get', asynchronous:true, evalScripts:true})"
|
|
865
865
|
|
|
866
866
|
ret = <<EOF
|
|
867
|
-
<span><a href="#" onclick="showDatePicker('#{object}', '#{method_prefix}'); return false;"><span id="date_picker_#{object}_#{method_prefix}_value">#{default_value.strftime('%a %m/%d/%y')}</span></a></span>
|
|
867
|
+
<span><a href="#" onclick="showDatePicker('#{object}', '#{method_prefix}'); return false;"><span id="date_picker_#{object}_#{method_prefix}_value" style="font-weight: normal;">#{default_value.strftime('%a %m/%d/%y')}</span></a></span>
|
|
868
868
|
<span id="date_picker_#{object}_#{method_prefix}icon"><a href="#" onclick="showDatePicker('#{object}', '#{method_prefix}'); return false;"><img src="/assets/management/icon_time.gif" style="float: none" alt="date picker" /></a></span>
|
|
869
869
|
<div id="date_picker_#{object}_#{method_prefix}main" style="display: none; background-color: white; border: 1px solid gray; padding: 3px; z-index: 101;" class="date-picker-main">
|
|
870
870
|
<table width="190">
|
data/app/models/cms_page.rb
CHANGED
|
@@ -6,7 +6,8 @@ class CmsPage < ActiveRecord::Base
|
|
|
6
6
|
:name, :title, :path, :html_head, :summary, :position,
|
|
7
7
|
:article_date, :article_end_date, :published_date, :expiration_date, :expires,
|
|
8
8
|
:thumbnail_path, :feature_image_path, :comment_count, :version, :published_version,
|
|
9
|
-
:search_index, :updated_by, :updated_by_username
|
|
9
|
+
:search_index, :updated_by, :updated_by_username,
|
|
10
|
+
:redirect_enabled, :redirect_to
|
|
10
11
|
|
|
11
12
|
acts_as_versioned
|
|
12
13
|
acts_as_tree :order => 'path'
|
|
@@ -135,4 +136,4 @@ class CmsPage < ActiveRecord::Base
|
|
|
135
136
|
html # already plain text
|
|
136
137
|
end
|
|
137
138
|
end
|
|
138
|
-
end
|
|
139
|
+
end
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
<%= form_remote_tag :url => { :action => 'edit_page', :id => @pg },
|
|
12
12
|
:loading => "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';",
|
|
13
13
|
:html => { :onsubmit => 'teardownTextFieldHints();' } do %>
|
|
14
|
-
<table>
|
|
14
|
+
<table id="dlg-page-properties">
|
|
15
15
|
<col width="120"><col width="*"><col width="5">
|
|
16
16
|
<%- if (@pg.id || 2) > 1 -%>
|
|
17
17
|
<tr>
|
|
18
|
-
<td>Name
|
|
18
|
+
<td>Name (for URL):</td>
|
|
19
19
|
<td>
|
|
20
20
|
<%= 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/>
|
|
21
21
|
<%= text_field_tag :original_name, @pg.name, :style => 'display: none' %>
|
|
@@ -24,36 +24,62 @@
|
|
|
24
24
|
</tr>
|
|
25
25
|
<%- end -%>
|
|
26
26
|
<tr>
|
|
27
|
-
<td>Title:</td>
|
|
27
|
+
<td>Page Title:</td>
|
|
28
28
|
<td><%= text_field :pg, :title, :class => 'form', :style => 'width: 100%;' %></td>
|
|
29
29
|
</tr>
|
|
30
|
+
<%- if @pg.respond_to?(:redirect_enabled) -%>
|
|
30
31
|
<tr>
|
|
32
|
+
<td>Page Type:</td>
|
|
33
|
+
<td>
|
|
34
|
+
<%= radio_button :pg, :redirect_enabled, false %> Normal
|
|
35
|
+
<%= radio_button :pg, :redirect_enabled, true %> Redirect to:
|
|
36
|
+
<%= text_field :pg, :redirect_to %>
|
|
37
|
+
<script type="text/javascript">
|
|
38
|
+
jQuery('#pg_redirect_enabled_false').click(function () {
|
|
39
|
+
jQuery('#pg_redirect_to').prop('disabled', true);
|
|
40
|
+
jQuery('#dlg-page-properties tr.page-field').show();
|
|
41
|
+
jQuery('#dlg-page-properties tr.redirect-field').hide();
|
|
42
|
+
});
|
|
43
|
+
jQuery('#pg_redirect_enabled_true').click(function () {
|
|
44
|
+
jQuery('#pg_redirect_to').prop('disabled', false);
|
|
45
|
+
jQuery('#dlg-page-properties tr.page-field').hide();
|
|
46
|
+
jQuery('#dlg-page-properties tr.redirect-field').show();
|
|
47
|
+
});
|
|
48
|
+
jQuery('#pg_redirect_enabled_<%= @pg.redirect_enabled == true %>').trigger('click');
|
|
49
|
+
</script>
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<%- end -%>
|
|
53
|
+
<tr class="page-field">
|
|
31
54
|
<td valign="top"><div style="margin-top: 4px;">Template:</div></td>
|
|
32
55
|
<td>
|
|
33
56
|
<%= select :pg, :cms_template_id, CmsTemplate.find(:all, :order => 'name').collect { |t| [ t.name, t.id ] }, {}, :class => 'form', :style => 'width: 100%;' %>
|
|
34
57
|
|
|
35
|
-
<div id="edit_page_template_options"
|
|
58
|
+
<div id="edit_page_template_options">
|
|
36
59
|
<%= render :partial => 'template_options' %>
|
|
37
60
|
</div>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
<script type="text/javascript">
|
|
62
|
+
jQuery('#pg_cms_template_id').change(function () {
|
|
63
|
+
jQuery.get('<%= url_for(:action => 'show_template_options', :id => @pg) %>?template_id=' + jQuery(this).val(), function (data) {
|
|
64
|
+
jQuery('#edit_page_template_options').html(data);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
42
68
|
</td>
|
|
43
69
|
</tr>
|
|
44
|
-
<tr>
|
|
70
|
+
<tr class="page-field">
|
|
45
71
|
<td>Article Date:</td>
|
|
46
72
|
<td>
|
|
47
73
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
48
74
|
<tr>
|
|
49
|
-
<td width="
|
|
75
|
+
<td width="115">
|
|
50
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 %>
|
|
51
77
|
</td>
|
|
52
78
|
<td width="120">
|
|
53
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>
|
|
54
80
|
</td>
|
|
55
81
|
<td align="right" width="180">
|
|
56
|
-
<input type="checkbox" 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>
|
|
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>
|
|
57
83
|
</td>
|
|
58
84
|
</tr>
|
|
59
85
|
</table>
|
|
@@ -63,7 +89,7 @@
|
|
|
63
89
|
<td>Tags:</td>
|
|
64
90
|
<td><%= text_field_tag :tags, @tags, :class => 'form', :style => 'width: 100%' %></td>
|
|
65
91
|
</tr>
|
|
66
|
-
<tr>
|
|
92
|
+
<tr class="page-field">
|
|
67
93
|
<td>Publish Version:</td>
|
|
68
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>
|
|
69
95
|
</tr>
|
|
@@ -90,7 +116,7 @@
|
|
|
90
116
|
</table>
|
|
91
117
|
</td>
|
|
92
118
|
</tr>
|
|
93
|
-
<tr>
|
|
119
|
+
<tr class="page-field">
|
|
94
120
|
<td valign="top"><div style="margin-top: 4px;">Summary:</div></td>
|
|
95
121
|
<td><%= text_area :pg, :summary, :class => 'form', :style => 'width: 100%; height: 50px;' %></td>
|
|
96
122
|
</tr>
|
|
@@ -102,7 +128,7 @@
|
|
|
102
128
|
<%- else -%>
|
|
103
129
|
<div id="thumbnail_preview" style="width: 385px; overflow: auto;">
|
|
104
130
|
<%- if @pg.thumbnail_path.blank? -%>
|
|
105
|
-
no thumbnail image selected
|
|
131
|
+
<!-- no thumbnail image selected -->
|
|
106
132
|
<%- else -%>
|
|
107
133
|
<%= image_tag(@pg.thumbnail_path, :onclick => "jQuery('#pg_thumbnail_path').show();") %>
|
|
108
134
|
<%- end -%>
|
|
@@ -123,7 +149,7 @@
|
|
|
123
149
|
<%- else -%>
|
|
124
150
|
<div id="feature_image_preview" style="width: 385px; overflow: auto;">
|
|
125
151
|
<%- if @pg.feature_image_path.blank? -%>
|
|
126
|
-
no feature image selected
|
|
152
|
+
<!-- no feature image selected -->
|
|
127
153
|
<%- else -%>
|
|
128
154
|
<%= image_tag(@pg.feature_image_path, :onclick => "jQuery('#pg_feature_image_path').show();") %>
|
|
129
155
|
<%- end -%>
|
|
@@ -137,7 +163,7 @@
|
|
|
137
163
|
</tr>
|
|
138
164
|
<%- end -%>
|
|
139
165
|
<%- if @pg.respond_to?(:html_head) -%>
|
|
140
|
-
<tr>
|
|
166
|
+
<tr class="page-field">
|
|
141
167
|
<td valign="top"><div style="margin-top: 4px;">HTML Head:<br>(advanced)</div></td>
|
|
142
168
|
<td><%= text_area :pg, :html_head, :class => 'form', :style => 'width: 100%; height: 35px; overflow: auto;' %></td>
|
|
143
169
|
</tr>
|
|
@@ -169,7 +195,7 @@
|
|
|
169
195
|
<td></td>
|
|
170
196
|
<td>
|
|
171
197
|
<%= submit_tag 'Save', :id => 'btn_save', :class => 'form_button', :style => 'width: 70px;' %>
|
|
172
|
-
<%= link_to_function 'Cancel', "cancelEditProperties();" %>
|
|
198
|
+
<%= link_to_function 'Cancel', "cancelEditProperties();", :style => 'font-weight: normal;' %>
|
|
173
199
|
<%= hidden_field_tag 'return_to', params[:return_to] %>
|
|
174
200
|
</td>
|
|
175
201
|
</tr>
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
<%-
|
|
2
|
-
|
|
3
|
-
<%-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
%>
|
|
24
|
-
</td>
|
|
25
|
-
</tr>
|
|
26
|
-
</table>
|
|
1
|
+
<%- unless @template_options.empty? -%>
|
|
2
|
+
<div style="background-color: white; width: 100%; border: 1px solid #aaaaaa;">
|
|
3
|
+
<%- @template_options.each do |name, type| -%>
|
|
4
|
+
<%- key = name.gsub(/[^\w\d]/, '_') -%>
|
|
5
|
+
<table width="100%">
|
|
6
|
+
<col width="45%" /><col width="55%" />
|
|
7
|
+
<tr>
|
|
8
|
+
<td><%= name %></td>
|
|
9
|
+
<td>
|
|
10
|
+
<%=
|
|
11
|
+
case type
|
|
12
|
+
when :checkbox
|
|
13
|
+
check_box :page_objects, "obj-option-checkbox-#{key}"
|
|
14
|
+
when :string, :text
|
|
15
|
+
text_field :page_objects, "obj-option-string-#{key}", :style => 'width: 100%;'
|
|
16
|
+
end
|
|
17
|
+
%>
|
|
18
|
+
</td>
|
|
19
|
+
</tr>
|
|
20
|
+
</table>
|
|
21
|
+
<%- end -%>
|
|
22
|
+
</div>
|
|
27
23
|
<%- end -%>
|
|
@@ -158,7 +158,8 @@ module ActionControllerExtensions
|
|
|
158
158
|
content << " onmouseover=\"this.className = 'page_list_segment page_list_segment_selected'\""
|
|
159
159
|
content << " onmouseout=\"this.className = 'page_list_segment'\""
|
|
160
160
|
content << " onclick=\"$('#{key}').style.cursor = 'wait'; $('#{key}').style.opacity = 0.5; "
|
|
161
|
-
|
|
161
|
+
# FIXME: Prototype
|
|
162
|
+
content << " new Ajax.Updater('#{key}', '#{url_for(:content_path => @pg.path.split('/').concat([ 'segment', start.to_s, name ]))}', {asynchronous:true, evalScripts:true, method:'get'});"
|
|
162
163
|
content << "; window.scrollBy(0, - 20 + document.getElementById('#{key}').getBoundingClientRect().top); return false;\""
|
|
163
164
|
end
|
|
164
165
|
content << ">#{seg+1}</a></td>"
|
data/lib/imagine_cms/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: imagine_cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.32
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Namba
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -301,6 +301,7 @@ files:
|
|
|
301
301
|
- app/assets/javascripts/dojo/src/widget/templates/incrementWeek.gif
|
|
302
302
|
- app/assets/javascripts/dojo/src/widget/templates/richtextframe.html
|
|
303
303
|
- app/assets/javascripts/imagine.js
|
|
304
|
+
- app/assets/javascripts/imagine_cms.js
|
|
304
305
|
- app/assets/javascripts/jquery_no_conflict.js
|
|
305
306
|
- app/assets/stylesheets/codepress/codepress.css
|
|
306
307
|
- app/assets/stylesheets/codepress/languages/css.css
|
|
@@ -412,6 +413,7 @@ files:
|
|
|
412
413
|
- db/migrate/20121115083748_add_logs_table.rb
|
|
413
414
|
- db/migrate/20121115083811_add_users_tables.rb
|
|
414
415
|
- db/migrate/20121115084028_add_cms_tables.rb
|
|
416
|
+
- db/migrate/20140423085357_add_redirect_fields_to_cms_pages.rb
|
|
415
417
|
- imagine_cms.gemspec
|
|
416
418
|
- lib/acts_as_versioned/.document
|
|
417
419
|
- lib/acts_as_versioned/.gitignore
|