spina 0.7.3 → 0.8.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 +12 -0
- data/app/assets/javascripts/spina/admin/spina.trix.js.coffee +0 -2
- data/app/controllers/spina/inquiries_controller.rb +1 -1
- data/app/helpers/spina/application_helper.rb +1 -1
- data/app/models/spina/ability.rb +2 -2
- data/app/uploaders/spina/default_store_uploader.rb +2 -2
- data/app/views/spina/admin/attachments/_select.html.haml +2 -2
- data/app/views/spina/admin/attachments/_select_collection.html.haml +2 -2
- data/app/views/spina/admin/attachments/index.html.haml +2 -2
- data/app/views/spina/admin/page_partables/_attachment_collection_form.html.haml +8 -6
- data/app/views/spina/admin/page_partables/_attachment_form.html.haml +8 -6
- data/app/views/spina/admin/sessions/new.html.haml +1 -1
- data/config/routes.rb +6 -2
- data/db/seeds.rb +0 -19
- data/lib/generators/spina/install_generator.rb +51 -14
- data/lib/generators/spina/templates/app/assets/stylesheets/default/application.css.sass +0 -66
- data/lib/generators/spina/templates/app/assets/stylesheets/demo/application.css.sass +66 -0
- data/lib/generators/spina/templates/app/views/{default → demo}/pages/demo.html.haml +0 -0
- data/lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml +2 -0
- data/lib/generators/spina/templates/app/views/demo/pages/show.html.haml +3 -0
- data/lib/generators/spina/templates/app/views/{default → demo}/shared/_navigation.html.haml +0 -0
- data/lib/generators/spina/templates/app/views/layouts/demo/application.html.haml +11 -0
- data/lib/generators/spina/templates/config/initializers/spina.rb +12 -9
- data/lib/generators/spina/templates/config/initializers/themes/default.rb +2 -51
- data/lib/generators/spina/templates/config/initializers/themes/demo.rb +103 -0
- data/lib/spina.rb +49 -2
- data/lib/spina/engine.rb +12 -52
- data/lib/spina/version.rb +1 -1
- data/test/dummy/app/assets/stylesheets/default/application.css.sass +0 -66
- data/test/dummy/app/assets/stylesheets/demo/application.css.sass +66 -0
- data/test/dummy/app/views/{default → demo}/pages/demo.html.haml +5 -16
- data/test/dummy/app/views/demo/pages/homepage.html.haml +2 -0
- data/test/dummy/app/views/demo/pages/show.html.haml +3 -0
- data/test/dummy/app/views/demo/shared/_navigation.html.haml +5 -0
- data/test/dummy/app/views/layouts/demo/application.html.haml +11 -0
- data/test/dummy/config/initializers/spina.rb +11 -8
- data/test/dummy/config/initializers/themes/default.rb +2 -51
- data/test/dummy/config/initializers/themes/demo.rb +103 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/tmp/restart.txt +0 -0
- metadata +21 -9
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= current_account.name
|
5
|
+
= stylesheet_link_tag 'demo/application', media: 'all', 'data-turbolinks-track' => true
|
6
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
7
|
+
= csrf_meta_tags
|
8
|
+
%body
|
9
|
+
.container
|
10
|
+
= render 'demo/shared/navigation'
|
11
|
+
= yield
|
@@ -1,23 +1,26 @@
|
|
1
|
-
Spina
|
2
|
-
config.NEGATIVE_CAPTCHA_SECRET = '<%= SecureRandom.hex(64) %>'
|
1
|
+
Spina.configure do |config|
|
2
|
+
config.NEGATIVE_CAPTCHA_SECRET = '<%= Spina.config.try(:NEGATIVE_CAPTCHA_SECRET) || SecureRandom.hex(64) %>'
|
3
3
|
|
4
4
|
# Important Note
|
5
5
|
# ==============
|
6
|
-
|
6
|
+
|
7
7
|
# You MUST restart your server before changes to this file
|
8
8
|
# will take effect.
|
9
|
-
|
9
|
+
|
10
|
+
# Specify a backend path. Defaults to /admin.
|
11
|
+
# config.backend_path = 'admin'
|
12
|
+
|
10
13
|
# Storage Options
|
11
14
|
# ===============
|
12
|
-
|
15
|
+
|
13
16
|
# Please specify how you want to store photos, your logo, and
|
14
17
|
# other files. We use CarrierWave for storage. See
|
15
18
|
# https://github.com/denkGroot/Spina/tree/master/app/uploaders/spina
|
16
|
-
|
17
|
-
config.storage = :file
|
18
|
-
|
19
|
+
|
20
|
+
# config.storage = :file
|
21
|
+
|
19
22
|
# If you want to use s3 to store uploads (recommended)
|
20
|
-
|
23
|
+
|
21
24
|
# config.storage = :s3
|
22
25
|
# config.aws_region = "eu-west-1"
|
23
26
|
# config.aws_access_key_id = "abc123"
|
@@ -7,52 +7,14 @@ module Spina
|
|
7
7
|
self.title = 'Default theme'
|
8
8
|
|
9
9
|
self.page_parts = [{
|
10
|
-
name: 'line',
|
11
|
-
title: 'Line',
|
12
|
-
page_partable_type: 'Spina::Line'
|
13
|
-
}, {
|
14
10
|
name: 'text',
|
15
11
|
title: 'Text',
|
16
12
|
page_partable_type: 'Spina::Text'
|
17
|
-
}, {
|
18
|
-
name: 'photo',
|
19
|
-
title: 'Photo',
|
20
|
-
page_partable_type: 'Spina::Photo'
|
21
|
-
}, {
|
22
|
-
name: 'photo_collection',
|
23
|
-
title: 'Photo collection',
|
24
|
-
page_partable_type: 'Spina::PhotoCollection'
|
25
|
-
}, {
|
26
|
-
name: 'structure',
|
27
|
-
title: 'Structure',
|
28
|
-
page_partable_type: 'Spina::Structure'
|
29
|
-
}, {
|
30
|
-
name: 'color',
|
31
|
-
title: 'Color',
|
32
|
-
page_partable_type: 'Spina::Color'
|
33
13
|
}]
|
34
14
|
|
35
|
-
self.structures = {
|
36
|
-
'structure' => [{
|
37
|
-
name: 'title',
|
38
|
-
title: 'Title',
|
39
|
-
structure_partable_type: 'Spina::Line'
|
40
|
-
}, {
|
41
|
-
name: 'description',
|
42
|
-
title: 'Description',
|
43
|
-
structure_partable_type: 'Spina::Text'
|
44
|
-
}]
|
45
|
-
}
|
15
|
+
self.structures = {}
|
46
16
|
|
47
|
-
self.layout_parts = [
|
48
|
-
name: 'line',
|
49
|
-
title: 'Line',
|
50
|
-
layout_partable_type: 'Spina::Line'
|
51
|
-
}, {
|
52
|
-
name: 'color',
|
53
|
-
title: 'Color',
|
54
|
-
layout_partable_type: 'Spina::Color'
|
55
|
-
}]
|
17
|
+
self.layout_parts = []
|
56
18
|
|
57
19
|
self.view_templates = {
|
58
20
|
'homepage' => {
|
@@ -64,12 +26,6 @@ module Spina
|
|
64
26
|
description: 'A simple page',
|
65
27
|
usage: 'Use for your content',
|
66
28
|
page_parts: ['text']
|
67
|
-
},
|
68
|
-
'demo' => {
|
69
|
-
title: 'Demo',
|
70
|
-
description: 'Example page',
|
71
|
-
usage: 'Shows the usage of several page parts',
|
72
|
-
page_parts: ['line', 'text', 'photo', 'photo_collection', 'structure', 'color']
|
73
29
|
}
|
74
30
|
}
|
75
31
|
|
@@ -78,11 +34,6 @@ module Spina
|
|
78
34
|
title: 'Homepage',
|
79
35
|
deletable: false,
|
80
36
|
view_template: 'homepage'
|
81
|
-
}, {
|
82
|
-
name: 'demo',
|
83
|
-
title: 'Demo',
|
84
|
-
deletable: true,
|
85
|
-
view_template: 'demo'
|
86
37
|
}]
|
87
38
|
|
88
39
|
self.plugins = []
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Spina
|
2
|
+
module DemoTheme
|
3
|
+
include ::ActiveSupport::Configurable
|
4
|
+
|
5
|
+
config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures
|
6
|
+
|
7
|
+
self.title = 'Demo theme'
|
8
|
+
|
9
|
+
self.page_parts = [{
|
10
|
+
name: 'line',
|
11
|
+
title: 'Line',
|
12
|
+
page_partable_type: 'Spina::Line'
|
13
|
+
}, {
|
14
|
+
name: 'text',
|
15
|
+
title: 'Text',
|
16
|
+
page_partable_type: 'Spina::Text'
|
17
|
+
}, {
|
18
|
+
name: 'photo',
|
19
|
+
title: 'Photo',
|
20
|
+
page_partable_type: 'Spina::Photo'
|
21
|
+
}, {
|
22
|
+
name: 'photo_collection',
|
23
|
+
title: 'Photo collection',
|
24
|
+
page_partable_type: 'Spina::PhotoCollection'
|
25
|
+
}, {
|
26
|
+
name: 'attachment',
|
27
|
+
title: 'Attachment',
|
28
|
+
page_partable_type: 'Spina::Attachment'
|
29
|
+
}, {
|
30
|
+
name: 'attachment_collection',
|
31
|
+
title: 'Attachment collection',
|
32
|
+
page_partable_type: 'Spina::AttachmentCollection'
|
33
|
+
}, {
|
34
|
+
name: 'structure',
|
35
|
+
title: 'Structure',
|
36
|
+
page_partable_type: 'Spina::Structure'
|
37
|
+
}, {
|
38
|
+
name: 'color',
|
39
|
+
title: 'Color',
|
40
|
+
page_partable_type: 'Spina::Color'
|
41
|
+
}]
|
42
|
+
|
43
|
+
self.structures = {
|
44
|
+
'structure' => [{
|
45
|
+
name: 'title',
|
46
|
+
title: 'Title',
|
47
|
+
structure_partable_type: 'Spina::Line'
|
48
|
+
}, {
|
49
|
+
name: 'description',
|
50
|
+
title: 'Description',
|
51
|
+
structure_partable_type: 'Spina::Text'
|
52
|
+
}]
|
53
|
+
}
|
54
|
+
|
55
|
+
self.layout_parts = [{
|
56
|
+
name: 'line',
|
57
|
+
title: 'Line',
|
58
|
+
layout_partable_type: 'Spina::Line'
|
59
|
+
}, {
|
60
|
+
name: 'color',
|
61
|
+
title: 'Color',
|
62
|
+
layout_partable_type: 'Spina::Color'
|
63
|
+
}]
|
64
|
+
|
65
|
+
self.view_templates = {
|
66
|
+
'homepage' => {
|
67
|
+
title: 'Homepage',
|
68
|
+
page_parts: ['text']
|
69
|
+
},
|
70
|
+
'show' => {
|
71
|
+
title: 'Default',
|
72
|
+
description: 'A simple page',
|
73
|
+
usage: 'Use for your content',
|
74
|
+
page_parts: ['text']
|
75
|
+
},
|
76
|
+
'demo' => {
|
77
|
+
title: 'Demo',
|
78
|
+
description: 'Contains examples of every page part',
|
79
|
+
page_parts: ['line', 'text', 'photo', 'photo_collection', 'attachment', 'attachment_collection', 'structure', 'color']
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
self.custom_pages = [{
|
84
|
+
name: 'homepage',
|
85
|
+
title: 'Homepage',
|
86
|
+
deletable: false,
|
87
|
+
view_template: 'homepage'
|
88
|
+
}, {
|
89
|
+
name: 'demo',
|
90
|
+
title: 'Demo',
|
91
|
+
deletable: true,
|
92
|
+
view_template: 'demo'
|
93
|
+
}]
|
94
|
+
|
95
|
+
self.plugins = []
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
theme = Spina::Theme.new
|
101
|
+
theme.name = 'demo'
|
102
|
+
theme.config = Spina::DemoTheme.config
|
103
|
+
Spina.register_theme(theme)
|
data/lib/spina.rb
CHANGED
@@ -1,2 +1,49 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spina/engine'
|
2
|
+
require 'spina/template'
|
3
|
+
|
4
|
+
module Spina
|
5
|
+
|
6
|
+
include ActiveSupport::Configurable
|
7
|
+
|
8
|
+
config_accessor :backend_path, :storage
|
9
|
+
|
10
|
+
self.backend_path = 'admin'
|
11
|
+
|
12
|
+
self.storage = :file
|
13
|
+
|
14
|
+
class << self
|
15
|
+
|
16
|
+
@@themes = []
|
17
|
+
@@plugins = []
|
18
|
+
|
19
|
+
def register_theme(theme)
|
20
|
+
@@themes << theme
|
21
|
+
end
|
22
|
+
|
23
|
+
def theme(theme_name)
|
24
|
+
@@themes.find { |theme| theme.name == theme_name }
|
25
|
+
end
|
26
|
+
|
27
|
+
def themes
|
28
|
+
@@themes
|
29
|
+
end
|
30
|
+
|
31
|
+
def register_plugin(plugin)
|
32
|
+
@@plugins << plugin
|
33
|
+
end
|
34
|
+
|
35
|
+
def plugin(plugin_name)
|
36
|
+
@@plugins.find { |plugin| plugin.name == plugin_name }
|
37
|
+
end
|
38
|
+
|
39
|
+
def plugins(plugin_type = :all)
|
40
|
+
case plugin_type
|
41
|
+
when :website_resource
|
42
|
+
@@plugins.find_all { |plugin| plugin.config.plugin_type == 'website_resource' }
|
43
|
+
else
|
44
|
+
@@plugins
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/spina/engine.rb
CHANGED
@@ -20,35 +20,22 @@ module Spina
|
|
20
20
|
|
21
21
|
isolate_namespace Spina
|
22
22
|
|
23
|
-
def self.require_decorators
|
24
|
-
[Rails.root].flatten.map { |p| Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]}.flatten.uniq.each do |decorator|
|
25
|
-
Rails.configuration.cache_classes ? require(decorator) : load(decorator)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
initializer "spina.configure_carrierwave" do
|
30
|
-
configure_carrierwave
|
31
|
-
end
|
32
|
-
|
33
|
-
config.to_prepare &method(:require_decorators).to_proc
|
34
23
|
config.autoload_paths += %W( #{config.root}/lib )
|
35
24
|
config.assets.paths << config.root.join('vendor', 'assets')
|
36
25
|
|
37
|
-
|
38
|
-
|
39
|
-
def configure_carrierwave
|
26
|
+
initializer 'spina.configure_carrierwave' do
|
40
27
|
CarrierWave.configure do |cfg|
|
41
|
-
if
|
28
|
+
if Spina.config.storage == :s3
|
42
29
|
cfg.storage = :fog
|
43
30
|
cfg.fog_credentials = {
|
44
|
-
provider:
|
45
|
-
region:
|
46
|
-
aws_access_key_id:
|
47
|
-
aws_secret_access_key:
|
31
|
+
provider: 'AWS',
|
32
|
+
region: Spina.config.aws_region,
|
33
|
+
aws_access_key_id: Spina.config.aws_access_key_id,
|
34
|
+
aws_secret_access_key: Spina.config.aws_secret_key
|
48
35
|
}
|
49
|
-
cfg.fog_directory =
|
36
|
+
cfg.fog_directory = Spina.config.s3_bucket
|
50
37
|
cfg.fog_public = true
|
51
|
-
cfg.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
|
38
|
+
cfg.fog_attributes = { 'Cache-Control' => 'max-age=315576000' }
|
52
39
|
else
|
53
40
|
cfg.storage = :file
|
54
41
|
end
|
@@ -56,39 +43,12 @@ module Spina
|
|
56
43
|
cfg.enable_processing = !Rails.env.test?
|
57
44
|
end
|
58
45
|
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class << self
|
62
|
-
@@themes = []
|
63
|
-
@@plugins = []
|
64
|
-
|
65
|
-
def register_theme(theme)
|
66
|
-
@@themes << theme
|
67
|
-
end
|
68
46
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
def themes
|
74
|
-
@@themes
|
75
|
-
end
|
76
|
-
|
77
|
-
def register_plugin(plugin)
|
78
|
-
@@plugins << plugin
|
79
|
-
end
|
80
|
-
|
81
|
-
def plugin(plugin_name)
|
82
|
-
@@plugins.find { |plugin| plugin.name == plugin_name }
|
83
|
-
end
|
84
|
-
|
85
|
-
def plugins(plugin_type = :all)
|
86
|
-
case plugin_type
|
87
|
-
when :website_resource
|
88
|
-
@@plugins.find_all { |plugin| plugin.config.plugin_type == 'website_resource' }
|
89
|
-
else
|
90
|
-
@@plugins
|
47
|
+
config.to_prepare do
|
48
|
+
[Rails.root].flatten.map { |p| Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]}.flatten.uniq.each do |decorator|
|
49
|
+
Rails.configuration.cache_classes ? require(decorator) : load(decorator)
|
91
50
|
end
|
92
51
|
end
|
52
|
+
|
93
53
|
end
|
94
54
|
end
|
data/lib/spina/version.rb
CHANGED
@@ -1,66 +0,0 @@
|
|
1
|
-
// require normalize.css
|
2
|
-
|
3
|
-
// $color-primary: #6865b4
|
4
|
-
$color-link: #0275d8
|
5
|
-
|
6
|
-
html
|
7
|
-
font-size: 16px
|
8
|
-
|
9
|
-
body
|
10
|
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
|
11
|
-
font-size: 1rem
|
12
|
-
line-height: 1.5
|
13
|
-
|
14
|
-
h1, h2, h3, h4, h5, h6
|
15
|
-
margin-top: 0
|
16
|
-
margin-bottom: 0.5rem
|
17
|
-
|
18
|
-
h1
|
19
|
-
font-size: 2.5rem
|
20
|
-
h2
|
21
|
-
font-size: 2rem
|
22
|
-
h3
|
23
|
-
font-size: 1.75rem
|
24
|
-
h4
|
25
|
-
font-size: 1.5rem
|
26
|
-
h5
|
27
|
-
font-size: 1.25rem
|
28
|
-
h6
|
29
|
-
font-size: 1rem
|
30
|
-
|
31
|
-
p
|
32
|
-
margin-top: 0
|
33
|
-
margin-bottom: 1rem
|
34
|
-
|
35
|
-
ul, ol
|
36
|
-
margin-top: 0
|
37
|
-
margin-bottom: 1rem
|
38
|
-
|
39
|
-
img
|
40
|
-
vertical-align: middle
|
41
|
-
|
42
|
-
a
|
43
|
-
color: $color-link
|
44
|
-
text-decoration: none
|
45
|
-
|
46
|
-
&:hover, &:focus
|
47
|
-
color: darken($color-link, 15%)
|
48
|
-
text-decoration: underline
|
49
|
-
|
50
|
-
.container
|
51
|
-
width: 960px
|
52
|
-
margin: 0 auto
|
53
|
-
|
54
|
-
.nav
|
55
|
-
padding-left: 0
|
56
|
-
margin-bottom: 2rem
|
57
|
-
list-style: none
|
58
|
-
|
59
|
-
.nav-item
|
60
|
-
display: inline-block
|
61
|
-
|
62
|
-
.nav-item + .nav-item
|
63
|
-
margin-left: 20px
|
64
|
-
|
65
|
-
.nav-item.active > a
|
66
|
-
text-decoration: underline
|