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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c193166046b26e158282c06d5445c0178dd25c2d
|
4
|
+
data.tar.gz: 791216beeef68374485919c5416b0eec0dd5e739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50b0830bd60b7f9d5f09bf4d0d26cbbb656e8af5415c688c46a68cb1934b79146966dbd1c8d3cfcc9ee9b6825c698d8480ecefeebab305f9a1abd9a9caabd1e8
|
7
|
+
data.tar.gz: 50ef7dea3eb8d1f06c00f189ce57493f56550619e719bfac2b5661349558882445372f193539bced3086dd6540f7a8d0b497dc3161d7d380dc5a3cd240386b46
|
data/README.md
CHANGED
@@ -26,6 +26,18 @@ The installer will help you setup your first user.
|
|
26
26
|
|
27
27
|
Then start `rails s` and access your admin panel at `/admin`.
|
28
28
|
|
29
|
+
## Upgrading from 0.7 to 0.8
|
30
|
+
|
31
|
+
Spina-specific configuration moved from `Spina::Engine.config` to just `Spina.config`.
|
32
|
+
Change the following in your initializer:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
# config/initializers/spina.rb
|
36
|
+
|
37
|
+
Spina::Engine.configure do |config| # OLD
|
38
|
+
Spina.configure do |config| # NEW
|
39
|
+
```
|
40
|
+
|
29
41
|
# Basics
|
30
42
|
|
31
43
|
The installer generates a few initializers that contain necessary configuration for Spina.
|
@@ -19,7 +19,7 @@ module Spina
|
|
19
19
|
|
20
20
|
def setup_negative_captcha
|
21
21
|
@captcha = NegativeCaptcha.new(
|
22
|
-
secret:
|
22
|
+
secret: Spina.config.NEGATIVE_CAPTCHA_SECRET,
|
23
23
|
spinner: request.remote_ip,
|
24
24
|
fields: [:email, :message, :name],
|
25
25
|
params: params
|
data/app/models/spina/ability.rb
CHANGED
@@ -2,7 +2,7 @@ module Spina
|
|
2
2
|
class DefaultStoreUploader < CarrierWave::Uploader::Base
|
3
3
|
|
4
4
|
def store_dir
|
5
|
-
case
|
5
|
+
case Spina.config.storage
|
6
6
|
when :s3
|
7
7
|
"#{mounted_as}/#{model.class.to_s.underscore}/#{model.id}"
|
8
8
|
when :file
|
@@ -12,4 +12,4 @@ module Spina
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -7,12 +7,12 @@
|
|
7
7
|
-# = form_for [spina, :admin, @attachment], html: {multipart: true} do |f|
|
8
8
|
-# = f.file_field :file, data: {customfileinput: true}
|
9
9
|
|
10
|
-
= form_tag spina.insert_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment' do
|
10
|
+
= form_tag spina.insert_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment', style: 'margin-bottom: 0' do
|
11
11
|
.table-container
|
12
12
|
%table.table.table-clickable
|
13
13
|
%thead
|
14
14
|
%tr
|
15
|
-
%th
|
15
|
+
%th
|
16
16
|
%th= Spina::Attachment.human_attribute_name(:name)
|
17
17
|
%tbody
|
18
18
|
- @attachments.each do |attachment|
|
@@ -7,12 +7,12 @@
|
|
7
7
|
-# = form_for [spina, :admin, @attachment], html: {multipart: true} do |f|
|
8
8
|
-# = f.file_field :file, data: {customfileinput: true}
|
9
9
|
|
10
|
-
= form_tag spina.insert_collection_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment' do
|
10
|
+
= form_tag spina.insert_collection_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment', style: 'margin-bottom: 0' do
|
11
11
|
.table-container
|
12
12
|
%table.table.table-clickable
|
13
13
|
%thead
|
14
14
|
%tr
|
15
|
-
%th
|
15
|
+
%th
|
16
16
|
%th= Spina::Attachment.human_attribute_name(:name)
|
17
17
|
%tbody
|
18
18
|
- @attachments.each do |attachment|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
.clear-input
|
5
5
|
= icon('times-circle')
|
6
6
|
|
7
|
-
%table.table
|
7
|
+
%table.table
|
8
8
|
%thead
|
9
9
|
%tr
|
10
10
|
%th= Spina::Attachment.human_attribute_name(:name)
|
@@ -17,4 +17,4 @@
|
|
17
17
|
= f.file_field :file, data: {customfileinput: true}
|
18
18
|
|
19
19
|
%tbody.table-prepend-document
|
20
|
-
= render partial: 'spina/admin/attachments/attachment', collection: @attachments
|
20
|
+
= render partial: 'spina/admin/attachments/attachment', collection: @attachments
|
@@ -8,11 +8,13 @@
|
|
8
8
|
|
9
9
|
= attachment_collection_form.fields_for :page_partable, attachment_collection_form.object.page_partable do |form|
|
10
10
|
= link_to select_collection_admin_attachments_path(form.object_name), remote: true, class: "media_picker" do
|
11
|
-
|
12
|
-
|
13
|
-
.
|
14
|
-
|
15
|
-
.placeholder
|
16
|
-
%span{data: {icon: 't'}}
|
11
|
+
.clearfix
|
12
|
+
.placeholder.pull-right
|
13
|
+
%span.button.button-small.button-round
|
14
|
+
%i.icon.icon-dots
|
17
15
|
= t('spina.choose_from_library')
|
16
|
+
- if form.object.attachments.any?
|
17
|
+
- form.object.attachments.each do |attachment|
|
18
|
+
.attachment= attachment.name
|
19
|
+
|
18
20
|
= form.hidden_field :attachment_tokens, value: form.object.attachment_ids.join(",")
|
@@ -7,11 +7,13 @@
|
|
7
7
|
= attachment_form.hidden_field :name
|
8
8
|
|
9
9
|
= link_to select_admin_attachments_path(attachment_form.object_name), remote: true, class: "media_picker" do
|
10
|
-
|
11
|
-
.
|
12
|
-
|
13
|
-
|
14
|
-
%span{data: {icon: 't'}}
|
10
|
+
.clearfix
|
11
|
+
.placeholder.pull-right
|
12
|
+
%span.button.button-small.button-round
|
13
|
+
%i.icon.icon-dots
|
15
14
|
= t('spina.choose_from_library')
|
16
15
|
|
17
|
-
|
16
|
+
- if attachment_form.object.page_partable && attachment_form.object.page_partable.file.present?
|
17
|
+
.attachment= attachment_form.object.page_partable.name
|
18
|
+
|
19
|
+
= attachment_form.hidden_field :page_partable_id
|
@@ -4,6 +4,6 @@
|
|
4
4
|
.notification.notification-danger
|
5
5
|
.icon.icon-cross
|
6
6
|
= flash[:alert]
|
7
|
-
= text_field_tag :email, params[:email], placeholder: Spina::User.human_attribute_name(:email)
|
7
|
+
= text_field_tag :email, params[:email], placeholder: Spina::User.human_attribute_name(:email), autofocus: true
|
8
8
|
= password_field_tag :password, nil, placeholder: Spina::User.human_attribute_name(:password)
|
9
9
|
= button_tag t('spina.login'), class: 'button button-primary', data: {icon: '3'}
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Spina::Engine.routes.draw do
|
2
2
|
|
3
3
|
# Backend
|
4
|
-
namespace :admin do
|
4
|
+
namespace :admin, path: Spina.config.backend_path do
|
5
5
|
root to: "pages#index"
|
6
6
|
|
7
7
|
resource :account do
|
@@ -85,5 +85,9 @@ Spina::Engine.routes.draw do
|
|
85
85
|
|
86
86
|
# get ':materialized_pathroot/:subpage/:id' => "pages#show", as: "third_level_page"
|
87
87
|
# get ':root/:id' => "pages#show", as: "subpage"
|
88
|
-
get '/*id' =>
|
88
|
+
get '/*id' => 'pages#show', as: "page", controller: 'pages', constraints: lambda { |request|
|
89
|
+
!(Rails.env.development? && request.env['PATH_INFO'].starts_with?('/rails/'))
|
90
|
+
}
|
91
|
+
|
89
92
|
end
|
93
|
+
|
data/db/seeds.rb
CHANGED
@@ -1,21 +1,2 @@
|
|
1
1
|
puts "Seeding #{__FILE__} from Spina::Engine"
|
2
2
|
|
3
|
-
current_theme = ::Spina.themes.detect{ |theme| theme.name == Spina::Account.first.theme }
|
4
|
-
if (page = Spina::Page.find_by(name: 'demo'))
|
5
|
-
page.page_parts.clear
|
6
|
-
parts = current_theme.config.page_parts.map { |page_part| page.page_part(page_part) }
|
7
|
-
parts.each do |part|
|
8
|
-
case part.partable_type
|
9
|
-
when 'Spina::Line' then part.partable.content = 'This is a single line'
|
10
|
-
when 'Spina::Text' then part.partable.content = '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>'
|
11
|
-
when 'Spina::Photo' then part.partable.remote_file_url = 'https://unsplash.it/300/200?random'
|
12
|
-
when 'Spina::PhotoCollection'
|
13
|
-
5.times { part.partable.photos.build(remote_file_url: 'https://unsplash.it/300/200?random') }
|
14
|
-
# when 'Spina::Structure'
|
15
|
-
# part.partable.structure_items.build({ name: 'title', title: 'Title', structure_partable_type: 'Spina::Line' })
|
16
|
-
# part.partable.structure_items.build({ name: 'description', title: 'Description', structure_partable_type: 'Spina::Text' })
|
17
|
-
when 'Spina::Color' then part.partable.content = '#6865b4'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
page.save
|
21
|
-
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
module Spina
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
|
+
|
3
4
|
source_root File.expand_path("../templates", __FILE__)
|
4
5
|
|
5
6
|
def create_initializer_file
|
6
7
|
template 'config/initializers/spina.rb'
|
7
8
|
end
|
8
9
|
|
9
|
-
def
|
10
|
-
|
10
|
+
def add_route
|
11
|
+
return if Rails.application.routes.routes.detect { |route| route.app.app == Spina::Engine }
|
12
|
+
route "mount Spina::Engine => '/'"
|
11
13
|
end
|
12
14
|
|
13
15
|
def copy_migrations
|
@@ -18,22 +20,35 @@ module Spina
|
|
18
20
|
rake 'db:migrate'
|
19
21
|
end
|
20
22
|
|
21
|
-
def copy_views
|
22
|
-
template 'app/assets/stylesheets/default/application.css.sass'
|
23
|
-
template 'app/views/layouts/default/application.html.haml'
|
24
|
-
template 'app/views/default/shared/_navigation.html.haml'
|
25
|
-
template 'app/views/default/pages/homepage.html.haml'
|
26
|
-
template 'app/views/default/pages/show.html.haml'
|
27
|
-
end
|
28
|
-
|
29
23
|
def create_account
|
24
|
+
return if Account.exists? && !no?('An account already exists. Skip? [Yn]')
|
30
25
|
name = ask('What would you like to name your website?')
|
31
|
-
Account.
|
26
|
+
account = Account.first_or_create.update_attribute(:name, name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_theme
|
30
|
+
account = Account.first
|
31
|
+
return if account.theme.present? && !no?("Theme '#{account.theme} is set. Skip? [Yn]")
|
32
|
+
|
33
|
+
theme = begin
|
34
|
+
theme = account.theme || 'default'
|
35
|
+
theme = ask("What theme do you want to use? (default/demo) [#{theme}]").presence || theme
|
36
|
+
end until theme.in? ['default', 'demo']
|
37
|
+
|
38
|
+
account.update_attribute(:theme, theme)
|
39
|
+
|
40
|
+
template "config/initializers/themes/#{theme}.rb"
|
41
|
+
directory "app/assets/stylesheets/#{theme}"
|
42
|
+
directory "app/views/#{theme}"
|
43
|
+
directory "app/views/layouts/#{theme}"
|
44
|
+
directory "app/views/layouts/#{theme}"
|
32
45
|
end
|
33
46
|
|
47
|
+
|
34
48
|
def create_user
|
49
|
+
return if User.exists? && !no?('A user already exists. Skip? [Yn]')
|
35
50
|
email = ask('Please enter an email address for your first user:')
|
36
|
-
password = ask('Create a temporary password:')
|
51
|
+
password = ask('Create a temporary password:', echo: false)
|
37
52
|
User.create name: 'admin', email: email, password: password, admin: true
|
38
53
|
end
|
39
54
|
|
@@ -41,8 +56,30 @@ module Spina
|
|
41
56
|
rake 'spina:bootstrap'
|
42
57
|
end
|
43
58
|
|
44
|
-
def
|
45
|
-
|
59
|
+
def seed_demo_content
|
60
|
+
theme_name = Account.first.theme
|
61
|
+
if theme_name == 'demo' && !no?('Seed example content? [Yn]')
|
62
|
+
|
63
|
+
current_theme = ::Spina.themes.find { |theme| theme.name == theme_name }
|
64
|
+
if (page = Spina::Page.find_by(name: 'demo'))
|
65
|
+
page.page_parts.clear
|
66
|
+
parts = current_theme.config.page_parts.map { |page_part| page.page_part(page_part) }
|
67
|
+
parts.each do |part|
|
68
|
+
case part.partable_type
|
69
|
+
when 'Spina::Line' then part.partable.content = 'This is a single line'
|
70
|
+
when 'Spina::Text' then part.partable.content = '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>'
|
71
|
+
when 'Spina::Photo' then part.partable.remote_file_url = 'https://unsplash.it/300/200?random'
|
72
|
+
when 'Spina::PhotoCollection'
|
73
|
+
5.times { part.partable.photos.build(remote_file_url: 'https://unsplash.it/300/200?random') }
|
74
|
+
# when 'Spina::Structure'
|
75
|
+
# part.partable.structure_items.build({ name: 'title', title: 'Title', structure_partable_type: 'Spina::Line' })
|
76
|
+
# part.partable.structure_items.build({ name: 'description', title: 'Description', structure_partable_type: 'Spina::Text' })
|
77
|
+
when 'Spina::Color' then part.partable.content = '#6865b4'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
page.save
|
81
|
+
end
|
82
|
+
end
|
46
83
|
end
|
47
84
|
|
48
85
|
end
|
@@ -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
|
@@ -0,0 +1,66 @@
|
|
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
|