alchemy_cms 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/alchemy_cms.gemspec +2 -2
- data/app/assets/stylesheets/alchemy/elements.scss +1 -0
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +2 -3
- data/app/controllers/alchemy/pictures_controller.rb +38 -41
- data/app/helpers/alchemy/pages_helper.rb +2 -2
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/page.rb +12 -8
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +3 -3
- data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -1
- data/config/locales/alchemy.de.yml +1 -0
- data/lib/alchemy/seeder.rb +3 -0
- data/lib/alchemy/upgrader.rb +14 -16
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/gallery_pictures_migration/gallery_pictures_migration_generator.rb +40 -0
- data/spec/controllers/admin/pages_controller_spec.rb +15 -0
- data/spec/controllers/pictures_controller_spec.rb +42 -10
- data/spec/dummy/config/alchemy/page_layouts.yml +4 -0
- data/spec/models/page_spec.rb +28 -2
- data/spec/support/80x60.png +0 -0
- data/spec/support/image.png +0 -0
- data/spec/support/image2.PNG +0 -0
- metadata +10 -7
data/alchemy_cms.gemspec
CHANGED
@@ -38,7 +38,7 @@ POST_INSTALL
|
|
38
38
|
s.add_runtime_dependency %q<awesome_nested_set>, ["~> 2.0"]
|
39
39
|
s.add_runtime_dependency %q<acts-as-taggable-on>, ["~> 2.1"]
|
40
40
|
s.add_runtime_dependency %q<declarative_authorization>, ["= 0.5.5"]
|
41
|
-
s.add_runtime_dependency %q<dragonfly>, ["~> 0.9.
|
41
|
+
s.add_runtime_dependency %q<dragonfly>, ["~> 0.9.14"]
|
42
42
|
s.add_runtime_dependency %q<kaminari>, ["~> 0.13.0"]
|
43
43
|
s.add_runtime_dependency %q<acts_as_ferret>, ["~> 0.5"]
|
44
44
|
s.add_runtime_dependency %q<acts_as_list>, ["~> 0.1.9"]
|
@@ -46,7 +46,7 @@ POST_INSTALL
|
|
46
46
|
s.add_runtime_dependency %q<dynamic_form>, ["~> 1.1"]
|
47
47
|
s.add_runtime_dependency %q<jquery-rails>, ["~> 2.1.3"]
|
48
48
|
s.add_runtime_dependency %q<jquery-ui-rails>, ["~> 3.0.1"]
|
49
|
-
s.add_runtime_dependency %q<attachment_magic>, ["
|
49
|
+
s.add_runtime_dependency %q<attachment_magic>, [">= 0.2.1"]
|
50
50
|
s.add_runtime_dependency %q<sass-rails>, ['~> 3.2.3']
|
51
51
|
s.add_runtime_dependency %q<coffee-rails>, ['~> 3.2.1']
|
52
52
|
s.add_runtime_dependency %q<compass-rails>, ['~> 1.0.3']
|
@@ -3,7 +3,7 @@ module Alchemy
|
|
3
3
|
class LayoutpagesController < Alchemy::Admin::BaseController
|
4
4
|
|
5
5
|
def index
|
6
|
-
@locked_pages = Page.all_locked_by(current_user)
|
6
|
+
@locked_pages = Page.from_current_site.all_locked_by(current_user)
|
7
7
|
@layout_root = Page.find_or_create_layout_root_for(session[:language_id])
|
8
8
|
@languages = Language.all
|
9
9
|
end
|
@@ -83,7 +83,7 @@ module Alchemy
|
|
83
83
|
redirect_to admin_pages_path
|
84
84
|
else
|
85
85
|
@page.lock(current_user)
|
86
|
-
@locked_pages = Page.from_current_site.
|
86
|
+
@locked_pages = Page.from_current_site.all_locked_by(current_user)
|
87
87
|
end
|
88
88
|
@layoutpage = @page.layoutpage?
|
89
89
|
end
|
@@ -178,8 +178,7 @@ module Alchemy
|
|
178
178
|
# Sets the page public and sweeps the page cache
|
179
179
|
def publish
|
180
180
|
# fetching page via before filter
|
181
|
-
@page.
|
182
|
-
@page.save
|
181
|
+
@page.publish!
|
183
182
|
flash[:notice] = _t("page_published", :name => @page.name)
|
184
183
|
redirect_back_or_to_default(admin_pages_path)
|
185
184
|
end
|
@@ -11,56 +11,23 @@ module Alchemy
|
|
11
11
|
filter_access_to :thumbnail
|
12
12
|
|
13
13
|
def show
|
14
|
-
|
15
|
-
|
16
|
-
if image_file.nil?
|
17
|
-
raise MissingImageFileError, "Missing image file for #{@picture.inspect}"
|
18
|
-
end
|
19
|
-
|
20
|
-
upsample = params[:upsample] == 'true'
|
21
|
-
crop_from = normalized_size(params[:crop_from])
|
22
|
-
crop_size = params[:crop_size]
|
23
|
-
size = params[:size]
|
24
|
-
|
25
|
-
if params[:crop_size].present? && params[:crop_from].present?
|
26
|
-
crop_from = params[:crop_from].split('x')
|
27
|
-
image_file = image_file.process(:thumb, "#{params[:crop_size]}+#{crop_from[0]}+#{crop_from[1]}")
|
28
|
-
elsif params[:crop] == 'crop' && size.present?
|
29
|
-
image_file = image_file.process(:thumb, "#{size}#")
|
30
|
-
end
|
31
|
-
|
32
|
-
if size.present?
|
33
|
-
image_file = image_file.process(:resize, size + '>')
|
34
|
-
end
|
14
|
+
@size = params[:size]
|
35
15
|
|
36
16
|
expires_in 1.month, public: !@picture.restricted?
|
37
|
-
respond_to { |format| send_image(
|
17
|
+
respond_to { |format| send_image(processed_image, format) }
|
38
18
|
end
|
39
19
|
|
40
20
|
def thumbnail
|
41
|
-
image_file = @picture.image_file
|
42
|
-
|
43
21
|
case params[:size]
|
44
|
-
when "small" then size = "80x60"
|
45
|
-
when "medium" then size = "160x120"
|
46
|
-
when "large" then size = "240x180"
|
47
|
-
when nil then size = "111x93"
|
22
|
+
when "small" then @size = "80x60"
|
23
|
+
when "medium" then @size = "160x120"
|
24
|
+
when "large" then @size = "240x180"
|
25
|
+
when nil then @size = "111x93"
|
48
26
|
else
|
49
|
-
size = params[:size]
|
50
|
-
end
|
51
|
-
|
52
|
-
if params[:crop_size].present? && params[:crop_from].present?
|
53
|
-
crop_from = params[:crop_from].split('x')
|
54
|
-
image_file = image_file.process(:thumb, "#{params[:crop_size]}+#{crop_from[0]}+#{crop_from[1]}")
|
55
|
-
elsif params[:crop] == 'crop' && size.present?
|
56
|
-
image_file = image_file.process(:thumb, "#{size}#")
|
27
|
+
@size = params[:size]
|
57
28
|
end
|
58
29
|
|
59
|
-
|
60
|
-
image_file = image_file.process(:resize, size + '>')
|
61
|
-
end
|
62
|
-
|
63
|
-
respond_to { |format| send_image(image_file, format) }
|
30
|
+
respond_to { |format| send_image(processed_image, format) }
|
64
31
|
end
|
65
32
|
|
66
33
|
def zoom
|
@@ -106,5 +73,35 @@ module Alchemy
|
|
106
73
|
end
|
107
74
|
end
|
108
75
|
|
76
|
+
# Return the processed image dependent of size and cropping parameters
|
77
|
+
def processed_image
|
78
|
+
image_file = @picture.image_file
|
79
|
+
if image_file.nil?
|
80
|
+
raise MissingImageFileError, "Missing image file for #{@picture.inspect}"
|
81
|
+
end
|
82
|
+
if params[:crop_size].present? && params[:crop_from].present?
|
83
|
+
crop_from = params[:crop_from].split('x')
|
84
|
+
image_file = image_file.process(:thumb, "#{params[:crop_size]}+#{crop_from[0]}+#{crop_from[1]}")
|
85
|
+
image_file.process(:resize, @size + '>')
|
86
|
+
elsif params[:crop] == 'crop' && @size.present?
|
87
|
+
width, height = @size.split('x').collect(&:to_i)
|
88
|
+
# prevent upscaling unless :upsample param is true
|
89
|
+
# unfurtunally dragonfly does not handle this correctly while cropping
|
90
|
+
unless params[:upsample] == 'true'
|
91
|
+
if width > image_file.width
|
92
|
+
width = image_file.width
|
93
|
+
end
|
94
|
+
if height > image_file.height
|
95
|
+
height = image_file.height
|
96
|
+
end
|
97
|
+
end
|
98
|
+
image_file.process(:resize_and_crop, :width => width, :height => height, :gravity => 'c')
|
99
|
+
elsif @size.present?
|
100
|
+
image_file.process(:resize, "#{@size}>")
|
101
|
+
else
|
102
|
+
image_file
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
109
106
|
end
|
110
107
|
end
|
@@ -44,11 +44,11 @@ module Alchemy
|
|
44
44
|
options = default_options.merge(options)
|
45
45
|
if multi_language?
|
46
46
|
language_links = []
|
47
|
-
pages = (options[:link_to_public_child] == true) ? Page.language_roots : Page.public_language_roots
|
47
|
+
pages = (options[:link_to_public_child] == true) ? Page.from_current_site.language_roots : Page.from_current_site.public_language_roots
|
48
48
|
return nil if (pages.blank? || pages.length == 1)
|
49
49
|
pages.each_with_index do |page, i|
|
50
50
|
if (options[:link_to_page_with_layout] != nil)
|
51
|
-
page_found_by_layout = Page.where(:page_layout => options[:link_to_page_with_layout].to_s, :language_id => page.language_id).first
|
51
|
+
page_found_by_layout = Page.from_current_site.where(:page_layout => options[:link_to_page_with_layout].to_s, :language_id => page.language_id).first
|
52
52
|
end
|
53
53
|
page = page_found_by_layout || page
|
54
54
|
page = (options[:link_to_public_child] ? (page.first_public_child.blank? ? nil : page.first_public_child) : nil) if !page.public?
|
@@ -45,7 +45,7 @@ module Alchemy
|
|
45
45
|
scope :not_in_cell, where(:cell_id => nil)
|
46
46
|
scope :in_cell, where("#{self.table_name}.cell_id IS NOT NULL")
|
47
47
|
# Scope for only the elements from Alchemy::Site.current
|
48
|
-
scope :from_current_site, lambda { where(:alchemy_languages => {site_id: Site.current}).joins(:page => :language) }
|
48
|
+
scope :from_current_site, lambda { where(:alchemy_languages => {site_id: Site.current || Site.default}).joins(:page => :language) }
|
49
49
|
# TODO: add this as default_scope
|
50
50
|
#default_scope { from_current_site }
|
51
51
|
|
data/app/models/alchemy/page.rb
CHANGED
@@ -73,7 +73,7 @@ module Alchemy
|
|
73
73
|
after_create :autogenerate_elements, :unless => proc { |page| page.systempage? || page.do_not_autogenerate }
|
74
74
|
after_update :trash_not_allowed_elements, :if => :page_layout_changed?
|
75
75
|
after_update :autogenerate_elements, :if => :page_layout_changed?
|
76
|
-
after_update :create_legacy_url, :if =>
|
76
|
+
after_update :create_legacy_url, :if => proc { |page| page.urlname_changed? && !page.redirects_to_external? }
|
77
77
|
after_destroy { elements.each {|el| el.destroy unless el.trashed? } }
|
78
78
|
|
79
79
|
scope :language_roots, where(:language_root => true)
|
@@ -97,7 +97,7 @@ module Alchemy
|
|
97
97
|
scope :flushables, not_locked.published.contentpages
|
98
98
|
scope :searchables, not_restricted.published.contentpages
|
99
99
|
# Scope for only the pages from Alchemy::Site.current
|
100
|
-
scope :from_current_site, lambda { where(:alchemy_languages => {site_id: Site.current}).joins(:language) }
|
100
|
+
scope :from_current_site, lambda { where(:alchemy_languages => {site_id: Site.current || Site.default}).joins(:language) }
|
101
101
|
# TODO: add this as default_scope
|
102
102
|
#default_scope { from_current_site }
|
103
103
|
|
@@ -541,19 +541,23 @@ module Alchemy
|
|
541
541
|
rootpage? || (self.parent_id == Page.root.id && !self.language_root?)
|
542
542
|
end
|
543
543
|
|
544
|
+
# Overwrites the cache_key method so it uses the published_at attribute instead of updated_at.
|
544
545
|
def cache_key(request = nil)
|
545
|
-
|
546
|
-
timestamp = timestamp.utc.to_s(:number)
|
547
|
-
"alchemy/pages/#{id}-#{timestamp}"
|
548
|
-
else
|
549
|
-
"alchemy/pages/#{id}"
|
550
|
-
end
|
546
|
+
"alchemy/pages/#{id}"
|
551
547
|
end
|
552
548
|
|
553
549
|
def taggable?
|
554
550
|
definition['taggable'] == true
|
555
551
|
end
|
556
552
|
|
553
|
+
# Publishes the page
|
554
|
+
#
|
555
|
+
# Sets public true and saves the object.
|
556
|
+
def publish!
|
557
|
+
self.public = true
|
558
|
+
self.save
|
559
|
+
end
|
560
|
+
|
557
561
|
private
|
558
562
|
|
559
563
|
def next_or_previous(direction = :next, options = {})
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%-
|
2
2
|
prefix = "<div class=\"assign_file_file_icon\">"
|
3
|
-
suffix = "</div><div class=\"assign_file_file_name\">#{file_to_assign.
|
3
|
+
suffix = "</div><div class=\"assign_file_file_name\">#{file_to_assign.file_name}</div>"
|
4
4
|
-%>
|
5
5
|
<%- img_tag = "#{prefix}#{render_icon(file_to_assign.icon_css_class)}#{suffix}".html_safe -%>
|
6
|
-
<li class="assign_file_file <%= cycle('even', 'odd') %>" name="<%= file_to_assign.
|
6
|
+
<li class="assign_file_file <%= cycle('even', 'odd') %>" name="<%= file_to_assign.file_name %>">
|
7
7
|
<%= link_to(
|
8
8
|
img_tag,
|
9
9
|
{
|
@@ -15,6 +15,6 @@
|
|
15
15
|
},
|
16
16
|
:remote => true,
|
17
17
|
:method => 'put',
|
18
|
-
:title => file_to_assign.
|
18
|
+
:title => file_to_assign.file_name
|
19
19
|
) %>
|
20
20
|
</li>
|
@@ -5,5 +5,5 @@
|
|
5
5
|
:name => content.essence.attachment.urlname
|
6
6
|
),
|
7
7
|
:class => "file_link #{content.essence.css_class.blank? ? "" : content.essence.css_class}",
|
8
|
-
:title => "#{content.essence.title.blank? ? content.essence.attachment.
|
8
|
+
:title => "#{content.essence.title.blank? ? content.essence.attachment.file_name : content.essence.title}"
|
9
9
|
) if content.essence.attachment %>
|
data/lib/alchemy/seeder.rb
CHANGED
data/lib/alchemy/upgrader.rb
CHANGED
@@ -11,6 +11,7 @@ module Alchemy
|
|
11
11
|
Rake::Task['alchemy:install:migrations'].invoke
|
12
12
|
strip_alchemy_from_schema_version_table
|
13
13
|
Rake::Task['db:migrate'].invoke
|
14
|
+
Seeder.seed!
|
14
15
|
upgrade_to_language
|
15
16
|
upgrade_layoutpages
|
16
17
|
upgrade_essence_link_target_default
|
@@ -18,9 +19,9 @@ module Alchemy
|
|
18
19
|
convert_essence_texts_displayed_as_select_into_essence_selects
|
19
20
|
convert_essence_texts_displayed_as_checkbox_into_essence_booleans
|
20
21
|
copy_new_config_file
|
22
|
+
gallery_pictures_change_notice
|
21
23
|
removed_richmedia_essences_notice
|
22
24
|
convert_picture_storage
|
23
|
-
upgrade_to_sites
|
24
25
|
removed_standard_set_notice
|
25
26
|
renamed_t_method
|
26
27
|
migrated_to_devise
|
@@ -30,20 +31,6 @@ module Alchemy
|
|
30
31
|
|
31
32
|
private
|
32
33
|
|
33
|
-
def upgrade_to_sites
|
34
|
-
desc "Creating default site and migrating existing languages to it"
|
35
|
-
if Site.count == 0
|
36
|
-
Alchemy::Site.transaction do
|
37
|
-
site = Alchemy::Site.new(host: '*', name: 'Default Site')
|
38
|
-
site.languages << Alchemy::Language.all
|
39
|
-
site.save!
|
40
|
-
log "Done."
|
41
|
-
end
|
42
|
-
else
|
43
|
-
log "Site(s) already present.", :skip
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
34
|
# Creates Language model if it does not exist (Alchemy CMS prior v1.5)
|
48
35
|
# Also creates missing associations between pages and languages
|
49
36
|
def upgrade_to_language
|
@@ -51,7 +38,7 @@ module Alchemy
|
|
51
38
|
Alchemy::Page.all.each do |page|
|
52
39
|
if !page.language_code.blank? && page.language.nil?
|
53
40
|
root = page.get_language_root
|
54
|
-
lang = Alchemy::Language.
|
41
|
+
lang = Alchemy::Language.find_or_create_by_language_code(
|
55
42
|
:name => page.language_code.capitalize,
|
56
43
|
:code => page.language_code,
|
57
44
|
:frontpage_name => root.name,
|
@@ -214,6 +201,17 @@ module Alchemy
|
|
214
201
|
end
|
215
202
|
end
|
216
203
|
|
204
|
+
def gallery_pictures_change_notice
|
205
|
+
txt = ["We have changed the way Alchemy handles EssencePictures in elements."]
|
206
|
+
txt << "It is now possible to have single EssencePictures and galleries side by side in the same element."
|
207
|
+
txt << "All element editor views containing render_picture_editor with option `maximum_amount_of_images => 1` must be changed into render_essence_editor_by_name."
|
208
|
+
txt << "In the yml description of these elements add a new content for this picture."
|
209
|
+
txt << "\nIn order to upgrade your elements in the database run:"
|
210
|
+
txt << "\nrails g alchemy:gallery_pictures_migration\n"
|
211
|
+
txt << "and alter `db/seeds.rb`, so that it contains all elements that have essence pictures."
|
212
|
+
todo txt.join("\n")
|
213
|
+
end
|
214
|
+
|
217
215
|
def removed_richmedia_essences_notice
|
218
216
|
warn = <<-WARN
|
219
217
|
We removed the EssenceAudio, EssenceFlash and EssenceVideo essences from Alchemy core!
|
data/lib/alchemy/version.rb
CHANGED
data/lib/rails/generators/alchemy/gallery_pictures_migration/gallery_pictures_migration_generator.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
module Generators
|
5
|
+
class GalleryPicturesMigrationGenerator < ::Rails::Generators::Base
|
6
|
+
desc "This generator generates a script to update your elements to gallery pictures."
|
7
|
+
source_root File.expand_path('templates', File.dirname(__FILE__))
|
8
|
+
|
9
|
+
def append_into_seeds
|
10
|
+
append_file Rails.root.join("db/seeds.rb") do
|
11
|
+
<<-BLAH
|
12
|
+
|
13
|
+
module Alchemy
|
14
|
+
|
15
|
+
# Add all element names that contain a single picture.
|
16
|
+
Element.named(["picture", "background"]).each do |element|
|
17
|
+
element.contents.essence_pictures.each do |content|
|
18
|
+
content.update_column(:name, "image")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Add all element names that contain a picture gallery.
|
23
|
+
Element.named(["gallery", "slides"]).each do |element|
|
24
|
+
element.contents.essence_pictures.each_with_index do |content, i|
|
25
|
+
content.update_column(:name, "essence_picture_#\{i+1\}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
BLAH
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def display_todo
|
35
|
+
say "\nNow please alter `db/seeds.rb` so that it contains the elements you want to convert.\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -121,5 +121,20 @@ module Alchemy
|
|
121
121
|
|
122
122
|
end
|
123
123
|
|
124
|
+
describe '#publish' do
|
125
|
+
|
126
|
+
let(:page) { stub_model(Page, published_at: nil, public: false, name: "page", parent_id: 1, urlname: "page", language: stub_model(Language), page_layout: "bla") }
|
127
|
+
before do
|
128
|
+
@controller.stub!(:load_page).and_return(page)
|
129
|
+
@controller.instance_variable_set("@page", page)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should publish the page" do
|
133
|
+
page.should_receive(:publish!)
|
134
|
+
post :publish, { id: page.id }
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
124
139
|
end
|
125
140
|
end
|
@@ -67,18 +67,50 @@ module Alchemy
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
describe 'Picture processing' do
|
71
|
+
|
72
|
+
context "with crop and size parameters" do
|
73
|
+
|
74
|
+
let(:big_picture) { Picture.create(:image_file => fixture_file_upload(File.expand_path('../../support/80x60.png', __FILE__), 'image/png')) }
|
75
|
+
|
76
|
+
it "should return a cropped image." do
|
77
|
+
options = {
|
78
|
+
:crop => 'crop',
|
79
|
+
:size => '10x10',
|
80
|
+
:format => 'png'
|
81
|
+
}
|
82
|
+
get :show, options.merge(:id => big_picture.id, :sh => big_picture.security_token(options))
|
83
|
+
response.body[0x10..0x18].unpack('NN').should == [10,10]
|
84
|
+
end
|
85
|
+
|
86
|
+
context "without upsample parameter" do
|
87
|
+
it "should not upsample the image." do
|
88
|
+
options = {
|
89
|
+
:crop => 'crop',
|
90
|
+
:size => '10x10',
|
91
|
+
:format => 'png'
|
92
|
+
}
|
93
|
+
get :show, options.merge(:id => picture.id, :sh => picture.security_token(options))
|
94
|
+
response.body[0x10..0x18].unpack('NN').should == [1,1]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context "and with upsample true" do
|
99
|
+
it "should return an upsampled image." do
|
100
|
+
options = {
|
101
|
+
:crop => 'crop',
|
102
|
+
:size => '10x10',
|
103
|
+
:upsample => 'true',
|
104
|
+
:format => 'png'
|
105
|
+
}
|
106
|
+
get :show, options.merge(:id => picture.id, :sh => picture.security_token(options))
|
107
|
+
response.body[0x10..0x18].unpack('NN').should == [10,10]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
79
111
|
end
|
80
|
-
end
|
81
112
|
|
113
|
+
end
|
82
114
|
|
83
115
|
end
|
84
116
|
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -161,20 +161,31 @@ module Alchemy
|
|
161
161
|
end
|
162
162
|
|
163
163
|
context "urlname has changed" do
|
164
|
-
|
164
|
+
|
165
|
+
it "should store legacy url if page is not redirect to external page" do
|
165
166
|
page.urlname = 'new-urlname'
|
166
167
|
page.save!
|
167
168
|
page.legacy_urls.should_not be_empty
|
168
169
|
page.legacy_urls.first.urlname.should == 'my-testpage'
|
169
170
|
end
|
171
|
+
|
172
|
+
it "should not store legacy url if page is redirect to external page" do
|
173
|
+
page.urlname = 'new-urlname'
|
174
|
+
page.page_layout = "external"
|
175
|
+
page.save!
|
176
|
+
page.legacy_urls.should be_empty
|
177
|
+
end
|
178
|
+
|
170
179
|
end
|
171
180
|
|
172
181
|
context "urlname has not changed" do
|
182
|
+
|
173
183
|
it "should not store a legacy url" do
|
174
184
|
page.urlname = 'my-testpage'
|
175
185
|
page.save!
|
176
186
|
page.legacy_urls.should be_empty
|
177
187
|
end
|
188
|
+
|
178
189
|
end
|
179
190
|
|
180
191
|
end
|
@@ -681,7 +692,7 @@ module Alchemy
|
|
681
692
|
end
|
682
693
|
|
683
694
|
describe '.copy' do
|
684
|
-
let
|
695
|
+
let(:page) { FactoryGirl.create(:page, :name => 'Source') }
|
685
696
|
subject { Page.copy(page) }
|
686
697
|
|
687
698
|
it "the copy should have added (copy) to name" do
|
@@ -745,5 +756,20 @@ module Alchemy
|
|
745
756
|
end
|
746
757
|
end
|
747
758
|
|
759
|
+
describe "#cache_key" do
|
760
|
+
let(:page) { stub_model(Page) }
|
761
|
+
subject { page }
|
762
|
+
its(:cache_key) { should match(page.id.to_s) }
|
763
|
+
end
|
764
|
+
|
765
|
+
describe "#publish!" do
|
766
|
+
let(:page) { stub_model(Page, public: false, name: "page", parent_id: 1, urlname: "page", language: stub_model(Language), page_layout: "bla") }
|
767
|
+
before { page.publish! }
|
768
|
+
|
769
|
+
it "sets public attribute to true" do
|
770
|
+
page.public.should == true
|
771
|
+
end
|
772
|
+
end
|
773
|
+
|
748
774
|
end
|
749
775
|
end
|
Binary file
|
data/spec/support/image.png
CHANGED
Binary file
|
data/spec/support/image2.PNG
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rails
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
requirements:
|
119
119
|
- - ~>
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: 0.9.
|
121
|
+
version: 0.9.14
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - ~>
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.9.
|
129
|
+
version: 0.9.14
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
131
|
name: kaminari
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,7 +244,7 @@ dependencies:
|
|
244
244
|
requirement: !ruby/object:Gem::Requirement
|
245
245
|
none: false
|
246
246
|
requirements:
|
247
|
-
- -
|
247
|
+
- - ! '>='
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: 0.2.1
|
250
250
|
type: :runtime
|
@@ -252,7 +252,7 @@ dependencies:
|
|
252
252
|
version_requirements: !ruby/object:Gem::Requirement
|
253
253
|
none: false
|
254
254
|
requirements:
|
255
|
-
- -
|
255
|
+
- - ! '>='
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: 0.2.1
|
258
258
|
- !ruby/object:Gem::Dependency
|
@@ -859,6 +859,7 @@ files:
|
|
859
859
|
- lib/rails/generators/alchemy/essence/essence_generator.rb
|
860
860
|
- lib/rails/generators/alchemy/essence/templates/editor.html.erb
|
861
861
|
- lib/rails/generators/alchemy/essence/templates/view.html.erb
|
862
|
+
- lib/rails/generators/alchemy/gallery_pictures_migration/gallery_pictures_migration_generator.rb
|
862
863
|
- lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
|
863
864
|
- lib/rails/generators/alchemy/page_layouts/templates/layout.html.erb
|
864
865
|
- lib/rails/generators/alchemy/page_layouts/templates/layout.html.haml
|
@@ -993,6 +994,7 @@ files:
|
|
993
994
|
- spec/models/user_spec.rb
|
994
995
|
- spec/routing_spec.rb
|
995
996
|
- spec/spec_helper.rb
|
997
|
+
- spec/support/80x60.png
|
996
998
|
- spec/support/alchemy/controller_hacks.rb
|
997
999
|
- spec/support/alchemy/specs_helpers.rb
|
998
1000
|
- spec/support/alchemy/test_tweaks.rb
|
@@ -1129,7 +1131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1129
1131
|
version: '0'
|
1130
1132
|
segments:
|
1131
1133
|
- 0
|
1132
|
-
hash:
|
1134
|
+
hash: -107875823720288269
|
1133
1135
|
requirements:
|
1134
1136
|
- ImageMagick (libmagick), v6.6 or greater.
|
1135
1137
|
rubyforge_project:
|
@@ -1258,6 +1260,7 @@ test_files:
|
|
1258
1260
|
- spec/models/user_spec.rb
|
1259
1261
|
- spec/routing_spec.rb
|
1260
1262
|
- spec/spec_helper.rb
|
1263
|
+
- spec/support/80x60.png
|
1261
1264
|
- spec/support/alchemy/controller_hacks.rb
|
1262
1265
|
- spec/support/alchemy/specs_helpers.rb
|
1263
1266
|
- spec/support/alchemy/test_tweaks.rb
|