spina 1.0.3 → 1.1.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +5 -14
  4. data/app/assets/config/spina/manifest.js +5 -0
  5. data/app/assets/config/spina_manifest.js +5 -0
  6. data/app/assets/images/spina/arrow-left.svg +1 -0
  7. data/app/assets/images/spina/arrow-right.svg +1 -0
  8. data/app/assets/images/spina/datepicker.svg +1 -0
  9. data/app/assets/images/spina/divider.svg +1 -0
  10. data/app/assets/images/spina/media_folder_placeholder.svg +1 -0
  11. data/app/assets/images/spina/spina.svg +1 -0
  12. data/app/assets/javascripts/spina/admin/application.js +1 -2
  13. data/app/assets/javascripts/spina/admin/controllers/gallery_select_controller.js +52 -0
  14. data/app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js +2 -2
  15. data/app/assets/javascripts/spina/admin/controllers/page_collapse_controller.js +35 -0
  16. data/app/assets/javascripts/spina/admin/media_gallery.coffee +1 -1
  17. data/app/assets/javascripts/spina/admin/trix.coffee.erb +79 -5
  18. data/app/assets/javascripts/spina/admin/uploads.coffee +1 -1
  19. data/app/assets/stylesheets/spina.sass +8 -4
  20. data/app/assets/stylesheets/spina/_buttons.sass +1 -0
  21. data/app/assets/stylesheets/spina/_forms.sass +1 -1
  22. data/app/assets/stylesheets/spina/_gallery.sass +45 -12
  23. data/app/assets/stylesheets/spina/_sortable_lists.sass +7 -0
  24. data/app/assets/stylesheets/spina/_trix_custom.sass +227 -0
  25. data/app/assets/stylesheets/spina/admin/{application.sass → application.css.sass} +0 -0
  26. data/app/controllers/concerns/spina/frontend.rb +5 -5
  27. data/app/controllers/spina/admin/accounts_controller.rb +2 -1
  28. data/app/controllers/spina/admin/images_controller.rb +1 -1
  29. data/app/controllers/spina/admin/media_picker_controller.rb +14 -2
  30. data/app/controllers/spina/admin/navigations_controller.rb +9 -7
  31. data/app/controllers/spina/admin/pages_controller.rb +16 -11
  32. data/app/controllers/spina/admin/password_resets_controller.rb +2 -2
  33. data/app/controllers/spina/admin/resources_controller.rb +9 -7
  34. data/app/controllers/spina/admin/settings_controller.rb +1 -1
  35. data/app/controllers/spina/admin/users_controller.rb +8 -7
  36. data/app/controllers/spina/pages_controller.rb +1 -3
  37. data/app/helpers/spina/admin/pages_helper.rb +2 -2
  38. data/app/helpers/spina/images_helper.rb +1 -1
  39. data/app/models/spina/account.rb +14 -6
  40. data/app/models/spina/attachment.rb +3 -3
  41. data/app/models/spina/image.rb +10 -1
  42. data/app/models/spina/image_collection.rb +3 -3
  43. data/app/models/spina/line.rb +1 -1
  44. data/app/models/spina/navigation_item.rb +2 -1
  45. data/app/models/spina/page.rb +11 -6
  46. data/app/models/spina/resource.rb +11 -0
  47. data/app/models/spina/text.rb +1 -1
  48. data/app/presenters/spina/menu_presenter.rb +74 -0
  49. data/app/views/layouts/spina/admin/admin.html.haml +1 -1
  50. data/app/views/spina/admin/accounts/social.html.haml +18 -0
  51. data/app/views/spina/admin/images/_form.html.haml +1 -1
  52. data/app/views/spina/admin/images/_image.html.haml +3 -5
  53. data/app/views/spina/admin/media_folders/_media_folder.html.haml +2 -2
  54. data/app/views/spina/admin/media_folders/show.html.haml +1 -1
  55. data/app/views/spina/admin/media_picker/_modal.html.haml +51 -14
  56. data/app/views/spina/admin/media_picker/select.js.erb +4 -2
  57. data/app/views/spina/admin/pages/_form.html.haml +1 -1
  58. data/app/views/spina/admin/pages/children.html.haml +4 -0
  59. data/app/views/spina/admin/partables/lines/_form.html.haml +1 -1
  60. data/app/views/spina/admin/partables/texts/_form.html.haml +4 -1
  61. data/app/views/spina/admin/password_resets/edit.html.haml +1 -1
  62. data/app/views/spina/admin/password_resets/new.html.haml +1 -1
  63. data/app/views/spina/admin/resources/edit.html.haml +1 -1
  64. data/app/views/spina/admin/resources/show.html.haml +13 -3
  65. data/app/views/spina/admin/sessions/new.html.haml +1 -1
  66. data/app/views/spina/admin/shared/_primary_navigation.html.haml +1 -1
  67. data/app/views/spina/admin/shared/_rich_text_field.html.haml +1 -32
  68. data/app/views/spina/shared/_admin_bar.html.haml +1 -1
  69. data/app/views/spina/shared/_social.html.haml +2 -2
  70. data/config/locales/de.yml +3 -0
  71. data/config/locales/en.yml +4 -0
  72. data/config/locales/es.yml +3 -0
  73. data/config/locales/fr.yml +3 -0
  74. data/config/locales/it.yml +3 -0
  75. data/config/locales/nl.yml +4 -0
  76. data/config/locales/pt-BR.yml +20 -1
  77. data/config/locales/ru.yml +3 -0
  78. data/config/locales/tr.yml +3 -0
  79. data/config/locales/zh-CN.yml +3 -0
  80. data/config/routes.rb +1 -0
  81. data/lib/generators/spina/install_generator.rb +10 -10
  82. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +2 -3
  83. data/lib/generators/spina/templates/app/views/demo/pages/demo.html.haml +4 -3
  84. data/lib/generators/spina/templates/app/views/demo/shared/_navigation.html.haml +2 -3
  85. data/lib/generators/spina/templates/app/views/layouts/default/application.html.haml +0 -1
  86. data/lib/generators/spina/templates/app/views/layouts/demo/application.html.haml +0 -1
  87. data/lib/generators/spina/templates/config/initializers/mobility.rb +0 -1
  88. data/lib/spina.rb +1 -0
  89. data/lib/spina/engine.rb +1 -1
  90. data/lib/spina/railtie.rb +9 -0
  91. data/lib/spina/theme.rb +2 -1
  92. data/lib/spina/version.rb +1 -1
  93. data/lib/tasks/spina_tasks.rake +8 -2
  94. data/vendor/assets/javascripts/spina/trix.js +9 -9
  95. data/vendor/assets/stylesheets/spina/_normalize.scss +1 -1
  96. data/vendor/assets/stylesheets/spina/_trix.css +369 -0
  97. metadata +39 -21
  98. data/app/assets/images/spina/arrow-left.png +0 -0
  99. data/app/assets/images/spina/arrow-right.png +0 -0
  100. data/app/assets/images/spina/datepicker.png +0 -0
  101. data/app/assets/images/spina/divider.png +0 -0
  102. data/app/assets/images/spina/media_folder_placeholder.png +0 -0
  103. data/app/assets/images/spina/spina-large.png +0 -0
  104. data/app/assets/javascripts/spina/admin/galleryselect.coffee +0 -20
  105. data/app/assets/stylesheets/spina/_trix.sass +0 -102
  106. data/config/initializers/assets.rb +0 -6
  107. data/config/initializers/time_formats.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32187eb78136ac0dfe4d1725858773b6f1a1ccb2cbcdc0e34a0607465c5e79c3
4
- data.tar.gz: 870eb6a0b6680656373c86be1c7c76589d8bcb8568d8cebf3e14152e85067106
3
+ metadata.gz: db2767772ea24a0a4262e61db31f80abe5fc93f2b310edecc76f8bf00fbe342a
4
+ data.tar.gz: 7d38a0b23d9a4a9b77b6653be7c4f30b3c53e27fcb3b97c0e37371f4c3eb29d5
5
5
  SHA512:
6
- metadata.gz: 3090e08c178581fe346591ab4bba6d6f6906960c4e29a6f3fe5fa660305acfbedc0e5f43a492376f74843c2cd39184ff693f93ed2338c1963df6c044bae32583
7
- data.tar.gz: bff6c12eaaf8565db13e80f31193ee5ac744018b61dfe934a4c878b1dd574007976daff8f8065496bde5a715a3431aab32f294006d80813424d75c99bf72c3b2
6
+ metadata.gz: 20493b10e93d052d7c89efc2ed6e8b3cd9951b5bea67a4a1274ec23b97c13a80bf4c98feaefbab5a33ced6ef9acf25045b445a963b42478a638f6112add72813
7
+ data.tar.gz: 3fe59424afa8d9a792e6f6772e42764ccb14b4777f3eba65176dc527ac5a68fd93a8fc3d51d3cf4fcae2618341dcd9171e48edba93aff04547d0f3af4d3a95f6
data/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  # Getting Started
15
15
 
16
- Spina is a CMS for Rails 5.2. This guide is designed for developers with experience using Ruby on Rails.
16
+ Spina is a CMS for Rails 6.0. This guide is designed for developers with experience using Ruby on Rails.
17
17
 
18
18
  To start using Spina CMS add the following line to your Gemfile:
19
19
 
data/Rakefile CHANGED
@@ -1,16 +1,10 @@
1
- #!/usr/bin/env rake
2
1
  begin
3
2
  require 'bundler/setup'
4
3
  rescue LoadError
5
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
5
  end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
6
+
7
+ require 'rdoc/task'
14
8
 
15
9
  RDoc::Task.new(:rdoc) do |rdoc|
16
10
  rdoc.rdoc_dir = 'rdoc'
@@ -20,22 +14,19 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
14
  rdoc.rdoc_files.include('lib/**/*.rb')
21
15
  end
22
16
 
23
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
24
18
  load 'rails/tasks/engine.rake'
25
19
 
20
+ load 'rails/tasks/statistics.rake'
26
21
 
27
-
28
- Bundler::GemHelper.install_tasks
22
+ require 'bundler/gem_tasks'
29
23
 
30
24
  require 'rake/testtask'
31
25
 
32
26
  Rake::TestTask.new(:test) do |t|
33
- t.libs << 'lib'
34
27
  t.libs << 'test'
35
28
  t.pattern = 'test/**/*_test.rb'
36
29
  t.verbose = false
37
- t.warning = false
38
30
  end
39
31
 
40
-
41
32
  task :default => :test
@@ -0,0 +1,5 @@
1
+ //= link_directory ../../images/spina
2
+ //= link_directory ../../fonts/spina
3
+
4
+ //= link_tree ../../stylesheets/spina
5
+ //= link_directory ../../javascripts/spina/admin
@@ -0,0 +1,5 @@
1
+ //= link_directory ../images/spina
2
+ //= link_directory ../fonts/spina
3
+
4
+ //= link spina/admin/application.css
5
+ //= link spina/admin/application.js
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="26"><path fill-rule="evenodd" d="M15 0L2 13l13 13 4-4-9-9 9-9z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="26"><path fill-rule="evenodd" d="M5 0l13 13L5 26l-4-4 9-9-9-9z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="16"><defs><path id="a" d="M3 0h3v6H3z"/><path id="b" d="M10 0h3v6h-3z"/></defs><g fill="none" fill-rule="evenodd"><use fill="#FFF" xlink:href="#a"/><path stroke="#CCC" d="M3.5.5h2v5h-2z"/><use fill="#FFF" xlink:href="#b"/><path stroke="#CCC" d="M10.5.5h2v5h-2z"/><path fill="#CCC" d="M6 6V2h4v4h2V2h4v14H0V2h4v4h2zM1 7v8h14V7H1z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="6" height="16"><defs><linearGradient id="a" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#FFF" stop-opacity=".5"/><stop offset="100%" stop-opacity=".5"/></linearGradient></defs><path fill="url(#a)" stroke="#CCC" d="M0 0l6 8m-6 8l6-8" fill-rule="evenodd" stroke-linecap="square"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140" height="140"><defs><rect id="a" width="48" height="40" rx="4"/></defs><g fill="none" fill-rule="evenodd"><path fill="#D6D6E9" d="M0 0h140v140H0z"/><rect width="64" height="64" x="38" y="38" stroke="#9FA0C1" stroke-width="4" rx="8"/><g transform="translate(46 46)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><rect width="46" height="38" x="1" y="1" stroke="#9FA0C1" stroke-width="2" rx="4"/><path stroke="#9FA0C1" stroke-width="2" mask="url(#b)" d="M0 30l16-14 13 12 11-8 8 8"/><circle cx="36" cy="11" r="5" stroke="#9FA0C1" stroke-width="2" mask="url(#b)"/></g></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="24"><g fill="none" fill-rule="evenodd"><path fill="#685D98" d="M0 8l16 16V8z"/><path fill="#6B649C" d="M32 8L16 24V8z"/><path fill="#8980B2" d="M8 8l8 16 8-16z"/><path fill="#8278B1" d="M27 0v8H5V0z"/><path fill="#A9A4CB" d="M8 8l8-8 8 8z"/><path fill="#7668A6" d="M5 0L0 8h8z"/><path fill="#8980B2" d="M27 0l5 8h-8z"/></g></svg>
@@ -34,7 +34,6 @@
34
34
  //= require ./tabs
35
35
  //= require ./forms
36
36
  //= require ./dropdown
37
- //= require ./galleryselect
38
37
  //= require ./navigation
39
38
  //= require ./notifications
40
39
  //= require ./media_gallery
@@ -47,4 +46,4 @@
47
46
 
48
47
  // Scaffolding
49
48
 
50
- //= require ./scaffold
49
+ //= require ./scaffold
@@ -0,0 +1,52 @@
1
+ (() => {
2
+ const application = Stimulus.Application.start()
3
+
4
+ application.register("gallery-select", class extends Stimulus.Controller {
5
+ static get targets() {
6
+ return ["singleImage", "multipleImages", "multiple", "counter"]
7
+ }
8
+
9
+ select(event) {
10
+ let item = event.currentTarget
11
+ let imageId = item.dataset.imageId
12
+ if (this.multipleTarget.checked) {
13
+ item.classList.toggle('selected')
14
+ if (item.classList.contains('selected')) {
15
+ this.addToMultipleImages(imageId)
16
+ } else {
17
+ this.removeFromMultipleImages(imageId)
18
+ }
19
+ this.counterTarget.innerText = `(${this.imageCount})`
20
+ } else {
21
+ item.parentElement.querySelectorAll('.item').forEach(function(item) {
22
+ item.classList.remove('selected')
23
+ })
24
+ item.classList.add('selected')
25
+ this.singleImageTarget.value = imageId
26
+ }
27
+ }
28
+
29
+ addToMultipleImages(imageId) {
30
+ let imageIds = this.multipleImages
31
+ imageIds.push(imageId)
32
+ this.multipleImagesTarget.value = [...new Set(imageIds)].join("-")
33
+ }
34
+
35
+ removeFromMultipleImages(imageId) {
36
+ let imageIds = this.multipleImages
37
+ let newImageIds = imageIds.filter(function(id) {
38
+ return id != imageId
39
+ })
40
+ this.multipleImagesTarget.value = newImageIds.join("-")
41
+ }
42
+
43
+ get multipleImages() {
44
+ return this.multipleImagesTarget.value.split("-")
45
+ }
46
+
47
+ get imageCount() {
48
+ return this.multipleImages.length
49
+ }
50
+
51
+ })
52
+ })()
@@ -14,7 +14,7 @@
14
14
  let $link = $(this.linkTarget)
15
15
 
16
16
  // If the link has an actual href
17
- if ($link.attr('href').length > 0) {
17
+ if ($link.attr('href')) {
18
18
  // If the window scrolls
19
19
  $(window).on('scroll.infiniteScroll', this.loadNextPage($link))
20
20
 
@@ -35,6 +35,6 @@
35
35
  $.getScript(link.attr('href'))
36
36
  }
37
37
  }
38
-
38
+
39
39
  })
40
40
  })()
@@ -0,0 +1,35 @@
1
+ (() => {
2
+ const application = Stimulus.Application.start()
3
+
4
+ application.register("page-collapse", class extends Stimulus.Controller {
5
+ static get targets() {
6
+ return [ "list", "collapseLink", "expandLink" ]
7
+ }
8
+
9
+ expand() {
10
+ this.toggleLinks(true)
11
+
12
+ // Fetch children HTML
13
+ fetch(this.element.dataset.url)
14
+ .then(response => response.text())
15
+ .then(function(html) {
16
+ // Render the list
17
+ this.listTarget.innerHTML = html
18
+ }.bind(this))
19
+ }
20
+
21
+ collapse() {
22
+ this.toggleLinks(false)
23
+
24
+ // Clear the list
25
+ this.listTarget.innerHTML = ""
26
+ }
27
+
28
+ // Toggle plus/minus links
29
+ toggleLinks(expanded) {
30
+ this.expandLinkTarget.style.display = expanded ? "none" : "inline-block"
31
+ this.collapseLinkTarget.style.display = expanded ? "inline-block" : "none"
32
+ }
33
+
34
+ })
35
+ })()
@@ -29,7 +29,7 @@ ready = ->
29
29
  $('.media-folder').droppable(
30
30
  drop: (event, ui) ->
31
31
  url = $(this).attr('data-add-to-media-folder-url')
32
- image_id = $(ui.draggable).find('input[type="radio"]').val()
32
+ image_id = $(ui.draggable).attr('data-image-id')
33
33
 
34
34
  $.ajax
35
35
  url: url,
@@ -28,17 +28,91 @@ Trix.config.blockAttributes = $.extend Trix.config.blockAttributes, {
28
28
  group: false
29
29
  }
30
30
 
31
+ Trix.config.lang = $.extend Trix.config.lang, {
32
+ image: "Image"
33
+ heading1: "H1"
34
+ heading2: "H2"
35
+ heading3: "H3"
36
+ heading4: "H4"
37
+ heading5: "H5"
38
+ heading6: "H6"
39
+ }
40
+
41
+ Trix.config.toolbar =
42
+ getDefaultHTML: -> """
43
+ <div class="trix-button-row">
44
+ <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
45
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="#{Trix.config.lang.bold}" tabindex="-1">#{Trix.config.lang.bold}</button>
46
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="#{Trix.config.lang.italic}" tabindex="-1">#{Trix.config.lang.italic}</button>
47
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="#{Trix.config.lang.strike}" tabindex="-1">#{Trix.config.lang.strike}</button>
48
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="#{Trix.config.lang.link}" tabindex="-1">#{Trix.config.lang.link}</button>
49
+ </span>
50
+ <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
51
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading1" title="#{Trix.config.lang.heading1}" tabindex="-1">#{Trix.config.lang.heading1}</button>
52
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading2" title="#{Trix.config.lang.heading2}" tabindex="-1">#{Trix.config.lang.heading2}</button>
53
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading3" title="#{Trix.config.lang.heading3}" tabindex="-1">#{Trix.config.lang.heading3}</button>
54
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading4" title="#{Trix.config.lang.heading4}" tabindex="-1">#{Trix.config.lang.heading4}</button>
55
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading5" title="#{Trix.config.lang.heading5}" tabindex="-1">#{Trix.config.lang.heading5}</button>
56
+ <button type="button" class="trix-button trix-button--text" data-trix-attribute="heading6" title="#{Trix.config.lang.heading6}" tabindex="-1">#{Trix.config.lang.heading6}</button>
57
+ </span>
58
+ <span class="trix-button-group-spacer"></span>
59
+ <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
60
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="#{Trix.config.lang.undo}" tabindex="-1">#{Trix.config.lang.undo}</button>
61
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="#{Trix.config.lang.redo}" tabindex="-1">#{Trix.config.lang.redo}</button>
62
+ </span>
63
+ </div>
64
+ <div class="trix-button-row">
65
+ <span class="trix-button-group trix-button-group--block-tools">
66
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-image" data-trix-attribute="image" data-trix-action="image" title="#{Trix.config.lang.image}" tabindex="-1">#{Trix.config.lang.image}</button>
67
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="#{Trix.config.lang.quote}" tabindex="-1">#{Trix.config.lang.quote}</button>
68
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="#{Trix.config.lang.code}" tabindex="-1">#{Trix.config.lang.code}</button>
69
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="#{Trix.config.lang.bullets}" tabindex="-1">#{Trix.config.lang.bullets}</button>
70
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="#{Trix.config.lang.numbers}" tabindex="-1">#{Trix.config.lang.numbers}</button>
71
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="#{Trix.config.lang.outdent}" tabindex="-1">#{Trix.config.lang.outdent}</button>
72
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="#{Trix.config.lang.indent}" tabindex="-1">#{Trix.config.lang.indent}</button>
73
+ </span>
74
+ </div>
75
+ <div class="trix-dialogs" data-trix-dialogs>
76
+ <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
77
+ <div class="trix-dialog__link-fields">
78
+ <input type="text" name="href" class="trix-input trix-input--dialog" placeholder="#{Trix.config.lang.urlPlaceholder}" aria-label="#{Trix.config.lang.url}" required data-trix-input>
79
+ <div class="trix-button-group">
80
+ <input type="button" class="trix-button trix-button--dialog" value="#{Trix.config.lang.link}" data-trix-method="setAttribute">
81
+ <input type="button" class="trix-button trix-button--dialog" value="#{Trix.config.lang.unlink}" data-trix-method="removeAttribute">
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ """
87
+
31
88
  class Spina.TrixAttachment
32
89
  @imageSelect: (e) ->
33
- editor_id = $(this).closest('trix-toolbar').data('trix-editor-id')
34
- $.get("<%= Spina::Engine.routes.url_helpers.admin_media_picker_path %>" + "?trix_editor_id=#{editor_id}")
90
+ toolbar_id = $(this).closest('trix-toolbar').attr('id')
91
+ $.get("<%= Spina::Engine.routes.url_helpers.admin_media_picker_path %>" + "?trix_toolbar_id=#{toolbar_id}")
35
92
 
36
- @imageInsert: (e, url) ->
37
- this.editor.insertHTML "<img src='#{ url }' />"
93
+ @imageInsert: (e, url, alt = "", link_to_url = "") ->
94
+ labels = []
95
+ labels.push "✍️ #{alt}" if alt != ""
96
+ labels.push "🔗 #{link_to_url}" if link_to_url != ""
97
+ label = labels.join("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
98
+
99
+ if link_to_url != ""
100
+ attachment = new Trix.Attachment({content: "<a href='#{link_to_url}' class='trix-attachment-spina-image' data-label='#{label}'>
101
+ <img src='#{url}' alt='#{alt}' />
102
+ </a>"})
103
+ else
104
+ attachment = new Trix.Attachment({content: "<span class='trix-attachment-spina-image' data-label='#{label}'>
105
+ <img src='#{url}' alt='#{alt}' />
106
+ </span>"})
107
+
108
+ this.editor.insertAttachment(attachment)
38
109
 
39
110
  document.addEventListener 'trix-file-accept', (e) ->
40
111
  e.preventDefault()
41
112
 
42
- $(document).on 'click', '.js-trix-image', Spina.TrixAttachment.imageSelect
113
+ $(document).on 'click', '[data-trix-attribute="image"]', Spina.TrixAttachment.imageSelect
43
114
 
44
115
  $(document).on 'image-insert', 'trix-editor', Spina.TrixAttachment.imageInsert
116
+
117
+ $(document).on 'click', 'a.trix-attachment-spina-image', (e) ->
118
+ e.preventDefault()
@@ -3,8 +3,8 @@ $.fn.uploadPhoto = ->
3
3
  $(this).fileupload
4
4
  dataType: "script"
5
5
  singleFileUploads: true
6
+ replaceFileInput: true
6
7
  dropZone: $(this).find('.photo-field')
7
- # maxNumberOfFiles: 1
8
8
  add: (e, data) ->
9
9
  types = /(\.|\/)(gif|jpe?g|png)$/i
10
10
  file = data.files[0]
@@ -1,4 +1,8 @@
1
1
  // Configuration
2
+ @import font_awesome5_webfont
3
+ @import font_awesome5
4
+ @import spina/trix
5
+
2
6
  @import spina/configuration
3
7
 
4
8
  // Mixins
@@ -24,7 +28,7 @@
24
28
  @import spina/sortable_lists
25
29
  @import spina/gallery
26
30
  @import spina/login
27
- @import spina/trix
31
+ @import spina/trix_custom
28
32
  @import spina/wizard
29
33
  @import spina/notifications
30
34
 
@@ -313,12 +317,12 @@ nav#secondary
313
317
  opacity: 1
314
318
 
315
319
  a.ui-datepicker-prev span
316
- background: url(asset-path('spina/arrow-left.png')) no-repeat center
320
+ background: url(asset-path('spina/arrow-left.svg')) no-repeat center
317
321
  background-size: 10px 13px
318
322
  display: block
319
323
 
320
324
  a.ui-datepicker-next span
321
- background: url(asset-path('spina/arrow-right.png')) no-repeat center
325
+ background: url(asset-path('spina/arrow-right.svg')) no-repeat center
322
326
  background-size: 10px 13px
323
327
  display: block
324
328
 
@@ -432,7 +436,7 @@ section#main
432
436
  color: #999
433
437
 
434
438
  .divider
435
- background: url(asset-path('spina/divider.png'))
439
+ background: url(asset-path('spina/divider.svg'))
436
440
  color: #999
437
441
  display: inline-block
438
442
  height: 17px
@@ -1,6 +1,7 @@
1
1
  // Buttons
2
2
 
3
3
  button, input[type="submit"], input[type="button"]
4
+ background: none
4
5
  border: none
5
6
 
6
7
  .button
@@ -460,7 +460,7 @@ fieldset
460
460
  color: #999
461
461
 
462
462
  input.datepicker
463
- background: url(asset-path('spina/datepicker.png')) no-repeat center right
463
+ background: url(asset-path('spina/datepicker.svg')) no-repeat center right
464
464
 
465
465
  // Switch
466
466
 
@@ -8,6 +8,38 @@
8
8
  input[type="radio"], input[type="checkbox"]
9
9
  display: none
10
10
 
11
+ .gallery-select-container
12
+ display: flex
13
+ width: 100%
14
+
15
+ .gallery-select
16
+ flex: 1
17
+ max-height: 100%
18
+ overflow: scroll
19
+
20
+ .gallery-select-sidebar
21
+ border-left: 1px solid #ddd
22
+ box-shadow: 0 0 15px rgba(0, 0, 0, .15)
23
+ margin: -20px -20px -20px 0
24
+ padding: 20px
25
+ width: 300px
26
+
27
+ .gallery-select-sidebar form
28
+ display: flex
29
+ flex-direction: column
30
+ height: 100%
31
+ justify-content: space-between
32
+
33
+ .gallery-select-action-bar
34
+ align-items: center
35
+ display: flex
36
+
37
+ .button
38
+ margin-bottom: 0
39
+
40
+ button
41
+ margin-right: 0
42
+
11
43
  .gallery
12
44
  margin: 20px 0
13
45
 
@@ -81,7 +113,7 @@
81
113
  line-height: 15px
82
114
  text-align: left
83
115
  transition: all 0.2s ease
84
- transform: translateY(-100%)
116
+ opacity: 0
85
117
  padding: 10px
86
118
  position: absolute
87
119
  word-break: break-word
@@ -99,7 +131,7 @@
99
131
  transform: translateY(0%)
100
132
 
101
133
  .photo-name
102
- transform: translateY(0%)
134
+ opacity: 1
103
135
 
104
136
  &.dropping:not(.media-folder)
105
137
  transform: scale(0.8)
@@ -110,7 +142,7 @@
110
142
  form
111
143
  height: 100%
112
144
 
113
- .gallery form .item .overlay a
145
+ .gallery-select .item .overlay a
114
146
  display: none
115
147
 
116
148
  .gallery:after
@@ -119,7 +151,7 @@
119
151
  display: block
120
152
 
121
153
  .gallery-select
122
- margin: -8px
154
+ margin: 0
123
155
 
124
156
  &.gallery-select-multiple
125
157
  padding-bottom: 70px
@@ -187,15 +219,16 @@
187
219
  opacity: .7
188
220
 
189
221
  .gallery-select-action-bar
222
+ align-items: center
190
223
  background: #fff
191
224
  border-top: 1px solid #e5e5e5
192
- bottom: 0px
193
- clear: both
194
- margin: 0 -12px
195
- padding: 12px
196
- position: absolute
197
- width: 100%
198
- z-index: 3
225
+ display: flex
226
+ justify-content: flex-end
227
+ margin-top: 12px
228
+ padding: 12px 12px 0
229
+
230
+ .button
231
+ margin: 0 0 0 4px
199
232
 
200
233
  // Customfile
201
234
 
@@ -351,4 +384,4 @@
351
384
  height: 16px
352
385
  line-height: 16px
353
386
  margin-top: 6px
354
- text-align: center
387
+ text-align: center