spina 2.7.0 → 2.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.

Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -2
  3. data/Rakefile +2 -1
  4. data/app/assets/builds/spina/tailwind.css +3460 -0
  5. data/app/assets/config/spina/manifest.js +3 -1
  6. data/app/assets/javascripts/spina/controllers/image_collection_controller.js +5 -3
  7. data/app/assets/stylesheets/spina/{_animate.css → animate.css} +0 -0
  8. data/app/assets/stylesheets/spina/{tailwind/custom.css → application.tailwind.css} +40 -46
  9. data/app/assets/stylesheets/spina/{_fonts.css.erb → fonts.css.erb} +0 -0
  10. data/app/components/spina/accounts/translations_component.html.erb +21 -0
  11. data/app/components/spina/accounts/translations_component.rb +26 -0
  12. data/app/components/spina/forms/trix_toolbar_component.html.erb +1 -1
  13. data/app/controllers/spina/admin/layout_controller.rb +1 -1
  14. data/app/controllers/spina/admin/navigation_items_controller.rb +1 -1
  15. data/app/views/layouts/spina/admin/application.html.erb +2 -2
  16. data/app/views/spina/admin/layout/edit.html.erb +2 -0
  17. data/app/views/spina/admin/navigation_items/_form.html.erb +5 -1
  18. data/config/locales/fr.yml +190 -152
  19. data/lib/generators/spina/install_generator.rb +4 -0
  20. data/lib/generators/spina/tailwind_config_generator.rb +10 -0
  21. data/{app/assets/config/spina/tailwind.config.js → lib/generators/spina/templates/app/assets/config/spina/tailwind.config.js.tt} +5 -7
  22. data/lib/spina/version.rb +1 -1
  23. data/lib/spina.rb +22 -11
  24. data/lib/tasks/install.rake +39 -0
  25. data/lib/tasks/tailwind.rake +22 -0
  26. metadata +26 -10
  27. data/app/assets/stylesheets/spina/_tailwind.css +0 -203643
  28. data/app/assets/stylesheets/spina/application.css +0 -6
  29. data/lib/spina/tailwind_purger.rb +0 -147
  30. data/lib/tasks/spina_tasks.rake +0 -75
@@ -4,6 +4,8 @@
4
4
  //= link_directory ../../javascripts/spina/controllers
5
5
  //= link_directory ../../javascripts/spina/libraries
6
6
 
7
- //= link spina/application.css
7
+ //= link spina/animate.css
8
+ //= link spina/fonts.css
9
+ //= link spina/tailwind.css
8
10
 
9
11
  //= link spina/application.js
@@ -7,9 +7,11 @@ export default class extends Controller {
7
7
  }
8
8
 
9
9
  connect() {
10
- this.sortable = Sortable.create(this.collectionTarget, {
11
- animation: 150
12
- })
10
+ setTimeout(function() {
11
+ this.sortable = Sortable.create(this.collectionTarget, {
12
+ animation: 150
13
+ })
14
+ }.bind(this), 250)
13
15
  }
14
16
 
15
17
  removeImage(event) {
@@ -138,58 +138,52 @@
138
138
  @apply border border-gray-400;
139
139
  }
140
140
 
141
- /* Trix */
142
- .trix-toolbar {
143
- button[data-trix-active] {
144
- @apply text-white bg-spina;
145
- }
141
+ /* Trix */
142
+ .trix-toolbar button[data-trix-active] {
143
+ @apply text-white bg-spina;
144
+ }
146
145
 
147
- button[disabled] {
148
- @apply bg-gray-100 text-gray-400;
149
- }
146
+ .trix-toolbar button[disabled] {
147
+ @apply bg-gray-100 text-gray-400;
150
148
  }
151
149
 
152
- trix-editor {
153
-
154
- [data-trix-mutable]:not(.attachment__captain-editor) {
155
- @apply select-none
156
- }
157
-
158
- figure.attachment {
159
- @apply m-0 inline-block
160
- }
161
-
162
- figure.attachment[data-trix-content-type="Spina::Image"] {
163
- max-height: 150px;
164
- max-width: 200px;
165
- }
166
-
167
- figure.attachment[data-trix-content-type="Spina::Image"] img {
168
- @apply m-0 rounded-md object-contain;
169
- }
170
-
171
- figure.attachment[data-trix-content-type="Spina::Image"] [data-label]:after {
172
- content: attr(data-label);
173
- @apply italic text-gray-500 h-8 flex items-center px-2 mt-1 text-sm;
174
- }
175
-
176
- figure[data-trix-mutable].attachment[data-trix-content-type="Spina::Image"] img {
177
- @apply shadow-lg ring ring-spina-light
178
- }
150
+ trix-editor [data-trix-mutable]:not(.attachment__captain-editor) {
151
+ @apply select-none
152
+ }
179
153
 
180
- figure[data-trix-mutable][data-trix-content-type="application/vnd+spina.embed+html"].attachment > spina-embed {
181
- @apply block;
182
- @apply shadow-lg ring ring-spina-light rounded-md;
183
- }
184
-
185
- figure .attachment__caption {
186
- @apply hidden
187
- }
154
+ trix-editor figure.attachment {
155
+ @apply m-0 inline-block
156
+ }
157
+
158
+ trix-editor figure.attachment[data-trix-content-type="Spina::Image"] {
159
+ max-height: 150px;
160
+ max-width: 200px;
161
+ }
162
+
163
+ trix-editor figure.attachment[data-trix-content-type="Spina::Image"] img {
164
+ @apply m-0 rounded-md object-contain;
165
+ }
188
166
 
189
- figure .attachment__toolbar {
190
- @apply hidden
191
- }
167
+ trix-editor figure.attachment[data-trix-content-type="Spina::Image"] [data-label]:after {
168
+ content: attr(data-label);
169
+ @apply italic text-gray-500 h-8 flex items-center px-2 mt-1 text-sm;
170
+ }
171
+
172
+ trix-editor figure[data-trix-mutable].attachment[data-trix-content-type="Spina::Image"] img {
173
+ @apply shadow-lg ring ring-spina-light
174
+ }
192
175
 
176
+ trix-editor figure[data-trix-mutable][data-trix-content-type="application/vnd+spina.embed+html"].attachment > spina-embed {
177
+ @apply block;
178
+ @apply shadow-lg ring ring-spina-light rounded-md;
179
+ }
180
+
181
+ trix-editor figure .attachment__caption {
182
+ @apply hidden
183
+ }
184
+
185
+ trix-editor figure .attachment__toolbar {
186
+ @apply hidden
193
187
  }
194
188
 
195
189
  trix-editor [data-trix-mutable]::-moz-selection,
@@ -0,0 +1,21 @@
1
+ <div class="relative" data-controller="reveal" data-reveal-away-value>
2
+ <button type="button" class="btn btn-default px-3" data-action="reveal#toggle">
3
+ <%= helpers.heroicon("chat-alt", style: :solid, class: 'w-4 h-4 text-gray-300') %>
4
+
5
+ <span class="ml-1 font-semibold"><%= @label %></span>
6
+ </button>
7
+
8
+ <div hidden data-reveal data-transition class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg border border-gray-200 z-20">
9
+ <div class="rounded-md bg-white shadow-xs">
10
+ <div class="py-1">
11
+ <% locales.each do |locale| %>
12
+ <%= link_to helpers.spina.edit_admin_layout_path(locale: locale), class: "block px-3 py-2 text-sm leading-4 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 font-medium" do %>
13
+ <div class="text-gray-700">
14
+ <%=t('spina.pages.edit_translation', language: '<span class="font-semibold">' + t("spina.languages.#{locale}") + '</span>').html_safe %>
15
+ </div>
16
+ <% end %>
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
@@ -0,0 +1,26 @@
1
+ module Spina
2
+ module Accounts
3
+ class TranslationsComponent < ApplicationComponent
4
+
5
+ def initialize(account, label: nil)
6
+ @account = account
7
+ @label = label
8
+ end
9
+
10
+ def render?
11
+ spina_locales.many?
12
+ end
13
+
14
+ def locales
15
+ spina_locales
16
+ end
17
+
18
+ private
19
+
20
+ def spina_locales
21
+ Spina.config.locales.map(&:to_sym)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -1,4 +1,4 @@
1
- <div class="relative sticky top-0 pt-4 bg-white trix-toolbar" id="<%= @trix_id %>">
1
+ <div class="relative sticky z-10 top-0 pt-4 bg-white trix-toolbar" id="<%= @trix_id %>">
2
2
  <div class="flex items-center flex-wrap" data-controller="reveal">
3
3
  <div class="flex items-center bg-gray-200 rounded overflow-hidden mb-3 mr-3">
4
4
  <button type="button" class="hover:bg-gray-300 text-gray-700 w-9 h-9 flex items-center justify-center" data-trix-attribute="bold" data-trix-key="b" title="${Trix.config.lang.bold}" tabindex="-1">
@@ -11,7 +11,7 @@ module Spina::Admin
11
11
 
12
12
  def update
13
13
  if @account.update(layout_params)
14
- redirect_to spina.edit_admin_layout_path, flash: {success: t('spina.layout.saved')}
14
+ redirect_to spina.edit_admin_layout_path(locale: @locale), flash: {success: t('spina.layout.saved')}
15
15
  else
16
16
  flash.now[:error] = t('spina.layout.couldnt_be_saved')
17
17
  render partial: 'error', status: :unprocessable_entity
@@ -5,7 +5,7 @@ module Spina
5
5
 
6
6
  def new
7
7
  @navigation_item = @navigation.navigation_items.new(parent_id: params[:parent_id])
8
- @pages = Page.sorted
8
+ @pages = Page.sorted.main.includes(:translations)
9
9
  end
10
10
 
11
11
  def create
@@ -10,8 +10,8 @@
10
10
 
11
11
  <title>Spina CMS</title>
12
12
 
13
- <!-- Tailwind -->
14
- <%= stylesheet_link_tag 'spina/application', data: {turbolinks_track: true} %>
13
+ <!-- Stylesheets -->
14
+ <%= stylesheet_link_tag "spina/tailwind", "spina/fonts", "spina/animate", "data-turbo-track": "reload" %>
15
15
 
16
16
  <!-- Spina's importmap -->
17
17
  <%= spina_importmap_tags %>
@@ -1,5 +1,7 @@
1
1
  <%= render Spina::UserInterface::HeaderComponent.new do |header| %>
2
2
  <% header.actions do %>
3
+ <%= render Spina::Accounts::TranslationsComponent.new(@account, label: @locale.upcase) %>
4
+
3
5
  <% if Spina::Current.theme.layout_parts.any? %>
4
6
  <%= button_tag type: :submit, form: dom_id(@account), class: 'btn btn-primary', data: {controller: "button hotkeys", hotkeys: "command+s, ctrl+s", hotkeys_target: "button", action: "button#loading", loading_message: t('spina.ui.saving')} do %>
5
7
  <%= heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2') %>
@@ -10,7 +10,11 @@
10
10
  </h3>
11
11
 
12
12
  <div class="mt-3">
13
- <%= f.select :page_id, @pages.map{|page| [page.menu_title, page.id]}, {disabled: @navigation.navigation_items.pluck(:page_id), include_blank: t('spina.navigations.choose_page')}, class: 'form-select w-full' %>
13
+
14
+ <div class="border border-gray-300 rounded-md bg-white">
15
+ <%= render Spina::Pages::PageSelectComponent.new("navigation_item[page_id]", @pages, include_blank: t("spina.navigations.choose_page"), disabled: @navigation.navigation_items.pluck(:page_id)) %>
16
+ </div>
17
+
14
18
  </div>
15
19
  </div>
16
20
  </div>