imagine_cms 4.1.4 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +2 -1
  3. data/app/assets/images/interface/form_loading.gif +0 -0
  4. data/app/assets/images/management/btn-top-delete.png +0 -0
  5. data/app/assets/images/management/btn-top-edit.png +0 -0
  6. data/app/assets/images/management/btn-top-exterminate.png +0 -0
  7. data/app/assets/images/management/btn-top-new.png +0 -0
  8. data/app/assets/images/management/btn-top-preview.png +0 -0
  9. data/app/assets/images/management/btn-top-properties.png +0 -0
  10. data/app/assets/javascripts/codemirror/modes-custom/imagine_cms.js +87 -0
  11. data/app/assets/javascripts/imagine_cms/core.js +510 -0
  12. data/app/assets/javascripts/imagine_cms/legacy/misc.js +537 -0
  13. data/app/assets/javascripts/imagine_cms/legacy/rollovers.js +193 -0
  14. data/app/assets/javascripts/imagine_cms/legacy/slideshow.js +116 -0
  15. data/app/assets/javascripts/imagine_cms/legacy/textfieldhints.js +55 -0
  16. data/app/assets/javascripts/imagine_cms.js +14 -1
  17. data/app/assets/javascripts/imagine_cms_compat.js +26 -0
  18. data/app/assets/javascripts/jquery-ui.js +16608 -0
  19. data/app/assets/javascripts/tag-it.js +591 -0
  20. data/app/assets/stylesheets/imagine_cms.css.scss +26 -10
  21. data/app/assets/stylesheets/imagine_controls.css.scss +8 -0
  22. data/app/assets/stylesheets/jquery-ui.css +1225 -0
  23. data/app/assets/stylesheets/jquery-ui.structure.css +833 -0
  24. data/app/assets/stylesheets/jquery-ui.theme.css +410 -0
  25. data/app/assets/stylesheets/jquery.tagit.css +69 -0
  26. data/app/assets/stylesheets/management.css.scss +7 -0
  27. data/app/assets/stylesheets/tagit.ui-imagine.css +100 -0
  28. data/app/controllers/cms/content_controller.rb +28 -45
  29. data/app/controllers/management/cms_controller.rb +116 -94
  30. data/app/helpers/cms_application_helper.rb +76 -39
  31. data/app/models/cms_page.rb +32 -14
  32. data/app/models/cms_page_object.rb +1 -1
  33. data/app/models/cms_page_tag.rb +2 -2
  34. data/app/models/cms_template.rb +1 -1
  35. data/app/models/user.rb +6 -6
  36. data/app/models/user_group.rb +1 -1
  37. data/app/views/cms/content/_photo_gallery.html.erb +12 -12
  38. data/app/views/cms/content/_search.html.erb +2 -2
  39. data/app/views/cms/content/_search_result.html.erb +16 -10
  40. data/app/views/layouts/management.html.erb +18 -17
  41. data/app/views/management/cms/_edit_page.html.erb +47 -33
  42. data/app/views/management/cms/_gallery_index.html.erb +4 -4
  43. data/app/views/management/cms/_image.html.erb +3 -3
  44. data/app/views/management/cms/_image_details.html.erb +9 -8
  45. data/app/views/management/cms/_list_page.html.erb +2 -2
  46. data/app/views/management/cms/_list_page_select.html.erb +1 -1
  47. data/app/views/management/cms/_page_list.html.erb +69 -48
  48. data/app/views/management/cms/_page_list_source_folder.html.erb +2 -2
  49. data/app/views/management/cms/_template_options.html.erb +4 -4
  50. data/app/views/management/cms/_template_reference.html.erb +13 -15
  51. data/app/views/management/cms/edit_page_content.html.erb +3 -3
  52. data/app/views/management/cms/edit_snippet.html.erb +19 -41
  53. data/app/views/management/cms/edit_template.html.erb +15 -38
  54. data/app/views/management/cms/pages.html.erb +17 -29
  55. data/app/views/management/cms/snippets.html.erb +2 -2
  56. data/app/views/management/cms/templates.html.erb +2 -2
  57. data/app/views/management/cms/toolbar_edit.html.erb +2 -0
  58. data/app/views/management/cms/toolbar_preview.html.erb +2 -2
  59. data/config/initializers/config_file.rb +1 -1
  60. data/imagine_cms.gemspec +7 -4
  61. data/lib/extensions/action_controller_extensions.rb +50 -19
  62. data/lib/imagine_cms/engine.rb +12 -8
  63. data/lib/imagine_cms/version.rb +1 -1
  64. data/lib/prototype_legacy_helper/lib/prototype_legacy_helper.rb +2 -2
  65. data/lib/tasks/imagine_cms_tasks.rake +8 -0
  66. metadata +69 -91
  67. data/app/assets/images/management/btn_archive.gif +0 -0
  68. data/app/assets/images/management/btn_delete.gif +0 -0
  69. data/app/assets/images/management/btn_duplicate.gif +0 -0
  70. data/app/assets/images/management/btn_edit.gif +0 -0
  71. data/app/assets/images/management/btn_new_page.gif +0 -0
  72. data/app/assets/images/management/btn_preview.gif +0 -0
  73. data/app/assets/images/management/btn_properties.gif +0 -0
  74. data/app/assets/images/management/btn_restore.gif +0 -0
  75. data/app/assets/images/management/btn_top_delete.gif +0 -0
  76. data/app/assets/images/management/btn_top_duplicate.gif +0 -0
  77. data/app/assets/images/management/btn_top_edit.gif +0 -0
  78. data/app/assets/images/management/btn_top_new.gif +0 -0
  79. data/app/assets/images/management/btn_top_preview.gif +0 -0
  80. data/app/assets/images/management/btn_top_properties.gif +0 -0
  81. data/app/assets/javascripts/codepress/codepress.html +0 -36
  82. data/app/assets/javascripts/codepress/codepress.js +0 -130
  83. data/app/assets/javascripts/codepress/engines/gecko.js +0 -240
  84. data/app/assets/javascripts/codepress/engines/khtml.js +0 -0
  85. data/app/assets/javascripts/codepress/engines/msie.js +0 -263
  86. data/app/assets/javascripts/codepress/engines/older.js +0 -0
  87. data/app/assets/javascripts/codepress/engines/opera.js +0 -259
  88. data/app/assets/javascripts/codepress/languages/css.js +0 -23
  89. data/app/assets/javascripts/codepress/languages/generic.js +0 -25
  90. data/app/assets/javascripts/codepress/languages/html.js +0 -63
  91. data/app/assets/javascripts/codepress/languages/java.js +0 -24
  92. data/app/assets/javascripts/codepress/languages/javascript.js +0 -30
  93. data/app/assets/javascripts/codepress/languages/perl.js +0 -27
  94. data/app/assets/javascripts/codepress/languages/php.js +0 -60
  95. data/app/assets/javascripts/codepress/languages/ruby.js +0 -26
  96. data/app/assets/javascripts/codepress/languages/sql.js +0 -30
  97. data/app/assets/javascripts/codepress/languages/text.js +0 -9
  98. data/app/assets/javascripts/imagine.js +0 -1393
  99. data/app/assets/stylesheets/codepress/codepress.css +0 -7
  100. data/app/assets/stylesheets/codepress/languages/css.css +0 -10
  101. data/app/assets/stylesheets/codepress/languages/generic.css +0 -9
  102. data/app/assets/stylesheets/codepress/languages/html.css +0 -18
  103. data/app/assets/stylesheets/codepress/languages/java.css +0 -7
  104. data/app/assets/stylesheets/codepress/languages/javascript.css +0 -8
  105. data/app/assets/stylesheets/codepress/languages/perl.css +0 -11
  106. data/app/assets/stylesheets/codepress/languages/php.css +0 -12
  107. data/app/assets/stylesheets/codepress/languages/ruby.css +0 -10
  108. data/app/assets/stylesheets/codepress/languages/sql.css +0 -10
  109. data/app/assets/stylesheets/codepress/languages/text.css +0 -5
@@ -1,16 +1,23 @@
1
1
  <script type="text/javascript">
2
2
  attrlist = new Array(<%= @attrs.size %>)
3
-
4
3
  <%- @attrs.each_with_index do |attr, i| -%>
5
- attrlist[<%= i %>]="<%=h attr %>"
4
+ attrlist[<%= i %>]="<%=j attr %>";
5
+ <%- end -%>
6
+
7
+ taglist = new Array(<%= @taglist.size %>)
8
+ <%- @taglist.each_with_index do |tag, i| -%>
9
+ taglist[<%= i %>]="<%=j tag %>";
6
10
  <%- end -%>
11
+
12
+ jQuery(document).ready(function () {
13
+ jQuery('#tags').tagit({ availableTags: taglist, allowSpaces: true, caseSensitive: false, removeConfirmation: true, autocomplete: { delay: 0, minLength: 0 } });
14
+ });
7
15
  </script>
8
16
 
9
17
  <div id="save_errors" class="error"></div>
10
18
 
11
19
  <%= form_remote_tag :url => { :action => 'edit_page', :id => @pg },
12
- :loading => "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';",
13
- :html => { :onsubmit => 'teardownTextFieldHints();' } do %>
20
+ :loading => "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';" do %>
14
21
  <table id="dlg-page-properties">
15
22
  <col width="120"><col width="*"><col width="5">
16
23
  <%- if (@pg.id || 2) > 1 -%>
@@ -67,7 +74,7 @@
67
74
  </script>
68
75
  </td>
69
76
  </tr>
70
- <tr class="page-field">
77
+ <tr>
71
78
  <td>Article Date:</td>
72
79
  <td>
73
80
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
@@ -86,7 +93,7 @@
86
93
  </td>
87
94
  </tr>
88
95
  <tr>
89
- <td>Tags:</td>
96
+ <td valign="middle">Tags:</td>
90
97
  <td><%= text_field_tag :tags, @tags, :class => 'form', :style => 'width: 100%' %></td>
91
98
  </tr>
92
99
  <tr class="page-field">
@@ -126,18 +133,21 @@
126
133
  <%- if @pg.new_record? -%>
127
134
  A thumbnail cannot be added until you save this page.
128
135
  <%- else -%>
129
- <div id="thumbnail_preview" style="width: 385px; overflow: auto;">
130
- <%- if @pg.thumbnail_path.blank? -%>
131
- <!-- no thumbnail image selected -->
132
- <%- else -%>
133
- <%= image_tag(@pg.thumbnail_path, :onclick => "jQuery('#pg_thumbnail_path').show();") %>
136
+ <div id="thumbnail_preview" style="width: 385px; overflow: auto;">
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>
143
+ <%= button_to_function "Select Thumbnail...",
144
+ "selectThumbnail('#{url_for action: 'upload_thumb', id: @pg}');",
145
+ class: 'form_button' %>
146
+ <%- if @pg.thumbnail_path.present? -%>
147
+ <%= button_to_function "Remove", "jQuery('#thumbnail_preview img').remove(); jQuery('#pg_thumbnail_path').val(''); jQuery(this).remove();", class: 'form_button' %>
134
148
  <%- end -%>
135
- </div>
136
- <%= button_to_function "Select Thumbnail...",
137
- "selectThumbnail('#{url_for :action => 'upload_thumb', :id => @pg}');",
138
- :class => 'form_button' %>
149
+ <%= text_field :pg, :thumbnail_path, class: 'form', style: 'width: 100%; display: none;' %>
139
150
  <%- end -%>
140
- <%= text_field :pg, :thumbnail_path, :class => 'form', :style => 'width: 100%; display: none;' %>
141
151
  </td>
142
152
  </tr>
143
153
  <%- if @pg.respond_to?(:feature_image_path) -%>
@@ -147,18 +157,21 @@
147
157
  <%- if @pg.new_record? -%>
148
158
  A feature image cannot be added until you save this page.
149
159
  <%- else -%>
150
- <div id="feature_image_preview" style="width: 385px; overflow: auto;">
151
- <%- if @pg.feature_image_path.blank? -%>
152
- <!-- no feature image selected -->
153
- <%- else -%>
154
- <%= image_tag(@pg.feature_image_path, :onclick => "jQuery('#pg_feature_image_path').show();") %>
160
+ <div id="feature_image_preview" style="width: 385px; overflow: auto;">
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>
167
+ <%= button_to_function "Select Feature Image...",
168
+ "selectThumbnail('#{url_for action: 'upload_feature_image', id: @pg}');",
169
+ class: 'form_button' %>
170
+ <%- if @pg.feature_image_path.present? -%>
171
+ <%= button_to_function "Remove", "jQuery('#feature_image_preview img').remove(); jQuery('#pg_feature_image_path').val(''); jQuery(this).remove();", class: 'form_button' %>
155
172
  <%- end -%>
156
- </div>
157
- <%= button_to_function "Select Feature Image...",
158
- "selectThumbnail('#{url_for :action => 'upload_feature_image', :id => @pg}');",
159
- :class => 'form_button' %>
173
+ <%= text_field :pg, :feature_image_path, class: 'form', style: 'width: 100%; display: none;' %>
160
174
  <%- end -%>
161
- <%= text_field :pg, :feature_image_path, :class => 'form', :style => 'width: 100%; display: none;' %>
162
175
  </td>
163
176
  </tr>
164
177
  <%- end -%>
@@ -175,16 +188,17 @@
175
188
  <tr>
176
189
  <td>Add an attribute: &nbsp;</td>
177
190
  <td>
178
- <%= text_field_tag :custom_attribute_name, '', :class => 'form', :style => 'margin-bottom: 4px;' %>
179
- <%= javascript_tag "addTextFieldHint('custom_attribute_name', '[ attribute name ]'); setupTextFieldHints(); "%>
180
- <div id="custom_attribute_name_auto_complete" class="auto_complete" style="display: none;"></div>
181
- <%= javascript_tag "$('custom_attribute_name').onkeydown = disableEnterKey; new Autocompleter.Local('custom_attribute_name', 'custom_attribute_name_auto_complete', attrlist, { frequency: 0.1, minChars: 1 });" %>
182
-
183
- <%= button_to_function 'Add', "new Ajax.Updater('custom_attributes', '/manage/cms/page_attribute?name=' + $('custom_attribute_name').value, {asynchronous:true, evalScripts:true, insertion:Insertion.Bottom}); $('custom_attribute_name').value = ''; return false;", :class => 'form_button', :style => 'margin-bottom: 5px;' %>
191
+ <div style="position: relative;">
192
+ <%= text_field_tag :custom_attribute_name, '', :class => 'form', :style => 'margin-bottom: 4px;', :placeholder => '[ attribute name ]' %>
193
+ <div id="custom_attribute_name_auto_complete" class="auto_complete" style="display: none;"></div>
194
+ <%= 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
+
196
+ <%= button_to_function 'Add', "new Ajax.Updater('custom_attributes', '/manage/cms/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
+ </div>
184
198
  </td>
185
199
  </tr>
186
200
  </table>
187
- <div id="custom_attributes" style="background-color: white; height: 80px; overflow: auto; border: 1px solid #aaaaaa">
201
+ <div id="custom_attributes" style="background-color: white; min-height: 40px; overflow: auto; border: 1px solid #aaaaaa">
188
202
  <%- @page_objects.each do |key,val| -%>
189
203
  <%- key =~ /^obj-(\w+?)-(.+?)$/ -%>
190
204
  <%= render :partial => 'page_attribute', :locals => { :name => $2 } if $1 == 'attribute' %>
@@ -1,10 +1,10 @@
1
1
  <div id="images_container">
2
2
  <div id="images">
3
- <%= render :partial => 'image', :collection => @images, :locals => { :id => @pg, :path => @pg.path, :gallery_id => params[:gallery_id] } %>
3
+ <%= render partial: 'image', collection: @images, locals: { id: @pg, path: @pg.path, gallery_id: params[:gallery_id] } %>
4
4
  </div>
5
5
  </div>
6
6
 
7
- <%= form_remote_tag(:update => 'gallery_container', :html => { :id => 'mainform_gallery' },
8
- :url => { :action => 'gallery_management', :id => @pg, :gallery_id => params[:gallery_id] }) do -%>
9
- <%= text_field_tag :dirname, '', :style => 'display: none' %>
7
+ <%= form_remote_tag(update: 'gallery_container', html: { id: 'mainform_gallery' },
8
+ url: { action: 'gallery_management', id: @pg, gallery_id: params[:gallery_id] }) do -%>
9
+ <%= text_field_tag :dirname, '', style: 'display: none' %>
10
10
  <%- end -%>
@@ -1,6 +1,6 @@
1
1
  <%-
2
2
  thumb = "assets/content/#{path}/#{gallery_id}/management/#{image}.jpg"
3
3
  -%>
4
- <%= link_to_remote image_tag("/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}", :size => '90x90'),
5
- :url => { :action => 'image_details', :id => id, :path => path, :gallery_id => gallery_id, :image => image.to_s + '.jpg' },
6
- :update => 'gallery_window' %>
4
+ <%= link_to_remote image_tag("/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}", size: '90x90'),
5
+ url: { action: 'image_details', id: id, gallery_id: gallery_id, image: "#{image}.jpg" },
6
+ update: 'gallery_window' %>
@@ -1,23 +1,24 @@
1
+ <%- img = "content/#{@pg.path}/#{params[:gallery_id]}/#{params[:image]}" -%>
1
2
  <table>
2
3
  <tr valign="top">
3
- <td><%= image_tag "content/#{params[:path]}/#{params[:gallery_id]}/#{params[:image]}" %></td>
4
+ <td><%= image_tag "#{img}?#{File.mtime(File.join(Rails.root, 'public', 'assets', img)).to_i}" %></td>
4
5
  <td style="padding-left: 10px;">
5
6
  <div id="caption_container" style="margin-bottom: 20px;">
6
7
  <strong>Caption</strong><br/>
7
- <%= form_remote_tag :url => { :action => 'update_caption', :id => params[:id], :path => params[:path], :gallery_id => params[:gallery_id], :image => params[:image] },
8
- :update => 'gallery_container' do -%>
8
+ <%= form_remote_tag url: { action: 'update_caption', id: params[:id], gallery_id: params[:gallery_id], image: params[:image] },
9
+ update: 'gallery_container' do -%>
9
10
  <%= text_area_tag "caption", @caption %><br/>
10
11
  <%= submit_tag "Save" %> or <%= link_to_remote "cancel",
11
- :url => { :action => 'gallery_management', :id => params[:id], :gallery_id => params[:gallery_id] },
12
- :update => 'gallery_container' %>
12
+ url: { action: 'gallery_management', id: params[:id], gallery_id: params[:gallery_id] },
13
+ update: 'gallery_container' %>
13
14
  <%- end -%>
14
15
  </div>
15
16
 
16
17
  <div id="delete_container">
17
18
  <strong>Delete Photo</strong><br/>
18
- <%= form_remote_tag :url => { :action => 'delete_photo', :id => params[:id], :path => params[:path], :gallery_id => params[:gallery_id], :image => params[:image] },
19
- :update => 'gallery_container',
20
- :confirm => "This action cannot be undone. Continue?" do -%>
19
+ <%= form_remote_tag url: { action: 'delete_photo', id: params[:id], gallery_id: params[:gallery_id], image: params[:image] },
20
+ update: 'gallery_container',
21
+ confirm: "This action cannot be undone. Continue?" do -%>
21
22
  <%= submit_tag "Delete" %>
22
23
  <%- end -%>
23
24
  </div>
@@ -1,7 +1,7 @@
1
- <div id="<%= "cb_item_#{list_page.id}" %>" class="cb_item" style="width: 148px; overflow: hidden; margin: 2px; float: left; cursor: pointer" onclick="$('view_link').href = '<%= list_page.path.blank? ? '' : '/' + list_page.path %>/version/<%= list_page.published_version > 0 ? list_page.published_version : list_page.version %>'; $('new_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :mode => 'ajax_new', :parent_id => list_page %>', 'Create New Page under /<%= list_page.path %>'); return false; }; $('edit_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :id => list_page, :mode => 'ajax_edit' %>', 'Page Properties: <%= list_page.name %>'); return false; }; $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page %>'; $('delete_form').action = '<%=raw url_for :action => 'delete_page', :id => list_page.id %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages', :level => @page_level + 1, :parent_id => list_page.id %>\');', 200);" ondblclick="$('edit_content_form').onsubmit(); $('edit_content_form').submit();">
1
+ <div id="<%= "cb_item_#{list_page.id}" %>" class="cb_item" style="width: 148px; overflow: hidden; margin: 2px; float: left; cursor: pointer" onclick="$('view_link').href = '<%= list_page.path.blank? ? '' : '/' + list_page.path %>/version/<%= list_page.published_version > 0 ? list_page.published_version : list_page.version %>'; $('new_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :mode => 'ajax_new', :parent_id => list_page %>', 'Create New Page under /<%= list_page.path %>'); return false; }; $('edit_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :id => list_page, :mode => 'ajax_edit' %>', 'Page Properties: <%= list_page.name %>'); return false; }; $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page %>'; $('delete_link').href = '<%=raw url_for :action => 'delete_page', :id => list_page.id %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages', :level => @page_level + 1, :parent_id => list_page.id %>\');', 200);" ondblclick="$('edit_content_link').click();">
2
2
  <table cellpadding="0" cellspacing="0" border="0">
3
3
  <tr>
4
- <td valign="top"><img src="/assets/management/icon_page.gif" style="margin: 2px 5px 0 0; "/></td>
4
+ <td valign="top"><%= image_tag 'management/icon_page.gif', style: 'margin: 2px 5px 0 0;' %></td>
5
5
  <td<%= list_page.published_version >= 0 ? '' : ' style="color: gray"'.html_safe %>><%= list_page.name %></td>
6
6
  </tr>
7
7
  </table>
@@ -1,7 +1,7 @@
1
1
  <div id="<%= "cb_item_#{list_page_select.id}" %>" class="cb_item" style="width: 148px; overflow: hidden; margin: 2px; float: left; cursor: pointer" onclick="$('page_browser_selection').value = '/<%= list_page_select.path %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages_select', :level => @page_level + 1, :parent_id => list_page_select.id %>\');', 200);" ondblclick="return false;">
2
2
  <table cellpadding="0" cellspacing="0" border="0">
3
3
  <tr>
4
- <td valign="top"><img src="/assets/management/icon_page.gif" style="margin: 2px 5px 0 0; "/></td>
4
+ <td valign="top"><%= image_tag 'management/icon_page.gif', style: 'margin: 2px 5px 0 0;' %></td>
5
5
  <td<%= list_page_select.published_version >= 0 ? '' : ' style="color: gray"'.html_safe %>><%= list_page_select.name %></td>
6
6
  </tr>
7
7
  </table>
@@ -1,11 +1,11 @@
1
- <div id="page_list_container_<%= key %>" style="border: 1px solid gray; padding: 8px; background-color: #dddddd; width: 170px; text-align: center;">
1
+ <%- options ||= {} -%>
2
+ <div id="page_list_container_<%= key %>" class="page_list_dialog" style="border: 1px solid gray; padding: 8px; background-color: #dddddd; width: 170px; text-align: center;">
2
3
  Page List: <%= name %><br/>
3
4
  <button class="form_button" onclick="showDojoDialog('page_list_<%= key %>'); return false;">Configure</button>
4
5
  </div>
5
-
6
6
  <div dojoType="ModalFloatingPane" id="page_list_<%= key %>" title="Page List: <%= name %>"
7
7
  hasShadow="true" resizable="true" followScroll="false" displayCloseAction="true" appendToBody="false"
8
- style="width: 600px; height: 580px; display: none">
8
+ style="width: 620px; height: 600px; display: none">
9
9
  <div class="ccs-page-list-form">
10
10
  <fieldset>
11
11
  <legend>Sources</legend>
@@ -14,29 +14,29 @@
14
14
 
15
15
  <div id="page_list_<%= key %>-source-list" style="margin: 10px;">
16
16
  <%- @page_objects["#{key}-sources-folder-count"].to_i.times do |i| -%>
17
- <%= render :partial => 'page_list_source_folder', :locals => { :i => i, :key => key } %>
17
+ <%= render partial: 'page_list_source_folder', locals: { i: i, key: key } %>
18
18
  <%- end -%>
19
19
  <%- @page_objects["#{key}-sources-tag-count"].to_i.times do |i| -%>
20
- <%= render :partial => 'page_list_source_tag', :locals => { :i => i, :key => key } %>
20
+ <%= render partial: 'page_list_source_tag', locals: { i: i, key: key } %>
21
21
  <%- end -%>
22
22
  <%-
23
23
  @page_objects["#{key}-sources-tag-count"] ||= 0
24
24
  @page_objects["#{key}-sources-folder-count"] ||= 0
25
25
  -%>
26
- <%= text_field(:page_objects, "#{key}-sources-tag-count", :style => 'display: none;') %>
27
- <%= text_field(:page_objects, "#{key}-sources-folder-count", :style => 'display: none;') %>
26
+ <%= text_field :page_objects, "#{key}-sources-tag-count", style: 'display: none;' %>
27
+ <%= text_field :page_objects, "#{key}-sources-folder-count", style: 'display: none;' %>
28
28
  </div>
29
29
 
30
30
  <table>
31
31
  <tr>
32
- <td><%= button_to_function('Add Folder', "new Ajax.Updater('page_list_#{key}-source-list', '/manage/cms/page_list_add_folder?key=#{key}&i=' + $('page_objects_#{key}-sources-folder-count').value, {asynchronous:true, evalScripts:true, insertion:Insertion.Bottom}); $('page_objects_#{key}-sources-folder-count').value++;", :class => 'form_button') %></td>
32
+ <td><%= button_to_function('Add Page/Folder', "new Ajax.Updater('page_list_#{key}-source-list', '/manage/cms/page_list_add_folder?key=#{key}&i=' + $('page_objects_#{key}-sources-folder-count').value, {asynchronous:true, evalScripts:true, insertion:Insertion.Bottom}); $('page_objects_#{key}-sources-folder-count').value++;", :class => 'form_button') %></td>
33
33
  <td><%= button_to_function('Add Tag', "new Ajax.Updater('page_list_#{key}-source-list', '/manage/cms/page_list_add_tag?key=#{key}&i=' + $('page_objects_#{key}-sources-tag-count').value, {asynchronous:true, evalScripts:true, insertion:Insertion.Bottom}); $('page_objects_#{key}-sources-tag-count').value++;", :class => 'form_button') %></td>
34
34
  <td>
35
- <%= check_box(:page_objects, "#{key}-include-expired", { :class => 'form', :style => '' }, 'true', 'false') %>
35
+ <%= check_box :page_objects, "#{key}-include-expired", { class: 'form', style: '' }, 'true', 'false' %>
36
36
  <label for="page_objects_<%= key %>-include-expired">Include expired items</label>
37
37
  </td>
38
38
  <td>
39
- <%= check_box(:page_objects, "#{key}-exclude-current", { :class => 'form', :style => '' }, 'true', 'false') %>
39
+ <%= check_box :page_objects, "#{key}-exclude-current", { class: 'form', style: '' }, 'true', 'false' %>
40
40
  <label for="page_objects_<%= key %>-exclude-current">Exclude current page</label>
41
41
  </td>
42
42
  </tr>
@@ -52,28 +52,28 @@
52
52
  <td>Format:</td>
53
53
  <td colspan="2">
54
54
  <%- @page_objects["#{key}-style-display-as"] ||= 'list' -%>
55
- <%= radio_button :page_objects, "#{key}-style-display-as", 'list', :onclick => "$$('.page_list_#{key}_list_option').each(function (e) { Element.show(e) }); $$('.page_list_#{key}_calendar_option').each(function (e) { Element.hide(e) });" %><label for="page_objects_<%= key %>-style-display-as_list">List</label>&nbsp;
56
- <%= radio_button :page_objects, "#{key}-style-display-as", 'calendar', :onclick => "$$('.page_list_#{key}_calendar_option').each(function (e) { Element.show(e) }); $$('.page_list_#{key}_list_option').each(function (e) { Element.hide(e) });" %><label for="page_objects_<%= key %>-style-display-as_calendar">Calendar</label>
55
+ <%= radio_button :page_objects, "#{key}-style-display-as", 'list' %><label for="page_objects_<%= key %>-style-display-as_list">List</label>&nbsp;
56
+ <%= radio_button :page_objects, "#{key}-style-display-as", 'calendar' %><label for="page_objects_<%= key %>-style-display-as_calendar">Calendar</label>
57
57
  </td>
58
58
  </tr>
59
59
  <tr class="page_list_<%= key %>_list_option">
60
- <td>Number:</td>
60
+ <td valign="top"><div style="margin-top: 2px;">Number:</div></td>
61
61
  <td>
62
- Display <%= text_field(:page_objects, "#{key}-max-item-count", :class => 'form', :style => 'margin: 0; width: 20px') %> items,
63
- but skip the first <%= text_field(:page_objects, "#{key}-item-offset", :class => 'form', :style => 'margin: 0; width: 20px;') %>
64
- <br/>
62
+ Display <%= text_field :page_objects, "#{key}-max-item-count", placeholder: options[:item_count].to_s, class: 'form', style: 'margin: 0; width: 20px;' %> items,
63
+ but skip the first <%= text_field :page_objects, "#{key}-item-offset", placeholder: (options[:item_offset] || 0).to_s, class: 'form', style: 'margin: 0; width: 20px;' %>
64
+ <br>
65
65
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
66
66
  <%= check_box :page_objects, "#{key}-use-pagination" %>
67
67
  <label for="page_objects_<%= key %>-use-pagination">Show multiple list segments</label>
68
- <br/>
68
+ <br>
69
69
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
70
70
  <%= check_box :page_objects, "#{key}-use-randomization" %>
71
71
  <label for="page_objects_<%= key %>-use-randomization">Select randomly from the top</label>
72
- <%= text_field(:page_objects, "#{key}-random-pool-size", :class => 'form', :style => 'margin: 0; width: 20px') %> items
72
+ <%= text_field(:page_objects, "#{key}-random-pool-size", class: 'form', style: 'margin: 0; width: 20px') %> items
73
73
  </td>
74
74
  </tr>
75
75
  <tr class="page_list_<%= key %>_list_option">
76
- <td>Sort:</td>
76
+ <td>Sort Order:</td>
77
77
  <td>
78
78
  First by
79
79
  <%= select(:page_objects, "#{key}-sort-first-field",
@@ -93,30 +93,21 @@
93
93
  :class => 'form', :style => 'margin: 0; border: 1px solid gray;') %>
94
94
  </td>
95
95
  <tr class="page_list_<%= key %>_list_option">
96
- <td>Date:</td>
96
+ <td>Dates:</td>
97
97
  <td>
98
98
  <%-
99
99
  @page_objects["#{key}-date-range"] ||= 'all'
100
100
  -%>
101
- <%= radio_button :page_objects, "#{key}-date-range", 'all' %><label for="page_objects_<%= key %>-date-range_all">All Dates</label>&nbsp;&nbsp;
102
- <%= radio_button :page_objects, "#{key}-date-range", 'past' %><label for="page_objects_<%= key %>-date-range_past">Past</label>&nbsp;&nbsp;
103
- <%= radio_button :page_objects, "#{key}-date-range", 'future' %><label for="page_objects_<%= key %>-date-range_future">Future</label>&nbsp;&nbsp;
101
+ <%= radio_button :page_objects, "#{key}-date-range", 'all' %><label for="page_objects_<%= key %>-date-range_all">All Dates</label>&nbsp;
102
+ <%= radio_button :page_objects, "#{key}-date-range", 'past' %><label for="page_objects_<%= key %>-date-range_past">Past</label>&nbsp;
103
+ <%= radio_button :page_objects, "#{key}-date-range", 'future' %><label for="page_objects_<%= key %>-date-range_future">Future</label>&nbsp;
104
104
  <%= radio_button :page_objects, "#{key}-date-range", 'custom' %><label for="page_objects_<%= key %>-date-range_custom">Range:</label>
105
- <%= date_picker :page_objects, "#{key}-date-range-custom-start", :default_value => (@page_objects["#{key}-date-range-custom-start"] || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 5.years.from_now %> &ndash;
106
- <%= date_picker :page_objects, "#{key}-date-range-custom-end", :default_value => (@page_objects["#{key}-date-range-custom-end"] || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 5.years.from_now %>
105
+ <%= date_picker :page_objects, "#{key}-date-range-custom-start", default_value: (@page_objects["#{key}-date-range-custom-start"] || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 5.years.from_now %> &ndash;
106
+ <%= date_picker :page_objects, "#{key}-date-range-custom-end", default_value: (@page_objects["#{key}-date-range-custom-end"] || Time.now), start_date: Time.utc(2006, 1, 1), end_date: 5.years.from_now %>
107
107
  </td>
108
108
  </tr>
109
109
  </table>
110
110
  </fieldset>
111
- <script type="text/javascript">
112
- if ($('page_objects_<%= key %>-style-display-as_list').checked) {
113
- $$('.page_list_<%= key %>_list_option').each(function(e) { Element.show(e) } );
114
- $$('.page_list_<%= key %>_calendar_option').each(function(e) { Element.hide(e) } );
115
- } else {
116
- $$('.page_list_<%= key %>_calendar_option').each(function(e) { Element.show(e) } );
117
- $$('.page_list_<%= key %>_list_option').each(function(e) { Element.hide(e) } );
118
- }
119
- </script>
120
111
 
121
112
  <fieldset>
122
113
  <legend>Item Template</legend>
@@ -126,21 +117,32 @@
126
117
  </div>
127
118
 
128
119
  <div style="float: right">
129
- <%- system_attrs = @pg.attributes.map { |c| c.first }.
130
- reject { |c| [ 'cms_template_id',
131
- 'cms_template_version',
132
- 'position' ].include?(c) }.sort -%>
120
+ <%-
121
+ system_attrs = {
122
+ 'article_date_month' => 'Article Date - Month',
123
+ 'article_date_mon' => 'Article Date - Month Abbr',
124
+ 'article_date_day' => 'Article Date - Day',
125
+ 'article_date_year' => 'Article Date - Year',
126
+ 'article_date_yr' => 'Article Date - Year Abbr',
127
+ 'tags' => 'Tags',
128
+ 'tags_as_css_classes' => 'Tags as CSS Classes',
129
+ }
130
+ @pg.attributes.each do |attr, value|
131
+ next if [ 'cms_template_id', 'cms_template_version' ].include?(attr)
132
+ system_attrs[attr] ||= attr.titleize
133
+ end
134
+ -%>
133
135
  <select class="form" style="width: 150px;" onchange="insertAtCaret($('page_objects_<%= key %>-template'), '<# ' + this.value + ' #>'); this.value = '';">
134
136
  <option value="">-- Insert Attribute --</option>
135
- <%- system_attrs.each do |attr| -%>
136
- <option value="<%=h attr %>"><%=h attr.titleize %></option>
137
+ <%- system_attrs.sort.each do |attr, label| -%>
138
+ <option value="<%= attr %>"><%= label %></option>
137
139
  <%- end -%>
138
140
  </select>
139
141
  </div>
140
142
 
141
- <br clear="all" />
143
+ <br clear="all">
142
144
 
143
- <%= text_area(:page_objects, "#{key}-template", :style => 'border: 1px solid gray; width: 100%;', :rows => '6') %>
145
+ <%= text_area :page_objects, "#{key}-template", placeholder: options[:template].to_s.gsub(/\s+/, ' '), style: 'border: 1px solid gray; width: 99%;', rows: '6' %>
144
146
  </fieldset>
145
147
 
146
148
  <div id="page_list_<%= key %>-advanced">
@@ -149,12 +151,12 @@
149
151
 
150
152
  <table width="100%">
151
153
  <tr>
152
- <td valign="top">Start:</td>
153
- <td><%= text_area(:page_objects, "#{key}-header", :style => 'border: 1px solid gray; width: 100%;', :rows => '4') %></td>
154
+ <td valign="top">Before:</td>
155
+ <td><%= text_area :page_objects, "#{key}-header", placeholder: options[:header].to_s.gsub(/\s+/, ' '), style: 'border: 1px solid gray; width: 99%; height: 32px;' %></td>
154
156
  </tr>
155
157
  <tr>
156
- <td valign="top">End:</td>
157
- <td><%= text_area(:page_objects, "#{key}-footer", :style => 'border: 1px solid gray; width: 100%;', :rows => '4') %></td>
158
+ <td valign="top">After:</td>
159
+ <td><%= text_area :page_objects, "#{key}-footer", placeholder: options[:footer].to_s.gsub(/\s+/, ' '), style: 'border: 1px solid gray; width: 99%; height: 32px;' %></td>
158
160
  </tr>
159
161
  </table>
160
162
  </fieldset>
@@ -164,12 +166,31 @@
164
166
 
165
167
  <p>This message is displayed when no pages match the search criteria.</p>
166
168
 
167
- <%= text_area(:page_objects, "#{key}-empty_message", :style => 'border: 1px solid gray; width: 100%;', :rows => '4') %>
169
+ <%= text_area :page_objects, "#{key}-empty_message", placeholder: options[:empty_message].to_s.gsub(/\s+/, ' '), style: 'border: 1px solid gray; width: 99%; height: 24px;' %>
168
170
  </fieldset>
169
171
  </div>
170
172
 
171
- <br/>
173
+ <br>
172
174
 
173
175
  <center><button class="form_button" onclick="hideDojoDialog('page_list_<%= key %>'); return false;">Close</button></center>
174
176
  </div>
175
177
  </div>
178
+
179
+ <script type="text/javascript">
180
+ var displayAsList = jQuery('#page_objects_<%= key %>-style-display-as_list').checked;
181
+ jQuery('.page_list_<%= key %>_list_option').toggle(displayAsList);
182
+ jQuery('.page_list_<%= key %>_calendar_option').toggle(!displayAsList);
183
+
184
+ // reattach to a safe place in the DOM (away from styled regions)
185
+ jQuery(document).ready(function () {
186
+ jQuery('#page_list_<%= key %>').appendTo(jQuery('#page_content_form')[0]);
187
+ jQuery('#page_objects_<%= key %>-style-display-as_list').click(function () {
188
+ jQuery('.page_list_<%= key %>_list_option').show();
189
+ jQuery('.page_list_<%= key %>_calendar_option').hide();
190
+ });
191
+ jQuery('#page_objects_<%= key %>-style-display-as_calendar').click(function () {
192
+ jQuery('.page_list_<%= key %>_list_option').hide();
193
+ jQuery('.page_list_<%= key %>_calendar_option').show();
194
+ });
195
+ });
196
+ </script>
@@ -4,9 +4,9 @@
4
4
  -%>
5
5
  <div style="border: 1px solid #f0f0f0;">
6
6
  <table width="100%">
7
- <col width="70" /><col width="*" /><col width="80" />
7
+ <col width="100" /><col width="*" /><col width="80" />
8
8
  <tr>
9
- <td valign="top">Folder <%= i.to_i + 1 %>:</td>
9
+ <td valign="top">Page/Folder <%= i.to_i + 1 %>:</td>
10
10
  <td>
11
11
  <%= text_field(:page_objects, "#{key}-sources-folder#{i}", :class => 'form', :style => 'margin: 0; padding: 2px; border: 1px solid gray; width: 98%;') %><br/>
12
12
  <%= check_box(:page_objects, "#{key}-sources-folder#{i}-expand-folders", { :class => 'form', :style => '' }, 'true', 'false') %>
@@ -3,16 +3,16 @@
3
3
  <%- @template_options.each do |name, type| -%>
4
4
  <%- key = name.gsub(/[^\w\d]/, '_') -%>
5
5
  <table width="100%">
6
- <col width="45%" /><col width="55%" />
6
+ <col width="55%" /><col width="45%" />
7
7
  <tr>
8
8
  <td><%= name %></td>
9
9
  <td>
10
10
  <%=
11
11
  case type
12
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%;'
13
+ check_box :page_objects, "obj-option-#{type}-#{key}"
14
+ else
15
+ text_field :page_objects, "obj-option-#{type}-#{key}", :style => 'width: 96%;'
16
16
  end
17
17
  %>
18
18
  </td>
@@ -1,5 +1,5 @@
1
1
  <table width="100%">
2
- <col width="100" />
2
+ <col width="20" />
3
3
  <tr>
4
4
  <td></td>
5
5
  <td>
@@ -10,28 +10,26 @@
10
10
  <tr>
11
11
  <td valign="top">
12
12
  <pre>
13
- &lt;%= insert_object('Content', :text) %&gt;
14
- &lt;%= insert_object('Top Nav', :snippet) %&gt;
15
- &lt;%= insert_object('My Page List', :page_list,
16
- :header => 'html', :footer => 'html',
17
- :template => 'html', :folders => 'f1,f2',
18
- :include_tags => 't1,t2',
19
- :exclude_tags => 't3,t4',
20
- :require_tags => 't5,t6',
21
- :primary_sort_key => 'article_date',
22
- :primary_sort_direction => 'asc',
23
- :item_count => 5, :item_offset => 1) %&gt;
13
+ &lt;%= text_editor('Content') %&gt;
14
+ &lt;%= snippet('Top Nav') %&gt;
15
+ &lt;%= page_list('My Page List',
16
+ template: 'html', header: 'html', footer: 'html',
17
+ folders: 'f1,f2', include_tags: 't1,t2',
18
+ exclude_tags: 't3,t4', require_tags: 't5,t6',
19
+ primary_sort_key: 'article_date', primary_sort_direction: 'asc',
20
+ item_count: 5, item_offset: 1, use_pagination: 1,
21
+ empty_message: 'Coming soon!') %&gt;
24
22
  </pre>
25
23
  </td>
26
24
  <td valign="top">
27
25
  <pre>
28
26
  &lt;%= template_option('Caption', :string) %&gt;
29
27
 
30
- &lt;% if template_option('Use sidebar?', :checkbox) %&gt;
28
+ &lt;%- if template_option('Use sidebar?', :checkbox) -%&gt;
31
29
  ...
32
- &lt;% else %&gt;
30
+ &lt;%- else -%&gt;
33
31
  ...
34
- &lt;% end %&gt;
32
+ &lt;%- end -%&gt;
35
33
  </pre>
36
34
  </td>
37
35
  </tr>
@@ -1,6 +1,6 @@
1
- <%= form_tag({}, :id => 'page_content_form') do %>
2
- <%= submit_tag 'Save', :id => 'btn_save', :style => 'display: none' %>
3
- <%= render :inline => @template_content %>
1
+ <%= form_tag({}, id: 'page_content_form') do %>
2
+ <%= submit_tag 'Save', id: 'btn_save', style: 'display: none' %>
3
+ <%= render inline: @template_content %>
4
4
  <% end %>
5
5
 
6
6
  <script type="text/javascript">
@@ -2,46 +2,24 @@
2
2
 
3
3
  <h2>Edit Snippet</h2>
4
4
 
5
- <%= form_tag({}, { :onsubmit => "snip_content.toggleEditor();" }) do %>
6
- <table width="100%" height="100%">
7
- <col width="100" />
8
- <tr>
9
- <td>Name:</td>
10
- <td><%= text_field :snip, :name %></td>
11
- </tr>
12
- <tr>
13
- <td valign="top"><div style="margin-top: 2px">Content:</div></td>
14
- <td>
15
- <%= text_area :snip, :content, :class => 'codepress html autocomplete-off', :style => 'width: 100%; height: 600px;' %>
16
- </td>
17
- </tr>
18
- <tr>
19
- <td></td>
20
- <td>
21
- <%= submit_tag 'Save Snippet', :class => 'form_button' %>
22
- <button onclick="$('preview_frame').scrollIntoView(); snip_content.toggleEditor(); $('preview_content').value = $('snip_content_cp').value; $('preview_form').submit(); snip_content.toggleEditor(); return false;" class="form_button">Preview</button>
23
- <%= link_to 'Cancel', :action => 'snippets' %>
24
- </td>
25
- </tr>
26
- </table>
27
- <br/>
28
-
29
- <%= render :partial => 'template_reference' %>
30
- <br/>
31
-
32
- <table width="100%">
33
- <col width="100" />
34
- <tr>
35
- <td valign="top"><div style="margin-top: 2px">Preview:</div></td>
36
- <td>
37
- <iframe id="preview_frame" name="preview_frame" style="width: 100%; height: 600px; border: 1px solid gray;"></iframe>
38
- <%= submit_tag 'Save Snippet', :class => 'form_button' %>
39
- </td>
40
- </tr>
41
- </table>
5
+ <%= form_tag do %>
6
+ <%= text_field :snip, :name, :placeholder => 'Snippet Name', :size => '50' %>
7
+ <div class="codemirror-html-container">
8
+ <%= text_area :snip, :content, :class => 'codemirror-html autocomplete-off' %>
9
+ </div>
10
+ <%= submit_tag 'Save Snippet', :class => 'form_button' %>
11
+ <button onclick="jQuery('#preview_frame').show(); jQuery('#preview_frame')[0].scrollIntoView(); jQuery('#preview_content').val(jQuery('#snip_content').val()); jQuery('#preview_form').submit(); return false;" class="form_button">Preview</button>
12
+ <%= link_to 'Cancel', :action => 'sniplates' %>
13
+ <br/>
14
+
15
+ <br/>
16
+ <%= render :partial => 'template_reference' %>
17
+ <br/>
18
+
19
+ <iframe id="preview_frame" name="preview_frame"></iframe>
42
20
  <% end %>
43
21
 
44
-
45
- <form id="preview_form" action="<%= url_for :controller => '/cms/content', :action => 'preview_template' %>" target="preview_frame">
46
- <textarea id="preview_content" name="temp[content]" style="display: none;"></textarea>
47
- </form>
22
+ <%= form_tag({ :controller => '/cms/content', :action => 'preview_template' }, :id => 'preview_form', :target => 'preview_frame') do %>
23
+ <%= text_area_tag 'temp[content]', '', :id => 'preview_content', :style => 'display: none;' %>
24
+ <%= hidden_field_tag 'mode', 'preview' %>
25
+ <% end %>