skylinecms 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -1
- data/CHANGELOG +50 -0
- data/README.md +11 -3
- data/app/controllers/skyline/application_controller.rb +6 -5
- data/app/controllers/skyline/articles_controller.rb +4 -4
- data/app/controllers/skyline/content_controller.rb +2 -4
- data/app/controllers/skyline/media/data_controller.rb +1 -0
- data/app/controllers/skyline/site/media_files_data_controller.rb +1 -0
- data/app/controllers/skyline/user_preferences_controller.rb +1 -1
- data/app/controllers/skyline/users_controller.rb +5 -1
- data/app/controllers/skyline/variant_current_editor_controller.rb +6 -1
- data/app/controllers/skyline/variants_controller.rb +2 -2
- data/app/helpers/skyline/content_helper.rb +1 -1
- data/app/helpers/skyline/editors/editor.rb +6 -6
- data/app/helpers/skyline/editors/joinable_list.rb +1 -1
- data/app/helpers/skyline/form_helper.rb +1 -0
- data/app/helpers/skyline/menu_helper.rb +0 -8
- data/app/helpers/skyline/presenters/presenter.rb +2 -2
- data/app/middleware/skyline/sprockets_middleware.rb +3 -8
- data/app/models/skyline/article.rb +29 -25
- data/app/models/skyline/article_version.rb +20 -20
- data/app/models/skyline/associated_tag.rb +1 -1
- data/app/models/skyline/grant.rb +1 -1
- data/app/models/skyline/link_section_link.rb +1 -1
- data/app/models/skyline/media_cache.rb +1 -1
- data/app/models/skyline/media_dir.rb +0 -2
- data/app/models/skyline/media_node.rb +1 -1
- data/app/models/skyline/object_ref.rb +3 -3
- data/app/models/skyline/page.rb +1 -3
- data/app/models/skyline/publication.rb +3 -1
- data/app/models/skyline/ref_object.rb +1 -1
- data/app/models/skyline/referable_uri.rb +1 -1
- data/app/models/skyline/right.rb +1 -1
- data/app/models/skyline/role.rb +1 -1
- data/app/models/skyline/section.rb +9 -9
- data/app/models/skyline/sections/content_collection_section.rb +3 -3
- data/app/models/skyline/sections/link_section.rb +3 -3
- data/app/models/skyline/sections/media_section.rb +2 -0
- data/app/models/skyline/sections/rss_section.rb +11 -12
- data/app/models/skyline/tag.rb +1 -1
- data/app/models/skyline/user.rb +213 -202
- data/app/models/skyline/user_preference.rb +2 -2
- data/app/models/skyline/variant.rb +18 -14
- data/app/observers/skyline/version_stamper.rb +1 -1
- data/app/templates/skyline/page/default/index.html.erb +1 -1
- data/app/views/skyline/articles/_security.html.erb +1 -1
- data/app/views/skyline/articles/edit.html.erb +1 -1
- data/app/views/skyline/content/{_add.rhtml → _add.html.erb} +0 -0
- data/app/views/skyline/content/{_filter.rhtml → _filter.html.erb} +0 -0
- data/app/views/skyline/content/{create.rhtml → create.html.erb} +0 -0
- data/app/views/skyline/content/{edit.rhtml → edit.html.erb} +0 -0
- data/app/views/skyline/content/{error.rhtml → error.html.erb} +0 -0
- data/app/views/skyline/content/{list.rhtml → list.html.erb} +3 -3
- data/app/views/skyline/content/{show.rhtml → show.html.erb} +0 -0
- data/app/views/skyline/content_sections/_tags.html.erb +1 -1
- data/app/views/skyline/shared/_header_area.html.erb +1 -1
- data/app/views/skyline/users/_new.html.erb +1 -1
- data/config/initializers/middlewares.rb +5 -1
- data/config/initializers/mime_types.rb +0 -6
- data/config/initializers/observers.rb +1 -1
- data/config/locales/en-US.yml +1 -1
- data/db/fixtures/roles_and_rights.rb +5 -5
- data/db/fixtures/roots.rb +1 -1
- data/doc/concepts.md +37 -0
- data/lib/skyline/belongs_to_referable.rb +5 -5
- data/lib/skyline/content/class_meta_data.rb +4 -3
- data/lib/skyline/content/content.rb +28 -18
- data/lib/skyline/content/exportable.rb +3 -3
- data/lib/skyline/content/field_meta_data.rb +12 -11
- data/lib/skyline/content/implementation.rb +7 -6
- data/lib/skyline/content/meta_data/field.rb +1 -1
- data/lib/skyline/content/stack.rb +1 -1
- data/lib/skyline/content/versioning/version.rb +1 -1
- data/lib/skyline/engine.rb +1 -1
- data/lib/skyline/has_many_referables_in.rb +4 -4
- data/lib/skyline/plugins/manager.rb +4 -3
- data/lib/skyline/plugins/plugin.rb +9 -1
- data/lib/skyline/rendering/renderer.rb +12 -2
- data/lib/skyline/sections/interface.rb +1 -1
- data/lib/skyline/taggable.rb +4 -4
- data/lib/skyline/version.rb +2 -2
- data/public/skyline/javascripts/src/application.js +1 -1
- data/public/skyline/javascripts/src/application_preinit.js +1 -0
- data/public/skyline/javascripts/src/library_uploader.js +1 -1
- data/public/skyline/javascripts/src/skyline.editor/src/skyline.editor.js +18 -18
- data/public/skyline/javascripts/src/skyline.editor/src/tinymce_preinit.js +4 -0
- data/public/skyline/javascripts/src/skyline.js +20 -18
- data/public/skyline/javascripts/src/skyline/src/skyline.js +2 -2
- data/public/skyline/javascripts/src/skyline/src/uploader.js +1 -1
- data/skylinecms.gemspec +7 -5
- data/test/factories.rb +2 -0
- data/test/integration/media_browser_super_access_test.rb +3 -3
- data/test/integration/media_browser_user_access_test.rb +2 -2
- data/test/integration/user_preferences_test.rb +5 -5
- data/test/test_helper.rb +1 -0
- data/test/unit/article_test.rb +1 -1
- data/test/unit/locales_test.rb +13 -3
- data/test/unit/test_content_object_test.rb +1 -1
- data/test/unit/test_section_test.rb +3 -2
- data/test/unit/user_preference_test.rb +2 -2
- data/vendor/digitpaint/nested_attributes_positioning.rb +5 -5
- metadata +66 -40
data/.yardopts
CHANGED
data/CHANGELOG
CHANGED
@@ -1,5 +1,55 @@
|
|
1
1
|
# Changelog for Skyline #
|
2
2
|
|
3
|
+
## 3.3.0 (March 16th, 2012) ##
|
4
|
+
|
5
|
+
### Core ###
|
6
|
+
* [Core] Skyline now works with Rails 3.2.2
|
7
|
+
* [Core] Dependency updates for sprockets, shoulda, factory-girl and seed-fu
|
8
|
+
* [Core] Fixed lot's of Rails deprecation issues
|
9
|
+
* [Core] Allow setting of renderable by string within global namespace
|
10
|
+
* [Core] Fix for bug with VERSION display in some git
|
11
|
+
* [Core] Observers are added to applications observers instead of overwriting them
|
12
|
+
|
13
|
+
### User Interface (Core) ###
|
14
|
+
* [UI] Remove unused menu_for helper
|
15
|
+
* [UI] Changes to form_for and fields_for syntax
|
16
|
+
* [UI] Fix logout link to no longer use :url =>
|
17
|
+
* [UI] Update javascript to work with newer sprockets gem
|
18
|
+
|
19
|
+
### Plugin management (Core) ###
|
20
|
+
* [Plugins] Fix view_paths for skyline plugins
|
21
|
+
|
22
|
+
### Articles ###
|
23
|
+
* [Articles] Add API for publication/depublication callbacks
|
24
|
+
* [Articles] Added created_at and updated_at to publication rollback
|
25
|
+
|
26
|
+
### Content elements ###
|
27
|
+
* [Content Elements] Redirect to content list for selected item after new/create/edit/delete
|
28
|
+
|
29
|
+
### Media Library
|
30
|
+
* [MediaLibrary] Media files edit and delete are available through javascript only
|
31
|
+
* [MediaLibrary] Do not allow image links with only one size parameter (default to 0x0 image)
|
32
|
+
|
33
|
+
### Sections (builtin) ###
|
34
|
+
* [Sections] Empty values for MediaSection's dimensions resulted in 0-values for width and height.
|
35
|
+
* [Sections] rss_feed method no longer protected in RssSection
|
36
|
+
|
37
|
+
### Test ###
|
38
|
+
* [Test] Fix Test_section_test: @small_image_no_refs used wrong order for dimensions
|
39
|
+
* [Test] Do not use CGI Escaping for JSON in tests
|
40
|
+
* [Test] Update reference to test media file in integration test to use more flexible relative path
|
41
|
+
* [Test] Fixes for locales-test: load skyline locales as in initializer, I18n.backend.send(:translations) to get all values
|
42
|
+
|
43
|
+
### Documentation ###
|
44
|
+
* [Documentation] Add link to api
|
45
|
+
* [Documentation] Update migration documentation
|
46
|
+
* [Documentation] Add concepts documentation
|
47
|
+
|
48
|
+
### Settings and users ###
|
49
|
+
* [Users] Allow creation of users that were previously deleted
|
50
|
+
* [Users] Correctly revoke all grants from a user upon deletion
|
51
|
+
|
52
|
+
|
3
53
|
## 3.2.0 (November 1, 2011) ##
|
4
54
|
|
5
55
|
### Core ###
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@ Skyline CMS
|
|
2
2
|
===========
|
3
3
|
|
4
4
|
**Homepage**: [http://www.skylinecms.nl](http://www.skylinecms.nl)
|
5
|
+
**Documentation**: [http://api.skylinecms.nl](http://api.skylinecms.nl)
|
5
6
|
**Twitter**: Follow [skylinecms](http://www.twitter.com/skylinecms) on twitter
|
6
7
|
**Git**: [http://github.com/digitpaint/skyline](http://github.com/digitpaint/skyline)
|
7
8
|
**Author**: DigitPaint
|
@@ -30,14 +31,21 @@ either be featured as lists or shown individually
|
|
30
31
|
Installation and usage
|
31
32
|
----------------------
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
Start with our {file:doc/INSTALL.md installation instructions} to get Skyline up and running.
|
35
|
+
|
36
|
+
It might be a good idea to read about {file:doc/concepts.md the basic Skyline concepts}.
|
35
37
|
|
36
38
|
For further information, see our documentation and guides on
|
37
|
-
[www.skylinecms.nl/documentation](http://www.skylinecms.nl/documentation).
|
39
|
+
[www.skylinecms.nl/documentation](http://www.skylinecms.nl/documentation) (currently outdated).
|
38
40
|
|
39
41
|
If you're running into problems, don't hesitate to contact us!
|
40
42
|
|
43
|
+
Updating
|
44
|
+
--------
|
45
|
+
|
46
|
+
See our {file:doc/MIGRATION.md migration instructions} to update from one Skyline version to another.
|
47
|
+
|
48
|
+
|
41
49
|
Copyright
|
42
50
|
---------
|
43
51
|
|
@@ -8,7 +8,7 @@ class Skyline::ApplicationController < ApplicationController
|
|
8
8
|
|
9
9
|
around_filter Skyline::ArticleVersionObserver.instance
|
10
10
|
|
11
|
-
|
11
|
+
class_attribute :default_menu
|
12
12
|
attr_accessor :current_menu
|
13
13
|
hide_action :default_menu, :default_menu=, :current_menu, :current_menu=, :menu, :javascript_redirect_to
|
14
14
|
|
@@ -25,6 +25,7 @@ class Skyline::ApplicationController < ApplicationController
|
|
25
25
|
|
26
26
|
define_callbacks :authenticate
|
27
27
|
|
28
|
+
class_attribute :authorization_hash
|
28
29
|
|
29
30
|
class << self
|
30
31
|
|
@@ -42,7 +43,7 @@ class Skyline::ApplicationController < ApplicationController
|
|
42
43
|
def authorize(*actions)
|
43
44
|
options = actions.extract_options!
|
44
45
|
raise ArgumentError, "You must specify the :by option" if !options.has_key?(:by)
|
45
|
-
authorizations =
|
46
|
+
authorizations = self.authorization_hash || {}
|
46
47
|
if actions.any?
|
47
48
|
actions.each do |a|
|
48
49
|
authorizations[a] ||= []
|
@@ -52,11 +53,11 @@ class Skyline::ApplicationController < ApplicationController
|
|
52
53
|
authorizations[:*] ||= []
|
53
54
|
authorizations[:*] << options[:by]
|
54
55
|
end
|
55
|
-
|
56
|
+
self.authorization_hash = authorizations
|
56
57
|
end
|
57
58
|
|
58
59
|
def authorizations
|
59
|
-
|
60
|
+
self.authorization_hash || {}
|
60
61
|
end
|
61
62
|
|
62
63
|
end
|
@@ -115,7 +116,7 @@ class Skyline::ApplicationController < ApplicationController
|
|
115
116
|
up.each do |k,v|
|
116
117
|
if k == "_delete"
|
117
118
|
v.each do |delete_id|
|
118
|
-
current_user.user_preferences.
|
119
|
+
current_user.user_preferences.remove_key(delete_id)
|
119
120
|
end
|
120
121
|
else
|
121
122
|
current_user.user_preferences.set(k,v)
|
@@ -58,7 +58,7 @@ class Skyline::ArticlesController < Skyline::ApplicationController
|
|
58
58
|
end
|
59
59
|
|
60
60
|
if @variant.editable_by?(current_user)
|
61
|
-
@variant.edit_by!(current_user)
|
61
|
+
@variant.edit_by!(current_user)
|
62
62
|
else
|
63
63
|
messages.now[:error] = render_to_string(:partial => "currently_editing")
|
64
64
|
return render(:action => "edit_preview_only")
|
@@ -101,7 +101,7 @@ class Skyline::ArticlesController < Skyline::ApplicationController
|
|
101
101
|
begin
|
102
102
|
Skyline::Article.transaction do
|
103
103
|
if params["clone_variant"] == "1"
|
104
|
-
@variant = @variant.
|
104
|
+
@variant = @variant.dup()
|
105
105
|
|
106
106
|
# Dirty hack so AR thinks this object isn't new.
|
107
107
|
@variant.attributes = new_variant.attributes.except("version")
|
@@ -133,8 +133,8 @@ class Skyline::ArticlesController < Skyline::ApplicationController
|
|
133
133
|
notifications[:success] = t(:success, :scope => [@article.class, :update, :flashes])
|
134
134
|
redirect_to edit_skyline_article_path(@article, :variant_id => @variant.id)
|
135
135
|
else
|
136
|
-
if @variant.errors
|
137
|
-
messages.now[:error] = @variant.errors
|
136
|
+
if @variant.errors[:version]
|
137
|
+
messages.now[:error] = @variant.errors[:version]
|
138
138
|
else
|
139
139
|
messages.now[:error] = t(:error, :scope => [@article.class, :update, :flashes])
|
140
140
|
end
|
@@ -64,7 +64,7 @@ class Skyline::ContentController < Skyline::Skyline2Controller
|
|
64
64
|
|
65
65
|
def delete
|
66
66
|
@element = stack.last
|
67
|
-
if request.post?
|
67
|
+
if request.post? || request.xhr?
|
68
68
|
if @element.destroy
|
69
69
|
notifications[:success] = t(:successfully_deleted, :scope => [:content, :flashes], :class => @element.class.singular_name)
|
70
70
|
else
|
@@ -73,9 +73,7 @@ class Skyline::ContentController < Skyline::Skyline2Controller
|
|
73
73
|
end
|
74
74
|
respond_to do |format|
|
75
75
|
format.html{ redirect_after(:delete) }
|
76
|
-
format.js
|
77
|
-
render(:update){|p| p.redirect_to controller.send(:redirect_url_after,:delete) }
|
78
|
-
end
|
76
|
+
format.js { javascript_redirect_to(redirect_url_after(:delete)) }
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
@@ -30,6 +30,7 @@ class Skyline::Media::DataController < Skyline::ApplicationController
|
|
30
30
|
else
|
31
31
|
if params[:size].present?
|
32
32
|
size = params[:size].to_s.split("x").map{|v| v.to_i }
|
33
|
+
size = [0, 0] unless size.count == 2
|
33
34
|
size = nil if size[0] == @file.width && size[1] >= @file.height || size[1] == @file.height && size[0] >= @file.width
|
34
35
|
else
|
35
36
|
size = nil
|
@@ -30,6 +30,7 @@ class Skyline::Site::MediaFilesDataController < ApplicationController
|
|
30
30
|
else
|
31
31
|
if params[:size].present?
|
32
32
|
size = params[:size].to_s.split("x").map{|v| v.to_i }
|
33
|
+
size = [0, 0] unless size.count == 2
|
33
34
|
size = nil if size[0] == @file.width && size[1] >= @file.height || size[1] == @file.height && size[0] >= @file.width
|
34
35
|
else
|
35
36
|
size = nil
|
@@ -4,7 +4,7 @@ class Skyline::UserPreferencesController < Skyline::ApplicationController
|
|
4
4
|
user_preference = ActiveSupport::JSON.decode(params[:skyline_up])
|
5
5
|
|
6
6
|
if user_preference.values.first == "_delete"
|
7
|
-
current_user.user_preferences.
|
7
|
+
current_user.user_preferences.remove_key(user_preference.keys.first)
|
8
8
|
up = {}
|
9
9
|
else
|
10
10
|
current_user.user_preferences.set(user_preference.keys.first, user_preference.values.first)
|
@@ -19,7 +19,11 @@ class Skyline::UsersController < Skyline::ApplicationController
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def create
|
22
|
-
@user = Skyline::User.
|
22
|
+
if (@user = Skyline::User.find_by_email(params[:user][:email])) && @user.is_destroyed
|
23
|
+
@user.reactivate(params[:user])
|
24
|
+
else
|
25
|
+
@user = Skyline::User.new(params[:user])
|
26
|
+
end
|
23
27
|
|
24
28
|
if @user.save
|
25
29
|
notifications[:success] = t(:success, :scope => [:user,:create,:flashes])
|
@@ -27,7 +27,12 @@ class Skyline::VariantCurrentEditorController < Skyline::ApplicationController
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def process(request,*args)
|
30
|
-
logger.
|
30
|
+
old_level = Rails.logger.level
|
31
|
+
Rails.logger.level = Logger::FATAL
|
32
|
+
|
33
|
+
super
|
34
|
+
ensure
|
35
|
+
Rails.logger.level = old_level
|
31
36
|
end
|
32
37
|
|
33
38
|
protected
|
@@ -9,8 +9,8 @@ class Skyline::VariantsController < Skyline::ApplicationController
|
|
9
9
|
return handle_unauthorized_user unless Skyline::Configuration.enable_multiple_variants
|
10
10
|
|
11
11
|
if params[:variant_id]
|
12
|
-
|
13
|
-
variant =
|
12
|
+
variant_to_dup = @article.variants.find_by_id(params[:variant_id])
|
13
|
+
variant = variant_to_dup.dup
|
14
14
|
variant.save
|
15
15
|
else
|
16
16
|
variant = @article.variants.create
|
@@ -135,7 +135,7 @@ module Skyline::ContentHelper
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def record_with_errors(content, record, field)
|
138
|
-
if record.errors
|
138
|
+
if record.errors[field.attribute_name]
|
139
139
|
content_tag("div", content.html_safe, :class => "fieldWithErrors")
|
140
140
|
else
|
141
141
|
content
|
@@ -10,9 +10,9 @@ module Skyline::Editors
|
|
10
10
|
Skyline::Editors::TextField.new(name_chain,record,field,template)
|
11
11
|
end
|
12
12
|
rescue NameError => e
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Rails.logger.warn(" Editor instantiation error ".center(50,"="))
|
14
|
+
Rails.logger.warn(e.to_s + "\n" + e.backtrace.join("\n"))
|
15
|
+
Rails.logger.warn("=" * 50)
|
16
16
|
Skyline::Editors::TextField.new(name_chain,record,field,template)
|
17
17
|
end
|
18
18
|
|
@@ -51,11 +51,11 @@ module Skyline::Editors
|
|
51
51
|
if self.respond_to? :output_without_errors
|
52
52
|
out << field_with_errors([field_prefix, output_without_errors, field_suffix].join.html_safe)
|
53
53
|
end
|
54
|
-
content_tag("div",out.html_safe, :id => "field_#{input_id(field_names)}", :class => "editor #{"invalid" if record.errors
|
54
|
+
content_tag("div",out.html_safe, :id => "field_#{input_id(field_names)}", :class => "editor #{"invalid" if record.errors[field.attribute_name].any?}")
|
55
55
|
end
|
56
56
|
|
57
57
|
def errors
|
58
|
-
errors = record.errors
|
58
|
+
errors = record.errors[field.attribute_name]
|
59
59
|
if errors.kind_of?(Array)
|
60
60
|
errors.flatten.to_sentence
|
61
61
|
else
|
@@ -70,7 +70,7 @@ module Skyline::Editors
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def field_with_errors(content)
|
73
|
-
if self.record.errors
|
73
|
+
if self.record.errors[self.field.attribute_name].any?
|
74
74
|
content_tag("div", content.html_safe, :class => "fieldWithErrors")
|
75
75
|
else
|
76
76
|
content
|
@@ -4,7 +4,7 @@ class Skyline::Editors::JoinableList < Skyline::Editors::Editor
|
|
4
4
|
|
5
5
|
def initialize(names,record,field,template)
|
6
6
|
super
|
7
|
-
|
7
|
+
Rails.logger.debug("@attribute => #{@attribute_names.inspect}")
|
8
8
|
|
9
9
|
@reflection = self.field.reflection
|
10
10
|
if @reflection.macro == :has_many
|
@@ -9,6 +9,7 @@ module Skyline::FormHelper
|
|
9
9
|
|
10
10
|
def skyline_fields_for(record_or_name_or_array, *args, &block)
|
11
11
|
options = args.extract_options!
|
12
|
+
args = [nil] if args == []
|
12
13
|
with_custom_field_error_proc do
|
13
14
|
self.fields_for(record_or_name_or_array, *(args << options.merge(:builder => Skyline::FormBuilder)), &proc)
|
14
15
|
end
|
@@ -18,14 +18,6 @@ module Skyline::MenuHelper
|
|
18
18
|
content_tag("li", link_to(t(scope.last, :scope => [:navigation, scope[-2]]), url, url_options), options)
|
19
19
|
end
|
20
20
|
|
21
|
-
def menu_for(*scope, &block)
|
22
|
-
return unless controller.current_menu[0, scope.size] == scope
|
23
|
-
@_menu_scope = scope
|
24
|
-
menu = capture(&block)
|
25
|
-
@_menu_scope = []
|
26
|
-
concat(menu)
|
27
|
-
end
|
28
|
-
|
29
21
|
def current_menu_scope(scope)
|
30
22
|
(@_menu_scope || []) + scope
|
31
23
|
end
|
@@ -32,13 +32,13 @@ class Skyline::Presenters::Presenter
|
|
32
32
|
|
33
33
|
|
34
34
|
def edit_button(record)
|
35
|
-
|
35
|
+
link_to button_text(:edit),{:action => "edit", :types => stack.url_types(:down => [record.id]), :return_to => url_for({:types => record.class.to_s.underscore.pluralize, :filter => params[:filter]})}, :class => "button small"
|
36
36
|
end
|
37
37
|
|
38
38
|
def delete_button(record)
|
39
39
|
link_to(
|
40
40
|
button_text(:delete),
|
41
|
-
{:action => "delete",:types => stack.url_types(:down => [record.id]),:return_to => url_for({})},
|
41
|
+
{:action => "delete",:types => stack.url_types(:down => [record.id]),:return_to => url_for({:types => record.class.to_s.underscore.pluralize})},
|
42
42
|
:remote => true,
|
43
43
|
:confirm => t(:confirm_deletion, :scope => [:content,:list], :class => self.fieldset.singular_name),
|
44
44
|
:class => "button small red")
|
@@ -16,9 +16,8 @@ class Skyline::SprocketsMiddleware
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def register_load_location(*paths)
|
19
|
-
|
20
|
-
|
21
|
-
@environment.register_load_location(p)
|
19
|
+
paths.each do |p|
|
20
|
+
@environment.append_path(p)
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -40,7 +39,6 @@ class Skyline::SprocketsMiddleware
|
|
40
39
|
end
|
41
40
|
|
42
41
|
if path && content = self.render(path)
|
43
|
-
|
44
42
|
resp = ::Rack::Response.new do |res|
|
45
43
|
res.status = 200
|
46
44
|
res.headers["Content-Type"] = "text/javascript"
|
@@ -62,10 +60,7 @@ class Skyline::SprocketsMiddleware
|
|
62
60
|
end
|
63
61
|
|
64
62
|
def render(path)
|
65
|
-
|
66
|
-
@preprocessor = Sprockets::Preprocessor.new(@environment, :strip_comments => @options[:strip_comments])
|
67
|
-
@preprocessor.require(pathname.source_file)
|
68
|
-
@preprocessor.concatenation.to_s
|
63
|
+
@environment.find_asset(path.to_s).to_s
|
69
64
|
end
|
70
65
|
|
71
66
|
end
|
@@ -12,7 +12,7 @@ class Skyline::Article < ActiveRecord::Base
|
|
12
12
|
|
13
13
|
def self.inherited(subclass)
|
14
14
|
super
|
15
|
-
subclass.
|
15
|
+
subclass.table_name = subclass.name.underscore.gsub("/","_")
|
16
16
|
|
17
17
|
parentclass = subclass.parent
|
18
18
|
parentclass.class_eval do
|
@@ -43,9 +43,7 @@ class Skyline::Article < ActiveRecord::Base
|
|
43
43
|
attr_accessor :to_be_published
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
set_table_name :skyline_articles
|
46
|
+
self.table_name = "skyline_articles"
|
49
47
|
|
50
48
|
# Associations
|
51
49
|
has_many :versions, :class_name => "Skyline::ArticleVersion"
|
@@ -64,6 +62,10 @@ class Skyline::Article < ActiveRecord::Base
|
|
64
62
|
before_destroy :confirm_destroyability
|
65
63
|
after_destroy :reset_ref_object
|
66
64
|
after_destroy :destroy_variants
|
65
|
+
|
66
|
+
# Custom callbacks
|
67
|
+
define_callbacks :publication
|
68
|
+
define_callbacks :depublication
|
67
69
|
|
68
70
|
# Validations
|
69
71
|
validate :has_at_least_one_variant
|
@@ -132,8 +134,10 @@ class Skyline::Article < ActiveRecord::Base
|
|
132
134
|
raise StandardError, "can't be depublished because this page is persistent" if self.persistent?
|
133
135
|
|
134
136
|
if self.published_publication
|
135
|
-
self.
|
136
|
-
|
137
|
+
self.run_callbacks :depublication do
|
138
|
+
self.published_publication.destroy unless self.keep_history?
|
139
|
+
self.published_publication = nil
|
140
|
+
end
|
137
141
|
end
|
138
142
|
|
139
143
|
self.published_publication_data = nil
|
@@ -209,29 +213,29 @@ class Skyline::Article < ActiveRecord::Base
|
|
209
213
|
false
|
210
214
|
end
|
211
215
|
|
212
|
-
def
|
213
|
-
s = super.tap do |
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
216
|
+
def dup
|
217
|
+
s = super.tap do |dup|
|
218
|
+
dup.created_at = nil
|
219
|
+
dup.updated_at = nil
|
220
|
+
dup.default_variant_id = nil
|
221
|
+
dup.default_variant_data_id = nil
|
222
|
+
dup.default_variant = nil
|
223
|
+
dup.default_variant_data = nil
|
224
|
+
dup.published_publication_id = nil
|
225
|
+
dup.published_publication_data_id = nil
|
222
226
|
|
223
|
-
|
224
|
-
|
225
|
-
|
227
|
+
dup.publications.clear
|
228
|
+
dup.versions.clear
|
229
|
+
dup.variants.clear
|
226
230
|
|
227
231
|
self.variants.each do |variant|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
self.becomes_default_variant_after_save =
|
232
|
+
variant_dup = variant.dup
|
233
|
+
dup.variants << variant_dup
|
234
|
+
variant_dup.article = dup
|
235
|
+
variant_dup.article_id = nil
|
236
|
+
self.becomes_default_variant_after_save = variant_dup if variant == self.default_variant
|
233
237
|
end
|
234
|
-
|
238
|
+
dup
|
235
239
|
end
|
236
240
|
end
|
237
241
|
|