skylinecms 3.2.0 → 3.3.0

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.
Files changed (102) hide show
  1. data/.yardopts +1 -1
  2. data/CHANGELOG +50 -0
  3. data/README.md +11 -3
  4. data/app/controllers/skyline/application_controller.rb +6 -5
  5. data/app/controllers/skyline/articles_controller.rb +4 -4
  6. data/app/controllers/skyline/content_controller.rb +2 -4
  7. data/app/controllers/skyline/media/data_controller.rb +1 -0
  8. data/app/controllers/skyline/site/media_files_data_controller.rb +1 -0
  9. data/app/controllers/skyline/user_preferences_controller.rb +1 -1
  10. data/app/controllers/skyline/users_controller.rb +5 -1
  11. data/app/controllers/skyline/variant_current_editor_controller.rb +6 -1
  12. data/app/controllers/skyline/variants_controller.rb +2 -2
  13. data/app/helpers/skyline/content_helper.rb +1 -1
  14. data/app/helpers/skyline/editors/editor.rb +6 -6
  15. data/app/helpers/skyline/editors/joinable_list.rb +1 -1
  16. data/app/helpers/skyline/form_helper.rb +1 -0
  17. data/app/helpers/skyline/menu_helper.rb +0 -8
  18. data/app/helpers/skyline/presenters/presenter.rb +2 -2
  19. data/app/middleware/skyline/sprockets_middleware.rb +3 -8
  20. data/app/models/skyline/article.rb +29 -25
  21. data/app/models/skyline/article_version.rb +20 -20
  22. data/app/models/skyline/associated_tag.rb +1 -1
  23. data/app/models/skyline/grant.rb +1 -1
  24. data/app/models/skyline/link_section_link.rb +1 -1
  25. data/app/models/skyline/media_cache.rb +1 -1
  26. data/app/models/skyline/media_dir.rb +0 -2
  27. data/app/models/skyline/media_node.rb +1 -1
  28. data/app/models/skyline/object_ref.rb +3 -3
  29. data/app/models/skyline/page.rb +1 -3
  30. data/app/models/skyline/publication.rb +3 -1
  31. data/app/models/skyline/ref_object.rb +1 -1
  32. data/app/models/skyline/referable_uri.rb +1 -1
  33. data/app/models/skyline/right.rb +1 -1
  34. data/app/models/skyline/role.rb +1 -1
  35. data/app/models/skyline/section.rb +9 -9
  36. data/app/models/skyline/sections/content_collection_section.rb +3 -3
  37. data/app/models/skyline/sections/link_section.rb +3 -3
  38. data/app/models/skyline/sections/media_section.rb +2 -0
  39. data/app/models/skyline/sections/rss_section.rb +11 -12
  40. data/app/models/skyline/tag.rb +1 -1
  41. data/app/models/skyline/user.rb +213 -202
  42. data/app/models/skyline/user_preference.rb +2 -2
  43. data/app/models/skyline/variant.rb +18 -14
  44. data/app/observers/skyline/version_stamper.rb +1 -1
  45. data/app/templates/skyline/page/default/index.html.erb +1 -1
  46. data/app/views/skyline/articles/_security.html.erb +1 -1
  47. data/app/views/skyline/articles/edit.html.erb +1 -1
  48. data/app/views/skyline/content/{_add.rhtml → _add.html.erb} +0 -0
  49. data/app/views/skyline/content/{_filter.rhtml → _filter.html.erb} +0 -0
  50. data/app/views/skyline/content/{create.rhtml → create.html.erb} +0 -0
  51. data/app/views/skyline/content/{edit.rhtml → edit.html.erb} +0 -0
  52. data/app/views/skyline/content/{error.rhtml → error.html.erb} +0 -0
  53. data/app/views/skyline/content/{list.rhtml → list.html.erb} +3 -3
  54. data/app/views/skyline/content/{show.rhtml → show.html.erb} +0 -0
  55. data/app/views/skyline/content_sections/_tags.html.erb +1 -1
  56. data/app/views/skyline/shared/_header_area.html.erb +1 -1
  57. data/app/views/skyline/users/_new.html.erb +1 -1
  58. data/config/initializers/middlewares.rb +5 -1
  59. data/config/initializers/mime_types.rb +0 -6
  60. data/config/initializers/observers.rb +1 -1
  61. data/config/locales/en-US.yml +1 -1
  62. data/db/fixtures/roles_and_rights.rb +5 -5
  63. data/db/fixtures/roots.rb +1 -1
  64. data/doc/concepts.md +37 -0
  65. data/lib/skyline/belongs_to_referable.rb +5 -5
  66. data/lib/skyline/content/class_meta_data.rb +4 -3
  67. data/lib/skyline/content/content.rb +28 -18
  68. data/lib/skyline/content/exportable.rb +3 -3
  69. data/lib/skyline/content/field_meta_data.rb +12 -11
  70. data/lib/skyline/content/implementation.rb +7 -6
  71. data/lib/skyline/content/meta_data/field.rb +1 -1
  72. data/lib/skyline/content/stack.rb +1 -1
  73. data/lib/skyline/content/versioning/version.rb +1 -1
  74. data/lib/skyline/engine.rb +1 -1
  75. data/lib/skyline/has_many_referables_in.rb +4 -4
  76. data/lib/skyline/plugins/manager.rb +4 -3
  77. data/lib/skyline/plugins/plugin.rb +9 -1
  78. data/lib/skyline/rendering/renderer.rb +12 -2
  79. data/lib/skyline/sections/interface.rb +1 -1
  80. data/lib/skyline/taggable.rb +4 -4
  81. data/lib/skyline/version.rb +2 -2
  82. data/public/skyline/javascripts/src/application.js +1 -1
  83. data/public/skyline/javascripts/src/application_preinit.js +1 -0
  84. data/public/skyline/javascripts/src/library_uploader.js +1 -1
  85. data/public/skyline/javascripts/src/skyline.editor/src/skyline.editor.js +18 -18
  86. data/public/skyline/javascripts/src/skyline.editor/src/tinymce_preinit.js +4 -0
  87. data/public/skyline/javascripts/src/skyline.js +20 -18
  88. data/public/skyline/javascripts/src/skyline/src/skyline.js +2 -2
  89. data/public/skyline/javascripts/src/skyline/src/uploader.js +1 -1
  90. data/skylinecms.gemspec +7 -5
  91. data/test/factories.rb +2 -0
  92. data/test/integration/media_browser_super_access_test.rb +3 -3
  93. data/test/integration/media_browser_user_access_test.rb +2 -2
  94. data/test/integration/user_preferences_test.rb +5 -5
  95. data/test/test_helper.rb +1 -0
  96. data/test/unit/article_test.rb +1 -1
  97. data/test/unit/locales_test.rb +13 -3
  98. data/test/unit/test_content_object_test.rb +1 -1
  99. data/test/unit/test_section_test.rb +3 -2
  100. data/test/unit/user_preference_test.rb +2 -2
  101. data/vendor/digitpaint/nested_attributes_positioning.rb +5 -5
  102. metadata +66 -40
@@ -1,5 +1,5 @@
1
1
  class Skyline::UserPreference < ActiveRecord::Base
2
- set_table_name :skyline_user_preferences
2
+ self.table_name = "skyline_user_preferences"
3
3
 
4
4
  belongs_to :user, :class_name => "::#{Skyline::Configuration.user_class.name}"
5
5
 
@@ -26,7 +26,7 @@ class Skyline::UserPreference < ActiveRecord::Base
26
26
  self.exists?(["`#{self.table_name}`.`key` LIKE ?", "#{key}.%"])
27
27
  end
28
28
 
29
- def remove(key)
29
+ def remove_key(key)
30
30
  self.delete_all("`#{self.table_name}`.`key` LIKE '#{key}.%'")
31
31
  end
32
32
 
@@ -53,24 +53,28 @@ class Skyline::Variant < Skyline::ArticleVersion
53
53
  raise StandardError, "can't be published if its dirty" if self.changed? || self.data.changed?
54
54
 
55
55
  if self.valid?
56
- self.prepare_data_to_be_published!(false)
56
+ self.article.run_callbacks :publication do
57
+ self.prepare_data_to_be_published!(false)
57
58
 
58
- published_publication = self.clone_to_class(self.article.publications)
59
- published_publication.save
59
+ published_publication = self.dup_to_class(self.article.publications)
60
+ published_publication.created_at = Time.now
61
+ published_publication.updated_at = Time.now
62
+ published_publication.save
60
63
 
61
- self.article.published_publication = published_publication
62
- self.article.url_part = published_publication.data.url_part if published_publication.data.respond_to?(:url_part)
63
- self.article.published_publication_data = published_publication.data
64
- self.article.set_default_variant(self)
65
- self.article.save!
64
+ self.article.published_publication = published_publication
65
+ self.article.url_part = published_publication.data.url_part if published_publication.data.respond_to?(:url_part)
66
+ self.article.published_publication_data = published_publication.data
67
+ self.article.set_default_variant(self)
68
+ self.article.save!
66
69
 
67
- unless self.article.keep_history?
68
- self.article.publications.each do |publication|
69
- publication.destroy if publication != published_publication
70
+ unless self.article.keep_history?
71
+ self.article.publications.each do |publication|
72
+ publication.destroy if publication != published_publication
73
+ end
70
74
  end
71
- end
72
75
 
73
- published_publication
76
+ published_publication
77
+ end
74
78
  else
75
79
  self.prepare_data_to_be_published!(false)
76
80
  false
@@ -158,7 +162,7 @@ class Skyline::Variant < Skyline::ArticleVersion
158
162
 
159
163
  def create_data
160
164
  if self.data.new_record?
161
- self.data.save(false)
165
+ self.data.save(:validate => false)
162
166
  self.data_id = self.data.id
163
167
  end
164
168
  end
@@ -36,7 +36,7 @@ class Skyline::VersionStamper < ActiveRecord::Observer
36
36
  end
37
37
 
38
38
  def logger
39
- RAILS_DEFAULT_LOGGER
39
+ Rails.logger
40
40
  end
41
41
 
42
42
  end
@@ -16,6 +16,6 @@
16
16
  <% assign(:heading_level,1) %>
17
17
 
18
18
  <%= render_collection(article_version.sections) %>
19
- <%= @body %>
19
+ <%= @body.andand.html_safe %>
20
20
  </body>
21
21
  </html>
@@ -13,7 +13,7 @@
13
13
  </tbody>
14
14
  </table>
15
15
  <% if @variant.editable_by?(current_user) && current_user.allow?(@article, :lock) %>
16
- <%= skyline_form_for(:article, @article, :url => skyline_article_path(@article, :variant_id => @variant), :html => {:method => "put"}, :remote => true) do |f| %>
16
+ <%= skyline_form_for(@article, {:as => :article, :url => skyline_article_path(@article, :variant_id => @variant), :html => {:method => "put"}, :remote => true}) do |f| %>
17
17
  <div class="button" style="margin-top: 5px">
18
18
  <% if @article.locked? %>
19
19
  <%= f.hidden_field :locked, :value => "0" %>
@@ -1,4 +1,4 @@
1
- <%= skyline_form_for @article, :as => :article, :url => skyline_article_path(@article), :html => {:method => :put, :id => "page_form"} do |a| %>
1
+ <%= skyline_form_for @article, {:as => :article, :url => skyline_article_path(@article), :html => {:method => :put, :id => "page_form"}} do |a| %>
2
2
  <dl id="contentPanel" class="panel">
3
3
  <%= a.fields_for :variants_attributes, @variant, :index => 1 do |v| %>
4
4
  <%= v.fields_for :data_attributes, v.object.data do |vd| %>
@@ -1,15 +1,15 @@
1
1
  <% content_for :header do %>
2
2
  <% if @stack.size > 1 %>
3
- <%= @title = t(:title_sublisting, :scope => [:content, :list], :group => @stack.klass.plural_name, :title => @stack[-2].class.singular_name + " " + @stack[-2].human_id.to_s) %>
3
+ <%= @title = t(:title_sublisting, :scope => [:content, :list], :group => @stack.klass.plural_name, :title => @stack[-2].class.singular_name + " " + @stack[-2].human_id.to_s).html_safe %>
4
4
  <% else %>
5
- <%= @title = t(:title, :scope => [:content, :list], :class => @stack.klass.plural_name) %>
5
+ <%= @title = t(:title, :scope => [:content, :list], :class => @stack.klass.plural_name).html_safe %>
6
6
  <% end %>
7
7
  <% end %>
8
8
 
9
9
  <%= Skyline::Presenters::Table.new(@elements,stack.klass,self).output %>
10
10
 
11
11
  <% content_for :meta do %>
12
- <%= render :partial => "add", :locals => {:klass => stack.klass, :record => stack.current, :return_to => url_for({})} %>
12
+ <%= render :partial => "add", :locals => {:klass => stack.klass, :record => stack.current, :return_to => url_for(:types => stack.klass.to_s.underscore.pluralize)} %>
13
13
  <%= render :partial => "filter" if stack.klass.filterable? %>
14
14
  <% end %>
15
15
 
@@ -1,4 +1,4 @@
1
- <%= skyline_fields_for "article[variants_attributes][1][sections_attributes][#{guid}][sectionable_attributes]", sectionable do |s| %>
1
+ <%= skyline_fields_for sectionable, :as => "article[variants_attributes][1][sections_attributes][#{guid}][sectionable_attributes]" do |s| %>
2
2
  <table class="fields" id="section-<%=guid%>-tags">
3
3
  <tbody>
4
4
  <tr>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div id="usernavigation">
6
6
  <%= t(:logged_in_as, :user => h(current_user.display_name), :scope => [:authentication]).html_safe %>
7
- (<%= link_to t(:logout, :scope => [:authentication]), :url => skyline_authentication_path, :method => :delete, :remote => true %>)
7
+ (<%= link_to t(:logout, :scope => [:authentication]), skyline_authentication_path, :method => :delete, :remote => true %>)
8
8
  </div>
9
9
  </div>
10
10
 
@@ -1,3 +1,3 @@
1
- <%= skyline_form_for :user, @user, :url => skyline_users_path(), :remote => true, :method => :post do |f|%>
1
+ <%= skyline_form_for @user, {:as => :user, :url => skyline_users_path(), :remote => true, :method => :post} do |f|%>
2
2
  <%= render :partial => "form", :locals => {:f => f, :password_attribute => :password, :password_confirmation_attribute => :password_confirmation} %>
3
3
  <% end %>
@@ -8,11 +8,15 @@ Rails.application.config.middleware.insert_before(
8
8
  # Only needed for development, the files will be cached in Production.
9
9
  # --
10
10
  Rails.application.config.middleware.use(Skyline::SprocketsMiddleware, Rails.public_path, "skyline/javascripts/src", :cache => (Rails.env == "production") ) do |env|
11
+ env.register_load_location("")
11
12
  env.register_load_location("skyline/src")
12
13
  env.register_load_location("skyline/vendor/*")
14
+ env.register_load_location("skyline/vendor/fancyupload/")
15
+ env.register_load_location("skyline/vendor/mootools/")
16
+
13
17
  env.register_load_location("skyline.editor/src")
14
18
  env.register_load_location("skyline.editor/vendor/*")
15
- env.register_load_location("skyline.editor/vendor/tinymce/jscripts/*")
19
+ env.register_load_location("skyline.editor/vendor/tinymce/jscripts/*")
16
20
 
17
21
  env.map "skyline/javascripts/application.js", "skyline/javascripts/src/application.js"
18
22
  env.map "skyline/javascripts/skyline.js", "skyline/javascripts/src/skyline.js"
@@ -103,12 +103,6 @@ mime_types = {
103
103
  audio/x-midi
104
104
  application/x-midi
105
105
  audio/ac3},
106
- :pdf => %w{application/pdf
107
- application/x-pdf
108
- application/acrobat
109
- applications/vnd.pdf
110
- text/pdf
111
- text/x-pdf},
112
106
  :excel => %w{application/vnd.ms-excel
113
107
  application/msexcel
114
108
  application/x-msexcel
@@ -1,5 +1,5 @@
1
1
  unless ( File.basename($0) == "rake" && ARGV.include?("skyline:db:migrate") )
2
- ActiveRecord::Base.observers = [
2
+ ActiveRecord::Base.observers += [
3
3
  "Skyline::FileCacheSweeper",
4
4
  "Skyline::ArticleVersionObserver"
5
5
  ]
@@ -631,7 +631,7 @@
631
631
  add_a_new: Add %{class}
632
632
  add_more: Add more %{class}
633
633
  pagination:
634
- number_of: "Nubmer of %{class}:"
634
+ number_of: "Number of %{class}:"
635
635
  pages: "Pages:"
636
636
  next: "Next &raquo;"
637
637
  previous: "Previous &raquo;"
@@ -1,5 +1,5 @@
1
1
  if !Object.const_defined?(:Rails)
2
- require File.dirname(__FILE__) + "/../../../../../config/environment"
2
+ require File.dirname(__FILE__) + "/../../../../config/environment"
3
3
  end
4
4
 
5
5
  def log(str)
@@ -38,15 +38,15 @@ Skyline::Right.connection.execute("DELETE FROM skyline_rights_skyline_roles WHER
38
38
  log "\n== Creating roles"
39
39
 
40
40
  stfu do
41
- Skyline::Role.seed_many(:name,[
41
+ Skyline::Role.seed(:name,
42
42
  {:name => "super", :system => true}
43
- ])
43
+ )
44
44
  end
45
45
 
46
46
  log "\n== Creating rights"
47
47
 
48
48
  stfu do
49
- Skyline::Right.seed_many(:name,[
49
+ Skyline::Right.seed(:name,
50
50
  {:name => "media_dir_create"},
51
51
  {:name => "media_dir_update"},
52
52
  {:name => "media_dir_delete"},
@@ -91,7 +91,7 @@ stfu do
91
91
  {:name => "user_delete"},
92
92
 
93
93
  {:name => "tinymce_edit_html"} # Defines wether or not to show the "edit html" button in the toolbar
94
- ])
94
+ )
95
95
  end
96
96
 
97
97
  log "\n== Mapping Rights to Roles"
@@ -1,5 +1,5 @@
1
1
  if !Object.const_defined?(:Rails)
2
- require File.dirname(__FILE__) + "/../../../../../config/environment"
2
+ require File.dirname(__FILE__) + "/../../../../config/environment"
3
3
  end
4
4
 
5
5
  # ========================================================================
@@ -0,0 +1,37 @@
1
+ Skyline concepts
2
+ ================
3
+
4
+ To get a better understanding of Skyline here's a quick overview of the main building blocks.
5
+
6
+ Pages
7
+ -----
8
+
9
+ Skyline is primarily built around pages. Pages are ordered into a tree which represents the structure of the
10
+ website. Pages consist of two parts: static data and sections and they inherit their properties from articles.
11
+
12
+ Articles
13
+ --------
14
+
15
+ Article is a container class that adds the functionality needed to add sections, versioning, publication
16
+ and other cool stuff. Pages are articles too. You can subclass the `Article` class to create your
17
+ own custom editable object (A news item for instance)
18
+
19
+ Sections
20
+ --------
21
+
22
+ Sections are elements that are predefined and are used as building blocks for content. Skyline has a number of
23
+ sections built in but you can also add new sections.
24
+
25
+
26
+ Rendering
27
+ ---------
28
+
29
+ Skyline articles are rendered by the show action of the Skyline::Site::PagesController this controller can be overwritten if
30
+ for instance you need to render a specific page template for an element that is not directly linked to a page.
31
+ Like articles.
32
+
33
+ Settings
34
+ --------
35
+
36
+ Settings can be used to link articles to pages but also to set defaults like templates or colors which
37
+ then can be used in the templates.
@@ -43,7 +43,7 @@ module Skyline::BelongsToReferable
43
43
 
44
44
  base.send(:cattr_accessor, :referable_contents)
45
45
  base.send(:attr_accessor, :previous_referables)
46
- base.send(:alias_method_chain, :clone, :referable_content)
46
+ base.send(:alias_method_chain, :dup, :referable_content)
47
47
 
48
48
 
49
49
  base.send("referable_contents=", [])
@@ -112,13 +112,13 @@ module Skyline::BelongsToReferable
112
112
  end
113
113
 
114
114
  # @private
115
- def clone_with_referable_content
116
- clone_without_referable_content.tap do |clone|
115
+ def dup_with_referable_content
116
+ dup_without_referable_content.tap do |dup|
117
117
  if self.referable_contents.any?
118
118
  self.referable_contents.each do |field|
119
119
  if self.send(field).present?
120
- clone.send("#{field}_id=", nil)
121
- clone.send("#{field}=", self.send(field).clone)
120
+ dup.send("#{field}_id=", nil)
121
+ dup.send("#{field}=", self.send(field).dup)
122
122
  end
123
123
  end
124
124
  end
@@ -1,6 +1,6 @@
1
1
  module Skyline::Content
2
2
  module ClassMetaData
3
-
3
+
4
4
  # Returns singular name of this class, falls back on standard Rails humanization
5
5
  def singular_name
6
6
  self.settings.singular_label
@@ -72,7 +72,7 @@ module Skyline::Content
72
72
  return get_settings if settings.nil? && !block_given?
73
73
  s = MetaData::ClassSettings.new(settings.update(:owner => self))
74
74
  yield s if block_given?
75
- write_inheritable_attribute(:settings,s)
75
+ self.cmd_settings = s
76
76
  after_set_settings!
77
77
  s
78
78
  end
@@ -99,7 +99,8 @@ module Skyline::Content
99
99
  end
100
100
 
101
101
  def get_settings
102
- read_inheritable_attribute(:settings) || write_inheritable_attribute(:settings,MetaData::ClassSettings.new(:owner => self))
102
+ self.cmd_settings = MetaData::ClassSettings.new(:owner => self) unless self.cmd_settings.present?
103
+ self.cmd_settings
103
104
  end
104
105
  end
105
106
  end
@@ -3,25 +3,35 @@ module Skyline::Content
3
3
  module Content
4
4
  def self.included(obj)
5
5
  obj.extend(KlassMethods)
6
-
7
- if obj.ancestors.include?( ::ActiveRecord::Base)
8
- obj.class_eval do
9
- after_save :process_after_save
6
+
7
+ if obj.ancestors.include?( ::ActiveRecord::Base)
8
+ obj.class_eval do
9
+ after_save :process_after_save
10
+
11
+ # Attributes for module settings (replacement for read/write_inheritable*)
12
+ # Values for FieldMetaData
13
+ class_attribute :fmd_field_hash
14
+ class_attribute :fmd_ungrouped_field_list
15
+ class_attribute :fmd_field_order_value
16
+ # Settings for ClassMetaData
17
+ class_attribute :cmd_settings
18
+ # List of possible export formats for Exportable
19
+ class_attribute :exportable_formats
10
20
 
11
- scope :published, lambda {
12
- if obj.publishable?
13
- {:conditions => {:published => true}}
14
- else
15
- {}
16
- end
17
- }
21
+ scope :published, lambda {
22
+ if obj.publishable?
23
+ {:conditions => {:published => true}}
24
+ else
25
+ {}
26
+ end
27
+ }
18
28
 
19
- scope :with_site, {}
20
- end
21
- end
22
- end
29
+ scope :with_site, {}
30
+ end
31
+ end
32
+ end
23
33
 
24
- module KlassMethods #:nodoc:
34
+ module KlassMethods #:nodoc:
25
35
 
26
36
  def content?
27
37
  true
@@ -174,7 +184,7 @@ module Skyline::Content
174
184
  return nil if self_referential_associations.empty?
175
185
 
176
186
  self_referential_associations.collect do |assoc|
177
- (assoc.options[:foreign_key] || assoc.primary_key_name).to_s + " is null"
187
+ (assoc.options[:foreign_key] || assoc.foreign_key).to_s + " is null"
178
188
  end.join(" AND ")
179
189
  end
180
190
 
@@ -272,7 +282,7 @@ module Skyline::Content
272
282
  params = {}
273
283
  if tempid = k.to_s[/^n__?(n?\d+)/,1]
274
284
  # new
275
- params.update(assoc.source_reflection.primary_key_name => target_id)
285
+ params.update(assoc.source_reflection.foreign_key => target_id)
276
286
  params.update(position_column => order_map[tempid]) if position_column
277
287
  self.send(assoc.through_reflection.name).build(v.update(params))
278
288
  else
@@ -4,8 +4,8 @@ module Skyline::Content
4
4
 
5
5
  # List of possible export formats for this class
6
6
  def export_formats
7
- read_inheritable_attribute(:export_formats) || []
8
- end
7
+ self.exportable_formats || []
8
+ end
9
9
 
10
10
  # Set a list of possible export format for this class
11
11
  # [DOC]
@@ -17,7 +17,7 @@ module Skyline::Content
17
17
  class << self; self; end.send(:define_method, "export_#{format}"){}
18
18
  end
19
19
  if formats.any?
20
- write_inheritable_attribute(:export_formats,formats)
20
+ self.exportable_formats = formats
21
21
  class << self; self; end.send(:define_method,:exportable?) do
22
22
  true
23
23
  end
@@ -153,15 +153,15 @@ module Skyline::Content
153
153
  options = options_from_params_with_default fields
154
154
  fields = fields.first if fields.any? && fields.first.kind_of?(Array)
155
155
  options.reverse_merge! field_create_defaults(options)
156
-
156
+
157
157
  fields.each do |field_name|
158
158
  options.update(:name => field_name, :owner => self)
159
159
  if self.fields.has_key?(field_name)
160
- write_inheritable_hash(:fields,{field_name => MetaData::Field.from(self.fields[field_name],options)})
160
+ self.fmd_field_hash = self.fields.merge(field_name => MetaData::Field.from(self.fields[field_name],options))
161
161
  else
162
- write_inheritable_hash(:fields,{field_name => MetaData::Field.new(options)})
162
+ self.fmd_field_hash = self.fields.merge(field_name => MetaData::Field.new(options))
163
163
  end
164
- self.ungrouped_fields << field_name
164
+ self.fmd_ungrouped_field_list = self.ungrouped_fields << field_name
165
165
  yield self.fields[field_name] if block_given?
166
166
  after_field_create!(self.fields[field_name])
167
167
  end
@@ -184,8 +184,8 @@ module Skyline::Content
184
184
  field_group = MetaData::FieldGroup.new(options.update(:owner => self, :name => name))
185
185
  yield field_group if block_given?
186
186
 
187
- write_inheritable_attribute(:ungrouped_fields,self.ungrouped_fields.dup << name)
188
- write_inheritable_hash(:fields,{name => field_group})
187
+ self.fmd_ungrouped_field_list = self.ungrouped_fields.dup << name
188
+ self.fmd_field_hash = self.fields.merge(name => field_group)
189
189
 
190
190
  field_group
191
191
  end
@@ -194,9 +194,10 @@ module Skyline::Content
194
194
  # field_order :name,:naw,:body
195
195
  def field_order(*order)
196
196
  if order.empty?
197
- read_inheritable_attribute(:field_order) || write_inheritable_attribute(:field_order,order)
197
+ self.fmd_field_order_value = order unless self.fmd_field_order_value.present?
198
+ self.fmd_field_order_value
198
199
  else
199
- write_inheritable_attribute(:field_order,order)
200
+ self.fmd_field_order_value = order
200
201
  end
201
202
  end
202
203
 
@@ -209,7 +210,7 @@ module Skyline::Content
209
210
  # <tt>Array[Symbol]</tt>:: Field names of fields which are writable.
210
211
  #--
211
212
  def writable_fields #:nodoc:
212
- self.fields.select do |k,v|
213
+ self.fields.select do |k,v|
213
214
  if v.kind_of?(MetaData::Field) && v.editor == :file && !v.hidden_in(:edit)
214
215
  true
215
216
  else
@@ -231,11 +232,11 @@ module Skyline::Content
231
232
  end
232
233
 
233
234
  def fields #:nodoc:
234
- read_inheritable_attribute(:fields) || write_inheritable_hash(:fields,{})
235
+ self.fmd_field_hash || {}
235
236
  end
236
237
 
237
238
  def ungrouped_fields #:nodoc:
238
- read_inheritable_attribute(:ungrouped_fields) || write_inheritable_attribute(:ungrouped_fields,[])
239
+ self.fmd_ungrouped_field_list || []
239
240
  end
240
241
 
241
242
  # @deprecated