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.

Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -52
  3. data/app/assets/javascripts/spina/admin/application.js +0 -1
  4. data/app/controllers/spina/admin/accounts_controller.rb +11 -16
  5. data/app/controllers/spina/admin/admin_controller.rb +12 -23
  6. data/app/controllers/spina/admin/attachments_controller.rb +1 -1
  7. data/app/controllers/spina/admin/pages_controller.rb +14 -7
  8. data/app/controllers/spina/admin/photos_controller.rb +4 -2
  9. data/app/controllers/spina/admin/sessions_controller.rb +3 -3
  10. data/app/controllers/spina/admin/users_controller.rb +3 -3
  11. data/app/controllers/spina/application_controller.rb +7 -3
  12. data/app/controllers/spina/pages_controller.rb +13 -2
  13. data/app/controllers/spina/sitemaps_controller.rb +1 -0
  14. data/app/helpers/spina/admin/pages_helper.rb +12 -2
  15. data/app/helpers/spina/application_helper.rb +0 -9
  16. data/app/models/concerns/spina/part.rb +31 -0
  17. data/app/models/{spina → concerns/spina}/partable.rb +0 -0
  18. data/app/models/spina/ability.rb +0 -1
  19. data/app/models/spina/account.rb +6 -6
  20. data/app/models/spina/attachment.rb +1 -1
  21. data/app/models/spina/layout_part.rb +4 -27
  22. data/app/models/spina/line.rb +2 -0
  23. data/app/models/spina/page.rb +24 -5
  24. data/app/models/spina/page_part.rb +6 -30
  25. data/app/models/spina/structure_part.rb +7 -19
  26. data/app/models/spina/text.rb +2 -0
  27. data/app/views/layouts/spina/admin/application.html.haml +12 -14
  28. data/app/views/layouts/spina/admin/media_library.html.haml +4 -4
  29. data/app/views/layouts/spina/admin/settings.html.haml +7 -8
  30. data/app/views/layouts/spina/admin/website.html.haml +9 -16
  31. data/app/views/spina/admin/accounts/style.html.haml +10 -10
  32. data/app/views/spina/admin/attachments/_attachment.html.haml +1 -2
  33. data/app/views/spina/admin/{pages/_attachment_fields.html.haml → attachments/_fields.html.haml} +0 -0
  34. data/app/views/spina/admin/attachments/index.html.haml +2 -7
  35. data/app/views/spina/admin/layout_partables/colors/_form.html.haml +4 -0
  36. data/app/views/spina/admin/layout_partables/lines/_form.html.haml +2 -0
  37. data/app/views/spina/admin/page_partables/attachment_collections/_form.html.haml +15 -0
  38. data/app/views/spina/admin/page_partables/attachments/_form.html.haml +14 -0
  39. data/app/views/spina/admin/page_partables/colors/_form.html.haml +7 -0
  40. data/app/views/spina/admin/page_partables/lines/_form.html.haml +5 -0
  41. data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +17 -0
  42. data/app/views/spina/admin/page_partables/photos/_form.html.haml +18 -0
  43. data/app/views/spina/admin/page_partables/structures/_form.html.haml +22 -0
  44. data/app/views/spina/admin/page_partables/texts/_form.html.haml +5 -0
  45. data/app/views/spina/admin/pages/_form.html.haml +11 -8
  46. data/app/views/spina/admin/pages/_form_advanced.html.haml +3 -3
  47. data/app/views/spina/admin/pages/_form_page_content.html.haml +8 -3
  48. data/app/views/spina/admin/pages/_form_page_seo.html.haml +1 -1
  49. data/app/views/spina/admin/pages/edit.html.haml +13 -1
  50. data/app/views/spina/admin/photos/_photo.html.haml +1 -3
  51. data/app/views/spina/admin/photos/create.js.erb +1 -2
  52. data/app/views/spina/admin/photos/create_and_select.js.erb +7 -0
  53. data/app/views/spina/admin/photos/index.html.haml +7 -6
  54. data/app/views/spina/admin/shared/_primary_navigation.html.haml +19 -0
  55. data/app/views/spina/admin/shared/_rich_text_field.html.haml +2 -2
  56. data/app/views/spina/admin/structure_items/_fields.html.haml +16 -0
  57. data/app/views/spina/admin/structure_partables/lines/_form.html.haml +2 -0
  58. data/app/views/spina/admin/structure_partables/photos/_form.html.haml +11 -0
  59. data/app/views/spina/admin/structure_partables/texts/_form.html.haml +2 -0
  60. data/app/views/spina/sitemaps/show.xml.builder +12 -8
  61. data/{lib/spina/carrierwave.rb → config/initializers/spina.rb} +0 -0
  62. data/config/locales/de.yml +0 -26
  63. data/config/locales/en.yml +4 -26
  64. data/config/locales/es.yml +0 -26
  65. data/config/locales/fr.yml +4 -27
  66. data/config/locales/it.yml +0 -26
  67. data/config/locales/nl.yml +2 -28
  68. data/config/locales/pt-BR.yml +0 -26
  69. data/config/locales/ru.yml +0 -26
  70. data/config/locales/tr.yml +2 -28
  71. data/config/locales/zh-CN.yml +0 -3
  72. data/config/routes.rb +3 -19
  73. data/db/migrate/{20150507135428_create_spina_tables.rb → 1_create_spina_tables.rb} +0 -11
  74. data/db/migrate/2_create_spina_translation_tables.rb +13 -0
  75. data/lib/generators/spina/install_generator.rb +23 -9
  76. data/lib/generators/spina/templates/app/assets/stylesheets/demo/application.css.sass +3 -0
  77. data/lib/generators/spina/templates/app/views/demo/shared/_languages.html.haml +2 -0
  78. data/lib/generators/spina/templates/app/views/layouts/demo/application.html.haml +1 -0
  79. data/lib/generators/spina/templates/config/initializers/carrierwave.rb +17 -0
  80. data/lib/generators/spina/templates/config/initializers/spina.rb +2 -22
  81. data/lib/generators/spina/templates/config/initializers/themes/default.rb +29 -45
  82. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +82 -92
  83. data/lib/spina.rb +24 -30
  84. data/lib/spina/engine.rb +2 -22
  85. data/lib/spina/plugin.rb +21 -3
  86. data/lib/spina/railtie.rb +9 -0
  87. data/lib/spina/theme.rb +34 -6
  88. data/lib/spina/version.rb +1 -1
  89. metadata +51 -124
  90. data/app/assets/javascripts/spina/admin/aviary.js.coffee +0 -25
  91. data/app/controllers/spina/admin/inquiries_controller.rb +0 -63
  92. data/app/controllers/spina/inquiries_controller.rb +0 -30
  93. data/app/mailers/spina/inquiry_mailer.rb +0 -19
  94. data/app/models/spina/inquiry.rb +0 -41
  95. data/app/views/layouts/spina/admin/messages.html.haml +0 -24
  96. data/app/views/spina/admin/accounts/aviary.html.haml +0 -26
  97. data/app/views/spina/admin/inquiries/inbox.html.haml +0 -30
  98. data/app/views/spina/admin/inquiries/index.html.haml +0 -36
  99. data/app/views/spina/admin/inquiries/show.html.haml +0 -23
  100. data/app/views/spina/admin/inquiries/spam.html.haml +0 -36
  101. data/app/views/spina/admin/layout_partables/_color_form.html.haml +0 -4
  102. data/app/views/spina/admin/layout_partables/_line_form.html.haml +0 -2
  103. data/app/views/spina/admin/page_partables/_attachment_collection_form.html.haml +0 -20
  104. data/app/views/spina/admin/page_partables/_attachment_form.html.haml +0 -19
  105. data/app/views/spina/admin/page_partables/_color_form.html.haml +0 -12
  106. data/app/views/spina/admin/page_partables/_line_form.html.haml +0 -10
  107. data/app/views/spina/admin/page_partables/_photo_collection_form.html.haml +0 -22
  108. data/app/views/spina/admin/page_partables/_photo_form.html.haml +0 -23
  109. data/app/views/spina/admin/page_partables/_structure_form.html.haml +0 -28
  110. data/app/views/spina/admin/page_partables/_text_form.html.haml +0 -10
  111. data/app/views/spina/admin/pages/_structure_item_fields.html.haml +0 -15
  112. data/app/views/spina/admin/shared/_navigation.html.haml +0 -21
  113. data/app/views/spina/admin/structure_partables/_line_form.html.haml +0 -2
  114. data/app/views/spina/admin/structure_partables/_photo_form.html.haml +0 -11
  115. data/app/views/spina/admin/structure_partables/_text_form.html.haml +0 -2
  116. data/app/views/spina/inquiries/create.html.haml +0 -2
  117. data/app/views/spina/inquiries/index.html.haml +0 -19
  118. data/app/views/spina/inquiry_mailer/inquiry.html.haml +0 -15
  119. data/test/dummy/README.rdoc +0 -261
  120. data/test/dummy/Rakefile +0 -7
  121. data/test/dummy/app/assets/javascripts/application.js +0 -15
  122. data/test/dummy/app/assets/stylesheets/default/application.css.sass +0 -0
  123. data/test/dummy/app/assets/stylesheets/demo/application.css.sass +0 -66
  124. data/test/dummy/app/assets/stylesheets/fonts.css.sass +0 -3
  125. data/test/dummy/app/controllers/application_controller.rb +0 -3
  126. data/test/dummy/app/helpers/application_helper.rb +0 -2
  127. data/test/dummy/app/views/default/pages/homepage.html.haml +0 -2
  128. data/test/dummy/app/views/default/pages/show.html.haml +0 -3
  129. data/test/dummy/app/views/default/shared/_navigation.html.haml +0 -5
  130. data/test/dummy/app/views/demo/pages/demo.html.haml +0 -30
  131. data/test/dummy/app/views/demo/pages/homepage.html.haml +0 -2
  132. data/test/dummy/app/views/demo/pages/show.html.haml +0 -3
  133. data/test/dummy/app/views/demo/shared/_navigation.html.haml +0 -5
  134. data/test/dummy/app/views/layouts/default/application.html.haml +0 -11
  135. data/test/dummy/app/views/layouts/demo/application.html.haml +0 -11
  136. data/test/dummy/config.ru +0 -4
  137. data/test/dummy/config/application.rb +0 -52
  138. data/test/dummy/config/application.yml +0 -2
  139. data/test/dummy/config/boot.rb +0 -10
  140. data/test/dummy/config/database.yml +0 -24
  141. data/test/dummy/config/environment.rb +0 -5
  142. data/test/dummy/config/environments/development.rb +0 -41
  143. data/test/dummy/config/environments/production.rb +0 -70
  144. data/test/dummy/config/environments/test.rb +0 -38
  145. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  146. data/test/dummy/config/initializers/inflections.rb +0 -15
  147. data/test/dummy/config/initializers/mime_types.rb +0 -5
  148. data/test/dummy/config/initializers/session_store.rb +0 -8
  149. data/test/dummy/config/initializers/spina.rb +0 -33
  150. data/test/dummy/config/initializers/themes/default.rb +0 -47
  151. data/test/dummy/config/initializers/themes/demo.rb +0 -103
  152. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  153. data/test/dummy/config/locales/en.yml +0 -5
  154. data/test/dummy/config/locales/nl.yml +0 -214
  155. data/test/dummy/config/routes.rb +0 -4
  156. data/test/dummy/config/secrets.yml +0 -7
  157. data/test/dummy/db/migrate/20160114085213_create_spina_tables.spina.rb +0 -167
  158. data/test/dummy/db/schema.rb +0 -183
  159. data/test/dummy/db/seeds.rb +0 -1
  160. data/test/dummy/public/404.html +0 -26
  161. data/test/dummy/public/422.html +0 -26
  162. data/test/dummy/public/500.html +0 -25
  163. data/test/dummy/public/favicon.ico +0 -0
  164. data/test/dummy/script/rails +0 -6
  165. data/test/dummy/tmp/restart.txt +0 -0
  166. data/test/fixtures/spina/accounts.yml +0 -3
  167. data/test/fixtures/spina/pages.yml +0 -10
  168. data/test/fixtures/spina/users.yml +0 -5
  169. data/test/functional/spina/admin/admin_controller.rb +0 -36
  170. data/test/functional/spina/admin/sessions_controller_test.rb +0 -32
  171. data/test/functional/spina/pages_controller_test.rb +0 -16
  172. data/test/integration/navigation_test.rb +0 -8
  173. data/test/integration/spina/admin/login_test.rb +0 -31
  174. data/test/integration/spina/admin/logout_test.rb +0 -17
  175. data/test/integration/spina/admin/pages_test.rb +0 -34
  176. data/test/integration/spina/pages_test.rb +0 -19
  177. data/test/models/spina/line_test.rb +0 -9
  178. data/test/models/spina/text_test.rb +0 -9
  179. data/test/test_helper.rb +0 -23
  180. data/test/unit/helpers/spina/accounts_helper_test.rb +0 -6
  181. data/test/unit/helpers/spina/inquiries_helper_test.rb +0 -6
  182. data/test/unit/helpers/spina/page_parts_helper_test.rb +0 -6
  183. data/test/unit/helpers/spina/pages_helper_test.rb +0 -6
  184. data/test/unit/helpers/spina/photos_helper_test.rb +0 -6
  185. data/test/unit/helpers/spina/sessions_helper_test.rb +0 -6
  186. data/test/unit/helpers/spina/users_helper_test.rb +0 -6
  187. data/test/unit/spina/account_test.rb +0 -9
  188. data/test/unit/spina/file_collection_file_test.rb +0 -9
  189. data/test/unit/spina/gallery_test.rb +0 -9
  190. data/test/unit/spina/inquiry_test.rb +0 -9
  191. data/test/unit/spina/page_include_test.rb +0 -9
  192. data/test/unit/spina/page_part_test.rb +0 -9
  193. data/test/unit/spina/page_test.rb +0 -9
  194. data/test/unit/spina/photo_collection_file_test.rb +0 -9
  195. data/test/unit/spina/photo_collection_test.rb +0 -9
  196. data/test/unit/spina/photo_test.rb +0 -9
  197. data/test/unit/spina/user_test.rb +0 -9
@@ -33,20 +33,6 @@ ru:
33
33
  documents: Документы
34
34
  photos: Изображения
35
35
 
36
- inquiries:
37
- title: Сообщения
38
- all: Все сообщения
39
- all_description: Все сообщения
40
- delete_confirmation: "Вы уверены, что хотите удалить <strong>%{subject}</strong> сообщение?"
41
- empty: У вас нет входящих сообщений
42
- empty_inbox: У вас нет входящих сообщений
43
- empty_spam: "У вас нет сообщений, помеченных как спам"
44
- inbox: Входящие
45
- inbox_description: Входящие сообщения
46
- mark_as_read: Пометить как прочитанное
47
- no_spam: Не спам
48
- spam: Спам
49
-
50
36
  pages:
51
37
  new: Новая страница
52
38
  create_page: "Создать %{template}"
@@ -92,9 +78,6 @@ ru:
92
78
  account: Общее
93
79
  account_description: Персональные параметры
94
80
  account_save: Сохранить параметры
95
- aviary: Вольер
96
- aviary_description: Настройки вольера
97
- aviary_save: Сохранить параметры
98
81
  style: Дизайн
99
82
  style_description: Выберите тему
100
83
  style_save: Сохранить параметры стиля
@@ -127,9 +110,6 @@ ru:
127
110
  spina/attachment:
128
111
  one: Документ
129
112
  other: Документы
130
- spina/inquiry:
131
- one: Сообщение
132
- other: Сообщения
133
113
 
134
114
  attributes:
135
115
  spina/account:
@@ -157,12 +137,6 @@ ru:
157
137
  name: Название файла
158
138
  size: Размер
159
139
 
160
- spina/inquiries:
161
- email: Почта
162
- name: от
163
- message: Сообщение
164
- phone: Телефон
165
-
166
140
  spina/page:
167
141
  title: Заголовок
168
142
  title_placeholder: Заголовок страницы
@@ -33,20 +33,6 @@ tr:
33
33
  documents: Belgeler
34
34
  photos: Resimler
35
35
 
36
- inquiries:
37
- title: Mesajlar
38
- all: Tüm mesajlar
39
- all_description: Tüm mesajlarınız
40
- delete_confirmation: "<strong>%{subject}</strong> başlıklı mesajı silmek istediğinizden emin misiniz?"
41
- empty: Henüz hiç mesajınız bulunmuyor
42
- empty_inbox: Gelen kutusu boş
43
- empty_spam: Spam olarak işaretli mesaj bulunmuyor
44
- inbox: Gelen kutusu
45
- inbox_description: Yeni gelen mesajlarınız
46
- mark_as_read: Okundu olarak işaretle
47
- no_spam: Spam değil
48
- spam: Spam
49
-
50
36
  pages:
51
37
  new: Yeni sayfa
52
38
  create_page: "Yeni %{template}"
@@ -92,9 +78,6 @@ tr:
92
78
  account: Genel
93
79
  account_description: Kişisel seçenekleriniz
94
80
  account_save: Seçenekleri kaydet
95
- aviary: Aviary
96
- aviary_description: Aviary seçenekleriniz
97
- aviary_save: Seçenekleri kaydet
98
81
  style: Görünüm
99
82
  style_description: Size uyan bir tema seçin
100
83
  style_save: Görünümü kaydet
@@ -115,10 +98,10 @@ tr:
115
98
 
116
99
  activerecord:
117
100
  models:
118
- spina/page:
101
+ spina/page:
119
102
  one: Sayfa
120
103
  other: Sayfalar
121
- spina/user:
104
+ spina/user:
122
105
  one: Kullanıcı
123
106
  other: Kullanıcılar
124
107
  spina/photo:
@@ -127,9 +110,6 @@ tr:
127
110
  spina/attachment:
128
111
  one: Belge
129
112
  other: Belgeler
130
- spina/inquiry:
131
- one: Mesaj
132
- other: Mesajlar
133
113
 
134
114
  attributes:
135
115
  spina/account:
@@ -157,12 +137,6 @@ tr:
157
137
  name: Dosya adı
158
138
  size: Boyut
159
139
 
160
- spina/inquiries:
161
- email: Eposta
162
- name: Gönderen
163
- message: Mesaj
164
- phone: Telefon
165
-
166
140
  spina/page:
167
141
  title: Başlık
168
142
  title_placeholder: Sayfa başlığı
@@ -92,9 +92,6 @@ zh-CN:
92
92
  account: 通用
93
93
  account_description: 个人设置
94
94
  account_save: 保存设置
95
- aviary: Aviary
96
- aviary_description: 设置 aviary
97
- aviary_save: 保存设置
98
95
  style: 样式
99
96
  style_description: 选择主题
100
97
  style_save: 保存样式
data/config/routes.rb CHANGED
@@ -9,7 +9,6 @@ Spina::Engine.routes.draw do
9
9
  get :style
10
10
  get :analytics
11
11
  get :social
12
- get :aviary
13
12
  end
14
13
  end
15
14
 
@@ -57,23 +56,8 @@ Spina::Engine.routes.draw do
57
56
  get :link
58
57
  end
59
58
  end
60
-
61
- resources :inquiries, only: [:index, :show, :destroy] do
62
- collection do
63
- get :inbox
64
- get :spam
65
- end
66
- member do
67
- get :inbox_show
68
- patch :mark_as_read
69
- patch :unmark_spam
70
- end
71
- end
72
59
  end
73
60
 
74
- # Inquiries
75
- resources :inquiries
76
-
77
61
  # Sitemap
78
62
  resource :sitemap
79
63
 
@@ -83,11 +67,11 @@ Spina::Engine.routes.draw do
83
67
  # Frontend
84
68
  root to: "pages#homepage"
85
69
 
86
- # get ':materialized_pathroot/:subpage/:id' => "pages#show", as: "third_level_page"
87
- # get ':root/:id' => "pages#show", as: "subpage"
70
+ # Pages
71
+ get '/:locale/*id' => 'pages#show', constraints: {locale: /#{Spina.config.locales.join('|')}/ }
72
+ get '/:locale/' => 'pages#homepage', constraints: {locale: /#{Spina.config.locales.join('|')}/ }
88
73
  get '/*id' => 'pages#show', as: "page", controller: 'pages', constraints: lambda { |request|
89
74
  !(Rails.env.development? && request.env['PATH_INFO'].starts_with?('/rails/'))
90
75
  }
91
76
 
92
77
  end
93
-
@@ -38,17 +38,6 @@ class CreateSpinaTables < ActiveRecord::Migration
38
38
  t.datetime "updated_at"
39
39
  end
40
40
 
41
- create_table "spina_inquiries", force: :cascade do |t|
42
- t.string "name"
43
- t.string "email"
44
- t.string "phone"
45
- t.text "message"
46
- t.boolean "archived", default: false
47
- t.datetime "created_at", null: false
48
- t.datetime "updated_at", null: false
49
- t.boolean "spam"
50
- end
51
-
52
41
  create_table "spina_layout_parts", force: :cascade do |t|
53
42
  t.string "title"
54
43
  t.string "name"
@@ -0,0 +1,13 @@
1
+ class CreateSpinaTranslationTables < ActiveRecord::Migration
2
+ def up
3
+ Spina::Page.create_translation_table! title: :string, menu_title: :string, description: :string, seo_title: :string, materialized_path: :string
4
+ Spina::Text.create_translation_table! content: :text
5
+ Spina::Line.create_translation_table! content: :string
6
+ end
7
+
8
+ def down
9
+ Spina::Page.drop_translation_table!
10
+ Spina::Text.drop_translation_table!
11
+ Spina::Line.drop_translation_table!
12
+ end
13
+ end
@@ -4,15 +4,23 @@ module Spina
4
4
  source_root File.expand_path("../templates", __FILE__)
5
5
 
6
6
  def create_initializer_file
7
+ return if Rails.env.production?
7
8
  template 'config/initializers/spina.rb'
8
9
  end
9
10
 
11
+ def create_carrierwave_initializer_file
12
+ return if Rails.env.production?
13
+ template 'config/initializers/carrierwave.rb'
14
+ end
15
+
10
16
  def add_route
17
+ return if Rails.env.production?
11
18
  return if Rails.application.routes.routes.detect { |route| route.app.app == Spina::Engine }
12
19
  route "mount Spina::Engine => '/'"
13
20
  end
14
21
 
15
22
  def copy_migrations
23
+ return if Rails.env.production?
16
24
  rake 'spina:install:migrations'
17
25
  end
18
26
 
@@ -31,19 +39,22 @@ module Spina
31
39
  return if account.theme.present? && !no?("Theme '#{account.theme} is set. Skip? [Yn]")
32
40
 
33
41
  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']
42
+ theme = account.theme || themes.first
43
+ theme = ask("What theme do you want to use? (#{themes.join('/')}) [#{theme}]").presence || theme
44
+ end until theme.in? themes
37
45
 
38
46
  account.update_attribute(:theme, theme)
47
+ end
39
48
 
49
+ def copy_template_files
50
+ return if Rails.env.production?
51
+ theme = Account.first.theme
40
52
  template "config/initializers/themes/#{theme}.rb"
41
53
  directory "app/assets/stylesheets/#{theme}"
42
54
  directory "app/views/#{theme}"
43
55
  directory "app/views/layouts/#{theme}"
44
56
  end
45
57
 
46
-
47
58
  def create_user
48
59
  return if User.exists? && !no?('A user already exists. Skip? [Yn]')
49
60
  email = ask('Please enter an email address for your first user:')
@@ -59,10 +70,10 @@ module Spina
59
70
  theme_name = Account.first.theme
60
71
  if theme_name == 'demo' && !no?('Seed example content? [Yn]')
61
72
 
62
- current_theme = ::Spina.themes.find { |theme| theme.name == theme_name }
73
+ current_theme = ::Spina::Theme.find_by_name(theme_name)
63
74
  if (page = Spina::Page.find_by(name: 'demo'))
64
75
  page.page_parts.clear
65
- parts = current_theme.config.page_parts.map { |page_part| page.page_part(page_part) }
76
+ parts = current_theme.page_parts.map { |page_part| page.page_part(page_part) }
66
77
  parts.each do |part|
67
78
  case part.partable_type
68
79
  when 'Spina::Line' then part.partable.content = 'This is a single line'
@@ -70,9 +81,6 @@ module Spina
70
81
  when 'Spina::Photo' then part.partable.remote_file_url = 'https://unsplash.it/300/200?random'
71
82
  when 'Spina::PhotoCollection'
72
83
  5.times { part.partable.photos.build(remote_file_url: 'https://unsplash.it/300/200?random') }
73
- # when 'Spina::Structure'
74
- # part.partable.structure_items.build({ name: 'title', title: 'Title', structure_partable_type: 'Spina::Line' })
75
- # part.partable.structure_items.build({ name: 'description', title: 'Description', structure_partable_type: 'Spina::Text' })
76
84
  when 'Spina::Color' then part.partable.content = '#6865b4'
77
85
  end
78
86
  end
@@ -81,5 +89,11 @@ module Spina
81
89
  end
82
90
  end
83
91
 
92
+ private
93
+
94
+ def themes
95
+ Rails.env.production? ? Spina::Theme.all.map(&:name) : ['default', 'demo']
96
+ end
97
+
84
98
  end
85
99
  end
@@ -64,3 +64,6 @@ a
64
64
 
65
65
  .nav-item.active > a
66
66
  text-decoration: underline
67
+
68
+ #languages
69
+ float: right
@@ -0,0 +1,2 @@
1
+ - if Spina.config.locales.size > 1
2
+ #languages= Spina.config.locales.map{|l| link_to_unless(l == I18n.locale, l.upcase, root_url(params: {locale: l}))}.join(' / ').html_safe
@@ -7,5 +7,6 @@
7
7
  = csrf_meta_tags
8
8
  %body
9
9
  .container
10
+ = render 'demo/shared/languages'
10
11
  = render 'demo/shared/navigation'
11
12
  = yield
@@ -0,0 +1,17 @@
1
+ CarrierWave.configure do |config|
2
+ config.storage = :file
3
+
4
+ # Use S3 if you want
5
+ # config.storage = :fog
6
+ # config.fog_credentials = {
7
+ # provider: 'AWS',
8
+ # region: '',
9
+ # aws_access_key_id: '',
10
+ # aws_secret_access_key: ''
11
+ # }
12
+ # config.fog_directory = ''
13
+ # config.fog_public = true
14
+ # config.fog_attributes = { 'Cache-Control' => 'max-age=315576000' }
15
+
16
+ config.enable_processing = !Rails.env.test?
17
+ end
@@ -1,5 +1,6 @@
1
1
  Spina.configure do |config|
2
- config.NEGATIVE_CAPTCHA_SECRET = '<%= Spina.config.try(:NEGATIVE_CAPTCHA_SECRET) || SecureRandom.hex(64) %>'
2
+ # Set locales
3
+ config.locales = [:en]
3
4
 
4
5
  # Important Note
5
6
  # ==============
@@ -15,25 +16,4 @@ Spina.configure do |config|
15
16
 
16
17
  # Note that you might need to remove cached asset after changing this value
17
18
  # config.max_page_depth = 5
18
-
19
- # Storage Options
20
- # ===============
21
-
22
- # Please specify how you want to store photos, your logo, and
23
- # other files. We use CarrierWave for storage. See
24
- # https://github.com/denkGroot/Spina/tree/master/app/uploaders/spina
25
-
26
- # config.storage = :file
27
-
28
- # If you want to use s3 to store uploads (recommended)
29
-
30
- # config.storage = :s3
31
- # config.aws_region = "eu-west-1"
32
- # config.aws_access_key_id = "abc123"
33
- # config.aws_secret_key = "abc123"
34
- # config.s3_bucket = "mybucket"
35
- # If you want to store your files localy (not recommended for
36
- # production, in large part because it's more difficult to ensure
37
- # that files are backed up in sync with your database):
38
-
39
19
  end
@@ -1,47 +1,31 @@
1
- module Spina
2
- module DefaultTheme
3
- include ::ActiveSupport::Configurable
1
+ ::Spina::Theme.register do |theme|
2
+
3
+ theme.name = 'default'
4
+ theme.title = 'Default Theme'
5
+
6
+ theme.page_parts = [{
7
+ name: 'text',
8
+ title: 'Text',
9
+ partable_type: 'Spina::Text'
10
+ }]
11
+
12
+ theme.view_templates = [{
13
+ name: 'homepage',
14
+ title: 'Homepage',
15
+ page_parts: ['text']
16
+ }, {
17
+ name: 'show',
18
+ title: 'Default',
19
+ description: 'A simple page',
20
+ usage: 'Use for your content',
21
+ page_parts: ['text']
22
+ }]
23
+
24
+ theme.custom_pages = [{
25
+ name: 'homepage',
26
+ title: 'Homepage',
27
+ deletable: false,
28
+ view_template: 'homepage'
29
+ }]
4
30
 
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: 'text',
11
- title: 'Text',
12
- page_partable_type: 'Spina::Text'
13
- }]
14
-
15
- self.structures = {}
16
-
17
- self.layout_parts = []
18
-
19
- self.view_templates = {
20
- 'homepage' => {
21
- title: 'Homepage',
22
- page_parts: ['text']
23
- },
24
- 'show' => {
25
- title: 'Default',
26
- description: 'A simple page',
27
- usage: 'Use for your content',
28
- page_parts: ['text']
29
- }
30
- }
31
-
32
- self.custom_pages = [{
33
- name: 'homepage',
34
- title: 'Homepage',
35
- deletable: false,
36
- view_template: 'homepage'
37
- }]
38
-
39
- self.plugins = []
40
-
41
- end
42
31
  end
43
-
44
- theme = Spina::Theme.new
45
- theme.name = 'default'
46
- theme.config = Spina::DefaultTheme.config
47
- Spina.register_theme(theme)