imagine_cms 3.0.0.beta7 → 3.0.0.beta8

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.
@@ -59,7 +59,7 @@ module Cms # :nodoc:
59
59
  def show_from_db
60
60
  logger.debug 'Rendering content from database'
61
61
 
62
- # begin
62
+ begin
63
63
  @content_levels = params[:content_path]
64
64
  db_path = params[:content_path]
65
65
  edit_mode = false
@@ -182,10 +182,10 @@ module Cms # :nodoc:
182
182
  return true
183
183
  end
184
184
  end
185
- # rescue Exception => e
186
- # logger.debug "Error rendering from db: #{e.inspect.gsub(/</, '&lt;')} #{e.backtrace}"
187
- # log_error(e)
188
- # end
185
+ rescue Exception => e
186
+ logger.debug "Error rendering from db: #{e.inspect.gsub(/</, '&lt;')} #{e.backtrace}"
187
+ log_error(e)
188
+ end
189
189
 
190
190
  # if we haven't rendered something from the db by now, return false
191
191
  false
@@ -137,57 +137,61 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
137
137
  end
138
138
  end
139
139
 
140
- def edit_master
141
- @file_type = case params[:id]
142
- when 'template' then 'html'
143
- when 'web_stylesheet', 'print_stylesheet' then 'css'
144
- else nil
145
- end
146
-
147
- filename = case params[:id]
148
- when 'template' then File.join('app', 'views', 'layouts', 'application.rhtml')
149
- when 'web_stylesheet' then File.join('public', 'stylesheets', 'default.css')
150
- when 'print_stylesheet' then File.join('public', 'stylesheets', 'print.css')
151
- when 'ie_stylesheet' then File.join('public', 'stylesheets', 'ie.css')
152
- when 'ie6_stylesheet' then File.join('public', 'stylesheets', 'ie6.css')
153
- end
154
- filename = File.join(Rails.root, filename)
155
-
156
- case request.method
157
- when :get
158
- @file_content = File.open(filename, 'r').read
159
- when :post
160
- begin
161
- @pg = CmsPage.new
162
- @page_objects = HashObject.new
163
- render_to_string :inline => params[:file_content]
164
- rescue Exception => e
165
- message = e.message
166
- flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
167
- logger.debug e
168
- return
169
- end
170
-
171
- begin
172
- if params[:file_content].empty?
173
- flash[:error] = 'An error occurred, please contact support.'
174
- else
175
- File.open(filename, 'w') { |f| f.write(params[:file_content]) }
176
- flash[:notice] = 'File saved.'
177
- end
178
-
179
- CmsPage.find(:all).each do |page|
180
- expire_page :controller => 'cms/content', :action => 'show', :content_path => page.path.split('/')
181
- end
182
-
183
- redirect_to :action => 'edit_master', :id => params[:id]
184
- rescue Exception => e
185
- message = e.message
186
- flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
187
- log_error(e)
188
- end
189
- end
190
- end
140
+ #
141
+ # AKN 2012-11-08: This was never really a good idea. Need to figure out a better way. Disabling for now.
142
+ #
143
+
144
+ # def edit_master
145
+ # @file_type = case params[:id]
146
+ # when 'template' then 'html'
147
+ # when 'web_stylesheet', 'print_stylesheet' then 'css'
148
+ # else nil
149
+ # end
150
+ #
151
+ # filename = case params[:id]
152
+ # when 'template' then File.join('app', 'views', 'layouts', 'application.rhtml')
153
+ # when 'web_stylesheet' then File.join('public', 'stylesheets', 'default.css')
154
+ # when 'print_stylesheet' then File.join('public', 'stylesheets', 'print.css')
155
+ # when 'ie_stylesheet' then File.join('public', 'stylesheets', 'ie.css')
156
+ # when 'ie6_stylesheet' then File.join('public', 'stylesheets', 'ie6.css')
157
+ # end
158
+ # filename = File.join(Rails.root, filename)
159
+ #
160
+ # case request.method
161
+ # when :get
162
+ # @file_content = File.open(filename, 'r').read
163
+ # when :post
164
+ # begin
165
+ # @pg = CmsPage.new
166
+ # @page_objects = HashObject.new
167
+ # render_to_string :inline => params[:file_content]
168
+ # rescue Exception => e
169
+ # message = e.message
170
+ # flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
171
+ # logger.debug e
172
+ # return
173
+ # end
174
+ #
175
+ # begin
176
+ # if params[:file_content].empty?
177
+ # flash[:error] = 'An error occurred, please contact support.'
178
+ # else
179
+ # File.open(filename, 'w') { |f| f.write(params[:file_content]) }
180
+ # flash[:notice] = 'File saved.'
181
+ # end
182
+ #
183
+ # CmsPage.find(:all).each do |page|
184
+ # expire_page :controller => 'cms/content', :action => 'show', :content_path => page.path.split('/')
185
+ # end
186
+ #
187
+ # redirect_to :action => 'edit_master', :id => params[:id]
188
+ # rescue Exception => e
189
+ # message = e.message
190
+ # flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
191
+ # log_error(e)
192
+ # end
193
+ # end
194
+ # end
191
195
 
192
196
  def pages
193
197
  @page_levels = [ '' ].concat((params[:path] || session[:cms_pages_path] || '').split('/').reject { |l| l.empty? })
@@ -12,6 +12,10 @@
12
12
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
13
  <head>
14
14
  <title><%= controller.controller_path.split('/').concat([ params[:action] ]).map { |s| s.titlecase }.join(' > ') %></title>
15
+ <%#= javascript_tag 'var djConfig = { isDebug: true };' %>
16
+ <%- if is_logged_in_user? -%>
17
+ <script src="/assets/dojo/dojo.js" type="text/javascript"></script>
18
+ <%- end -%>
15
19
  <%= stylesheet_link_tag "application", :media => "all" %>
16
20
  <%= stylesheet_link_tag "manage", :media => "all" %>
17
21
  <%#= stylesheet_link_tag 'print', :media => 'print' %>
@@ -12,6 +12,7 @@
12
12
  :loading => "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';",
13
13
  :html => { :onsubmit => 'teardownTextFieldHints();' } do -%>
14
14
  <table>
15
+ <col width="120"><col width="*"><col width="5">
15
16
  <%- if (@pg.id || 2) > 1 -%>
16
17
  <tr>
17
18
  <td>Name/URL:</td>
@@ -1,8 +1,8 @@
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 %>'; $('new_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :mode => 'ajax_new', :parent_id => list_page, :authenticity_token => form_authenticity_token.to_s %>', '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', :authenticity_token => form_authenticity_token.to_s %>', 'Page Properties: <%= list_page.name %>'); return false; }; $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page, :authenticity_token => form_authenticity_token.to_s %>'; $('delete_form').action = '<%=raw url_for :action => 'delete_page', :id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages', :level => @page_level + 1, :parent_id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>\');', 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 %>/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, :authenticity_token => form_authenticity_token.to_s %>', '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', :authenticity_token => form_authenticity_token.to_s %>', 'Page Properties: <%= list_page.name %>'); return false; }; $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page, :authenticity_token => form_authenticity_token.to_s %>'; $('delete_form').action = '<%=raw url_for :action => 'delete_page', :id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages', :level => @page_level + 1, :parent_id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>\');', 200);" ondblclick="$('edit_content_form').onsubmit(); $('edit_content_form').submit();">
2
2
  <table cellpadding="0" cellspacing="0" border="0">
3
3
  <tr>
4
4
  <td valign="top"><img src="/assets/management/icon_page.gif" style="margin: 2px 5px 0 0; "/></td>
5
- <td<%= list_page.published_version >= 0 ? '' : ' style="color: gray"' %>><%= list_page.name %></td>
5
+ <td<%= list_page.published_version >= 0 ? '' : ' style="color: gray"'.html_safe %>><%= list_page.name %></td>
6
6
  </tr>
7
7
  </table>
8
8
  </div>
@@ -21,24 +21,14 @@ EOF
21
21
  <%= flash_message %>
22
22
 
23
23
  <div id="columnBrowserToolbar" style="background-color: #d0d0d0; padding: 4px; margin-bottom: 5px; ">
24
- <a id="new_link" href="#">
25
- <img src="/assets/management/btn_top_new.gif" style="margin-right: 2px;" />
26
- </a>
27
- <a id="edit_content_link" href="#" target="_blank">
28
- <img src="/assets/management/btn_top_edit.gif" style="margin-right: 2px;" />
29
- </a>
24
+ <a id="new_link" href="#"><img src="/assets/management/btn_top_new.gif" style="margin-right: 2px;" /></a>
25
+ <a id="edit_content_link" href="#" target="_blank"><img src="/assets/management/btn_top_edit.gif" style="margin-right: 2px;" /></a>
30
26
  <form id="edit_content_form" action="#" onsubmit="this.action = $('edit_content_link').href;" target="_blank" style="display: none">
31
27
  <button>dummy</button>
32
28
  </form>
33
- <a id="edit_link" href="#">
34
- <img src="/assets/management/btn_top_properties.gif" style="margin-right: 2px;" />
35
- </a>
36
- <a id="view_link" href="#" target="_blank">
37
- <img src="/assets/management/btn_top_preview.gif" style="margin-right: 2px;" />
38
- </a>
39
- <a id="delete_link" href="#" onclick="if (confirm('Are you sure you want to delete the selected page?')) { $('delete_form').submit(); } return false;">
40
- <img src="/assets/management/btn_top_delete.gif" style="margin: 0" />
41
- </a>
29
+ <a id="edit_link" href="#"><img src="/assets/management/btn_top_properties.gif" style="margin-right: 2px;" /></a>
30
+ <a id="view_link" href="#" target="_blank"><img src="/assets/management/btn_top_preview.gif" style="margin-right: 2px;" /></a>
31
+ <a id="delete_link" href="#" onclick="if (confirm('Are you sure you want to delete the selected page?')) { $('delete_form').submit(); } return false;"><img src="/assets/management/btn_top_delete.gif" style="margin: 0" /></a>
42
32
  <%= form_tag('', :id => "delete_form", :style => "display: none") do %>
43
33
  <button>dummy</button>
44
34
  <% end %>
@@ -0,0 +1,33 @@
1
+ #
2
+ # define constants related to configurable behaviors (change to proper config.imagine_cms.X later)
3
+ # for now, to override at the site-level:
4
+ # Object.send(:remove_const, :UseCmsPageCaching)
5
+ # UseCmsPageCaching = false
6
+ #
7
+
8
+ # Shouldn't need to adjust these
9
+ ContentIgnoreDirectories = [ '.svn', 'CVS' ] unless defined? ContentIgnoreDirectories
10
+ ContentIgnoreFilesRE = /^\./ unless defined? ContentIgnoreFilesRE
11
+ ContentExcludeFiles = [ 'index' ] unless defined? ContentExcludeFiles
12
+ UseCmsPageCaching = false unless defined? UseCmsPageCaching
13
+ # UseCmsPageDatabase = CmsPage.table_exists? unless defined? UseCmsPageDatabase
14
+ UseCmsAccessLevels = false unless defined? UseCmsAccessLevels
15
+ EnableAssetTimestamping = true unless defined? EnableAssetTimestamping
16
+
17
+ # CMS gallery setup
18
+ GalleryMaxWidth = 586 unless defined? GalleryMaxWidth
19
+ GalleryMaxHeight = 400 unless defined? GalleryMaxHeight
20
+ GalleryThumbWidth = 50 unless defined? GalleryThumbWidth
21
+ GalleryThumbHeight = 50 unless defined? GalleryThumbHeight
22
+
23
+ # SSL settings
24
+ SSL_REDIRECTS_ON = false unless defined?(SSL_REDIRECTS_ON)
25
+ SSL_STANDARD_HOST = 'localhost' unless defined?(SSL_STANDARD_HOST)
26
+ SSL_SECURE_HOST = '127.0.0.1' unless defined?(SSL_SECURE_HOST)
27
+ # if using non-standard ports, also set these:
28
+ # SSL_STANDARD_PORT = 80
29
+ # SSL_SECURE_PORT = 443
30
+
31
+ # Member component
32
+ Member_AllowEmailAsLogin = true unless defined? Member_AllowEmailAsLogin
33
+ Member_RequireMembername = false unless defined? Member_RequireMembername
@@ -6,8 +6,8 @@ module ImagineCms
6
6
  config.app_root = root
7
7
  middleware.use ::ActionDispatch::Static, "#{root}/public"
8
8
 
9
- initializer :assets do |config|
10
- Rails.application.config.assets.precompile += %w( codepress/** dojo/** manage.css )
9
+ initializer "imagine_cms.assets.precompile" do |config|
10
+ Rails.application.config.assets.precompile += %w( codepress/** dojo/** management.css reset.css )
11
11
  end
12
12
 
13
13
  #
@@ -1,3 +1,3 @@
1
1
  module ImagineCms
2
- VERSION = "3.0.0.beta7"
2
+ VERSION = "3.0.0.beta8"
3
3
  end
data/lib/imagine_cms.rb CHANGED
@@ -14,35 +14,3 @@ end
14
14
 
15
15
  # Require our engine
16
16
  require "imagine_cms/engine"
17
-
18
-
19
- #
20
- # define constants related to configurable behaviors (change to proper config.imagine_cms.X later)
21
- #
22
-
23
- # Shouldn't need to adjust these
24
- ContentIgnoreDirectories = [ '.svn', 'CVS' ] unless defined? ContentIgnoreDirectories
25
- ContentIgnoreFilesRE = /^\./ unless defined? ContentIgnoreFilesRE
26
- ContentExcludeFiles = [ 'index' ] unless defined? ContentExcludeFiles
27
- UseCmsPageCaching = false unless defined? UseCmsPageCaching
28
- # UseCmsPageDatabase = CmsPage.table_exists? unless defined? UseCmsPageDatabase
29
- UseCmsAccessLevels = false unless defined? UseCmsAccessLevels
30
- EnableAssetTimestamping = true unless defined? EnableAssetTimestamping
31
-
32
- # CMS gallery setup
33
- GalleryMaxWidth = 586 unless defined? GalleryMaxWidth
34
- GalleryMaxHeight = 400 unless defined? GalleryMaxHeight
35
- GalleryThumbWidth = 50 unless defined? GalleryThumbWidth
36
- GalleryThumbHeight = 50 unless defined? GalleryThumbHeight
37
-
38
- # SSL settings
39
- SSL_REDIRECTS_ON = false unless defined?(SSL_REDIRECTS_ON)
40
- SSL_STANDARD_HOST = 'localhost' unless defined?(SSL_STANDARD_HOST)
41
- SSL_SECURE_HOST = '127.0.0.1' unless defined?(SSL_SECURE_HOST)
42
- # if using non-standard ports, also set these:
43
- # SSL_STANDARD_PORT = 80
44
- # SSL_SECURE_PORT = 443
45
-
46
- # Member component
47
- Member_AllowEmailAsLogin = true unless defined? Member_AllowEmailAsLogin
48
- Member_RequireMembername = false unless defined? Member_RequireMembername
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagine_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta7
4
+ version: 3.0.0.beta8
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -346,6 +346,7 @@ files:
346
346
  - app/views/util/_message.html.erb
347
347
  - app/views/util/_show_message.js.erb
348
348
  - app/views/util/_tab.html.erb
349
+ - config/initializers/constants.rb
349
350
  - config/routes.rb
350
351
  - doc/Gemfile.html
351
352
  - doc/ImagineCms.html