skylinecms 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.yardopts +4 -2
- data/CHANGELOG +12 -0
- data/Rakefile +88 -8
- data/app/helpers/skyline/content_helper.rb +1 -0
- data/app/helpers/skyline/media_files_helper.rb +1 -0
- data/app/helpers/skyline/message_generator.rb +1 -0
- data/app/helpers/skyline/tree_helper.rb +1 -1
- data/app/models/skyline/article.rb +57 -15
- data/app/models/skyline/article_version.rb +1 -0
- data/app/models/skyline/associated_tag.rb +1 -0
- data/app/models/skyline/grant.rb +1 -0
- data/app/models/skyline/image_ref.rb +1 -0
- data/app/models/skyline/inline_ref.rb +2 -1
- data/app/models/skyline/link_ref.rb +1 -0
- data/app/models/skyline/link_section_link.rb +1 -0
- data/app/models/skyline/media_cache.rb +1 -0
- data/app/models/skyline/media_dir.rb +1 -0
- data/app/models/skyline/media_file.rb +1 -0
- data/app/models/skyline/media_node.rb +1 -0
- data/app/models/skyline/object_ref.rb +1 -0
- data/app/models/skyline/page.rb +9 -2
- data/app/models/skyline/publication.rb +1 -0
- data/app/models/skyline/ref_object.rb +1 -0
- data/app/models/skyline/referable_uri.rb +1 -0
- data/app/models/skyline/right.rb +1 -0
- data/app/models/skyline/role.rb +1 -0
- data/app/models/skyline/section.rb +1 -0
- data/app/models/skyline/sections/content_collection_section.rb +13 -0
- data/app/models/skyline/sections/content_item_section.rb +1 -0
- data/app/models/skyline/sections/heading_section.rb +1 -0
- data/app/models/skyline/sections/iframe_section.rb +1 -0
- data/app/models/skyline/sections/link_section.rb +1 -0
- data/app/models/skyline/sections/media_section.rb +1 -0
- data/app/models/skyline/sections/page_fragment_section.rb +1 -0
- data/app/models/skyline/sections/raw_section.rb +1 -0
- data/app/models/skyline/sections/redirect_section.rb +1 -0
- data/app/models/skyline/sections/rss_section.rb +2 -0
- data/app/models/skyline/sections/splitter_section.rb +1 -0
- data/app/models/skyline/sections/wysiwyg_section.rb +1 -0
- data/app/models/skyline/variant.rb +1 -6
- data/app/templates/skyline/page/default/index.html.erb +2 -0
- data/app/templates/skyline/sections/content_collection_section/default/index.html.erb +1 -2
- data/app/templates/skyline/sections/link_section/default/index.html.erb +3 -1
- data/config/initializers/rails_defaults.rb +5 -1
- data/config/locales/en-US.yml +4 -4
- data/db/migrate/20090526090049_add_pages_url_part.rb +1 -3
- data/db/migrate/20090610142139_add_skyline_tags_taggable_type.rb +1 -1
- data/db/migrate/20090610143446_move_skyline_media_files_skyline_tags_to_skyline_associated_tags.rb +1 -1
- data/db/migrate/20090616091122_add_skyline_pages_persistent.rb +0 -1
- data/db/migrate/20091008134448_article_position_no_default.rb +2 -1
- data/doc/Bundler.md +71 -0
- data/doc/INSTALL.md +72 -42
- data/doc/MIGRATION.md +24 -0
- data/lib/skyline/cli/base.rb +2 -0
- data/lib/skyline/cli/init.rb +2 -1
- data/lib/skyline/configuration.rb +1 -1
- data/lib/skyline/content/exportable.rb +1 -1
- data/lib/skyline/content/orderable.rb +3 -3
- data/lib/skyline/content/versioning/version.rb +1 -0
- data/lib/skyline/content/versioning/versionable.rb +2 -0
- data/lib/skyline/referable.rb +4 -2
- data/lib/skyline/rendering/helpers/bread_crumb_helper.rb +5 -3
- data/lib/skyline/rendering/helpers/column_helper.rb +5 -2
- data/lib/skyline/rendering/helpers/renderer_helper.rb +20 -3
- data/lib/skyline/rendering/helpers/settings_helper.rb +9 -14
- data/lib/skyline/version.rb +26 -3
- data/lib/skyline/wildcard_renderable_scope.rb +1 -0
- data/lib/skyline.rb +6 -3
- data/rails/init.rb +3 -1
- metadata +3 -4
- data/app/helpers/skyline/browser/tabs/media_library/media_files_helper.rb +0 -6
- data/app/helpers/skyline/users_helper.rb +0 -2
data/.yardopts
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
*3.0.8 (December 18, 2009)*
|
2
|
+
|
3
|
+
* Added support for SQLite3
|
4
|
+
* Always make the last saved variant the default variant
|
5
|
+
* Fix longstanding bug which can be caused by copy-paste from one wysiwyg section to another
|
6
|
+
* Make the default templates more bullet-proof
|
7
|
+
* Implemented capture functionality on RendererHelper#assign
|
8
|
+
* Add some helper methods to the ContentCollectionSection. Simplified the templates accordingly
|
9
|
+
* Added loads and loads of API documentation
|
10
|
+
* Deprecate the settings helper in favour of Settings#get and Settings#get_page
|
11
|
+
* Deprecate page_sections_per_column in favour of sections_per_column
|
12
|
+
|
1
13
|
*3.0.7 (December 8, 2009)*
|
2
14
|
|
3
15
|
* Minor optimalisation to make (auto)loading work better
|
data/Rakefile
CHANGED
@@ -3,6 +3,63 @@ require File.dirname(__FILE__) + "/lib/skyline/version"
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
|
+
rescue LoadError
|
7
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
8
|
+
end
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'yard'
|
12
|
+
rescue LoadError
|
13
|
+
puts "Yardoc not available. Install it with: sudo gem install yard"
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'yaml'
|
17
|
+
|
18
|
+
DEFAULT_OPTIONS = {
|
19
|
+
"doc" => {
|
20
|
+
"output_path" => "ydoc",
|
21
|
+
"deploy_to" => nil
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
class Options < Hash
|
26
|
+
def [](v)
|
27
|
+
get_options!
|
28
|
+
super(v)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
def inspect
|
34
|
+
get_options!
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def get_options!
|
41
|
+
return if @_loaded
|
42
|
+
@_loaded = true
|
43
|
+
|
44
|
+
self.update(DEFAULT_OPTIONS)
|
45
|
+
|
46
|
+
f = File.expand_path("~/.skyline_options")
|
47
|
+
if File.exist?(f)
|
48
|
+
opts = YAML.load(File.read(f))
|
49
|
+
opts.each do |k,v|
|
50
|
+
if self.has_key?(k)
|
51
|
+
self[k].update(v)
|
52
|
+
else
|
53
|
+
self[k] = v
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
OPTIONS = Options.new
|
61
|
+
|
62
|
+
namespace :gem do
|
6
63
|
Jeweler::Tasks.new do |gemspec|
|
7
64
|
gemspec.version = Skyline.version
|
8
65
|
gemspec.name = "skylinecms"
|
@@ -11,22 +68,22 @@ begin
|
|
11
68
|
gemspec.email = "info@digitpaint.nl"
|
12
69
|
gemspec.homepage = "http://www.skylinecms.nl"
|
13
70
|
gemspec.authors = ["DigitPaint"]
|
14
|
-
|
71
|
+
|
15
72
|
gemspec.files.exclude "tasks/testing.rake"
|
16
73
|
gemspec.files.exclude "Gemfile"
|
17
74
|
gemspec.files.exclude ".gitignore"
|
18
75
|
gemspec.files.exclude "test/"
|
19
|
-
|
76
|
+
|
20
77
|
gemspec.test_files = []
|
21
|
-
|
78
|
+
|
22
79
|
gemspec.has_rdoc = false
|
23
80
|
gemspec.extra_rdoc_files = %w{README.md doc/MIGRATION.md}
|
24
|
-
|
81
|
+
|
25
82
|
gemspec.add_dependency "thor", "0.12.0"
|
26
|
-
|
83
|
+
|
27
84
|
gemspec.add_dependency "rails", "2.3.5"
|
28
85
|
gemspec.add_dependency "rack", "1.0.1"
|
29
|
-
|
86
|
+
|
30
87
|
gemspec.add_dependency "polyglot", "0.2.6"
|
31
88
|
gemspec.add_dependency "sprockets", "1.0.2"
|
32
89
|
gemspec.add_dependency "mime-types", "1.16"
|
@@ -35,8 +92,31 @@ begin
|
|
35
92
|
gemspec.add_dependency "guid", "0.1.1"
|
36
93
|
gemspec.add_dependency "will_paginate", "~>2.3.11"
|
37
94
|
gemspec.add_dependency "seed-fu", "~>1.2.0"
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
namespace :doc do
|
100
|
+
desc "Generate the Skyline CMS documentation (uses Yard)"
|
101
|
+
YARD::Rake::YardocTask.new(:generate) do |t|
|
102
|
+
t.options = ["-o#{OPTIONS["doc"]["output_path"]}", "--title=\"Skyline #{Skyline.version} API documentation\""]
|
103
|
+
end
|
104
|
+
|
105
|
+
task :deploy do
|
106
|
+
raise "No Options['doc']['deploy_to'] variable set, create a ~/.skyline_options YAML file and set it there" if OPTIONS["doc"]["deploy_to"].nil?
|
38
107
|
|
108
|
+
puts "=> Generating YarDoc first."
|
109
|
+
Rake::Task['doc:generate'].execute
|
110
|
+
|
111
|
+
puts "=> Uploading documentation"
|
112
|
+
Rake::Task['doc:upload'].execute
|
39
113
|
end
|
40
|
-
|
41
|
-
|
114
|
+
|
115
|
+
task :upload do
|
116
|
+
system("rsync -az --delete #{OPTIONS["doc"]["output_path"]}/* #{OPTIONS["doc"]["deploy_to"]}")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
task :options do
|
121
|
+
puts OPTIONS.inspect
|
42
122
|
end
|
@@ -1,4 +1,12 @@
|
|
1
|
+
# Articles are container objects that contain Sections, have history and can (optional) be previewed
|
2
|
+
# and published.
|
3
|
+
#
|
4
|
+
# @abstract Subclass and implement the Article interface
|
1
5
|
class Skyline::Article < ActiveRecord::Base
|
6
|
+
|
7
|
+
# The data object contains required structured data needed for an article.
|
8
|
+
#
|
9
|
+
# @abstract Subclass and implement the Article::Data interface
|
2
10
|
class Data < ActiveRecord::Base
|
3
11
|
self.abstract_class = true
|
4
12
|
|
@@ -57,29 +65,35 @@ class Skyline::Article < ActiveRecord::Base
|
|
57
65
|
|
58
66
|
# The prefix to use when determining rights. User#allow? uses
|
59
67
|
# this method when called with 2 parameters.
|
60
|
-
#
|
68
|
+
#
|
69
|
+
# @return [String] The string to prefix to the right (_create, _update, _delete)
|
70
|
+
# @abstract Implement the value correct value in your subclass, defaults to 'article'
|
61
71
|
def right_prefix
|
62
72
|
"article"
|
63
73
|
end
|
64
74
|
|
65
|
-
#
|
75
|
+
# Is this type of article publishable?
|
76
|
+
#
|
77
|
+
# @return [true,false] Wether or not this article type can be published
|
78
|
+
# @abstract Implement in subclass if needed, true is a sensible default.
|
66
79
|
def publishable?
|
67
80
|
true
|
68
81
|
end
|
69
82
|
end
|
70
83
|
|
84
|
+
# Has this article been puslished?
|
85
|
+
#
|
86
|
+
# @return [true,false] True if it has a published_publication, meaning it's currently published
|
71
87
|
def published?
|
72
88
|
# Don't use only "self.published_publication" here, it causes way too many lookups
|
73
89
|
# If the next test is wrong, than maybe you should wonder why it is wrong? Foreign key left behind?
|
74
90
|
self.published_publication_id.present?
|
75
91
|
end
|
76
92
|
|
77
|
-
# Depublish
|
78
|
-
#
|
79
|
-
# ==== Raises
|
80
|
-
# StandardError:: if page is persistent
|
93
|
+
# Depublish an article, removes the published_publication if keep_history? is false
|
81
94
|
#
|
82
|
-
#
|
95
|
+
# @raise [StandardError] If page is persistent and cannot be depulished
|
96
|
+
# @return [void]
|
83
97
|
def depublish
|
84
98
|
raise StandardError, "can't be depublished because this page is persistent" if self.persistent?
|
85
99
|
|
@@ -94,31 +108,47 @@ class Skyline::Article < ActiveRecord::Base
|
|
94
108
|
self.save
|
95
109
|
end
|
96
110
|
|
111
|
+
# Depublish this article and destroy it.
|
112
|
+
#
|
113
|
+
# @see Skylien::Article#depublish
|
114
|
+
# @return [false,true] True sucessfully destroyed, otherwise false
|
97
115
|
def destroy
|
98
116
|
depublish
|
99
117
|
super
|
100
118
|
end
|
101
119
|
|
120
|
+
# Can this article be depublished?
|
121
|
+
#
|
122
|
+
# @return [true,false]
|
102
123
|
def depublishable?
|
103
124
|
!self.persistent?
|
104
125
|
end
|
105
126
|
|
127
|
+
# Can this article be destroyed? Only works if the article isn't persisntent and does not have
|
128
|
+
# a publication (isn't published).
|
129
|
+
#
|
130
|
+
# @return [true,false]
|
106
131
|
def destroyable?
|
107
132
|
!self.persistent? && self.published_publication == nil
|
108
133
|
end
|
109
134
|
|
135
|
+
# Can this article be rendered. This basically means wether or not there are any templates for
|
136
|
+
# this article.
|
137
|
+
#
|
138
|
+
# @return [true,false]
|
110
139
|
def renderable?
|
111
140
|
self.renderable_scope.renderer.templates_for(self).any?
|
112
141
|
end
|
113
142
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
143
|
+
# Can this article be previewed? Delegates to Skyline::Article#renderable?
|
144
|
+
#
|
145
|
+
# @return [true,false]
|
146
|
+
# @see Skyline::Article#renderable?
|
118
147
|
def previewable?
|
119
148
|
self.renderable?
|
120
149
|
end
|
121
150
|
|
151
|
+
|
122
152
|
def rollbackable?
|
123
153
|
true
|
124
154
|
end
|
@@ -142,12 +172,15 @@ class Skyline::Article < ActiveRecord::Base
|
|
142
172
|
|
143
173
|
# Checks if the page can be edited by a certain user
|
144
174
|
# Currently only checks on page locks.
|
145
|
-
#
|
175
|
+
#
|
176
|
+
# @param user [Skyline::User,Integer] The user or user id to check the access for.
|
177
|
+
# @return [true,false] True if the user can edit this page, false otherwise
|
146
178
|
def editable_by?(user)
|
147
179
|
user = user.kind_of?(Skyline::User) ? user : Skyline::User.find_by_id(user)
|
148
180
|
self.locked? && user.allow?(:page_lock) || !self.locked?
|
149
181
|
end
|
150
182
|
|
183
|
+
|
151
184
|
def set_default_variant!(variant)
|
152
185
|
return if variant.id == self.default_variant_id && variant.data_id == self.default_variant_data_id
|
153
186
|
self.update_attributes(:default_variant_id => variant.id, :default_variant_data_id => variant.data_id)
|
@@ -159,15 +192,17 @@ class Skyline::Article < ActiveRecord::Base
|
|
159
192
|
end
|
160
193
|
|
161
194
|
# The class that provides our custom data fields.
|
162
|
-
#
|
163
|
-
#
|
195
|
+
#
|
196
|
+
# @return [Class,false] False if we don't have an inner Data class, the inner Data class if there is one.
|
164
197
|
def data_class
|
198
|
+
# Note: We can't use memoize here, because it freezes the class
|
165
199
|
return @_data_class unless @_data_class.nil?
|
166
200
|
@_data_class = (self.class.name + "::" + "Data").constantize
|
167
201
|
rescue NameError
|
168
202
|
@_data_class = false
|
169
203
|
end
|
170
204
|
|
205
|
+
|
171
206
|
def right_prefix
|
172
207
|
self.class.right_prefix
|
173
208
|
end
|
@@ -176,7 +211,10 @@ class Skyline::Article < ActiveRecord::Base
|
|
176
211
|
self.id
|
177
212
|
end
|
178
213
|
|
179
|
-
#
|
214
|
+
# A subclass can return a Page in which the article (ie: NewsItem) will be rendered for previewing
|
215
|
+
#
|
216
|
+
# @return [Skyline::Page,nil] The page to wrap this article in when previewing. Nil if no wrapping is needed.
|
217
|
+
# @abstract Implement this in a subclass to get the Page from Settings or from somewhere else.
|
180
218
|
def preview_wrapper_page
|
181
219
|
nil
|
182
220
|
end
|
@@ -189,6 +227,10 @@ class Skyline::Article < ActiveRecord::Base
|
|
189
227
|
Skyline::Site.new
|
190
228
|
end
|
191
229
|
|
230
|
+
def renderable_scope
|
231
|
+
Skyline::WildcardRenderableScope.new
|
232
|
+
end
|
233
|
+
|
192
234
|
protected
|
193
235
|
|
194
236
|
def after_initialize
|
data/app/models/skyline/grant.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @private
|
1
2
|
class Skyline::InlineRef < Skyline::RefObject
|
2
3
|
|
3
4
|
attr_accessor :previous_referable
|
@@ -124,7 +125,7 @@ class Skyline::InlineRef < Skyline::RefObject
|
|
124
125
|
result
|
125
126
|
end
|
126
127
|
|
127
|
-
new_ref = skyline_class.
|
128
|
+
new_ref = skyline_class.find_by_id_and_refering_type_and_refering_id(id,refering_object.class.name,refering_object.id) if id
|
128
129
|
new_ref ||= skyline_class.new
|
129
130
|
|
130
131
|
new_ref.previous_referable = new_ref.referable.dup if new_ref.referable
|
data/app/models/skyline/page.rb
CHANGED
@@ -75,7 +75,8 @@ class Skyline::Page < Skyline::Article
|
|
75
75
|
pages = self.connection.select_all("
|
76
76
|
SELECT page.id,
|
77
77
|
page.parent_id,
|
78
|
-
|
78
|
+
data.navigation_title as navigation_title,
|
79
|
+
data.title as title,
|
79
80
|
page.locked,
|
80
81
|
page.published_publication_id,
|
81
82
|
page.default_variant_id,
|
@@ -93,7 +94,13 @@ class Skyline::Page < Skyline::Article
|
|
93
94
|
class << o
|
94
95
|
def id; self["id"].to_i; end
|
95
96
|
def parent_id; self["parent_id"].blank? ? nil : self["parent_id"].to_i; end
|
96
|
-
def title
|
97
|
+
def title
|
98
|
+
if self["navigation_title"].blank?
|
99
|
+
self["title"].blank? ? "n/a" : self["title"]
|
100
|
+
else
|
101
|
+
self["navigation_title"]
|
102
|
+
end
|
103
|
+
end
|
97
104
|
def published?; self["published_publication_id"].present?; end
|
98
105
|
def identical_to_publication?
|
99
106
|
self["published_publication_variant_id"] == self["default_variant_id"] && self["published_publication_version"] == self["default_variant_version"]
|
data/app/models/skyline/right.rb
CHANGED
data/app/models/skyline/role.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @private
|
1
2
|
class Skyline::Sections::ContentCollectionSection < ActiveRecord::Base
|
2
3
|
include Skyline::SectionItem
|
3
4
|
include Skyline::Taggable
|
@@ -18,6 +19,18 @@ class Skyline::Sections::ContentCollectionSection < ActiveRecord::Base
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
22
|
+
def collection_name
|
23
|
+
self.content_name.pluralize.to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
def collection
|
27
|
+
self.full_collection.scoped(:limit => self.number)
|
28
|
+
end
|
29
|
+
|
30
|
+
def full_collection
|
31
|
+
self.content_class.published.with_tags(self.tags).scoped(:limit => self.number)
|
32
|
+
end
|
33
|
+
|
21
34
|
def clone
|
22
35
|
returning super do |clone|
|
23
36
|
clone.associated_tags = self.associated_tags.collect{|associated_tag| associated_tag.clone}
|
@@ -158,12 +158,7 @@ class Skyline::Variant < Skyline::ArticleVersion
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def update_article_default_variant
|
161
|
-
|
162
|
-
!self.article.default_variant_data.present? || # no default_variant has been set yet
|
163
|
-
!self.article.published? # article isn't published, so now I'm the default variant
|
164
|
-
|
165
|
-
self.article.set_default_variant!(self)
|
166
|
-
end
|
161
|
+
self.article.set_default_variant!(self)
|
167
162
|
end
|
168
163
|
|
169
164
|
def update_article_default_variant_on_destroy
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
<%= render :partial => "#{content_collection_section.content_name.pluralize}", :locals => {content_collection_section.content_name.pluralize.to_sym => proxy} %>
|
1
|
+
<%= render :partial => "#{content_collection_section.collection_name}", :locals => {content_collection_section.collection_name => content_collection_section.collection} %>
|
@@ -1,2 +1,6 @@
|
|
1
1
|
ActionView::Base.field_error_proc = Proc.new {|html_tag, instance| %(#{html_tag})}
|
2
|
-
|
2
|
+
|
3
|
+
# This has to happen on every request as the Constant may not be the same anymore (because of reloading)
|
4
|
+
ActionController::Dispatcher.to_prepare(:form_builder) do
|
5
|
+
ActionView::Base.default_form_builder = Skyline::FormBuilderWithErrors
|
6
|
+
end
|