alchemy_cms 2.1.beta6 → 2.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/Gemfile +10 -2
- data/Guardfile +16 -0
- data/README.md +3 -3
- data/Rakefile +0 -5
- data/alchemy_cms.gemspec +1 -9
- data/app/assets/javascripts/alchemy/alchemy.base.js +5 -4
- data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js.erb → alchemy.dragndrop.js} +0 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +96 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +48 -50
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +41 -0
- data/app/assets/javascripts/alchemy/alchemy.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +55 -0
- data/app/assets/javascripts/alchemy/alchemy.preview.js +94 -139
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +98 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +1 -174
- data/app/assets/javascripts/alchemy/menubar.js +2 -0
- data/app/assets/javascripts/alchemy/preview.js +2 -1
- data/app/assets/stylesheets/alchemy/_defaults.scss +7 -8
- data/app/assets/stylesheets/alchemy/base.css.scss +29 -33
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -4
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +19 -4
- data/app/assets/stylesheets/alchemy/menubar.css.scss +85 -0
- data/app/assets/stylesheets/alchemy/standard_set.css +3 -5
- data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +2 -18
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
- data/app/controllers/alchemy/admin/essence_files_controller.rb +4 -2
- data/app/controllers/alchemy/admin/pictures_controller.rb +6 -20
- data/app/controllers/alchemy/admin/resources_controller.rb +7 -5
- data/app/controllers/alchemy/base_controller.rb +14 -4
- data/app/controllers/alchemy/messages_controller.rb +4 -4
- data/app/controllers/alchemy/pages_controller.rb +51 -32
- data/app/controllers/alchemy/pictures_controller.rb +0 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +6 -4
- data/app/helpers/alchemy/base_helper.rb +26 -0
- data/app/helpers/alchemy/pages_helper.rb +42 -22
- data/app/models/alchemy/attachment.rb +10 -2
- data/app/models/alchemy/cell.rb +1 -0
- data/app/models/alchemy/content.rb +8 -6
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/essence_audio.rb +1 -8
- data/app/models/alchemy/essence_date.rb +2 -9
- data/app/models/alchemy/essence_file.rb +1 -8
- data/app/models/alchemy/essence_flash.rb +0 -7
- data/app/models/alchemy/essence_html.rb +1 -8
- data/app/models/alchemy/essence_picture.rb +0 -11
- data/app/models/alchemy/essence_richtext.rb +4 -12
- data/app/models/alchemy/essence_text.rb +1 -13
- data/app/models/alchemy/essence_video.rb +1 -8
- data/app/models/alchemy/page.rb +28 -22
- data/app/models/alchemy/picture.rb +19 -0
- data/app/sweepers/alchemy/pages_sweeper.rb +17 -6
- data/app/sweepers/alchemy/pictures_sweeper.rb +1 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +13 -11
- data/app/views/alchemy/admin/attachments/create.js.erb +1 -1
- data/app/views/alchemy/admin/attachments/edit.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -2
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/essence_files/edit.html.erb +32 -32
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +29 -29
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +13 -12
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +4 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +8 -8
- data/app/views/alchemy/admin/pages/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +19 -12
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +8 -6
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +6 -1
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +13 -13
- data/app/views/alchemy/admin/users/_user.html.erb +1 -1
- data/app/views/alchemy/admin/users/index.html.erb +2 -2
- data/app/views/alchemy/elements/_contactform_view.html.erb +78 -78
- data/app/views/alchemy/elements/_download_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_download_view.html.erb +3 -0
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_file_view.html.erb +6 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +1 -2
- data/app/views/alchemy/notifications/admin_user_created.text.erb +7 -7
- data/app/views/alchemy/notifications/registered_user_created.text.erb +5 -5
- data/app/views/alchemy/user_sessions/login.html.erb +34 -35
- data/app/views/layouts/alchemy/login.html.erb +3 -8
- data/app/views/layouts/alchemy/pages.html.erb +1 -0
- data/bin/alchemy +43 -75
- data/config/alchemy/config.yml +10 -0
- data/config/alchemy/elements.yml +5 -0
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/locales/alchemy.de.yml +21 -8
- data/config/locales/alchemy.en.yml +20 -4
- data/config/routes.rb +25 -20
- data/db/migrate/{20111116125112_namespace_models.rb → 20111116125112_namespace_alchemy_models.rb} +1 -1
- data/lib/alchemy/capistrano.rb +4 -17
- data/lib/alchemy/engine.rb +2 -0
- data/lib/alchemy/essence.rb +29 -41
- data/lib/alchemy/i18n.rb +1 -1
- data/lib/alchemy/mount_point.rb +10 -0
- data/lib/alchemy/page_layout.rb +7 -7
- data/lib/alchemy/seeder.rb +85 -47
- data/lib/alchemy/upgrader.rb +115 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +4 -3
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +6 -2
- data/lib/tasks/ferret.rake +12 -0
- data/lib/tasks/install.rake +16 -105
- data/lib/tasks/routes.rake +29 -0
- data/lib/tasks/upgrade.rake +5 -67
- data/spec/controllers/admin/pages_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +31 -0
- data/spec/factories.rb +24 -15
- data/spec/helpers/admin/base_helper_spec.rb +0 -7
- data/spec/helpers/pages_helper_spec.rb +54 -29
- data/spec/helpers/url_helpers_spec.rb +40 -0
- data/spec/integration/admin/pages_controller_spec.rb +3 -3
- data/spec/integration/pages_controller_spec.rb +80 -6
- data/spec/integration/security_spec.rb +2 -2
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/page_spec.rb +174 -47
- data/spec/models/picture_spec.rb +54 -0
- data/spec/page_layout_spec.rb +2 -2
- data/spec/routing_spec.rb +205 -1
- data/spec/spec_helper.rb +53 -32
- metadata +51 -46
- data/lib/alchemy/file_utilz.rb +0 -73
@@ -5,15 +5,8 @@ module Alchemy
|
|
5
5
|
:ingredient_column => :attachment,
|
6
6
|
:preview_text_method => :name
|
7
7
|
)
|
8
|
-
|
8
|
+
|
9
9
|
belongs_to :attachment
|
10
|
-
|
11
|
-
# Saves the ingredient
|
12
|
-
def save_ingredient(params, options = {})
|
13
|
-
return true if params.blank?
|
14
|
-
self.attachment_id = params["attachment_id"].to_s
|
15
|
-
self.save
|
16
|
-
end
|
17
10
|
|
18
11
|
end
|
19
12
|
end
|
@@ -5,13 +5,6 @@ module Alchemy
|
|
5
5
|
:ingredient_column => :attachment,
|
6
6
|
:preview_text_method => :name
|
7
7
|
)
|
8
|
-
|
9
|
-
# Saves the ingredient
|
10
|
-
def save_ingredient(params, options = {})
|
11
|
-
return true if params.blank?
|
12
|
-
self.attachment_id = params["attachment_id"].to_s
|
13
|
-
self.save
|
14
|
-
end
|
15
8
|
|
16
9
|
end
|
17
10
|
end
|
@@ -4,18 +4,11 @@ module Alchemy
|
|
4
4
|
acts_as_essence(
|
5
5
|
:ingredient_column => :source
|
6
6
|
)
|
7
|
-
|
7
|
+
|
8
8
|
# Returns the first x (default = 30) (HTML escaped) characters from self.source for the Element#preview_text method.
|
9
9
|
def preview_text(maxlength = 30)
|
10
10
|
CGI.escapeHTML(source.to_s)[0..maxlength]
|
11
11
|
end
|
12
|
-
|
13
|
-
# Saves the ingredient
|
14
|
-
def save_ingredient(params, options = {})
|
15
|
-
return true if params.blank?
|
16
|
-
self.source = params["source"].to_s
|
17
|
-
self.save
|
18
|
-
end
|
19
12
|
|
20
13
|
end
|
21
14
|
end
|
@@ -14,16 +14,5 @@ module Alchemy
|
|
14
14
|
caption.gsub!(/(\r\n|\r|\n)/, "<br/>")
|
15
15
|
end
|
16
16
|
|
17
|
-
# Saves the ingredient
|
18
|
-
def save_ingredient(params, options = {})
|
19
|
-
return true if params.blank?
|
20
|
-
self.link_class_name = params['link_class_name']
|
21
|
-
self.link_target = params['link_target']
|
22
|
-
self.link = params['link']
|
23
|
-
self.link_title = params['link_title']
|
24
|
-
self.picture_id = params['picture_id']
|
25
|
-
self.save
|
26
|
-
end
|
27
|
-
|
28
17
|
end
|
29
18
|
end
|
@@ -4,7 +4,7 @@ module Alchemy
|
|
4
4
|
acts_as_essence(
|
5
5
|
:preview_text_column => :stripped_body
|
6
6
|
)
|
7
|
-
|
7
|
+
|
8
8
|
# Require acts_as_ferret only if Ferret full text search is enabled (default).
|
9
9
|
# You can disable it in +config/alchemy/config.yml+
|
10
10
|
if Alchemy::Config.get(:ferret) == true
|
@@ -17,29 +17,21 @@ module Alchemy
|
|
17
17
|
)
|
18
18
|
before_save :check_ferret_indexing
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
before_save :strip_content
|
22
|
-
|
23
|
-
# Saves the ingredient
|
24
|
-
def save_ingredient(params, options = {})
|
25
|
-
return true if params.blank?
|
26
|
-
self.body = params['body'].to_s
|
27
|
-
self.public = options[:public]
|
28
|
-
self.save
|
29
|
-
end
|
30
22
|
|
31
23
|
private
|
32
24
|
|
33
25
|
def strip_content
|
34
26
|
self.stripped_body = strip_tags(self.body)
|
35
27
|
end
|
36
|
-
|
28
|
+
|
37
29
|
def check_ferret_indexing
|
38
30
|
if self.do_not_index
|
39
31
|
self.disable_ferret(:always)
|
40
32
|
end
|
41
33
|
end
|
42
|
-
|
34
|
+
|
43
35
|
# Stripping HTML Tags and only returns plain text.
|
44
36
|
def strip_tags(html)
|
45
37
|
return html if html.blank?
|
@@ -2,7 +2,7 @@ module Alchemy
|
|
2
2
|
class EssenceText < ActiveRecord::Base
|
3
3
|
|
4
4
|
acts_as_essence
|
5
|
-
|
5
|
+
|
6
6
|
# Require acts_as_ferret only if Ferret full text search is enabled (default).
|
7
7
|
# You can disable it in +config/alchemy/config.yml+
|
8
8
|
if Alchemy::Config.get(:ferret) == true
|
@@ -15,18 +15,6 @@ module Alchemy
|
|
15
15
|
)
|
16
16
|
before_save :check_ferret_indexing
|
17
17
|
end
|
18
|
-
|
19
|
-
# Saves the content from params
|
20
|
-
def save_ingredient(params, options = {})
|
21
|
-
return true if params.blank?
|
22
|
-
self.body = params["body"]
|
23
|
-
self.link = params["link"]
|
24
|
-
self.link_title = params["link_title"]
|
25
|
-
self.link_class_name = params["link_class_name"]
|
26
|
-
self.link_target = params["link_target"]
|
27
|
-
self.public = options[:public]
|
28
|
-
self.save
|
29
|
-
end
|
30
18
|
|
31
19
|
private
|
32
20
|
|
@@ -5,15 +5,8 @@ module Alchemy
|
|
5
5
|
:ingredient_column => :attachment,
|
6
6
|
:preview_text_method => :name
|
7
7
|
)
|
8
|
-
|
8
|
+
|
9
9
|
belongs_to :attachment
|
10
|
-
|
11
|
-
# Saves the ingredient
|
12
|
-
def save_ingredient(params, options = {})
|
13
|
-
return true if params.blank?
|
14
|
-
self.attachment_id = params["attachment_id"].to_s
|
15
|
-
self.save
|
16
|
-
end
|
17
10
|
|
18
11
|
end
|
19
12
|
end
|
data/app/models/alchemy/page.rb
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
module Alchemy
|
3
3
|
class Page < ActiveRecord::Base
|
4
4
|
|
5
|
-
RESERVED_PAGE_LAYOUTS = %w(rootpage)
|
6
5
|
RESERVED_URLNAMES = %w(admin messages)
|
7
6
|
|
8
|
-
acts_as_nested_set
|
7
|
+
acts_as_nested_set(:dependent => :destroy)
|
9
8
|
stampable
|
10
9
|
|
11
10
|
has_many :folded_pages
|
@@ -15,23 +14,23 @@ module Alchemy
|
|
15
14
|
belongs_to :language
|
16
15
|
|
17
16
|
validates_presence_of :name, :message => '^'+Alchemy::I18n.t("please enter a name")
|
18
|
-
validates_presence_of :page_layout, :message => '^'+Alchemy::I18n.t("Please choose a page layout.")
|
19
|
-
validates_presence_of :parent_id, :message => '^'+Alchemy::I18n.t("No parent page was given."), :
|
17
|
+
validates_presence_of :page_layout, :message => '^'+Alchemy::I18n.t("Please choose a page layout."), :unless => :systempage?
|
18
|
+
validates_presence_of :parent_id, :message => '^'+Alchemy::I18n.t("No parent page was given."), :if => proc { Page.count > 1 }
|
20
19
|
validates_length_of :urlname, :minimum => 3, :too_short => Alchemy::I18n.t("urlname_to_short"), :if => :urlname_entered?
|
21
20
|
validates_uniqueness_of :urlname, :message => '^'+Alchemy::I18n.t("URL-Name already token"), :scope => 'language_id', :if => :urlname_entered?
|
22
|
-
validates :page_layout, :exclusion => { :in => RESERVED_PAGE_LAYOUTS, :message => '^'+Alchemy::I18n.t("This page_layout name is reserved.") }, :unless => :rootpage?
|
23
21
|
validates :urlname, :exclusion => { :in => RESERVED_URLNAMES, :message => '^'+Alchemy::I18n.t("This urlname is reserved.") }
|
24
22
|
|
25
23
|
attr_accessor :do_not_autogenerate
|
26
24
|
attr_accessor :do_not_sweep
|
27
25
|
attr_accessor :do_not_validate_language
|
28
26
|
|
29
|
-
before_save :set_url_name, :unless =>
|
30
|
-
before_save :set_title, :unless =>
|
31
|
-
before_save :set_language_code
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
before_save :set_url_name, :unless => proc { |page| page.systempage? || page.redirects_to_external? }
|
28
|
+
before_save :set_title, :unless => proc { |page| page.systempage? || page.redirects_to_external? }
|
29
|
+
before_save :set_language_code, :unless => :systempage?
|
30
|
+
before_save :set_restrictions_to_child_pages, :if => proc { |page| !page.systempage? && page.restricted_changed? }
|
31
|
+
before_save :inherit_restricted_status, :if => proc { |page| !page.systempage? && page.parent && page.parent.restricted? }
|
32
|
+
after_create :autogenerate_elements, :unless => proc { |page| page.systempage? || page.do_not_autogenerate }
|
33
|
+
after_create :create_cells, :unless => :systempage?
|
35
34
|
|
36
35
|
scope :language_roots, where(:language_root => true)
|
37
36
|
scope :layoutpages, where(:layoutpage => true)
|
@@ -42,6 +41,7 @@ module Alchemy
|
|
42
41
|
scope :published, where(:public => true)
|
43
42
|
scope :accessable, where(:restricted => false)
|
44
43
|
scope :restricted, where(:restricted => true)
|
44
|
+
scope :not_restricted, where(:restricted => false)
|
45
45
|
scope :public_language_roots, lambda {
|
46
46
|
where(:language_root => true).where("`alchemy_pages`.`language_code` IN ('#{Language.all_codes_for_published.join('\',\'')}')").where(:public => true)
|
47
47
|
}
|
@@ -52,6 +52,7 @@ module Alchemy
|
|
52
52
|
# Used for flushing all page caches at once.
|
53
53
|
scope :contentpages, where("`alchemy_pages`.`layoutpage` = 0 AND `alchemy_pages`.`parent_id` IS NOT NULL")
|
54
54
|
scope :flushables, not_locked.published.contentpages
|
55
|
+
scope :searchables, not_restricted.published.contentpages
|
55
56
|
|
56
57
|
# Finds selected elements from page.
|
57
58
|
#
|
@@ -305,10 +306,9 @@ module Alchemy
|
|
305
306
|
|
306
307
|
# Returns the self#page_layout description from config/alchemy/page_layouts.yml file.
|
307
308
|
def layout_description
|
309
|
+
return {} if self.systempage?
|
308
310
|
description = Alchemy::PageLayout.get(self.page_layout)
|
309
|
-
if
|
310
|
-
return {}
|
311
|
-
elsif description.nil?
|
311
|
+
if description.nil?
|
312
312
|
raise "Description could not be found for page layout named #{self.page_layout}. Please check page_layouts.yml file."
|
313
313
|
else
|
314
314
|
description
|
@@ -338,13 +338,15 @@ module Alchemy
|
|
338
338
|
end
|
339
339
|
|
340
340
|
def set_restrictions_to_child_pages
|
341
|
-
return nil if self.restricted_was == self.restricted
|
342
341
|
descendants.each do |child|
|
343
|
-
child.restricted
|
344
|
-
child.save
|
342
|
+
child.update_attribute(:restricted, self.restricted?)
|
345
343
|
end
|
346
344
|
end
|
347
345
|
|
346
|
+
def inherit_restricted_status
|
347
|
+
self.restricted = parent.restricted?
|
348
|
+
end
|
349
|
+
|
348
350
|
def contains_feed?
|
349
351
|
definition["feed"]
|
350
352
|
end
|
@@ -449,7 +451,7 @@ module Alchemy
|
|
449
451
|
:language_id => new_parent.language_id,
|
450
452
|
:language_code => new_parent.language_code,
|
451
453
|
:name => child.name + ' (' + Alchemy::I18n.t('Copy') + ')',
|
452
|
-
:urlname => '',
|
454
|
+
:urlname => child.redirects_to_external? ? child.urlname : '',
|
453
455
|
:title => ''
|
454
456
|
})
|
455
457
|
new_child.move_to_child_of(new_parent)
|
@@ -482,15 +484,19 @@ module Alchemy
|
|
482
484
|
self.locker.name
|
483
485
|
end
|
484
486
|
|
485
|
-
# is the curent object the main rootpage?
|
486
487
|
def rootpage?
|
487
|
-
|
488
|
+
!self.new_record? && self.parent_id.blank?
|
489
|
+
end
|
490
|
+
|
491
|
+
def systempage?
|
492
|
+
return true if Page.root.nil?
|
493
|
+
rootpage? || (self.parent_id == Page.root.id && !self.language_root?)
|
488
494
|
end
|
489
495
|
|
490
496
|
def self.rootpage
|
491
|
-
|
497
|
+
self.root
|
492
498
|
end
|
493
|
-
|
499
|
+
|
494
500
|
private
|
495
501
|
|
496
502
|
def find_next_or_previous_page(direction = "next", options = {})
|
@@ -19,6 +19,13 @@ module Alchemy
|
|
19
19
|
|
20
20
|
stampable
|
21
21
|
|
22
|
+
def self.find_paginated(params, per_page)
|
23
|
+
Picture.where("name LIKE '%#{params[:query]}%'").paginate(
|
24
|
+
:page => params[:page] || 1,
|
25
|
+
:per_page => per_page
|
26
|
+
).order(:name)
|
27
|
+
end
|
28
|
+
|
22
29
|
# Returning the filepath relative to Rails.root public folder.
|
23
30
|
def public_file_path
|
24
31
|
self.file_path.gsub("#{Rails.root}/public", '')
|
@@ -32,6 +39,18 @@ module Alchemy
|
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
42
|
+
def suffix
|
43
|
+
if image_filename =~ /\./
|
44
|
+
image_filename.split('.').last.downcase
|
45
|
+
else
|
46
|
+
""
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def humanized_name
|
51
|
+
(image_filename.downcase.gsub(/\.#{Regexp.quote(suffix)}$/, '')).humanize
|
52
|
+
end
|
53
|
+
|
35
54
|
# Returning true if picture's width is greater than it's height
|
36
55
|
def landscape_format?
|
37
56
|
return (self.image_width > self.image_height) ? true : false
|
@@ -37,12 +37,23 @@ module Alchemy
|
|
37
37
|
|
38
38
|
def expire_page(page)
|
39
39
|
return if page.do_not_sweep
|
40
|
-
expire_action
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
)
|
40
|
+
# TODO: We should change this back to expire_action after Rails 3.2 was released.
|
41
|
+
# expire_action(
|
42
|
+
# alchemy.show_page_url(
|
43
|
+
# :urlname => page.urlname_was,
|
44
|
+
# :lang => multi_language? ? page.language_code : nil
|
45
|
+
# )
|
46
|
+
# )
|
47
|
+
# Temporarily fix for Rails 3 bug
|
48
|
+
return if alchemy.nil?
|
49
|
+
expire_fragment(ActionController::Caching::Actions::ActionCachePath.new(
|
50
|
+
self,
|
51
|
+
alchemy.show_page_url(
|
52
|
+
:urlname => page.urlname_was,
|
53
|
+
:lang => multi_language? ? page.language_code : nil
|
54
|
+
),
|
55
|
+
false
|
56
|
+
).path)
|
46
57
|
end
|
47
58
|
|
48
59
|
end
|
@@ -14,9 +14,7 @@ module Alchemy
|
|
14
14
|
|
15
15
|
def expire_cache_for(picture)
|
16
16
|
# Removing all variants of the picture with FileUtils.
|
17
|
-
FileUtils.rm_rf(
|
18
|
-
FileUtils.rm_rf("#{Rails.root}/public/pictures/thumbnails/#{picture.id}")
|
19
|
-
expire_page(zoom_picture_path(picture, :format => 'png'))
|
17
|
+
FileUtils.rm_rf(Rails.root.join('public', Alchemy.mount_point, 'pictures', picture.id.to_s))
|
20
18
|
end
|
21
19
|
|
22
20
|
end
|
@@ -19,7 +19,7 @@
|
|
19
19
|
</div>
|
20
20
|
<%= js_filter_field(:onkeyup => "Alchemy.ListFilter('.assign_file_file')") %>
|
21
21
|
</div>
|
22
|
-
<
|
22
|
+
<ul id="assign_file_list" class="with_padding">
|
23
23
|
<%= render :partial => 'file_to_assign', :collection => @attachments %>
|
24
|
-
</
|
24
|
+
</ul>
|
25
25
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
suffix = "</div><div class=\"assign_file_file_name\">#{file_to_assign.filename}</div>"
|
4
4
|
-%>
|
5
5
|
<%- img_tag = "#{prefix}#{render_icon(file_to_assign.icon_css_class)}#{suffix}".html_safe -%>
|
6
|
-
<
|
6
|
+
<li class="assign_file_file <%= cycle('even', 'odd') %>" name="<%= file_to_assign.filename %>">
|
7
7
|
<%= link_to(
|
8
8
|
img_tag,
|
9
9
|
{
|
@@ -17,4 +17,4 @@
|
|
17
17
|
:method => 'put',
|
18
18
|
:title => file_to_assign.filename
|
19
19
|
) %>
|
20
|
-
</
|
20
|
+
</li>
|
@@ -1,21 +1,23 @@
|
|
1
1
|
<%- if @attachments.blank? && params[:query].nil? -%>
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
<div class="info" id="no_files_notice">
|
3
|
+
<%= render_icon('info') %>
|
4
|
+
<%= t("no_files_in_archive") %>
|
5
|
+
</div>
|
5
6
|
<%- elsif @attachments.blank? -%>
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
<div class="info">
|
8
|
+
<%= render_icon('info') %>
|
9
|
+
<%= t("no_search_results") %>
|
10
|
+
</div>
|
9
11
|
<%- end -%>
|
10
12
|
<table id="all_files" class="list">
|
11
13
|
<%- unless @attachments.blank? -%>
|
12
14
|
<tr>
|
13
15
|
<th class="icon"></th>
|
14
|
-
<th class="name"><%=
|
15
|
-
<th class="file_name"><%=
|
16
|
-
<th class="file_type"><%=
|
17
|
-
<th class="file_size"><%=
|
18
|
-
<th class="date"><%=
|
16
|
+
<th class="name"><%= Alchemy::Attachment.human_attribute_name('name') %></th>
|
17
|
+
<th class="file_name"><%= Alchemy::Attachment.human_attribute_name('filename') %></th>
|
18
|
+
<th class="file_type"><%= Alchemy::Attachment.human_attribute_name('content_type') %></th>
|
19
|
+
<th class="file_size"><%= Alchemy::Attachment.human_attribute_name('size') %></th>
|
20
|
+
<th class="date"><%= Alchemy::Attachment.human_attribute_name('created_at') %></th>
|
19
21
|
<th class="tools"></th>
|
20
22
|
</tr>
|
21
23
|
<%- end -%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%- if @while_assigning -%>
|
3
3
|
$('#alchemy_window_body').replaceWith('<%= escape_javascript(render(:partial => "archive_overlay.html.erb")) -%>');
|
4
4
|
<%- else -%>
|
5
|
-
$('#archive_all').html('<%= escape_javascript(render(:partial =>
|
5
|
+
$('#archive_all').html('<%= escape_javascript(render(:partial => "files_list")) %>');
|
6
6
|
Alchemy.growl('<%= @message %>');
|
7
7
|
<%- end -%>
|
8
8
|
})(jQuery);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= form_for([:admin, @attachment], :url => {:action => :update, :query => params[:query], :page => params[:page]}) do |f| -%>
|
2
2
|
<table>
|
3
3
|
<tr>
|
4
|
-
<td class="label"><%= f.label 'name', :class => "short"
|
5
|
-
<td class="input"><%= f.text_field
|
4
|
+
<td class="label"><%= f.label 'name', :class => "short" %></td>
|
5
|
+
<td class="input"><%= f.text_field 'name', :class => 'thin_border very_long' %></td>
|
6
6
|
</tr>
|
7
7
|
<tr>
|
8
8
|
<td></td>
|