spina 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spina might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +63 -52
- data/app/assets/javascripts/spina/admin/application.js +0 -1
- data/app/controllers/spina/admin/accounts_controller.rb +11 -16
- data/app/controllers/spina/admin/admin_controller.rb +12 -23
- data/app/controllers/spina/admin/attachments_controller.rb +1 -1
- data/app/controllers/spina/admin/pages_controller.rb +14 -7
- data/app/controllers/spina/admin/photos_controller.rb +4 -2
- data/app/controllers/spina/admin/sessions_controller.rb +3 -3
- data/app/controllers/spina/admin/users_controller.rb +3 -3
- data/app/controllers/spina/application_controller.rb +7 -3
- data/app/controllers/spina/pages_controller.rb +13 -2
- data/app/controllers/spina/sitemaps_controller.rb +1 -0
- data/app/helpers/spina/admin/pages_helper.rb +12 -2
- data/app/helpers/spina/application_helper.rb +0 -9
- data/app/models/concerns/spina/part.rb +31 -0
- data/app/models/{spina → concerns/spina}/partable.rb +0 -0
- data/app/models/spina/ability.rb +0 -1
- data/app/models/spina/account.rb +6 -6
- data/app/models/spina/attachment.rb +1 -1
- data/app/models/spina/layout_part.rb +4 -27
- data/app/models/spina/line.rb +2 -0
- data/app/models/spina/page.rb +24 -5
- data/app/models/spina/page_part.rb +6 -30
- data/app/models/spina/structure_part.rb +7 -19
- data/app/models/spina/text.rb +2 -0
- data/app/views/layouts/spina/admin/application.html.haml +12 -14
- data/app/views/layouts/spina/admin/media_library.html.haml +4 -4
- data/app/views/layouts/spina/admin/settings.html.haml +7 -8
- data/app/views/layouts/spina/admin/website.html.haml +9 -16
- data/app/views/spina/admin/accounts/style.html.haml +10 -10
- data/app/views/spina/admin/attachments/_attachment.html.haml +1 -2
- data/app/views/spina/admin/{pages/_attachment_fields.html.haml → attachments/_fields.html.haml} +0 -0
- data/app/views/spina/admin/attachments/index.html.haml +2 -7
- data/app/views/spina/admin/layout_partables/colors/_form.html.haml +4 -0
- data/app/views/spina/admin/layout_partables/lines/_form.html.haml +2 -0
- data/app/views/spina/admin/page_partables/attachment_collections/_form.html.haml +15 -0
- data/app/views/spina/admin/page_partables/attachments/_form.html.haml +14 -0
- data/app/views/spina/admin/page_partables/colors/_form.html.haml +7 -0
- data/app/views/spina/admin/page_partables/lines/_form.html.haml +5 -0
- data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +17 -0
- data/app/views/spina/admin/page_partables/photos/_form.html.haml +18 -0
- data/app/views/spina/admin/page_partables/structures/_form.html.haml +22 -0
- data/app/views/spina/admin/page_partables/texts/_form.html.haml +5 -0
- data/app/views/spina/admin/pages/_form.html.haml +11 -8
- data/app/views/spina/admin/pages/_form_advanced.html.haml +3 -3
- data/app/views/spina/admin/pages/_form_page_content.html.haml +8 -3
- data/app/views/spina/admin/pages/_form_page_seo.html.haml +1 -1
- data/app/views/spina/admin/pages/edit.html.haml +13 -1
- data/app/views/spina/admin/photos/_photo.html.haml +1 -3
- data/app/views/spina/admin/photos/create.js.erb +1 -2
- data/app/views/spina/admin/photos/create_and_select.js.erb +7 -0
- data/app/views/spina/admin/photos/index.html.haml +7 -6
- data/app/views/spina/admin/shared/_primary_navigation.html.haml +19 -0
- data/app/views/spina/admin/shared/_rich_text_field.html.haml +2 -2
- data/app/views/spina/admin/structure_items/_fields.html.haml +16 -0
- data/app/views/spina/admin/structure_partables/lines/_form.html.haml +2 -0
- data/app/views/spina/admin/structure_partables/photos/_form.html.haml +11 -0
- data/app/views/spina/admin/structure_partables/texts/_form.html.haml +2 -0
- data/app/views/spina/sitemaps/show.xml.builder +12 -8
- data/{lib/spina/carrierwave.rb → config/initializers/spina.rb} +0 -0
- data/config/locales/de.yml +0 -26
- data/config/locales/en.yml +4 -26
- data/config/locales/es.yml +0 -26
- data/config/locales/fr.yml +4 -27
- data/config/locales/it.yml +0 -26
- data/config/locales/nl.yml +2 -28
- data/config/locales/pt-BR.yml +0 -26
- data/config/locales/ru.yml +0 -26
- data/config/locales/tr.yml +2 -28
- data/config/locales/zh-CN.yml +0 -3
- data/config/routes.rb +3 -19
- data/db/migrate/{20150507135428_create_spina_tables.rb → 1_create_spina_tables.rb} +0 -11
- data/db/migrate/2_create_spina_translation_tables.rb +13 -0
- data/lib/generators/spina/install_generator.rb +23 -9
- data/lib/generators/spina/templates/app/assets/stylesheets/demo/application.css.sass +3 -0
- data/lib/generators/spina/templates/app/views/demo/shared/_languages.html.haml +2 -0
- data/lib/generators/spina/templates/app/views/layouts/demo/application.html.haml +1 -0
- data/lib/generators/spina/templates/config/initializers/carrierwave.rb +17 -0
- data/lib/generators/spina/templates/config/initializers/spina.rb +2 -22
- data/lib/generators/spina/templates/config/initializers/themes/default.rb +29 -45
- data/lib/generators/spina/templates/config/initializers/themes/demo.rb +82 -92
- data/lib/spina.rb +24 -30
- data/lib/spina/engine.rb +2 -22
- data/lib/spina/plugin.rb +21 -3
- data/lib/spina/railtie.rb +9 -0
- data/lib/spina/theme.rb +34 -6
- data/lib/spina/version.rb +1 -1
- metadata +51 -124
- data/app/assets/javascripts/spina/admin/aviary.js.coffee +0 -25
- data/app/controllers/spina/admin/inquiries_controller.rb +0 -63
- data/app/controllers/spina/inquiries_controller.rb +0 -30
- data/app/mailers/spina/inquiry_mailer.rb +0 -19
- data/app/models/spina/inquiry.rb +0 -41
- data/app/views/layouts/spina/admin/messages.html.haml +0 -24
- data/app/views/spina/admin/accounts/aviary.html.haml +0 -26
- data/app/views/spina/admin/inquiries/inbox.html.haml +0 -30
- data/app/views/spina/admin/inquiries/index.html.haml +0 -36
- data/app/views/spina/admin/inquiries/show.html.haml +0 -23
- data/app/views/spina/admin/inquiries/spam.html.haml +0 -36
- data/app/views/spina/admin/layout_partables/_color_form.html.haml +0 -4
- data/app/views/spina/admin/layout_partables/_line_form.html.haml +0 -2
- data/app/views/spina/admin/page_partables/_attachment_collection_form.html.haml +0 -20
- data/app/views/spina/admin/page_partables/_attachment_form.html.haml +0 -19
- data/app/views/spina/admin/page_partables/_color_form.html.haml +0 -12
- data/app/views/spina/admin/page_partables/_line_form.html.haml +0 -10
- data/app/views/spina/admin/page_partables/_photo_collection_form.html.haml +0 -22
- data/app/views/spina/admin/page_partables/_photo_form.html.haml +0 -23
- data/app/views/spina/admin/page_partables/_structure_form.html.haml +0 -28
- data/app/views/spina/admin/page_partables/_text_form.html.haml +0 -10
- data/app/views/spina/admin/pages/_structure_item_fields.html.haml +0 -15
- data/app/views/spina/admin/shared/_navigation.html.haml +0 -21
- data/app/views/spina/admin/structure_partables/_line_form.html.haml +0 -2
- data/app/views/spina/admin/structure_partables/_photo_form.html.haml +0 -11
- data/app/views/spina/admin/structure_partables/_text_form.html.haml +0 -2
- data/app/views/spina/inquiries/create.html.haml +0 -2
- data/app/views/spina/inquiries/index.html.haml +0 -19
- data/app/views/spina/inquiry_mailer/inquiry.html.haml +0 -15
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/default/application.css.sass +0 -0
- data/test/dummy/app/assets/stylesheets/demo/application.css.sass +0 -66
- data/test/dummy/app/assets/stylesheets/fonts.css.sass +0 -3
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/default/pages/homepage.html.haml +0 -2
- data/test/dummy/app/views/default/pages/show.html.haml +0 -3
- data/test/dummy/app/views/default/shared/_navigation.html.haml +0 -5
- data/test/dummy/app/views/demo/pages/demo.html.haml +0 -30
- data/test/dummy/app/views/demo/pages/homepage.html.haml +0 -2
- data/test/dummy/app/views/demo/pages/show.html.haml +0 -3
- data/test/dummy/app/views/demo/shared/_navigation.html.haml +0 -5
- data/test/dummy/app/views/layouts/default/application.html.haml +0 -11
- data/test/dummy/app/views/layouts/demo/application.html.haml +0 -11
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -52
- data/test/dummy/config/application.yml +0 -2
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -24
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -70
- data/test/dummy/config/environments/test.rb +0 -38
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/spina.rb +0 -33
- data/test/dummy/config/initializers/themes/default.rb +0 -47
- data/test/dummy/config/initializers/themes/demo.rb +0 -103
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/locales/nl.yml +0 -214
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/secrets.yml +0 -7
- data/test/dummy/db/migrate/20160114085213_create_spina_tables.spina.rb +0 -167
- data/test/dummy/db/schema.rb +0 -183
- data/test/dummy/db/seeds.rb +0 -1
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/restart.txt +0 -0
- data/test/fixtures/spina/accounts.yml +0 -3
- data/test/fixtures/spina/pages.yml +0 -10
- data/test/fixtures/spina/users.yml +0 -5
- data/test/functional/spina/admin/admin_controller.rb +0 -36
- data/test/functional/spina/admin/sessions_controller_test.rb +0 -32
- data/test/functional/spina/pages_controller_test.rb +0 -16
- data/test/integration/navigation_test.rb +0 -8
- data/test/integration/spina/admin/login_test.rb +0 -31
- data/test/integration/spina/admin/logout_test.rb +0 -17
- data/test/integration/spina/admin/pages_test.rb +0 -34
- data/test/integration/spina/pages_test.rb +0 -19
- data/test/models/spina/line_test.rb +0 -9
- data/test/models/spina/text_test.rb +0 -9
- data/test/test_helper.rb +0 -23
- data/test/unit/helpers/spina/accounts_helper_test.rb +0 -6
- data/test/unit/helpers/spina/inquiries_helper_test.rb +0 -6
- data/test/unit/helpers/spina/page_parts_helper_test.rb +0 -6
- data/test/unit/helpers/spina/pages_helper_test.rb +0 -6
- data/test/unit/helpers/spina/photos_helper_test.rb +0 -6
- data/test/unit/helpers/spina/sessions_helper_test.rb +0 -6
- data/test/unit/helpers/spina/users_helper_test.rb +0 -6
- data/test/unit/spina/account_test.rb +0 -9
- data/test/unit/spina/file_collection_file_test.rb +0 -9
- data/test/unit/spina/gallery_test.rb +0 -9
- data/test/unit/spina/inquiry_test.rb +0 -9
- data/test/unit/spina/page_include_test.rb +0 -9
- data/test/unit/spina/page_part_test.rb +0 -9
- data/test/unit/spina/page_test.rb +0 -9
- data/test/unit/spina/photo_collection_file_test.rb +0 -9
- data/test/unit/spina/photo_collection_test.rb +0 -9
- data/test/unit/spina/photo_test.rb +0 -9
- data/test/unit/spina/user_test.rb +0 -9
@@ -6,7 +6,7 @@ module Spina
|
|
6
6
|
id = new_object.object_id
|
7
7
|
fields = f.fields_for(association, new_object, child_index: id) do |builder|
|
8
8
|
build_structure_parts(f.object.page_part.name, new_object) if structure_item?(new_object)
|
9
|
-
render(
|
9
|
+
render("spina/admin/#{ partable_partial_namespace(new_object) }/fields", f: builder)
|
10
10
|
end
|
11
11
|
link_to '#', class: "#{add_fields_class(new_object)} button button-link", data: {id: id, fields: fields.gsub("\n", "")} do
|
12
12
|
block.yield
|
@@ -22,11 +22,21 @@ module Spina
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def build_structure_parts(name, item)
|
25
|
-
current_theme.
|
25
|
+
structure = current_theme.structures.find { |structure| structure[:name] == name }
|
26
|
+
structure[:structure_parts].each do |part|
|
26
27
|
part = item.structure_parts.build(part)
|
27
28
|
part.structure_partable = part.structure_partable_type.constantize.new
|
28
29
|
end
|
29
30
|
end
|
31
|
+
|
32
|
+
def partable_partial_namespace(partable)
|
33
|
+
partable_type_partial_namespace(partable.model_name.to_s)
|
34
|
+
end
|
35
|
+
|
36
|
+
def partable_type_partial_namespace(partable_type)
|
37
|
+
partable_type.tableize.sub(/\Aspina\//, '')
|
38
|
+
end
|
39
|
+
|
30
40
|
end
|
31
41
|
end
|
32
42
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Spina
|
4
|
+
module Part
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
attr_accessor :position
|
9
|
+
|
10
|
+
validates :name, :title, :partable_type, presence: true
|
11
|
+
|
12
|
+
scope :sorted, -> { order(:position) }
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
name
|
17
|
+
end
|
18
|
+
|
19
|
+
def content
|
20
|
+
self.partable.try(:content) || self.partable
|
21
|
+
end
|
22
|
+
|
23
|
+
def partable_attributes=(attributes)
|
24
|
+
if self.partable.present?
|
25
|
+
self.partable.assign_attributes(attributes)
|
26
|
+
else
|
27
|
+
self.partable = self.partable_type.constantize.new(attributes)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
File without changes
|
data/app/models/spina/ability.rb
CHANGED
data/app/models/spina/account.rb
CHANGED
@@ -37,13 +37,13 @@ module Spina
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
serialized_attr_accessor :google_analytics, :google_site_verification, :facebook, :twitter, :google_plus, :theme
|
40
|
+
serialized_attr_accessor :google_analytics, :google_site_verification, :facebook, :twitter, :google_plus, :theme
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def bootstrap_website
|
45
|
-
|
46
|
-
bootstrap_pages(
|
45
|
+
theme_config = ::Spina::Theme.find_by_name(theme)
|
46
|
+
bootstrap_pages(theme_config) if theme_config
|
47
47
|
end
|
48
48
|
|
49
49
|
def bootstrap_pages(theme)
|
@@ -53,17 +53,17 @@ module Spina
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def find_or_create_custom_pages(theme)
|
56
|
-
theme.
|
56
|
+
theme.custom_pages.each do |page|
|
57
57
|
Page.where(name: page[:name]).first_or_create(title: page[:title]).update_columns(view_template: page[:view_template], deletable: page[:deletable])
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
def deactivate_unused_view_templates(theme)
|
62
|
-
Page.where(active: true).where.not(view_template: theme.
|
62
|
+
Page.where(active: true).where.not(view_template: theme.view_templates.map { |h| h[:name] }).update_all(active: false)
|
63
63
|
end
|
64
64
|
|
65
65
|
def activate_used_view_templates(theme)
|
66
|
-
Page.where(active: false).where(view_template: theme.
|
66
|
+
Page.where(active: false).where(view_template: theme.view_templates.map { |h| h[:name] }).update_all(active: true)
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
@@ -1,44 +1,21 @@
|
|
1
1
|
module Spina
|
2
2
|
class LayoutPart < ActiveRecord::Base
|
3
|
-
include
|
3
|
+
include Part
|
4
4
|
|
5
5
|
belongs_to :account
|
6
6
|
belongs_to :layout_partable, polymorphic: true
|
7
7
|
|
8
8
|
accepts_nested_attributes_for :layout_partable, allow_destroy: true
|
9
|
-
attr_accessor :position
|
10
9
|
|
11
|
-
validates_presence_of :name, :layout_partable_type, :title
|
12
10
|
validates_uniqueness_of :name, scope: :account_id
|
13
11
|
|
14
|
-
scope :sorted, -> { order(:position) }
|
15
|
-
|
16
12
|
alias_attribute :partable, :layout_partable
|
17
|
-
|
18
|
-
|
19
|
-
name
|
20
|
-
end
|
13
|
+
alias_attribute :partable_type, :layout_partable_type
|
14
|
+
alias_method :layout_partable_attributes=, :partable_attributes=
|
21
15
|
|
22
16
|
def position(theme)
|
23
|
-
layout_parts = theme.
|
17
|
+
layout_parts = theme.layout_template[:layout_parts]
|
24
18
|
layout_parts.index { |layout_part| layout_part == self.name }.to_i
|
25
19
|
end
|
26
|
-
|
27
|
-
def content
|
28
|
-
self.layout_partable.try(:content) || self.layout_partable
|
29
|
-
end
|
30
|
-
|
31
|
-
def layout_partable_attributes=(attributes)
|
32
|
-
if self.layout_partable.present?
|
33
|
-
self.layout_partable.update_attributes(attributes)
|
34
|
-
else
|
35
|
-
self.layout_partable = self.layout_partable_type.constantize.create(attributes)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def partable_type
|
40
|
-
layout_partable_type
|
41
|
-
end
|
42
|
-
|
43
20
|
end
|
44
21
|
end
|
data/app/models/spina/line.rb
CHANGED
data/app/models/spina/page.rb
CHANGED
@@ -2,11 +2,13 @@ module Spina
|
|
2
2
|
class Page < ActiveRecord::Base
|
3
3
|
include Spina::Partable
|
4
4
|
|
5
|
+
translates :title, :menu_title, :seo_title, :description, :materialized_path
|
6
|
+
|
5
7
|
attr_accessor :old_path
|
6
8
|
|
7
9
|
has_ancestry orphan_strategy: :adopt # i.e. added to the parent of deleted node
|
8
10
|
|
9
|
-
has_many :page_parts, dependent: :destroy
|
11
|
+
has_many :page_parts, dependent: :destroy, inverse_of: :page
|
10
12
|
|
11
13
|
before_validation :ensure_title
|
12
14
|
before_validation :ancestry_is_nil
|
@@ -74,23 +76,40 @@ module Spina
|
|
74
76
|
|
75
77
|
def set_materialized_path
|
76
78
|
self.old_path = materialized_path
|
77
|
-
self.materialized_path =
|
79
|
+
self.materialized_path = localized_materialized_path
|
78
80
|
self.materialized_path += "-#{self.class.where(materialized_path: materialized_path).count}" if self.class.where(materialized_path: materialized_path).where.not(id: id).count > 0
|
79
81
|
materialized_path
|
80
82
|
end
|
81
83
|
|
84
|
+
def cache_key
|
85
|
+
super + "_" + Globalize.locale.to_s
|
86
|
+
end
|
87
|
+
|
88
|
+
def view_template_config(theme)
|
89
|
+
view_template_name = view_template.presence || 'show'
|
90
|
+
theme.view_templates.find { |template| template[:name] == view_template_name }
|
91
|
+
end
|
92
|
+
|
82
93
|
private
|
83
94
|
|
84
95
|
def rewrite_rule
|
85
96
|
RewriteRule.create(old_path: old_path, new_path: materialized_path) if old_path != materialized_path
|
86
97
|
end
|
87
98
|
|
99
|
+
def localized_materialized_path
|
100
|
+
if I18n.locale == I18n.default_locale
|
101
|
+
generate_materialized_path.prepend('/')
|
102
|
+
else
|
103
|
+
generate_materialized_path.prepend("/#{I18n.locale}/")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
88
107
|
def generate_materialized_path
|
89
108
|
if root?
|
90
|
-
name == 'homepage' ? '
|
109
|
+
name == 'homepage' ? '' : "#{url_title}"
|
91
110
|
else
|
92
|
-
ancestors.collect(&:url_title).append(url_title).join('/')
|
93
|
-
end
|
111
|
+
ancestors.collect(&:url_title).append(url_title).join('/')
|
112
|
+
end
|
94
113
|
end
|
95
114
|
|
96
115
|
def ancestry_is_nil
|
@@ -1,44 +1,20 @@
|
|
1
1
|
module Spina
|
2
2
|
class PagePart < ActiveRecord::Base
|
3
|
-
include
|
3
|
+
include Part
|
4
4
|
|
5
|
-
belongs_to :page
|
5
|
+
belongs_to :page, inverse_of: :page_parts
|
6
6
|
belongs_to :page_partable, polymorphic: true
|
7
7
|
|
8
8
|
accepts_nested_attributes_for :page_partable, allow_destroy: true
|
9
|
-
attr_accessor :position
|
10
9
|
|
11
|
-
|
12
|
-
validates_uniqueness_of :name, scope: :page_id
|
13
|
-
|
14
|
-
scope :sorted, -> { order(:position) }
|
10
|
+
validates :name, uniqueness: {scope: :page_id}
|
15
11
|
|
16
12
|
alias_attribute :partable, :page_partable
|
17
|
-
|
18
|
-
|
19
|
-
name
|
20
|
-
end
|
13
|
+
alias_attribute :partable_type, :page_partable_type
|
14
|
+
alias_method :page_partable_attributes=, :partable_attributes=
|
21
15
|
|
22
16
|
def position(theme)
|
23
|
-
|
24
|
-
page_parts.index { |page_part| page_part == self.name }.to_i
|
25
|
-
end
|
26
|
-
|
27
|
-
def content
|
28
|
-
self.page_partable.try(:content) || self.page_partable
|
17
|
+
page.view_template_config(theme)[:page_parts].index { |page_part| page_part == self.name }.to_i
|
29
18
|
end
|
30
|
-
|
31
|
-
def page_partable_attributes=(attributes)
|
32
|
-
if self.page_partable.present?
|
33
|
-
self.page_partable.assign_attributes(attributes)
|
34
|
-
else
|
35
|
-
self.page_partable = self.page_partable_type.constantize.new(attributes)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def partable_type
|
40
|
-
page_partable_type
|
41
|
-
end
|
42
|
-
|
43
19
|
end
|
44
20
|
end
|
@@ -1,29 +1,17 @@
|
|
1
1
|
module Spina
|
2
2
|
class StructurePart < ActiveRecord::Base
|
3
|
+
include Part
|
4
|
+
|
3
5
|
belongs_to :structure_item
|
4
6
|
belongs_to :structure_partable, polymorphic: true
|
5
7
|
|
6
8
|
accepts_nested_attributes_for :structure_partable, allow_destroy: true
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
scope :sorted, -> { order(:position) }
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
name
|
15
|
-
end
|
16
|
-
|
17
|
-
def content
|
18
|
-
structure_partable.try(:content) || structure_partable
|
19
|
-
end
|
10
|
+
validates :structure_partable_type, presence: true
|
11
|
+
validates :name, uniqueness: {scope: :structure_item_id}
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
else
|
25
|
-
self.structure_partable = self.structure_partable_type.constantize.new(attributes)
|
26
|
-
end
|
27
|
-
end
|
13
|
+
alias_attribute :partable, :structure_partable
|
14
|
+
alias_attribute :partable_type, :structure_partable_type
|
15
|
+
alias_method :structure_partable_attributes=, :partable_attributes=
|
28
16
|
end
|
29
17
|
end
|
data/app/models/spina/text.rb
CHANGED
@@ -7,36 +7,34 @@
|
|
7
7
|
%title Spina
|
8
8
|
|
9
9
|
/ Stylesheet
|
10
|
-
= stylesheet_link_tag
|
10
|
+
= stylesheet_link_tag 'spina/admin/application'
|
11
11
|
|
12
12
|
/[if lt IE 9]
|
13
|
-
= javascript_include_tag
|
13
|
+
= javascript_include_tag '//html5shiv.googlecode.com/svn/trunk/html5.js'
|
14
14
|
|
15
15
|
/ JavaScript
|
16
|
-
= javascript_include_tag
|
17
|
-
=
|
18
|
-
= yield(:plugin_stylesheets) if content_for?(:plugin_stylesheets)
|
19
|
-
%body{aviary_api_key: current_account.aviary_api_key, aviary_language: current_account.aviary_language, ngrok_address: (current_account.ngrok_address if Rails.env.development?) }
|
20
|
-
= render 'spina/admin/shared/navigation'
|
16
|
+
= javascript_include_tag 'spina/admin/application'
|
17
|
+
= yield(:plugin_stylesheets)
|
21
18
|
|
19
|
+
%body
|
20
|
+
= render 'spina/admin/shared/primary_navigation'
|
22
21
|
= yield(:secondary_navigation)
|
23
22
|
|
24
23
|
%section#main
|
25
24
|
%header#main_content_header
|
26
|
-
= yield(:permanent_notice)
|
25
|
+
= yield(:permanent_notice)
|
27
26
|
.pull-right
|
28
|
-
= link_to
|
27
|
+
= link_to '/', class: 'button button-hollow button-round button-small preview-website', data: {:"no-turbolink" => true} do
|
29
28
|
= icon('eye')
|
30
29
|
= t('spina.preview_website')
|
30
|
+
|
31
|
+
= yield(:header_actions) if content_for?(:header_actions)
|
31
32
|
.breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
|
32
|
-
= yield(:tertiary_navigation)
|
33
|
+
= yield(:tertiary_navigation)
|
33
34
|
|
34
35
|
= render 'spina/admin/shared/notifications'
|
35
36
|
|
36
|
-
= content_for?(:
|
37
|
+
= content_for?(:application) ? yield(:application) : yield
|
37
38
|
|
38
39
|
= link_to 'http://www.spinacms.com', class: 'spina-logo', target: :blank do
|
39
40
|
= image_tag('spina/spina.png')
|
40
|
-
|
41
|
-
/ Aviary editor
|
42
|
-
#injection_site
|
@@ -1,12 +1,12 @@
|
|
1
1
|
- content_for(:tertiary_navigation) do
|
2
2
|
%nav.tabs
|
3
3
|
%ul
|
4
|
-
%li{class: ('active' if controller_name ==
|
4
|
+
%li{class: ('active' if controller_name == 'photos')}
|
5
5
|
= link_to Spina::Photo.model_name.human(count: 2), spina.admin_photos_path
|
6
|
-
%li{class: ('active' if controller_name ==
|
6
|
+
%li{class: ('active' if controller_name == 'attachments')}
|
7
7
|
= link_to Spina::Attachment.model_name.human(count: 2), spina.admin_attachments_path
|
8
8
|
|
9
|
-
- content_for :
|
9
|
+
- content_for :website do
|
10
10
|
= yield
|
11
11
|
|
12
|
-
= render template:
|
12
|
+
= render template: 'layouts/spina/admin/website'
|
@@ -34,13 +34,12 @@
|
|
34
34
|
= t('spina.preferences.analytics')
|
35
35
|
%small= t('spina.preferences.analytics_description')
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
%small= t('spina.preferences.aviary_description')
|
37
|
+
- Spina::Plugin.all.each do |plugin|
|
38
|
+
- if current_theme.plugins.include? plugin.name
|
39
|
+
- if lookup_context.exists? "spina/admin/hooks/#{ plugin.namespace }/_settings_secondary_navigation"
|
40
|
+
= render "spina/admin/hooks/#{ plugin.namespace }/settings_secondary_navigation", plugin: plugin
|
42
41
|
|
43
|
-
- content_for
|
44
|
-
= yield
|
42
|
+
- content_for(:application) do
|
43
|
+
= content_for?(:settings) ? yield(:settings) : yield
|
45
44
|
|
46
|
-
= render template:
|
45
|
+
= render template: 'layouts/spina/admin/application'
|