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.
- data/alchemy_cms.gemspec +1 -0
- data/app/assets/stylesheets/alchemy/base.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/sitemap.css.scss +3 -0
- data/app/controllers/alchemy/admin/attachments_controller.rb +1 -1
- data/app/controllers/alchemy/admin/contents_controller.rb +1 -1
- data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_audios_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_flashes_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_videos_controller.rb +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +4 -4
- data/app/controllers/alchemy/admin/resources_controller.rb +2 -3
- data/app/controllers/alchemy/admin/users_controller.rb +2 -2
- data/app/controllers/alchemy/base_controller.rb +8 -1
- data/app/controllers/alchemy/pages_controller.rb +2 -0
- data/app/models/alchemy/attachment.rb +2 -0
- data/app/models/alchemy/cell.rb +2 -0
- data/app/models/alchemy/content.rb +17 -4
- data/app/models/alchemy/element.rb +22 -3
- data/app/models/alchemy/essence_audio.rb +2 -0
- data/app/models/alchemy/essence_date.rb +2 -0
- data/app/models/alchemy/essence_file.rb +2 -0
- data/app/models/alchemy/essence_flash.rb +2 -0
- data/app/models/alchemy/essence_html.rb +2 -0
- data/app/models/alchemy/essence_picture.rb +15 -0
- data/app/models/alchemy/essence_richtext.rb +2 -0
- data/app/models/alchemy/essence_text.rb +10 -0
- data/app/models/alchemy/essence_video.rb +8 -0
- data/app/models/alchemy/folded_page.rb +1 -0
- data/app/models/alchemy/language.rb +11 -0
- data/app/models/alchemy/message.rb +7 -10
- data/app/models/alchemy/page.rb +28 -7
- data/app/models/alchemy/picture.rb +8 -0
- data/app/models/alchemy/user.rb +12 -8
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +1 -1
- data/app/views/alchemy/pictures/zoom.jpg.flexi +3 -0
- data/config/alchemy/config.yml +9 -13
- data/config/locales/alchemy.de.yml +29 -15
- data/config/locales/alchemy.en.yml +27 -10
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +8 -8
- data/spec/dummy/app/models/event.rb +1 -0
- data/spec/dummy/config/application.rb +26 -8
- data/spec/dummy/config/environments/development.rb +8 -8
- data/spec/dummy/config/environments/production.rb +9 -2
- data/spec/dummy/config/environments/test.rb +6 -11
- data/spec/factories.rb +1 -1
- data/spec/helpers/elements_helper_spec.rb +4 -4
- data/spec/models/language_spec.rb +2 -2
- data/spec/models/page_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -2
- 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")
|
@@ -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]
|
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"
|
@@ -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.
|
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
|
|
@@ -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]
|
50
|
+
@essence_picture.update_attributes(params[:essence_picture])
|
51
51
|
@content = Content.find(params[:content_id])
|
52
52
|
end
|
53
53
|
|
@@ -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]
|
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), '
|
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]
|
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, "
|
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]
|
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]
|
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]
|
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]
|
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 =>
|
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.
|
data/app/models/alchemy/cell.rb
CHANGED
@@ -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
|
-
|
77
|
-
|
78
|
-
|
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(
|
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
|
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(
|
222
|
-
|
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,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
|