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.

Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spina/admin/application.js +3 -1
  3. data/app/assets/javascripts/spina/admin/spina.infinite_scroll.coffee +20 -0
  4. data/app/assets/javascripts/spina/admin/spina.scaffold.coffee +15 -0
  5. data/app/assets/javascripts/spina/admin/spina.trix.js.coffee +2 -0
  6. data/app/controllers/spina/admin/photos_controller.rb +26 -6
  7. data/app/controllers/spina/application_controller.rb +2 -4
  8. data/app/controllers/spina/inquiries_controller.rb +2 -2
  9. data/app/controllers/spina/pages_controller.rb +2 -2
  10. data/app/controllers/spina/sitemaps_controller.rb +1 -1
  11. data/app/models/spina/account.rb +4 -4
  12. data/app/models/spina/page.rb +0 -10
  13. data/app/models/spina/photo.rb +5 -0
  14. data/app/presenters/spina/pages/menu_presenter.rb +7 -6
  15. data/app/uploaders/spina/photo_uploader.rb +1 -1
  16. data/app/views/spina/admin/inquiries/inbox.html.haml +1 -1
  17. data/app/views/spina/admin/inquiries/show.html.haml +1 -1
  18. data/app/views/spina/admin/photos/_photo.html.haml +4 -6
  19. data/app/views/spina/admin/photos/_photo_collection_select.html.haml +16 -15
  20. data/app/views/spina/admin/photos/_photo_multi_picker.html.haml +3 -0
  21. data/app/views/spina/admin/photos/_photo_select.html.haml +5 -14
  22. data/app/views/spina/admin/photos/_photo_single_picker.html.haml +3 -0
  23. data/app/views/spina/admin/photos/_photo_uploaded.html.haml +4 -0
  24. data/app/views/spina/admin/photos/_wysihtml5_select.html.haml +5 -12
  25. data/app/views/spina/admin/photos/create.js.erb +3 -1
  26. data/app/views/spina/admin/photos/index.html.haml +10 -6
  27. data/app/views/spina/admin/photos/index.js.erb +5 -0
  28. data/app/views/spina/admin/photos/multi_picker_infinite_scroll.js.erb +6 -0
  29. data/app/views/spina/admin/photos/photo_collection_select.js.erb +1 -0
  30. data/app/views/spina/admin/photos/photo_select.js.erb +1 -0
  31. data/app/views/spina/admin/photos/single_picker_infinite_scroll.js.erb +6 -0
  32. data/app/views/spina/admin/photos/wysihtml5_infinite_scroll.js.erb +6 -0
  33. data/app/views/spina/admin/photos/wysihtml5_select.js.erb +1 -0
  34. data/app/views/spina/admin/shared/_rich_text_field.html.haml +24 -23
  35. data/config/locales/en.yml +2 -1
  36. data/db/seeds.rb +19 -9
  37. data/lib/generators/spina/install_generator.rb +14 -12
  38. data/lib/generators/spina/templates/app/assets/stylesheets/default/application.css.sass +66 -0
  39. data/lib/generators/spina/templates/app/views/default/pages/demo.html.haml +30 -0
  40. data/lib/generators/spina/templates/app/views/default/pages/homepage.html.haml +2 -0
  41. data/lib/generators/spina/templates/app/views/default/pages/show.html.haml +3 -0
  42. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +5 -0
  43. data/lib/generators/spina/templates/app/views/layouts/default/application.html.haml +11 -0
  44. data/lib/generators/spina/templates/{spina.rb → config/initializers/spina.rb} +3 -2
  45. data/lib/generators/spina/templates/config/initializers/themes/default.rb +96 -0
  46. data/lib/spina/engine.rb +1 -0
  47. data/lib/spina/version.rb +1 -1
  48. data/test/dummy/app/assets/stylesheets/default/application.css.sass +66 -0
  49. data/test/dummy/app/views/default/pages/demo.html.haml +41 -0
  50. data/test/dummy/app/views/default/pages/homepage.html.haml +2 -0
  51. data/test/dummy/app/views/default/pages/show.html.haml +3 -0
  52. data/test/dummy/app/views/default/shared/_navigation.html.haml +5 -0
  53. data/test/dummy/app/views/layouts/default/application.html.haml +11 -0
  54. data/test/dummy/config/application.rb +1 -1
  55. data/test/dummy/config/initializers/spina.rb +26 -0
  56. data/test/dummy/config/initializers/themes/default.rb +65 -33
  57. data/test/dummy/db/migrate/20160114085213_create_spina_tables.spina.rb +167 -0
  58. metadata +40 -13
  59. data/app/views/spina/admin/photos/enhance.js +0 -0
  60. data/lib/generators/spina/templates/application.html.erb +0 -16
  61. data/lib/generators/spina/templates/homepage.html.erb +0 -3
  62. data/lib/generators/spina/templates/show.html.erb +0 -3
  63. data/lib/generators/spina/templates/theme.rb +0 -42
  64. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  65. data/test/dummy/app/views/default/pages/homepage.html.erb +0 -3
  66. data/test/dummy/app/views/default/pages/show.html.erb +0 -3
  67. data/test/dummy/app/views/layouts/default/application.html.erb +0 -16
  68. data/test/dummy/tmp/restart.txt +0 -0
data/lib/spina/engine.rb CHANGED
@@ -13,6 +13,7 @@ require 'negative_captcha'
13
13
  require 'filters_spam'
14
14
  require 'ancestry'
15
15
  require 'breadcrumbs_on_rails'
16
+ require 'kaminari'
16
17
 
17
18
  module Spina
18
19
  class Engine < ::Rails::Engine
data/lib/spina/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spina
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.2"
3
3
  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,41 @@
1
+ %h1
2
+ = @page.title
3
+
4
+ %h5 Line
5
+ %p
6
+ = @page.content(:line)
7
+
8
+ %hr
9
+
10
+ %h5 Content
11
+ = @page.content(:text).try(:html_safe)
12
+
13
+ %hr
14
+
15
+ %h5 Photo
16
+ %p
17
+ = image_tag @page.content(:photo).try(:file_url)
18
+
19
+ %hr
20
+
21
+ %h5 Photo collection
22
+ %p
23
+ - @page.content(:photo_collection).photos.each do |photo|
24
+ %span
25
+ = image_tag photo.file_url
26
+
27
+ %hr
28
+
29
+ %h5 Structure
30
+ - if @page.content(:structure).try(:structure_items)
31
+ %ul
32
+ - @page.content(:structure).structure_items.each do |item|
33
+ %li
34
+ %h6 Title
35
+ %p
36
+ = item.content(:title)
37
+ %h6 Description
38
+ = item.content(:description).try(:html_safe)
39
+
40
+ %h5 Color
41
+ = @page.content(:color)
@@ -0,0 +1,2 @@
1
+ %h1= @page.title
2
+ = @page.content(:content).try(:html_safe)
@@ -0,0 +1,3 @@
1
+ %h1= @page.title
2
+ = @page.content(:content).try(:html_safe)
3
+
@@ -0,0 +1,5 @@
1
+ - pages = current_user.present? ? Spina::Page.active : Spina::Page.live
2
+ - menu = Spina::Pages::MenuPresenter.new(pages.in_menu.arrange(order: :position), self, @page)
3
+ - menu.list_class = 'nav'
4
+ - menu.list_item_css = 'nav-item'
5
+ = menu.to_html
@@ -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
@@ -44,7 +44,7 @@ module Dummy
44
44
  # config.active_record.schema_format = :sql
45
45
 
46
46
  # Version of your assets, change this if you want to expire all your assets
47
- config.assets.version = '1.0'
47
+ config.assets.version = '1.01'
48
48
 
49
49
  config.active_record.raise_in_transactional_callbacks = true
50
50
  end
@@ -1,4 +1,30 @@
1
1
  Spina::Engine.configure do
2
2
  config.NEGATIVE_CAPTCHA_SECRET = '445e0c9c0cee31f783754bc174661052d1236850da8f5f5ba5e11cbfa56cbaa8bce9260df75feaa56da91949ee4204fefac41c35b3e4f5e0d3e395b00c87781a'
3
+
4
+ # Important Note
5
+ # ==============
6
+ #
7
+ # You MUST restart your server before changes to this file
8
+ # will take effect.
9
+ #
10
+ # Storage Options
11
+ # ===============
12
+ #
13
+ # Please specify how you want to store photos, your logo, and
14
+ # other files. We use CarrierWave for storage. See
15
+ # https://github.com/denkGroot/Spina/tree/master/app/uploaders/spina
16
+ #
3
17
  config.storage = :file
18
+ #
19
+ # If you want to use s3 to store uploads (recommended)
20
+ #
21
+ # config.storage = :s3
22
+ # config.aws_region = "eu-west-1"
23
+ # config.aws_access_key_id = "abc123"
24
+ # config.aws_secret_key = "abc123"
25
+ # config.s3_bucket = "mybucket"
26
+ # If you want to store your files localy (not recommended for
27
+ # production, in large part because it's more difficult to ensure
28
+ # that files are backed up in sync with your database):
29
+
4
30
  end
@@ -4,61 +4,93 @@ module Spina
4
4
 
5
5
  config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures
6
6
 
7
- self.title = "Default theme"
7
+ self.title = 'Default theme'
8
8
 
9
- self.page_parts = [{
10
- name: 'content',
11
- title: 'Content',
12
- page_partable_type: "Spina::Text"
9
+ self.page_parts = [{
10
+ name: 'line',
11
+ title: 'Line',
12
+ page_partable_type: 'Spina::Line'
13
13
  }, {
14
- name: "structure",
15
- title: "Structuur",
16
- page_partable_type: "Spina::Structure"
14
+ name: 'text',
15
+ title: 'Text',
16
+ page_partable_type: 'Spina::Text'
17
17
  }, {
18
- name: 'photo',
19
- title: "Foto",
20
- page_partable_type: "Spina::Photo"
18
+ name: 'photo',
19
+ title: 'Photo',
20
+ page_partable_type: 'Spina::Photo'
21
21
  }, {
22
- name: 'photo_collection',
23
- title: "Foto collection",
24
- page_partable_type: "Spina::PhotoCollection"
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'
25
33
  }]
26
34
 
27
35
  self.structures = {
28
36
  'structure' => [{
29
- name: 'name',
30
- title: 'Naam',
31
- structure_partable_type: "Spina::Line"
37
+ name: 'title',
38
+ title: 'Title',
39
+ structure_partable_type: 'Spina::Line'
32
40
  }, {
33
- name: 'description',
34
- title: "Description",
35
- structure_partable_type: "Spina::Text"
41
+ name: 'description',
42
+ title: 'Description',
43
+ structure_partable_type: 'Spina::Text'
36
44
  }]
37
45
  }
38
- self.layout_parts = []
39
- self.custom_pages = []
40
- self.plugins = []
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
+ }]
41
56
 
42
57
  self.view_templates = {
43
58
  'homepage' => {
44
- title: 'Homepage',
45
- page_parts: ['content']
59
+ title: 'Homepage',
60
+ page_parts: ['text']
46
61
  },
47
62
  'show' => {
48
- title: 'Default',
49
- description: 'A simple page',
50
- usage: 'Use for your content',
51
- page_parts: ['content', 'structure', 'photo', 'photo_collection']
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']
52
73
  }
53
74
  }
54
75
 
55
- self.custom_pages = [
56
- { name: 'homepage', title: 'Homepage', deletable: false, view_template: 'homepage' }
57
- ]
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
+
58
90
  end
59
91
  end
60
92
 
61
93
  theme = Spina::Theme.new
62
- theme.name = "default"
94
+ theme.name = 'default'
63
95
  theme.config = Spina::DefaultTheme.config
64
96
  Spina.register_theme(theme)
@@ -0,0 +1,167 @@
1
+ # This migration comes from spina (originally 20150507135428)
2
+ class CreateSpinaTables < ActiveRecord::Migration
3
+ def change
4
+ create_table "spina_accounts", force: :cascade do |t|
5
+ t.string "name"
6
+ t.string "address"
7
+ t.string "postal_code"
8
+ t.string "city"
9
+ t.string "phone"
10
+ t.string "email"
11
+ t.text "preferences"
12
+ t.string "logo"
13
+ t.datetime "created_at", null: false
14
+ t.datetime "updated_at", null: false
15
+ t.string "kvk_identifier"
16
+ t.string "vat_identifier"
17
+ t.boolean "robots_allowed", default: false
18
+ end
19
+
20
+ create_table "spina_attachment_collections", force: :cascade do |t|
21
+ t.datetime "created_at", null: false
22
+ t.datetime "updated_at", null: false
23
+ end
24
+
25
+ create_table "spina_attachment_collections_attachments", force: :cascade do |t|
26
+ t.integer "attachment_collection_id"
27
+ t.integer "attachment_id"
28
+ end
29
+
30
+ create_table "spina_attachments", force: :cascade do |t|
31
+ t.string "file"
32
+ t.datetime "created_at", null: false
33
+ t.datetime "updated_at", null: false
34
+ end
35
+
36
+ create_table "spina_colors", force: :cascade do |t|
37
+ t.text "content"
38
+ t.datetime "created_at"
39
+ t.datetime "updated_at"
40
+ end
41
+
42
+ create_table "spina_inquiries", force: :cascade do |t|
43
+ t.string "name"
44
+ t.string "email"
45
+ t.string "phone"
46
+ t.text "message"
47
+ t.boolean "archived", default: false
48
+ t.datetime "created_at", null: false
49
+ t.datetime "updated_at", null: false
50
+ t.boolean "spam"
51
+ end
52
+
53
+ create_table "spina_layout_parts", force: :cascade do |t|
54
+ t.string "title"
55
+ t.string "name"
56
+ t.integer "layout_partable_id"
57
+ t.string "layout_partable_type"
58
+ t.datetime "created_at"
59
+ t.datetime "updated_at"
60
+ t.integer "account_id"
61
+ end
62
+
63
+ create_table "spina_lines", force: :cascade do |t|
64
+ t.string "content"
65
+ t.datetime "created_at"
66
+ t.datetime "updated_at"
67
+ end
68
+
69
+ create_table "spina_page_parts", force: :cascade do |t|
70
+ t.string "title"
71
+ t.string "name"
72
+ t.datetime "created_at", null: false
73
+ t.datetime "updated_at", null: false
74
+ t.integer "page_id"
75
+ t.integer "page_partable_id"
76
+ t.string "page_partable_type"
77
+ end
78
+
79
+ create_table "spina_pages", force: :cascade do |t|
80
+ t.string "title"
81
+ t.string "menu_title"
82
+ t.string "description"
83
+ t.boolean "show_in_menu", default: true
84
+ t.string "slug"
85
+ t.boolean "deletable", default: true
86
+ t.datetime "created_at", null: false
87
+ t.datetime "updated_at", null: false
88
+ t.string "name"
89
+ t.string "seo_title"
90
+ t.boolean "skip_to_first_child", default: false
91
+ t.string "view_template"
92
+ t.string "layout_template"
93
+ t.boolean "draft", default: false
94
+ t.string "link_url"
95
+ t.string "ancestry"
96
+ t.integer "position"
97
+ t.string "materialized_path"
98
+ t.boolean "active", default: true
99
+ end
100
+
101
+ create_table "spina_photo_collections", force: :cascade do |t|
102
+ t.datetime "created_at", null: false
103
+ t.datetime "updated_at", null: false
104
+ end
105
+
106
+ create_table "spina_photo_collections_photos", force: :cascade do |t|
107
+ t.integer "photo_collection_id"
108
+ t.integer "photo_id"
109
+ t.integer "position"
110
+ end
111
+
112
+ create_table "spina_photos", force: :cascade do |t|
113
+ t.string "file"
114
+ t.datetime "created_at", null: false
115
+ t.datetime "updated_at", null: false
116
+ end
117
+
118
+ create_table "spina_structure_items", force: :cascade do |t|
119
+ t.integer "structure_id"
120
+ t.integer "position"
121
+ t.datetime "created_at"
122
+ t.datetime "updated_at"
123
+ end
124
+
125
+ add_index "spina_structure_items", ["structure_id"], name: "index_spina_structure_items_on_structure_id", using: :btree
126
+
127
+ create_table "spina_structure_parts", force: :cascade do |t|
128
+ t.integer "structure_item_id"
129
+ t.integer "structure_partable_id"
130
+ t.string "structure_partable_type"
131
+ t.string "name"
132
+ t.string "title"
133
+ t.datetime "created_at"
134
+ t.datetime "updated_at"
135
+ end
136
+
137
+ add_index "spina_structure_parts", ["structure_item_id"], name: "index_spina_structure_parts_on_structure_item_id", using: :btree
138
+ add_index "spina_structure_parts", ["structure_partable_id"], name: "index_spina_structure_parts_on_structure_partable_id", using: :btree
139
+
140
+ create_table "spina_structures", force: :cascade do |t|
141
+ t.datetime "created_at"
142
+ t.datetime "updated_at"
143
+ end
144
+
145
+ create_table "spina_texts", force: :cascade do |t|
146
+ t.text "content"
147
+ t.datetime "created_at"
148
+ t.datetime "updated_at"
149
+ end
150
+
151
+ create_table "spina_users", force: :cascade do |t|
152
+ t.string "name"
153
+ t.string "email"
154
+ t.string "password_digest"
155
+ t.boolean "admin", default: false
156
+ t.datetime "created_at", null: false
157
+ t.datetime "updated_at", null: false
158
+ t.datetime "last_logged_in"
159
+ end
160
+
161
+ create_table "spina_rewrite_rules", force: :cascade do |t|
162
+ t.string :old_path
163
+ t.string :new_path
164
+ t.timestamps
165
+ end
166
+ end
167
+ end