imagine_cms 3.0.0.beta10 → 3.0.0.beta11

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- imagine_cms (3.0.0.beta10)
4
+ imagine_cms (3.0.0.beta11)
5
5
  acts_as_tree (~> 1.1)
6
6
  aws-s3 (~> 0.6.3)
7
7
  mini_magick (~> 3.3)
@@ -92,5 +92,8 @@ h1 .volunteer { background-color: #5E14CD; }
92
92
  h1 .booth { background-color: #0AC153; }
93
93
  h1 .shift { background-color: #0A612C; }
94
94
 
95
+ table.imagine-management tr:hover { background-color: #fff8c6; }
96
+ table.imagine-management th { background-color: #dedede; text-transform: uppercase; }
97
+
95
98
  table.stats th { text-align: center; padding: 1px 8px; border: 1px solid gray; border-collapse: true; }
96
99
  table.stats td { text-align: center; padding: 4px 8px; border: 1px solid gray; border-collapse: true; }
@@ -50,12 +50,18 @@ module Cms # :nodoc:
50
50
  # Renders app/views/errors/404.rhtml with http status 404 Not Found.
51
51
  def not_found
52
52
  # logger.error "404 from #{request.referer}"
53
- # render :template => 'errors/404', :status => 404
53
+ # render :template => 'imagine_cms/errors/404', :status => 404
54
54
 
55
55
  # let Rails handle 404s natively (override if you want to handle manually)
56
56
  raise ActionController::RoutingError.new('404 Not Found')
57
57
  end
58
58
 
59
+ def rendering_error(exception = nil)
60
+ logger.error "500 from #{request.referer} (exception: #{exception})"
61
+ @exception = exception.message
62
+ render :template => 'imagine_cms/errors/500', :status => 500
63
+ end
64
+
59
65
  def show_from_db
60
66
  logger.debug 'Rendering content from database'
61
67
 
@@ -183,8 +189,9 @@ module Cms # :nodoc:
183
189
  end
184
190
  end
185
191
  rescue Exception => e
186
- logger.debug "Error rendering from db: #{e.inspect.gsub(/</, '&lt;')} #{e.backtrace}"
187
- log_error(e)
192
+ logger.debug "Error rendering from db: #{e.class}: #{e.message}"
193
+ # log_error(e)
194
+ return rendering_error(e)
188
195
  end
189
196
 
190
197
  # if we haven't rendered something from the db by now, return false
@@ -30,7 +30,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
30
30
 
31
31
  def check_permissions
32
32
  if !user_has_permission?(:manage_cms)
33
- render '/errors/permission_denied'
33
+ render '/imagine_cms/errors/permission_denied'
34
34
  return false
35
35
  end
36
36
  end
@@ -38,7 +38,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
38
38
  def block_basic_users
39
39
  return true unless UseCmsAccessLevels
40
40
  unless user_has_permission?(:manage_cms_full_access) && @user.cms_allowed_sections.to_s.strip.blank?
41
- render '/errors/permission_denied'
41
+ render '/imagine_cms/errors/permission_denied'
42
42
  return false
43
43
  end
44
44
  end
@@ -308,7 +308,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
308
308
  render :update do |page|
309
309
  case params[:return_to]
310
310
  when 'preview'
311
- page.redirect_to "/#{@pg.path}"
311
+ page.redirect_to "/#{@pg.path}/version/#{@pg.published_version > 0 ? @pg.published_version : @pg.version}"
312
312
  else
313
313
  flash[:notice] = 'Page saved.'
314
314
  session[:cms_pages_path] = @pg.path
@@ -814,8 +814,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
814
814
  end
815
815
 
816
816
  def receive_gallery
817
- require 'zip/zip'
818
-
819
817
  @pg = CmsPage.find_by_id(params[:id])
820
818
  begin
821
819
  data = params[:gallery_file][:data]
@@ -1151,8 +1149,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1151
1149
  create_preview_images(:force => 1)
1152
1150
 
1153
1151
  elsif ext == '.zip'
1154
- require 'zip/zip'
1155
-
1156
1152
  begin
1157
1153
  Zip::ZipFile.foreach(data.path) do |zipentry|
1158
1154
  next if ![ '.jpg', '.jpeg', '.png', '.gif' ].include?(File.extname(zipentry.name).downcase) || zipentry.size < 1000
@@ -1333,6 +1329,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1333
1329
  # get out now if user clicked finish
1334
1330
  if params[:next_clicked].to_i != 1
1335
1331
  @image_file = localfile
1332
+ upload_to_s3(localfile, @pg)
1336
1333
  render :partial => 'crop_results_thumb' and return
1337
1334
  end
1338
1335
 
@@ -1399,6 +1396,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1399
1396
 
1400
1397
  @image_file = localfile
1401
1398
  File.unlink testfile
1399
+ upload_to_s3(localfile, @pg)
1402
1400
 
1403
1401
  render :partial => 'crop_results_thumb'
1404
1402
  end
@@ -1415,6 +1413,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1415
1413
  # get out now if user clicked finish
1416
1414
  if params[:next_clicked].to_i != 1
1417
1415
  @image_file = localfile
1416
+ upload_to_s3(localfile, @pg)
1418
1417
  render :partial => 'crop_results_feature_image' and return
1419
1418
  end
1420
1419
 
@@ -1481,6 +1480,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1481
1480
 
1482
1481
  @image_file = localfile
1483
1482
  File.unlink testfile
1483
+ upload_to_s3(localfile, @pg)
1484
1484
 
1485
1485
  render :partial => 'crop_results_feature_image'
1486
1486
  end
@@ -1654,7 +1654,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
1654
1654
  s3retries = 0
1655
1655
  s3success = false
1656
1656
 
1657
-
1658
1657
  if ImagineCmsConfig['amazon_s3'] && ImagineCmsConfig['amazon_s3']['enabled']
1659
1658
  filename = File.join(Rails.root, 'public', 'assets', 'content', page.path, File.basename(filename))
1660
1659
  prefix = ImagineCmsConfig['amazon_s3'][Rails.env]['image_prefix']
@@ -280,7 +280,7 @@ module CmsApplicationHelper
280
280
 
281
281
 
282
282
  def load_page_objects(obj_type = nil, name = nil)
283
- if params[:version].to_i > 0 && params[:version].to_i != @pg.published_version
283
+ if params[:version].to_i > 0 && params[:version].to_i != @pg.published_version && !(@pg.published_version == 0 && params[:version].to_i == @pg.version)
284
284
  if is_logged_in_user?
285
285
  if user_has_permission?(:manage_cms)
286
286
  @pg.revert_to(params[:version].to_i)
@@ -1096,16 +1096,20 @@ EOF
1096
1096
  ret += javascript_tag("cropper = new Cropper.Img('testImage', { minWidth: 0, minHeight: 0, captureKeys: false, onEndCrop: onEndCrop });")
1097
1097
  end
1098
1098
 
1099
- def page_image_tag(page, filename)
1099
+ def page_image_path(page, filename)
1100
1100
  if ImagineCmsConfig['amazon_s3'] && ImagineCmsConfig['amazon_s3']['enabled']
1101
1101
  prefix = ImagineCmsConfig['amazon_s3'][Rails.env]['image_prefix']
1102
1102
  hostname = ImagineCmsConfig['amazon_s3'][Rails.env]['image_hostname']
1103
- "<img src=\"//#{hostname}/#{prefix}/#{page.path.blank? ? 'index' : page.path}/#{File.basename(filename)}\" alt=\"#{File.basename(filename, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize}\" />".html_safe
1103
+ "//#{hostname}/#{prefix}/#{page.path.blank? ? 'index' : page.path}/#{File.basename(filename)}"
1104
1104
  else
1105
- "<img src=\"/#{File.join('assets', 'content', page.path, File.basename(filename))}\" alt=\"#{File.basename(filename, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize}\" />".html_safe
1105
+ "/#{File.join('assets', 'content', page.path, File.basename(filename))}"
1106
1106
  end
1107
1107
  end
1108
1108
 
1109
+ def page_image_tag(page, filename)
1110
+ "<img src=\"#{page_image_path(page, filename)}\" alt=\"#{File.basename(filename, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize}\" />".html_safe
1111
+ end
1112
+
1109
1113
  def copyright_year(year)
1110
1114
  year_str, this_year = year.to_s, Time.now.year.to_s
1111
1115
  year_str << "&ndash;#{this_year}" if ((year_str.to_i.to_s == year_str) and (year_str.to_i != this_year.to_i))
@@ -0,0 +1,6 @@
1
+ class UserGroup < ActiveRecord::Base # :nodoc:
2
+ has_and_belongs_to_many :users, :join_table => 'user_group_memberships'
3
+
4
+ validates_presence_of :name
5
+ validates_uniqueness_of :name
6
+ end
@@ -0,0 +1,8 @@
1
+ <h2 style="text-transform: uppercase;">Sorry, an error occurred</h2>
2
+
3
+ <p>There was an error loading the page you requested. Please try again later, or contact the site owner if the error persists.</p>
4
+
5
+ <p style="margin-top: 100px; color: #999;">
6
+ Diagnostic Message:<br>
7
+ <pre style="color: #999"><%= @exception %></pre>
8
+ </p>
@@ -1 +1 @@
1
- <%= javascript_tag "$('pg_feature_image_path').value = '/#{File.join('images', 'content', @pg.path, File.basename(@image_file))}'; $('feature_image_preview').innerHTML = '#{page_image_tag(@pg, @image_file)}'; cancelSelectThumbnail();" %>
1
+ <%= javascript_tag "$('pg_feature_image_path').value = '#{page_image_path(@pg, @image_file)}'; $('feature_image_preview').innerHTML = '#{page_image_tag(@pg, @image_file)}'; cancelSelectThumbnail();" %>
@@ -1 +1 @@
1
- <%= javascript_tag "$('pg_thumbnail_path').value = '/#{File.join('images', 'content', @pg.path, File.basename(@image_file))}'; $('thumbnail_preview').innerHTML = '#{page_image_tag(@pg, @image_file)}'; cancelSelectThumbnail();" %>
1
+ <%= javascript_tag "$('pg_thumbnail_path').value = '#{page_image_path(@pg, @image_file)}'; $('thumbnail_preview').innerHTML = '#{page_image_tag(@pg, @image_file)}'; cancelSelectThumbnail();" %>
@@ -38,7 +38,7 @@
38
38
  <td>
39
39
  <%= select :pg, :cms_template_id, CmsTemplate.find(:all, :order => 'name').collect { |t| [ t.name, t.id ] }, {}, :class => 'form', :style => 'width: 100%;', :onchange => '' %>
40
40
 
41
- <div id="edit_page_template_options" style="background-color: white; width: 100%; height: 80px; overflow: auto; border: 1px solid #aaaaaa">
41
+ <div id="edit_page_template_options" style="background-color: white; width: 100%; height: 60px; overflow: auto; border: 1px solid #aaaaaa">
42
42
  <%= render :partial => 'template_options' %>
43
43
  </div>
44
44
  <%= observe_field 'pg_cms_template_id', :update => 'edit_page_template_options', :with => 'template_id',
@@ -106,18 +106,18 @@
106
106
  <%- if @pg.new_record? -%>
107
107
  A thumbnail cannot be added until you save this page.
108
108
  <%- else -%>
109
- <div id="thumbnail_preview">
109
+ <div id="thumbnail_preview" style="width: 100%; overflow: auto;">
110
110
  <%- if @pg.thumbnail_path.empty? -%>
111
111
  no thumbnail image selected
112
112
  <%- else -%>
113
- <%= image_tag(@pg.thumbnail_path) %>
113
+ <%= image_tag(@pg.thumbnail_path, :onclick => "jQuery('#pg_thumbnail_path').show();") %>
114
114
  <%- end -%>
115
115
  </div>
116
116
  <%= button_to_function "Select Thumbnail...",
117
- "selectThumbnail('#{url_for :action => 'upload_thumb', :id => @pg.id}');",
117
+ "selectThumbnail('#{url_for :action => 'upload_thumb', :id => @pg}');",
118
118
  :class => 'form_button' %>
119
119
  <%- end -%>
120
- <%= text_field :pg, :thumbnail_path, :class => 'form', :style => 'width: 350px; display: inline;' %>
120
+ <%= text_field :pg, :thumbnail_path, :class => 'form', :style => 'width: 100%; display: none;' %>
121
121
  </td>
122
122
  </tr>
123
123
  <%- if @pg.respond_to?(:feature_image_path) -%>
@@ -127,18 +127,18 @@
127
127
  <%- if @pg.new_record? -%>
128
128
  A feature image cannot be added until you save this page.
129
129
  <%- else -%>
130
- <div id="feature_image_preview">
130
+ <div id="feature_image_preview" style="width: 100%; overflow: auto;">
131
131
  <%- if @pg.feature_image_path.empty? -%>
132
132
  no feature image selected
133
133
  <%- else -%>
134
- <%= image_tag(@pg.feature_image_path) %>
134
+ <%= image_tag(@pg.feature_image_path, :onclick => "jQuery('#pg_feature_image_path').show();") %>
135
135
  <%- end -%>
136
136
  </div>
137
137
  <%= button_to_function "Select Feature Image...",
138
- "selectThumbnail('#{url_for :action => 'upload_feature_image', :id => @pg.id}');",
138
+ "selectThumbnail('#{url_for :action => 'upload_feature_image', :id => @pg}');",
139
139
  :class => 'form_button' %>
140
140
  <%- end -%>
141
- <%= text_field :pg, :feature_image_path, :class => 'form', :style => 'width: 350px; display: inline;' %>
141
+ <%= text_field :pg, :feature_image_path, :class => 'form', :style => 'width: 100%; display: none;' %>
142
142
  </td>
143
143
  </tr>
144
144
  <%- end -%>
@@ -158,7 +158,7 @@
158
158
  </td>
159
159
  </tr>
160
160
  </table>
161
- <div id="custom_attributes" style="background-color: white; height: 100px; overflow: auto; border: 1px solid #aaaaaa">
161
+ <div id="custom_attributes" style="background-color: white; height: 80px; overflow: auto; border: 1px solid #aaaaaa">
162
162
  <%- @page_objects.each do |key,val| -%>
163
163
  <%- key =~ /^obj-(\w+?)-(.+?)$/ -%>
164
164
  <%= render :partial => 'page_attribute', :locals => { :name => $2 } if $1 == 'attribute' %>
@@ -79,7 +79,7 @@ EOF
79
79
  <script type="text/javascript">
80
80
  cbNumColumns = <%= @page_levels.size - 1 %>;
81
81
  $('columnBrowserLevel' + cbNumColumns).scrollIntoView();
82
- $('view_link').href = '/<%= list_page.path %>';
82
+ $('view_link').href = '<%= list_page.path.blank? ? '' : '/' + list_page.path %>/version/<%= list_page.published_version > 0 ? list_page.published_version : list_page.version %>';
83
83
  $('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; };
84
84
  $('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; };
85
85
  $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page, :authenticity_token => form_authenticity_token.to_s %>';
@@ -1,14 +1,12 @@
1
1
  <h2>CMS &raquo; Snippets</h2>
2
2
 
3
- <%= flash_message %>
3
+ <p><%= button_to 'Create New Snippet', :action => 'edit_snippet' %></p>
4
4
 
5
- <button onclick="location.href = '<%= url_for :action => 'edit_snippet' %>'" class="form_button">Create Snippet</button>
6
- <br/>
7
- <br/>
5
+ <%= flash_message %>
8
6
 
9
- <table>
7
+ <table cellpadding="3" width="400" class="imagine-management">
10
8
  <tr>
11
- <td>Name</td>
9
+ <th>Name</th>
12
10
  </tr>
13
11
  <%= render :partial => 'snippet', :collection => @snippets %>
14
12
  </table>
@@ -1,14 +1,12 @@
1
1
  <h2>CMS &raquo; Templates</h2>
2
2
 
3
- <%= flash_message %>
3
+ <p><%= button_to 'Create New Template', :action => 'edit_template' %></p>
4
4
 
5
- <button onclick="location.href = '<%= url_for :action => 'edit_template' %>'" class="form_button">Create Template</button>
6
- <br/>
7
- <br/>
5
+ <%= flash_message %>
8
6
 
9
- <table>
7
+ <table cellpadding="3" width="400" class="imagine-management">
10
8
  <tr>
11
- <td>Name</td>
9
+ <th>Name</th>
12
10
  </tr>
13
11
  <%= render :partial => 'temp', :collection => @temps %>
14
12
  </table>
@@ -1,15 +1,15 @@
1
- <h2>Manage Users</h2><br/>
1
+ <h2>CMS &raquo; Users</h2>
2
2
 
3
- <%= link_to raw('Create a new user &raquo;'), :action => 'create' %>
3
+ <p><%= button_to 'Create New User', :action => 'create' %></p>
4
4
 
5
5
  <%= flash_message %>
6
6
 
7
- <table cellspacing="3" cellpadding="1" border="0" width="95%">
7
+ <table cellpadding="3" width="95%" class="imagine-management">
8
8
  <tr>
9
- <td bgcolor="#dedede" width="26%"><b>USERNAME</b></td>
10
- <td bgcolor="#dedede" width="22%"><b>FIRST NAME</b></td>
11
- <td bgcolor="#dedede" width="22%"><b>LAST NAME</b></td>
12
- <td bgcolor="#dedede" width="10%"><b>Active?</b></td>
9
+ <th width="26%">Username</th>
10
+ <th width="22%">First Name</th>
11
+ <th width="22%">Last Name</th>
12
+ <th width="10%">Active?</th>
13
13
  <td bgcolor="#dedede" width="10%">&nbsp;</td>
14
14
  <td bgcolor="#dedede" width="10%">&nbsp;</td>
15
15
  </tr>
@@ -18,9 +18,9 @@
18
18
  <td><%= link_to u.username, :action => 'edit', :id => u %></td>
19
19
  <td><%= u.first_name %></td>
20
20
  <td><%= u.last_name %></td>
21
- <td><%= u.active ? 'Y' : 'N' %>
21
+ <td><%= u.active? ? 'Y' : 'N' %>
22
22
  <td><%= button_to((u.active ? 'Disable' : 'Enable'), { :action => (u.active ? 'disable' : 'enable'), :id => u}, { :class => 'form_button' }) if u.username != session[:user_username] %></td>
23
23
  <td><%= button_to('Delete', { :action => 'destroy', :id => u }, { :confirm => 'Are you sure you want to delete ' + u.username + '?', :class => 'form_button' }) if u.username != session[:user_username] %></td>
24
24
  </tr>
25
25
  <% end %>
26
- </table><br/>
26
+ </table>
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_dependency "aws-s3", "~> 0.6.3"
28
28
  s.add_dependency "rmagick"
29
29
  s.add_dependency "mini_magick", "~> 3.3"
30
+ s.add_dependency "rubyzip"
30
31
  s.add_dependency "rinku", "~> 1.7.2"
31
32
  s.add_dependency "net-dns", "~> 0.7.1"
32
33
  s.add_dependency "acts_as_tree", "~> 1.1"
@@ -17,6 +17,7 @@ module ImagineCms
17
17
  require 'aws/s3'
18
18
  require 'RMagick'
19
19
  require 'mini_magick'
20
+ require 'zip/zip'
20
21
  require 'rails_rinku'
21
22
  require 'net/dns'
22
23
  require 'acts_as_tree'
@@ -1,3 +1,3 @@
1
1
  module ImagineCms
2
- VERSION = "3.0.0.beta10"
2
+ VERSION = "3.0.0.beta11"
3
3
  end
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.beta10
4
+ version: 3.0.0.beta11
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-15 00:00:00.000000000 Z
12
+ date: 2012-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: '3.3'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rubyzip
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: rinku
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -332,12 +348,14 @@ files:
332
348
  - app/models/cms_snippet.rb
333
349
  - app/models/cms_template.rb
334
350
  - app/models/user.rb
351
+ - app/models/user_group.rb
335
352
  - app/sweepers/cms_content_sweeper.rb
336
- - app/views/errors/404.html.erb
337
- - app/views/errors/permission_denied.html.erb
338
353
  - app/views/imagine_cms/_dialogs.html.erb
339
354
  - app/views/imagine_cms/_header.html.erb
340
355
  - app/views/imagine_cms/_toolbar.html.erb
356
+ - app/views/imagine_cms/errors/404.html.erb
357
+ - app/views/imagine_cms/errors/500.html.erb
358
+ - app/views/imagine_cms/errors/permission_denied.html.erb
341
359
  - app/views/layouts/management.html.erb
342
360
  - app/views/management/cms/_complete_gallery.html.erb
343
361
  - app/views/management/cms/_create_file_link.html.erb