alchemy_cms 2.2.rc3 → 2.2.rc6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/alchemy_cms.gemspec +1 -0
  2. data/app/assets/stylesheets/alchemy/base.css.scss +1 -1
  3. data/app/assets/stylesheets/alchemy/sitemap.css.scss +3 -0
  4. data/app/controllers/alchemy/admin/attachments_controller.rb +1 -1
  5. data/app/controllers/alchemy/admin/contents_controller.rb +1 -1
  6. data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
  7. data/app/controllers/alchemy/admin/elements_controller.rb +1 -1
  8. data/app/controllers/alchemy/admin/essence_audios_controller.rb +1 -1
  9. data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
  10. data/app/controllers/alchemy/admin/essence_flashes_controller.rb +1 -1
  11. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +1 -1
  12. data/app/controllers/alchemy/admin/essence_videos_controller.rb +1 -1
  13. data/app/controllers/alchemy/admin/pages_controller.rb +4 -4
  14. data/app/controllers/alchemy/admin/resources_controller.rb +2 -3
  15. data/app/controllers/alchemy/admin/users_controller.rb +2 -2
  16. data/app/controllers/alchemy/base_controller.rb +8 -1
  17. data/app/controllers/alchemy/pages_controller.rb +2 -0
  18. data/app/models/alchemy/attachment.rb +2 -0
  19. data/app/models/alchemy/cell.rb +2 -0
  20. data/app/models/alchemy/content.rb +17 -4
  21. data/app/models/alchemy/element.rb +22 -3
  22. data/app/models/alchemy/essence_audio.rb +2 -0
  23. data/app/models/alchemy/essence_date.rb +2 -0
  24. data/app/models/alchemy/essence_file.rb +2 -0
  25. data/app/models/alchemy/essence_flash.rb +2 -0
  26. data/app/models/alchemy/essence_html.rb +2 -0
  27. data/app/models/alchemy/essence_picture.rb +15 -0
  28. data/app/models/alchemy/essence_richtext.rb +2 -0
  29. data/app/models/alchemy/essence_text.rb +10 -0
  30. data/app/models/alchemy/essence_video.rb +8 -0
  31. data/app/models/alchemy/folded_page.rb +1 -0
  32. data/app/models/alchemy/language.rb +11 -0
  33. data/app/models/alchemy/message.rb +7 -10
  34. data/app/models/alchemy/page.rb +28 -7
  35. data/app/models/alchemy/picture.rb +8 -0
  36. data/app/models/alchemy/user.rb +12 -8
  37. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  38. data/app/views/alchemy/admin/pictures/show_in_window.html.erb +1 -1
  39. data/app/views/alchemy/pictures/zoom.jpg.flexi +3 -0
  40. data/config/alchemy/config.yml +9 -13
  41. data/config/locales/alchemy.de.yml +29 -15
  42. data/config/locales/alchemy.en.yml +27 -10
  43. data/lib/alchemy/version.rb +1 -1
  44. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -1
  45. data/spec/controllers/pages_controller_spec.rb +8 -8
  46. data/spec/dummy/app/models/event.rb +1 -0
  47. data/spec/dummy/config/application.rb +26 -8
  48. data/spec/dummy/config/environments/development.rb +8 -8
  49. data/spec/dummy/config/environments/production.rb +9 -2
  50. data/spec/dummy/config/environments/test.rb +6 -11
  51. data/spec/factories.rb +1 -1
  52. data/spec/helpers/elements_helper_spec.rb +4 -4
  53. data/spec/models/language_spec.rb +2 -2
  54. data/spec/models/page_spec.rb +2 -2
  55. data/spec/spec_helper.rb +1 -2
  56. metadata +36 -38
data/alchemy_cms.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{An extremly flexbile CMS for Rails 3.2}
13
13
  s.description = %q{Alchemy is a Rails 3 CMS with a flexible content storing architecture.}
14
14
  s.requirements << 'ImageMagick (libmagick), v6.6 or greater.'
15
+ s.required_ruby_version = '>= 1.8.7'
15
16
  s.license = 'BSD New'
16
17
 
17
18
  s.files = `git ls-files`.split("\n")
@@ -393,7 +393,7 @@ ul#layoutpages.list li {
393
393
  }
394
394
 
395
395
  ul#sitemap.list {
396
- padding: 0;
396
+ padding: 0 0 104px 0;
397
397
  }
398
398
 
399
399
  ul.list li {
@@ -41,6 +41,9 @@ div#bottom_buttons {
41
41
  padding-right: 4px;
42
42
  font-size: 10px;
43
43
  padding-left: 4px;
44
+ max-width: 45%;
45
+ white-space: nowrap;
46
+ overflow: hidden;
44
47
  }
45
48
 
46
49
  .sitemap_pagename_link.odd {
@@ -50,7 +50,7 @@ module Alchemy
50
50
  def update
51
51
  @attachment = Attachment.find(params[:id])
52
52
  oldname = @attachment.name
53
- if @attachment.update_attributes(params[:attachment], :as => current_user.role.to_sym)
53
+ if @attachment.update_attributes(params[:attachment])
54
54
  flash[:notice] = t("File renamed successfully from: '%{from}' to '%{to}'", :from => oldname, :to => @attachment.name)
55
55
  else
56
56
  render :action => "edit"
@@ -37,7 +37,7 @@ module Alchemy
37
37
 
38
38
  def update
39
39
  content = Content.find(params[:id])
40
- content.essence.update_attributes(params[:content], :as => current_user.role.to_sym)
40
+ content.essence.update_attributes(params[:content])
41
41
  end
42
42
 
43
43
  def order
@@ -7,7 +7,7 @@ module Alchemy
7
7
  @clipboard_items = session[:clipboard]
8
8
  @last_edited_pages = Page.all_last_edited_from(current_user)
9
9
  @locked_pages = Page.all_locked
10
- @online_users = User.all_online.to_a.delete_if { |u| u == current_user }
10
+ @online_users = User.logged_in.to_a - [current_user]
11
11
  @first_time = current_user.login_count == 1 && current_user.last_login_at.nil?
12
12
  end
13
13
 
@@ -54,7 +54,7 @@ module Alchemy
54
54
  if @element.save
55
55
  render :action => :create
56
56
  else
57
- render_remote_errors(@element, 'form#new_element button.button')
57
+ render_remote_errors(@element, 'form#new_alchemy_element button.button')
58
58
  end
59
59
  end
60
60
 
@@ -4,7 +4,7 @@ module Alchemy
4
4
 
5
5
  def update
6
6
  @essence_audio = EssenceAudio.find(params[:id])
7
- @essence_audio.update_attributes(params[:essence_audio], :as => current_user.role.to_sym)
7
+ @essence_audio.update_attributes(params[:essence_audio])
8
8
  end
9
9
 
10
10
  end
@@ -12,7 +12,7 @@ module Alchemy
12
12
 
13
13
  def update
14
14
  @essence_file = EssenceFile.find(params[:id])
15
- @essence_file.update_attributes(params[:essence_file], :as => current_user.role.to_sym)
15
+ @essence_file.update_attributes(params[:essence_file])
16
16
  end
17
17
 
18
18
  def assign
@@ -4,7 +4,7 @@ module Alchemy
4
4
 
5
5
  def update
6
6
  @essence_flash = EssenceFlash.find(params[:id])
7
- @essence_flash.update_attributes(params[:essence_flash], :as => current_user.role.to_sym)
7
+ @essence_flash.update_attributes(params[:essence_flash])
8
8
  end
9
9
 
10
10
  end
@@ -47,7 +47,7 @@ module Alchemy
47
47
 
48
48
  def update
49
49
  @essence_picture = EssencePicture.find(params[:id])
50
- @essence_picture.update_attributes(params[:essence_picture], :as => current_user.role.to_sym)
50
+ @essence_picture.update_attributes(params[:essence_picture])
51
51
  @content = Content.find(params[:content_id])
52
52
  end
53
53
 
@@ -4,7 +4,7 @@ module Alchemy
4
4
 
5
5
  def update
6
6
  @essence_video = EssenceVideo.find(params[:id])
7
- @essence_video.update_attributes(params[:essence_video], :as => current_user.role.to_sym)
7
+ @essence_video.update_attributes(params[:essence_video])
8
8
  end
9
9
 
10
10
  end
@@ -57,9 +57,9 @@ module Alchemy
57
57
  })
58
58
  source_page.copy_children_to(page) unless source_page.children.blank?
59
59
  else
60
- page = Page.create(params[:page], :as => current_user.role.to_sym)
60
+ page = Page.create(params[:page])
61
61
  end
62
- render_errors_or_redirect(page, parent.layoutpage? ? admin_layoutpages_path : admin_pages_path, t("Page created", :name => page.name), 'form#new_page_form button.button')
62
+ render_errors_or_redirect(page, parent.layoutpage? ? admin_layoutpages_path : admin_pages_path, t("Page created", :name => page.name), '#alchemyOverlay button.button')
63
63
  end
64
64
 
65
65
  # Edit the content of the page and all its elements and contents.
@@ -87,11 +87,11 @@ module Alchemy
87
87
 
88
88
  def update
89
89
  # fetching page via before filter
90
- if @page.update_attributes(params[:page], :as => current_user.role.to_sym)
90
+ if @page.update_attributes(params[:page])
91
91
  @notice = t("Page saved", :name => @page.name)
92
92
  @while_page_edit = request.referer.include?('edit')
93
93
  else
94
- render_remote_errors(@page, "form#edit_page_#{@page.id} button.button")
94
+ render_remote_errors(@page, "#alchemyOverlay button.button")
95
95
  end
96
96
  end
97
97
 
@@ -10,7 +10,6 @@ module Alchemy
10
10
 
11
11
  before_filter :load_resource, :only => [:show, :edit, :update, :destroy]
12
12
 
13
-
14
13
  def index
15
14
  if params[:query].blank?
16
15
  items = resource_handler.model
@@ -37,7 +36,7 @@ module Alchemy
37
36
  end
38
37
 
39
38
  def create
40
- instance_variable_set("@#{resource_handler.model_name}", resource_handler.model.new(params[resource_handler.namespaced_model_name.to_sym], :as => current_user.role.to_sym))
39
+ instance_variable_set("@#{resource_handler.model_name}", resource_handler.model.new(params[resource_handler.namespaced_model_name.to_sym]))
41
40
  resource_instance_variable.save
42
41
  render_errors_or_redirect(
43
42
  resource_instance_variable,
@@ -47,7 +46,7 @@ module Alchemy
47
46
  end
48
47
 
49
48
  def update
50
- resource_instance_variable.update_attributes(params[resource_handler.namespaced_model_name.to_sym], :as => current_user.role.to_sym)
49
+ resource_instance_variable.update_attributes(params[resource_handler.namespaced_model_name.to_sym])
51
50
  render_errors_or_redirect(
52
51
  resource_instance_variable,
53
52
  resources_path,
@@ -28,7 +28,7 @@ module Alchemy
28
28
  end
29
29
 
30
30
  def create
31
- @user = User.new(params[:user], :as => current_user.role.to_sym)
31
+ @user = User.new(params[:user])
32
32
  if @user.save
33
33
  if @user.role == "registered" && params[:send_credentials]
34
34
  Notifications.registered_user_created(@user).deliver
@@ -51,7 +51,7 @@ module Alchemy
51
51
 
52
52
  def update
53
53
  # User is fetched via before filter
54
- @user.update_attributes(params[:user], :as => current_user.role.to_sym)
54
+ @user.update_attributes(params[:user])
55
55
  Notifications.admin_user_created(@user).deliver if params[:send_credentials]
56
56
  render_errors_or_redirect(
57
57
  @user,
@@ -124,6 +124,13 @@ module Alchemy
124
124
  end
125
125
  end
126
126
 
127
+ def render_404(exception = nil)
128
+ if exception
129
+ logger.info "Rendering 404: #{exception.message}"
130
+ end
131
+ render :file => "#{Rails.root}/public/404", :status => 404
132
+ end
133
+
127
134
  protected
128
135
 
129
136
  def permission_denied
@@ -132,7 +139,7 @@ module Alchemy
132
139
  redirect_to alchemy.root_path
133
140
  else
134
141
  if request.referer == alchemy.login_url
135
- render :file => File.join(Rails.root.to_s, 'public', '422.html'), :status => 422, :layout => false
142
+ render :file => Rails.root.join('public/422'), :status => 422
136
143
  elsif request.xhr?
137
144
  respond_to do |format|
138
145
  format.js {
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class PagesController < Alchemy::BaseController
3
3
 
4
+ rescue_from ActionController::RoutingError, :with => :render_404
5
+
4
6
  # We need to include this helper because we need the breadcrumb method.
5
7
  # And we cannot define the breadcrump method as helper_method, because rspec does not see helper_methods.
6
8
  # Not the best solution, but's working.
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class Attachment < ActiveRecord::Base
3
3
 
4
+ attr_accessible :uploaded_data, :name
5
+
4
6
  stampable
5
7
 
6
8
  has_attachment(
@@ -13,6 +13,8 @@
13
13
  module Alchemy
14
14
  class Cell < ActiveRecord::Base
15
15
 
16
+ attr_accessible :page_id, :name
17
+
16
18
  belongs_to :page
17
19
  validates_uniqueness_of :name, :scope => :page_id
18
20
  has_many :elements, :dependent => :destroy, :order => :position
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class Content < ActiveRecord::Base
3
3
 
4
+ attr_accessible :name, :element_id, :do_not_index, :essence_type, :essence_id
5
+
4
6
  belongs_to :essence, :polymorphic => true, :dependent => :destroy
5
7
  belongs_to :element
6
8
 
@@ -73,11 +75,22 @@ module Alchemy
73
75
  # @copy.element_id # => 3
74
76
  #
75
77
  def self.copy(source, differences = {})
76
- differences[:position] = nil
77
- differences[:id] = nil
78
- attributes = source.attributes.except("id").merge(differences)
78
+ attributes = source.attributes.except(
79
+ "position",
80
+ "created_at",
81
+ "updated_at",
82
+ "creator_id",
83
+ "updater_id",
84
+ "id"
85
+ ).merge(differences.stringify_keys)
79
86
  content = self.create!(attributes)
80
- new_essence = content.essence.class.new(content.essence.attributes.except('id'))
87
+ new_essence = content.essence.class.new(content.essence.attributes.except(
88
+ "id",
89
+ "creator_id",
90
+ "updater_id",
91
+ "created_at",
92
+ "updated_at"
93
+ ))
81
94
  new_essence.save!
82
95
  raise "Essence not cloned" if new_essence.id == content.essence_id
83
96
  content.update_attribute(:essence_id, new_essence.id)
@@ -1,6 +1,16 @@
1
1
  module Alchemy
2
2
  class Element < ActiveRecord::Base
3
3
 
4
+ attr_accessible(
5
+ :name,
6
+ :unique,
7
+ :page_id,
8
+ :public,
9
+ :cell_id,
10
+ :folded,
11
+ :create_contents_after_create
12
+ )
13
+
4
14
  # All Elements inside a cell are a list. All Elements not in cell are in the cell_id.nil list.
5
15
  acts_as_list :scope => [:page_id, :cell_id]
6
16
  stampable :stamper_class_name => :user
@@ -11,7 +21,7 @@ module Alchemy
11
21
  has_and_belongs_to_many :to_be_sweeped_pages, :class_name => 'Alchemy::Page', :uniq => true, :join_table => 'alchemy_elements_alchemy_pages'
12
22
 
13
23
  validates_uniqueness_of :position, :scope => [:page_id, :cell_id]
14
- validates_presence_of :name, :on => :create, :message => '^' + I18n.t(:choose_element)
24
+ validates_presence_of :name, :on => :create
15
25
 
16
26
  attr_accessor :create_contents_after_create
17
27
 
@@ -218,8 +228,17 @@ module Alchemy
218
228
  # @copy.public? # => false
219
229
  #
220
230
  def self.copy(source, differences = {})
221
- attributes = source.attributes.except("id").merge(differences)
222
- element = self.create!(attributes.merge(:create_contents_after_create => false, :id => nil, :position => nil))
231
+ attributes = source.attributes.except(
232
+ "id",
233
+ "position",
234
+ "folded",
235
+ "created_at",
236
+ "updated_at",
237
+ "creator_id",
238
+ "updater_id",
239
+ "cell_id"
240
+ ).merge(differences.stringify_keys)
241
+ element = self.create!(attributes.merge(:create_contents_after_create => false))
223
242
  source.contents.each do |content|
224
243
  new_content = Content.copy(content, :element_id => element.id)
225
244
  new_content.move_to_bottom
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class EssenceAudio < ActiveRecord::Base
3
3
 
4
+ attr_accessible :width, :height, :show_eq, :show_navigation
5
+
4
6
  acts_as_essence(
5
7
  :ingredient_column => :attachment,
6
8
  :preview_text_method => :name
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class EssenceDate < ActiveRecord::Base
3
3
 
4
+ attr_accessible :date
5
+
4
6
  acts_as_essence(
5
7
  :ingredient_column => :date
6
8
  )
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class EssenceFile < ActiveRecord::Base
3
3
 
4
+ attr_accessible :title, :css_class
5
+
4
6
  acts_as_essence(
5
7
  :ingredient_column => :attachment,
6
8
  :preview_text_method => :name
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class EssenceFlash < ActiveRecord::Base
3
3
 
4
+ attr_accessible :width, :height, :player_version
5
+
4
6
  acts_as_essence(
5
7
  :ingredient_column => :attachment,
6
8
  :preview_text_method => :name
@@ -1,6 +1,8 @@
1
1
  module Alchemy
2
2
  class EssenceHtml < ActiveRecord::Base
3
3
 
4
+ attr_accessible :source
5
+
4
6
  acts_as_essence(
5
7
  :ingredient_column => :source
6
8
  )
@@ -1,6 +1,21 @@
1
1
  module Alchemy
2
2
  class EssencePicture < ActiveRecord::Base
3
3
 
4
+ attr_accessible(
5
+ :caption,
6
+ :title,
7
+ :alt_tag,
8
+ :link,
9
+ :link_class_name,
10
+ :link_title,
11
+ :css_class,
12
+ :link_target,
13
+ :crop_from,
14
+ :crop_size,
15
+ :render_size,
16
+ :picture_id
17
+ )
18
+
4
19
  acts_as_essence(
5
20
  :ingredient_column => :picture,
6
21
  :preview_text_method => :name
@@ -5,6 +5,8 @@ module Alchemy
5
5
  :preview_text_column => :stripped_body
6
6
  )
7
7
 
8
+ attr_accessible :do_not_index, :body, :public, :stripped_body
9
+
8
10
  # Require acts_as_ferret only if Ferret full text search is enabled (default).
9
11
  # You can disable it in +config/alchemy/config.yml+
10
12
  if Config.get(:ferret) == true
@@ -3,6 +3,16 @@ module Alchemy
3
3
 
4
4
  acts_as_essence
5
5
 
6
+ attr_accessible(
7
+ :do_not_index,
8
+ :body,
9
+ :public,
10
+ :link,
11
+ :link_title,
12
+ :link_class_name,
13
+ :link_target
14
+ )
15
+
6
16
  # Require acts_as_ferret only if Ferret full text search is enabled (default).
7
17
  # You can disable it in +config/alchemy/config.yml+
8
18
  if Config.get(:ferret) == true
@@ -1,6 +1,14 @@
1
1
  module Alchemy
2
2
  class EssenceVideo < ActiveRecord::Base
3
3
 
4
+ attr_accessible(
5
+ :width,
6
+ :height,
7
+ :allow_fullscreen,
8
+ :auto_play,
9
+ :show_navigation
10
+ )
11
+
4
12
  acts_as_essence(
5
13
  :ingredient_column => :attachment,
6
14
  :preview_text_method => :name