spina 0.7.0 → 0.7.2
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/app/assets/javascripts/spina/admin/application.js +3 -1
- data/app/assets/javascripts/spina/admin/spina.infinite_scroll.coffee +20 -0
- data/app/assets/javascripts/spina/admin/spina.scaffold.coffee +15 -0
- data/app/assets/javascripts/spina/admin/spina.trix.js.coffee +2 -0
- data/app/controllers/spina/admin/photos_controller.rb +26 -6
- data/app/controllers/spina/application_controller.rb +2 -4
- data/app/controllers/spina/inquiries_controller.rb +2 -2
- data/app/controllers/spina/pages_controller.rb +2 -2
- data/app/controllers/spina/sitemaps_controller.rb +1 -1
- data/app/models/spina/account.rb +4 -4
- data/app/models/spina/page.rb +0 -10
- data/app/models/spina/photo.rb +5 -0
- data/app/presenters/spina/pages/menu_presenter.rb +7 -6
- data/app/uploaders/spina/photo_uploader.rb +1 -1
- data/app/views/spina/admin/inquiries/inbox.html.haml +1 -1
- data/app/views/spina/admin/inquiries/show.html.haml +1 -1
- data/app/views/spina/admin/photos/_photo.html.haml +4 -6
- data/app/views/spina/admin/photos/_photo_collection_select.html.haml +16 -15
- data/app/views/spina/admin/photos/_photo_multi_picker.html.haml +3 -0
- data/app/views/spina/admin/photos/_photo_select.html.haml +5 -14
- data/app/views/spina/admin/photos/_photo_single_picker.html.haml +3 -0
- data/app/views/spina/admin/photos/_photo_uploaded.html.haml +4 -0
- data/app/views/spina/admin/photos/_wysihtml5_select.html.haml +5 -12
- data/app/views/spina/admin/photos/create.js.erb +3 -1
- data/app/views/spina/admin/photos/index.html.haml +10 -6
- data/app/views/spina/admin/photos/index.js.erb +5 -0
- data/app/views/spina/admin/photos/multi_picker_infinite_scroll.js.erb +6 -0
- data/app/views/spina/admin/photos/photo_collection_select.js.erb +1 -0
- data/app/views/spina/admin/photos/photo_select.js.erb +1 -0
- data/app/views/spina/admin/photos/single_picker_infinite_scroll.js.erb +6 -0
- data/app/views/spina/admin/photos/wysihtml5_infinite_scroll.js.erb +6 -0
- data/app/views/spina/admin/photos/wysihtml5_select.js.erb +1 -0
- data/app/views/spina/admin/shared/_rich_text_field.html.haml +24 -23
- data/config/locales/en.yml +2 -1
- data/db/seeds.rb +19 -9
- data/lib/generators/spina/install_generator.rb +14 -12
- data/lib/generators/spina/templates/app/assets/stylesheets/default/application.css.sass +66 -0
- data/lib/generators/spina/templates/app/views/default/pages/demo.html.haml +30 -0
- data/lib/generators/spina/templates/app/views/default/pages/homepage.html.haml +2 -0
- data/lib/generators/spina/templates/app/views/default/pages/show.html.haml +3 -0
- data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +5 -0
- data/lib/generators/spina/templates/app/views/layouts/default/application.html.haml +11 -0
- data/lib/generators/spina/templates/{spina.rb → config/initializers/spina.rb} +3 -2
- data/lib/generators/spina/templates/config/initializers/themes/default.rb +96 -0
- data/lib/spina/engine.rb +1 -0
- data/lib/spina/version.rb +1 -1
- data/test/dummy/app/assets/stylesheets/default/application.css.sass +66 -0
- data/test/dummy/app/views/default/pages/demo.html.haml +41 -0
- data/test/dummy/app/views/default/pages/homepage.html.haml +2 -0
- data/test/dummy/app/views/default/pages/show.html.haml +3 -0
- data/test/dummy/app/views/default/shared/_navigation.html.haml +5 -0
- data/test/dummy/app/views/layouts/default/application.html.haml +11 -0
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/initializers/spina.rb +26 -0
- data/test/dummy/config/initializers/themes/default.rb +65 -33
- data/test/dummy/db/migrate/20160114085213_create_spina_tables.spina.rb +167 -0
- metadata +40 -13
- data/app/views/spina/admin/photos/enhance.js +0 -0
- data/lib/generators/spina/templates/application.html.erb +0 -16
- data/lib/generators/spina/templates/homepage.html.erb +0 -3
- data/lib/generators/spina/templates/show.html.erb +0 -3
- data/lib/generators/spina/templates/theme.rb +0 -42
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/views/default/pages/homepage.html.erb +0 -3
- data/test/dummy/app/views/default/pages/show.html.erb +0 -3
- data/test/dummy/app/views/layouts/default/application.html.erb +0 -16
- data/test/dummy/tmp/restart.txt +0 -0
@@ -1,7 +1,11 @@
|
|
1
|
-
.gallery
|
2
|
-
.
|
3
|
-
|
4
|
-
|
1
|
+
.gallery-container
|
2
|
+
.gallery
|
3
|
+
-# .item
|
4
|
+
-# = form_for [spina, :admin, @photo], html: {multipart: true} do |f|
|
5
|
+
-# = f.label :file, t('spina.photos.upload_image')
|
6
|
+
-# = f.file_field :file, data: {customfileinput: true}
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
.gallery-prepend-image.infinite-scroll
|
9
|
+
= render partial: 'spina/admin/photos/photo', collection: @photos
|
10
|
+
|
11
|
+
.infinite-pagination= link_to_next_page @photos, 'Next', remote: true
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// Append new data
|
2
|
+
$("<%=j render partial: 'spina/admin/photos/photo_multi_picker', collection: @photos %>").appendTo($(".infinite-scroll"));
|
3
|
+
|
4
|
+
// Update pagination link
|
5
|
+
$('.infinite-pagination').html("<%= j link_to_next_page @photos, 'Next', params: {selected_photo_ids: @selected_photos.ids}, remote: true %>").infiniteScroll()
|
6
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// Append new data
|
2
|
+
$("<%=j render partial: 'spina/admin/photos/photo_single_picker', collection: @photos %>").appendTo($(".infinite-scroll"));
|
3
|
+
|
4
|
+
// Update pagination link
|
5
|
+
$('.infinite-pagination').html("<%= j link_to_next_page @photos, 'Next', params: {selected_photo_id: @selected_photo.try(:id)}, remote: true %>").infiniteScroll()
|
6
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// Append new data
|
2
|
+
$("<%=j render partial: 'spina/admin/photos/photo_single_picker', collection: @photos %>").appendTo($(".infinite-scroll"));
|
3
|
+
|
4
|
+
// Update pagination link
|
5
|
+
$('.infinite-pagination').html("<%= j link_to_next_page @photos, 'Next', remote: true %>").infiniteScroll()
|
6
|
+
|
@@ -1,33 +1,34 @@
|
|
1
|
-
- object_id = form.object.persisted? ? form.object.object_id :
|
1
|
+
- object_id = form.object.persisted? ? form.object.object_id : "new_association_#{form.object.object_id}"
|
2
2
|
= form.hidden_field field, id: "#{object_id}_input"
|
3
3
|
%trix-toolbar.clearfix{ id: "#{object_id}_toolbar", data: { editor_id: "#{object_id}_editor" }}
|
4
|
-
.button-
|
5
|
-
|
6
|
-
.
|
7
|
-
|
8
|
-
.
|
9
|
-
|
10
|
-
.
|
11
|
-
|
12
|
-
.
|
13
|
-
|
14
|
-
.
|
4
|
+
.button-groups
|
5
|
+
.button-group.pull-left
|
6
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'Bold', data: { attribute: 'bold', key: 'b' }}
|
7
|
+
.icon.icon-bold
|
8
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'Italic', data: { attribute: 'italic', key: 'i' }}
|
9
|
+
.icon.icon-italic
|
10
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'Bullets', data: { attribute: 'bullet' }}
|
11
|
+
.icon.icon-list-ul
|
12
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'Link', data: { action: 'link', attribute: 'href', key: 'k' }}
|
13
|
+
.icon.icon-link
|
14
|
+
%button.button.button-small.js-trix-photo{ type: 'button', tabindex: -1, title: 'Photo', data: { action: 'photo', attribute: 'photo' }}
|
15
|
+
.icon.icon-picture-o
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
.button-group.pull-left
|
18
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'h1', data: { attribute: 'h1' }} H1
|
19
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'h2', data: { attribute: 'h2' }} H2
|
20
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'h3', data: { attribute: 'h3' }} H3
|
21
|
+
%button.button.button-small{ type: 'button', tabindex: -1, title: 'h4', data: { attribute: 'h4' }} H4
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
-# %button.button.button-small{ type: 'button', tabindex: -1, title: 'Numbers', data: { attribute: 'number' }}
|
24
|
+
-# .icon.icon-list-ul
|
24
25
|
|
25
26
|
.dialogs
|
26
27
|
.dialog.link_dialog{ data: { attribute: 'href', dialog: 'href'}}
|
27
28
|
.link_url_fields
|
28
|
-
%input{
|
29
|
+
%input{type: 'text', name: 'href', placeholder: 'Enter a URL…', required: true}
|
29
30
|
.button-group
|
30
|
-
%
|
31
|
-
%
|
31
|
+
%input.button{type: 'button', tabindex: -1, value: 'Link', data: { method: 'setAttribute'}}
|
32
|
+
%input.button{type: 'button', tabindex: -1, value: 'Unlink', data: { method: 'removeAttribute'}}
|
32
33
|
|
33
|
-
%trix-editor.text-input{
|
34
|
+
%trix-editor.text-input{input: "#{object_id}_input", toolbar: "#{object_id}_toolbar", id: "#{object_id}_editor"}
|
data/config/locales/en.yml
CHANGED
@@ -76,7 +76,8 @@ en:
|
|
76
76
|
|
77
77
|
photos:
|
78
78
|
delete_confirmation: "Are you sure you want to delete this <strong>image</strong>?"
|
79
|
-
insert_photos:
|
79
|
+
insert_photos: Choose images
|
80
|
+
choose_images: Choose images
|
80
81
|
insert_photo: Insert image
|
81
82
|
link: "URL of your image:"
|
82
83
|
cannot_be_created: "Image could not be processed:"
|
data/db/seeds.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
puts "Seeding #{__FILE__} from Spina::Engine"
|
2
2
|
|
3
|
-
Spina::
|
4
|
-
Spina::
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Spina::
|
10
|
-
|
11
|
-
Spina::Photo.
|
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
|
@@ -3,40 +3,42 @@ module Spina
|
|
3
3
|
source_root File.expand_path("../templates", __FILE__)
|
4
4
|
|
5
5
|
def create_initializer_file
|
6
|
-
template
|
6
|
+
template 'config/initializers/spina.rb'
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_theme_initializer
|
10
|
-
template
|
10
|
+
template 'config/initializers/themes/default.rb'
|
11
11
|
end
|
12
12
|
|
13
13
|
def copy_migrations
|
14
|
-
rake
|
14
|
+
rake 'spina:install:migrations'
|
15
15
|
end
|
16
16
|
|
17
17
|
def run_migrations
|
18
|
-
rake
|
18
|
+
rake 'db:migrate'
|
19
19
|
end
|
20
20
|
|
21
21
|
def copy_views
|
22
|
-
template
|
23
|
-
template
|
24
|
-
template
|
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'
|
25
27
|
end
|
26
28
|
|
27
29
|
def create_account
|
28
|
-
name = ask(
|
30
|
+
name = ask('What would you like to name your website?')
|
29
31
|
Account.create name: name, theme: 'default'
|
30
32
|
end
|
31
33
|
|
32
34
|
def create_user
|
33
|
-
email = ask(
|
34
|
-
password = ask(
|
35
|
+
email = ask('Please enter an email address for your first user:')
|
36
|
+
password = ask('Create a temporary password:')
|
35
37
|
User.create name: 'admin', email: email, password: password, admin: true
|
36
38
|
end
|
37
39
|
|
38
40
|
def bootstrap_spina
|
39
|
-
rake
|
41
|
+
rake 'spina:bootstrap'
|
40
42
|
end
|
41
43
|
|
42
44
|
def add_route
|
@@ -44,4 +46,4 @@ module Spina
|
|
44
46
|
end
|
45
47
|
|
46
48
|
end
|
47
|
-
end
|
49
|
+
end
|
@@ -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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%h1
|
2
|
+
= @page.title
|
3
|
+
|
4
|
+
%h5 Line
|
5
|
+
%p
|
6
|
+
= @page.content(:line)
|
7
|
+
%h5 Content
|
8
|
+
= @page.content(:text).try(:html_safe)
|
9
|
+
|
10
|
+
%h5 Photo
|
11
|
+
%p
|
12
|
+
= image_tag @page.content(:photo).try(:file_url)
|
13
|
+
|
14
|
+
%h5 Photo collection
|
15
|
+
- if @page.content(:photo_collection).try(:photos)
|
16
|
+
%ul
|
17
|
+
- @page.content(:photo_collection).photos.each do |photo|
|
18
|
+
%li
|
19
|
+
= image_tag photo.file_url
|
20
|
+
|
21
|
+
%h5 Structure
|
22
|
+
- if @page.content(:structure).try(:structure_items)
|
23
|
+
%ul
|
24
|
+
- @page.content(:structure).structure_items.each do |item|
|
25
|
+
%li
|
26
|
+
%h6 Title
|
27
|
+
%p
|
28
|
+
= item.content(:title)
|
29
|
+
%h6 Description
|
30
|
+
= item.content(:description).try(:html_safe)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= current_account.name
|
5
|
+
= stylesheet_link_tag 'default/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 'default/shared/navigation'
|
11
|
+
= yield
|
@@ -14,6 +14,8 @@ Spina::Engine.configure do
|
|
14
14
|
# other files. We use CarrierWave for storage. See
|
15
15
|
# https://github.com/denkGroot/Spina/tree/master/app/uploaders/spina
|
16
16
|
#
|
17
|
+
config.storage = :file
|
18
|
+
#
|
17
19
|
# If you want to use s3 to store uploads (recommended)
|
18
20
|
#
|
19
21
|
# config.storage = :s3
|
@@ -24,6 +26,5 @@ Spina::Engine.configure do
|
|
24
26
|
# If you want to store your files localy (not recommended for
|
25
27
|
# production, in large part because it's more difficult to ensure
|
26
28
|
# that files are backed up in sync with your database):
|
27
|
-
|
28
|
-
# config.storage = :file
|
29
|
+
|
29
30
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Spina
|
2
|
+
module DefaultTheme
|
3
|
+
include ::ActiveSupport::Configurable
|
4
|
+
|
5
|
+
config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures
|
6
|
+
|
7
|
+
self.title = 'Default 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: 'structure',
|
27
|
+
title: 'Structure',
|
28
|
+
page_partable_type: 'Spina::Structure'
|
29
|
+
}, {
|
30
|
+
name: 'color',
|
31
|
+
title: 'Color',
|
32
|
+
page_partable_type: 'Spina::Color'
|
33
|
+
}]
|
34
|
+
|
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
|
+
}
|
46
|
+
|
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
|
+
}]
|
56
|
+
|
57
|
+
self.view_templates = {
|
58
|
+
'homepage' => {
|
59
|
+
title: 'Homepage',
|
60
|
+
page_parts: ['text']
|
61
|
+
},
|
62
|
+
'show' => {
|
63
|
+
title: 'Default',
|
64
|
+
description: 'A simple page',
|
65
|
+
usage: 'Use for your content',
|
66
|
+
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
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
self.custom_pages = [{
|
77
|
+
name: 'homepage',
|
78
|
+
title: 'Homepage',
|
79
|
+
deletable: false,
|
80
|
+
view_template: 'homepage'
|
81
|
+
}, {
|
82
|
+
name: 'demo',
|
83
|
+
title: 'Demo',
|
84
|
+
deletable: true,
|
85
|
+
view_template: 'demo'
|
86
|
+
}]
|
87
|
+
|
88
|
+
self.plugins = []
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
theme = Spina::Theme.new
|
94
|
+
theme.name = 'default'
|
95
|
+
theme.config = Spina::DefaultTheme.config
|
96
|
+
Spina.register_theme(theme)
|