spina 1.2.0 → 2.0.0.alpha

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/spina/favicon.png +0 -0
  3. data/app/assets/javascripts/spina/admin/application.js +1 -2
  4. data/app/assets/javascripts/spina/admin/controllers/attachment_picker_controller.js +15 -0
  5. data/app/assets/javascripts/spina/admin/controllers/image_form_controller.js +5 -4
  6. data/app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js +20 -22
  7. data/app/assets/javascripts/spina/admin/controllers/media_picker_controller.js +171 -0
  8. data/app/assets/javascripts/spina/admin/controllers/modal_controller.js +18 -0
  9. data/app/assets/javascripts/spina/admin/controllers/repeater_form_controller.js +38 -0
  10. data/app/assets/javascripts/spina/admin/media_gallery.coffee +0 -3
  11. data/app/assets/javascripts/spina/admin/notifications.coffee +1 -1
  12. data/app/assets/javascripts/spina/admin/pages.coffee.erb +3 -20
  13. data/app/assets/javascripts/spina/admin/scaffold.coffee +0 -3
  14. data/app/assets/javascripts/spina/admin/trix.coffee.erb +14 -18
  15. data/app/assets/stylesheets/spina.sass +10 -8
  16. data/app/assets/stylesheets/spina/_buttons.sass +57 -31
  17. data/app/assets/stylesheets/spina/_forms.sass +59 -73
  18. data/app/assets/stylesheets/spina/_gallery.sass +18 -2
  19. data/app/assets/stylesheets/spina/_media_picker.sass +133 -0
  20. data/app/assets/stylesheets/spina/_modal.sass +35 -2
  21. data/app/assets/stylesheets/spina/_notifications.sass +20 -14
  22. data/app/assets/stylesheets/spina/_pages.sass +131 -0
  23. data/app/assets/stylesheets/spina/_sortable_lists.sass +14 -8
  24. data/app/assets/stylesheets/spina/_trix_custom.sass +1 -1
  25. data/app/controllers/concerns/spina/frontend.rb +9 -0
  26. data/app/controllers/spina/admin/accounts_controller.rb +9 -13
  27. data/app/controllers/spina/admin/attachments_controller.rb +0 -22
  28. data/app/controllers/spina/admin/images_controller.rb +1 -1
  29. data/app/controllers/spina/admin/media_picker_controller.rb +18 -19
  30. data/app/controllers/spina/admin/pages_controller.rb +1 -5
  31. data/app/controllers/spina/admin/resources_controller.rb +9 -4
  32. data/app/controllers/spina/application_controller.rb +1 -1
  33. data/app/helpers/spina/admin/pages_helper.rb +22 -20
  34. data/app/helpers/spina/{files_helper.rb → attachments_helper.rb} +1 -1
  35. data/app/helpers/spina/images_helper.rb +6 -0
  36. data/app/helpers/spina/pages_helper.rb +23 -4
  37. data/app/models/concerns/spina/partable.rb +19 -7
  38. data/app/models/concerns/spina/translated_content.rb +19 -0
  39. data/app/models/spina/account.rb +3 -10
  40. data/app/models/spina/attachment.rb +0 -4
  41. data/app/models/spina/current.rb +1 -0
  42. data/app/models/spina/image.rb +0 -4
  43. data/app/models/spina/page.rb +7 -15
  44. data/app/models/spina/parts/attachment.rb +17 -0
  45. data/app/models/spina/parts/base.rb +12 -0
  46. data/app/models/spina/parts/image.rb +30 -0
  47. data/app/models/spina/parts/image_collection.rb +23 -0
  48. data/app/models/spina/parts/line.rb +7 -0
  49. data/app/models/spina/parts/option.rb +13 -0
  50. data/app/models/spina/parts/repeater.rb +10 -0
  51. data/app/models/spina/parts/repeater_content.rb +15 -0
  52. data/app/models/spina/parts/text.rb +7 -0
  53. data/app/models/spina/resource.rb +4 -0
  54. data/app/presenters/spina/content_presenter.rb +58 -0
  55. data/app/presenters/spina/menu_presenter.rb +2 -1
  56. data/app/views/layouts/spina/admin/admin.html.haml +3 -4
  57. data/app/views/layouts/spina/admin/pages.html.haml +5 -4
  58. data/app/views/spina/admin/accounts/_form.html.haml +13 -7
  59. data/app/views/spina/admin/accounts/analytics.html.haml +5 -3
  60. data/app/views/spina/admin/accounts/style.html.haml +26 -21
  61. data/app/views/spina/admin/images/index.html.haml +7 -5
  62. data/app/views/spina/admin/media_folders/show.html.haml +2 -2
  63. data/app/views/spina/admin/media_picker/_image.html.haml +3 -0
  64. data/app/views/spina/admin/media_picker/_media_picker.html.haml +32 -0
  65. data/app/views/spina/admin/media_picker/_media_picker_grid.html.haml +25 -0
  66. data/app/views/spina/admin/media_picker/infinite_scroll.js.erb +4 -4
  67. data/app/views/spina/admin/media_picker/select.js.erb +2 -0
  68. data/app/views/spina/admin/media_picker/show.html.haml +1 -0
  69. data/app/views/spina/admin/media_picker/show.js.erb +1 -1
  70. data/app/views/spina/admin/pages/_form.html.haml +9 -7
  71. data/app/views/spina/admin/pages/_form_advanced.html.haml +5 -5
  72. data/app/views/spina/admin/pages/_form_page_content.html.haml +14 -13
  73. data/app/views/spina/admin/pages/_form_page_seo.html.haml +9 -5
  74. data/app/views/spina/admin/pages/_page.html.haml +5 -3
  75. data/app/views/spina/admin/pages/_page_nested_list.html.haml +2 -3
  76. data/app/views/spina/admin/pages/index.html.haml +5 -4
  77. data/app/views/spina/admin/parts/attachments/_form.html.haml +6 -0
  78. data/app/views/spina/admin/parts/image_collections/_fields.html.haml +7 -0
  79. data/app/views/spina/admin/parts/image_collections/_form.html.haml +12 -0
  80. data/app/views/spina/admin/parts/images/_form.html.haml +18 -0
  81. data/app/views/spina/admin/parts/lines/_form.html.haml +2 -0
  82. data/app/views/spina/admin/parts/options/_form.html.haml +3 -0
  83. data/app/views/spina/admin/parts/repeaters/_fields.html.haml +15 -0
  84. data/app/views/spina/admin/parts/repeaters/_form.html.haml +18 -0
  85. data/app/views/spina/admin/parts/texts/_form.html.haml +6 -0
  86. data/app/views/spina/admin/resources/edit.html.haml +28 -5
  87. data/app/views/spina/admin/resources/show.html.haml +5 -2
  88. data/app/views/spina/admin/shared/_notifications.html.haml +4 -4
  89. data/db/migrate/12_add_url_title_to_spina_page_translations.rb +1 -1
  90. data/db/migrate/13_add_json_attributes_to_spina_accounts.rb +5 -0
  91. data/db/migrate/14_add_json_attributes_to_spina_pages.rb +5 -0
  92. data/db/migrate/15_add_slug_to_spina_resources.rb +5 -0
  93. data/lib/generators/spina/templates/app/views/demo/pages/demo.html.haml +13 -21
  94. data/lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml +1 -1
  95. data/lib/generators/spina/templates/config/initializers/themes/default.rb +4 -4
  96. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +32 -44
  97. data/lib/spina.rb +2 -0
  98. data/lib/spina/attr_json_spina_parts_model.rb +29 -0
  99. data/lib/spina/engine.rb +13 -2
  100. data/lib/spina/part.rb +19 -0
  101. data/lib/spina/theme.rb +1 -1
  102. data/lib/spina/version.rb +1 -1
  103. data/vendor/assets/javascripts/spina/sortable.js +2 -2
  104. metadata +54 -42
  105. data/app/assets/javascripts/spina/admin/account.coffee +0 -16
  106. data/app/models/concerns/spina/image_collectable.rb +0 -23
  107. data/app/models/concerns/spina/optionable.rb +0 -12
  108. data/app/models/concerns/spina/part.rb +0 -38
  109. data/app/models/spina/attachment_collection.rb +0 -20
  110. data/app/models/spina/image_collection.rb +0 -23
  111. data/app/models/spina/image_collections_image.rb +0 -6
  112. data/app/models/spina/layout_part.rb +0 -22
  113. data/app/models/spina/line.rb +0 -10
  114. data/app/models/spina/option.rb +0 -17
  115. data/app/models/spina/page_part.rb +0 -22
  116. data/app/models/spina/structure.rb +0 -14
  117. data/app/models/spina/structure_item.rb +0 -22
  118. data/app/models/spina/structure_part.rb +0 -20
  119. data/app/models/spina/text.rb +0 -10
  120. data/app/views/dummy/show.html.haml +0 -1
  121. data/app/views/spina/admin/attachments/_attachment_collection.html.haml +0 -2
  122. data/app/views/spina/admin/attachments/_select.html.haml +0 -17
  123. data/app/views/spina/admin/attachments/_select_collection.html.haml +0 -18
  124. data/app/views/spina/admin/attachments/insert.js.erb +0 -5
  125. data/app/views/spina/admin/attachments/insert_collection.js.coffee +0 -7
  126. data/app/views/spina/admin/attachments/select.js.erb +0 -2
  127. data/app/views/spina/admin/attachments/select_collection.js.erb +0 -2
  128. data/app/views/spina/admin/image_collections/_image_collection.html.haml +0 -5
  129. data/app/views/spina/admin/layout_partables/lines/_form.html.haml +0 -2
  130. data/app/views/spina/admin/partables/attachment_collections/_form.html.haml +0 -14
  131. data/app/views/spina/admin/partables/attachments/_form.html.haml +0 -13
  132. data/app/views/spina/admin/partables/image_collections/_form.html.haml +0 -16
  133. data/app/views/spina/admin/partables/images/_form.html.haml +0 -21
  134. data/app/views/spina/admin/partables/lines/_form.html.haml +0 -5
  135. data/app/views/spina/admin/partables/options/_form.html.haml +0 -7
  136. data/app/views/spina/admin/partables/photo_collections/_form.html.haml +0 -4
  137. data/app/views/spina/admin/partables/photos/_form.html.haml +0 -4
  138. data/app/views/spina/admin/partables/structures/_form.html.haml +0 -21
  139. data/app/views/spina/admin/partables/texts/_form.html.haml +0 -8
  140. data/app/views/spina/admin/structure_items/_fields.html.haml +0 -15
  141. data/app/views/spina/admin/structure_partables/attachment_collections/_form.html.haml +0 -14
  142. data/app/views/spina/admin/structure_partables/attachments/_form.html.haml +0 -13
@@ -0,0 +1,19 @@
1
+ module Spina
2
+ class Part
3
+
4
+ class << self
5
+
6
+ def all
7
+ ::Spina::PARTS
8
+ end
9
+
10
+ def register(*parts)
11
+ parts.each{|part| all << part}
12
+ end
13
+
14
+ end
15
+
16
+
17
+ end
18
+ end
19
+
@@ -1,7 +1,7 @@
1
1
  module Spina
2
2
  class Theme
3
3
 
4
- attr_accessor :name, :title, :page_parts, :structures, :view_templates, :layout_parts, :custom_pages, :plugins, :public_theme, :config, :navigations, :resources
4
+ attr_accessor :name, :title, :parts, :page_parts, :structures, :view_templates, :layout_parts, :custom_pages, :plugins, :public_theme, :config, :navigations, :resources
5
5
 
6
6
  class << self
7
7
 
@@ -1,3 +1,3 @@
1
1
  module Spina
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0.alpha"
3
3
  end
@@ -1,2 +1,2 @@
1
- /*! Sortable 1.4.2 - MIT | git://github.com/rubaxa/Sortable.git */
2
- !function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=s({},b),a[M]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1};for(var d in c)!(d in b)&&(b[d]=c[d]);W(b);for(var f in this)"_"===f.charAt(0)&&(this[f]=this[f].bind(this));this.nativeDraggable=b.forceFallback?!1:Q,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),U.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){w&&w.state!==a&&(h(w,"display",a?"none":""),!a&&w.state&&x.insertBefore(w,t),w.state=a)}function c(a,b,c){if(a){c=c||O;do if(">*"===b&&a.parentNode===c||q(a,b))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(L," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(L," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return O.defaultView&&O.defaultView.getComputedStyle?c=O.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function j(a,b,c,d,e,f,g){var h=O.createEvent("Event"),i=(a||b[M]).options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=w,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function k(a,b,c,d,e,f){var g,h,i=a[M],j=i.options.onMove;return g=O.createEvent("Event"),g.initEvent("move",!0,!0),g.to=b,g.from=a,g.dragged=c,g.draggedRect=d,g.related=e||b,g.relatedRect=f||b.getBoundingClientRect(),a.dispatchEvent(g),j&&(h=j.call(i,g)),h}function l(a){a.draggable=!1}function m(){S=!1}function n(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return(b.clientY-(d.top+d.height)>5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&q(a,b)&&c++;return c}function q(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function r(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function s(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}if("undefined"==typeof window||"undefined"==typeof window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K={},L=/\s+/g,M="Sortable"+(new Date).getTime(),N=window,O=N.document,P=N.parseInt,Q=!!("draggable"in O.createElement("div")),R=function(a){return a=O.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),S=!1,T=Math.abs,U=([].slice,[]),V=r(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(A!==c&&(z=b.scroll,A=c,z===!0)){z=c;do if(z.offsetWidth=l-j)-(h>=j),g=(h>=m-k)-(h>=k),(f||g)&&(d=N)),(K.vx!==f||K.vy!==g||K.el!==d)&&(K.el=d,K.vx=f,K.vy=g,clearInterval(K.pid),d&&(K.pid=setInterval(function(){d===N?N.scrollTo(N.pageXOffset+f*i,N.pageYOffset+g*i):(g&&(d.scrollTop+=g*i),f&&(d.scrollLeft+=f*i))},24)))}},30),W=function(a){var b=a.group;b&&"object"==typeof b||(b=a.group={name:b}),["pull","put"].forEach(function(a){a in b||(b[a]=!0)}),a.groups=" "+b.name+(b.put.join?" "+b.put.join(" "):"")+" "};return a.prototype={constructor:a,_onTapStart:function(a){var b=this,d=this.el,e=this.options,f=a.type,g=a.touches&&a.touches[0],h=(g||a).target,i=h,k=e.filter;if(!("mousedown"===f&&0!==a.button||e.disabled)&&(h=c(h,e.draggable,d))){if(E=p(h,e.draggable),"function"==typeof k){if(k.call(this,a,h,this))return j(b,i,"filter",h,d,E),void a.preventDefault()}else if(k&&(k=k.split(",").some(function(a){return a=c(i,a.trim(),d),a?(j(b,a,"filter",h,d,E),!0):void 0})))return void a.preventDefault();(!e.handle||c(i,e.handle,d))&&this._prepareDragStart(a,g,h)}},_prepareDragStart:function(a,b,c){var d,f=this,h=f.el,j=f.options,k=h.ownerDocument;c&&!t&&c.parentNode===h&&(H=a,x=h,t=c,u=t.parentNode,y=t.nextSibling,G=j.group,d=function(){f._disableDelayedDrag(),t.draggable=!0,g(t,f.options.chosenClass,!0),f._triggerDragStart(b)},j.ignore.split(",").forEach(function(a){i(t,a.trim(),l)}),e(k,"mouseup",f._onDrop),e(k,"touchend",f._onDrop),e(k,"touchcancel",f._onDrop),j.delay?(e(k,"mouseup",f._disableDelayedDrag),e(k,"touchend",f._disableDelayedDrag),e(k,"touchcancel",f._disableDelayedDrag),e(k,"mousemove",f._disableDelayedDrag),e(k,"touchmove",f._disableDelayedDrag),f._dragStartTimer=setTimeout(d,j.delay)):d())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),f(a,"mouseup",this._disableDelayedDrag),f(a,"touchend",this._disableDelayedDrag),f(a,"touchcancel",this._disableDelayedDrag),f(a,"mousemove",this._disableDelayedDrag),f(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(H={target:t,clientX:a.clientX,clientY:a.clientY},this._onDragStart(H,"touch")):this.nativeDraggable?(e(t,"dragend",this),e(x,"dragstart",this._onDragStart)):this._onDragStart(H,!0);try{O.selection?setTimeout(function(){O.selection.empty()}):window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){x&&t&&(g(t,this.options.ghostClass,!0),a.active=this,j(this,x,"start",t,x,E))},_emulateDragOver:function(){if(I){if(this._lastX===I.clientX&&this._lastY===I.clientY)return;this._lastX=I.clientX,this._lastY=I.clientY,R||h(v,"display","none");var a=O.elementFromPoint(I.clientX,I.clientY),b=a,c=" "+this.options.group.name,d=U.length;if(b)do{if(b[M]&&b[M].options.groups.indexOf(c)>-1){for(;d--;)U[d]({clientX:I.clientX,clientY:I.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);R||h(v,"display","")}},_onTouchMove:function(b){if(H){a.active||this._dragStarted(),this._appendGhost();var c=b.touches?b.touches[0]:b,d=c.clientX-H.clientX,e=c.clientY-H.clientY,f=b.touches?"translate3d("+d+"px,"+e+"px,0)":"translate("+d+"px,"+e+"px)";J=!0,I=c,h(v,"webkitTransform",f),h(v,"mozTransform",f),h(v,"msTransform",f),h(v,"transform",f),b.preventDefault()}},_appendGhost:function(){if(!v){var a,b=t.getBoundingClientRect(),c=h(t),d=this.options;v=t.cloneNode(!0),g(v,d.ghostClass,!1),g(v,d.fallbackClass,!0),h(v,"top",b.top-P(c.marginTop,10)),h(v,"left",b.left-P(c.marginLeft,10)),h(v,"width",b.width),h(v,"height",b.height),h(v,"opacity","0.8"),h(v,"position","fixed"),h(v,"zIndex","100000"),h(v,"pointerEvents","none"),d.fallbackOnBody&&O.body.appendChild(v)||x.appendChild(v),a=v.getBoundingClientRect(),h(v,"width",2*b.width-a.width),h(v,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),"clone"==G.pull&&(w=t.cloneNode(!0),h(w,"display","none"),x.insertBefore(w,t)),b?("touch"===b?(e(O,"touchmove",this._onTouchMove),e(O,"touchend",this._onDrop),e(O,"touchcancel",this._onDrop)):(e(O,"mousemove",this._onTouchMove),e(O,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,t)),e(O,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(a){var d,e,f,g=this.el,i=this.options,j=i.group,l=j.put,o=G===j,p=i.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!i.dragoverBubble&&a.stopPropagation()),J=!0,G&&!i.disabled&&(o?p||(f=!x.contains(t)):G.pull&&l&&(G.name===j.name||l.indexOf&&~l.indexOf(G.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(V(a,i,this.el),S)return;if(d=c(a.target,i.draggable,g),e=t.getBoundingClientRect(),f)return b(!0),void(w||y?x.insertBefore(t,w||y):p||x.appendChild(t));if(0===g.children.length||g.children[0]===v||g===a.target&&(d=n(g,a))){if(d){if(d.animated)return;r=d.getBoundingClientRect()}b(o),k(x,g,t,e,d,r)!==!1&&(t.contains(g)||(g.appendChild(t),u=g),this._animate(e,t),d&&this._animate(r,d))}else if(d&&!d.animated&&d!==t&&void 0!==d.parentNode[M]){B!==d&&(B=d,C=h(d),D=h(d.parentNode));var q,r=d.getBoundingClientRect(),s=r.right-r.left,z=r.bottom-r.top,A=/left|right|inline/.test(C.cssFloat+C.display)||"flex"==D.display&&0===D["flex-direction"].indexOf("row"),E=d.offsetWidth>t.offsetWidth,F=d.offsetHeight>t.offsetHeight,H=(A?(a.clientX-r.left)/s:(a.clientY-r.top)/z)>.5,I=d.nextElementSibling,K=k(x,g,t,e,d,r);if(K!==!1){if(S=!0,setTimeout(m,30),b(o),1===K||-1===K)q=1===K;else if(A){var L=t.offsetTop,N=d.offsetTop;q=L===N?d.previousElementSibling===t&&!E||H&&E:N>L}else q=I!==t&&!F||H&&F;t.contains(g)||(q&&!I?g.appendChild(t):d.parentNode.insertBefore(t,q?I:d)),u=t.parentNode,this._animate(e,t),this._animate(r,d)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(O,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(K.pid),clearTimeout(this._dragStartTimer),f(O,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(O,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(J&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),v&&v.parentNode.removeChild(v),t&&(this.nativeDraggable&&f(t,"dragend",this),l(t),g(t,this.options.ghostClass,!1),g(t,this.options.chosenClass,!1),x!==u?(F=p(t,d.draggable),F>=0&&(j(null,u,"sort",t,x,E,F),j(this,x,"sort",t,x,E,F),j(null,u,"add",t,x,E,F),j(this,x,"remove",t,x,E,F))):(w&&w.parentNode.removeChild(w),t.nextSibling!==y&&(F=p(t,d.draggable),F>=0&&(j(this,x,"update",t,x,E,F),j(this,x,"sort",t,x,E,F)))),a.active&&((null==F||-1===F)&&(F=E),j(this,x,"end",t,x,E,F),this.save()))),this._nulling()},_nulling:function(){a.active===this&&(x=t=u=v=y=w=z=A=H=I=J=F=B=C=G=a.active=null)},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?t&&(this._onDragOver(a),d(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;f>e;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||o(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&W(c)))},destroy:function(){var a=this.el;a[M]=null,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),U.splice(U.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:e,off:f,css:h,find:i,is:function(a,b){return!!c(a,b,a)},extend:s,throttle:r,closest:c,toggleClass:g,index:p},a.create=function(b,c){return new a(b,c)},a.version="1.4.2",a});
1
+ /*! Sortable 1.10.2 - MIT | git://github.com/SortableJS/Sortable.git */
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(){return(a=Object.assign||function(t){for(var e=1;e"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function P(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&h(t,e):h(t,e))||o&&t===n)return t;if(t===n)break}while(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode)}var i;return null}var f,p=/\s+/g;function k(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(p," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(p," ")}}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function v(t,e){var n="";if("string"==typeof t)n=t;else do{var o=R(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function g(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=e.left-n&&r<=e.right+n,i=a>=e.top-n&&a<=e.bottom+n;return n&&o&&i?l=t:void 0}}),l}((t=t.touches?t.touches[0]:t).clientX,t.clientY);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[j]._onDragOver(n)}}}function kt(t){z&&z.parentNode[j]._isOutsideThisEl(t.target)}function Rt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[j]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ot(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Rt.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var o in O.initializePlugins(this,t,n),n)o in e||(e[o]=n[o]);for(var i in At(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&xt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),bt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,T())}function Xt(t,e,n,o,i,r,a,l){var s,c,u=t[j],d=u.options.onMove;return!window.CustomEvent||w||E?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(u,s,a)),c}function Yt(t){t.draggable=!1}function Bt(){Dt=!1}function Ft(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Ht(t){return setTimeout(t,0)}function Lt(t){return clearTimeout(t)}Rt.prototype={constructor:Rt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ht=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(function(t){St.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&St.push(o)}}(o),!z&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled||s.isContentEditable||(l=P(l,t.draggable,o,!1))&&l.animated||Z===l)){if(J=F(l),et=F(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return W({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),K("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(t){if(t=P(s,t.trim(),o,!1))return W({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),K("filter",n,{evt:e}),!0})))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!P(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;if(n&&!z&&n.parentNode===r){var s=X(n);if(q=r,G=(z=n).parentNode,V=z.nextSibling,Z=n,ot=a.group,rt={target:Rt.dragged=z,clientX:(e||t).clientX,clientY:(e||t).clientY},ct=rt.clientX-s.left,ut=rt.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,z.style["will-change"]="all",o=function(){K("delayEnded",i,{evt:t}),Rt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!c&&i.nativeDraggable&&(z.draggable=!0),i._triggerDragStart(t,e),W({sortable:i,name:"choose",originalEvent:t}),k(z,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){g(z,t.trim(),Yt)}),u(l,"dragover",Pt),u(l,"mousemove",Pt),u(l,"touchmove",Pt),u(l,"mouseup",i._onDrop),u(l,"touchend",i._onDrop),u(l,"touchcancel",i._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,z.draggable=!0),K("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w))o();else{if(Rt.eventCanceled)return void this._onDrop();u(l,"mouseup",i._disableDelayedDrag),u(l,"touchend",i._disableDelayedDrag),u(l,"touchcancel",i._disableDelayedDrag),u(l,"mousemove",i._delayedDragTouchMoveHandler),u(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&u(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){z&&Yt(z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;d(t,"mouseup",this._disableDelayedDrag),d(t,"touchend",this._disableDelayedDrag),d(t,"touchcancel",this._disableDelayedDrag),d(t,"mousemove",this._delayedDragTouchMoveHandler),d(t,"touchmove",this._delayedDragTouchMoveHandler),d(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(z,"dragend",this),u(q,"dragstart",this._onDragStart));try{document.selection?Ht(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(vt=!1,q&&z){K("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",kt);var n=this.options;t||k(z,n.dragClass,!1),k(z,n.ghostClass,!0),Rt.active=this,t&&this._appendGhost(),W({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(at){this._lastX=at.clientX,this._lastY=at.clientY,Nt();for(var t=document.elementFromPoint(at.clientX,at.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(at.clientX,at.clientY))!==e;)e=t;if(z.parentNode[j]._isOutsideThisEl(t),e)do{if(e[j]){if(e[j]._onDragOver({clientX:at.clientX,clientY:at.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);It()}},_onTouchMove:function(t){if(rt){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=U&&v(U,!0),a=U&&r&&r.a,l=U&&r&&r.d,s=Ct&>&&b(gt),c=(i.clientX-rt.clientX+o.x)/(a||1)+(s?s[0]-Et[0]:0)/(a||1),u=(i.clientY-rt.clientY+o.y)/(l||1)+(s?s[1]-Et[1]:0)/(l||1);if(!Rt.active&&!vt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(n,a,this)&&!g.animated){if(g===z)return A(!1);if(g&&l===n.target&&(s=g),s&&(i=X(s)),!1!==Xt(q,l,z,o,s,i,n,!!s))return O(),l.appendChild(z),G=l,N(),A(!0)}else if(s.parentNode===l){i=X(s);var v,m,b,y=z.parentNode!==l,w=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(z.animated&&z.toRect||o,s.animated&&s.toRect||i,a),E=a?"top":"left",D=Y(s,"top","top")||Y(z,"top","top"),S=D?D.scrollTop:void 0;if(ht!==s&&(m=i[E],yt=!1,wt=!w&&e.invertSwap||y),0!==(v=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,h=!1;if(!a)if(l&&pt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bram Jetten
@@ -220,6 +220,20 @@ dependencies:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: 1.0.0
223
+ - !ruby/object:Gem::Dependency
224
+ name: attr_json
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
223
237
  description: CMS
224
238
  email:
225
239
  - bram@denkgroot.com
@@ -326,16 +340,20 @@ files:
326
340
  - app/assets/images/spina/arrow-right.svg
327
341
  - app/assets/images/spina/datepicker.svg
328
342
  - app/assets/images/spina/divider.svg
343
+ - app/assets/images/spina/favicon.png
329
344
  - app/assets/images/spina/media_folder_placeholder.svg
330
345
  - app/assets/images/spina/spina.png
331
346
  - app/assets/images/spina/spina.svg
332
- - app/assets/javascripts/spina/admin/account.coffee
333
347
  - app/assets/javascripts/spina/admin/application.js
334
348
  - app/assets/javascripts/spina/admin/confirm_delete.coffee.erb
349
+ - app/assets/javascripts/spina/admin/controllers/attachment_picker_controller.js
335
350
  - app/assets/javascripts/spina/admin/controllers/gallery_select_controller.js
336
351
  - app/assets/javascripts/spina/admin/controllers/image_form_controller.js
337
352
  - app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js
353
+ - app/assets/javascripts/spina/admin/controllers/media_picker_controller.js
354
+ - app/assets/javascripts/spina/admin/controllers/modal_controller.js
338
355
  - app/assets/javascripts/spina/admin/controllers/page_collapse_controller.js
356
+ - app/assets/javascripts/spina/admin/controllers/repeater_form_controller.js
339
357
  - app/assets/javascripts/spina/admin/dropdown.coffee
340
358
  - app/assets/javascripts/spina/admin/forms.coffee
341
359
  - app/assets/javascripts/spina/admin/media_gallery.coffee
@@ -359,10 +377,12 @@ files:
359
377
  - app/assets/stylesheets/spina/_ics_spina.scss
360
378
  - app/assets/stylesheets/spina/_labels.sass
361
379
  - app/assets/stylesheets/spina/_login.sass
380
+ - app/assets/stylesheets/spina/_media_picker.sass
362
381
  - app/assets/stylesheets/spina/_mixins.sass
363
382
  - app/assets/stylesheets/spina/_modal.sass
364
383
  - app/assets/stylesheets/spina/_normalize.scss
365
384
  - app/assets/stylesheets/spina/_notifications.sass
385
+ - app/assets/stylesheets/spina/_pages.sass
366
386
  - app/assets/stylesheets/spina/_sortable_lists.sass
367
387
  - app/assets/stylesheets/spina/_tables.sass
368
388
  - app/assets/stylesheets/spina/_trix_custom.sass
@@ -390,40 +410,36 @@ files:
390
410
  - app/helpers/spina/admin/admin_helper.rb
391
411
  - app/helpers/spina/admin/pages_helper.rb
392
412
  - app/helpers/spina/admin_nav_helper.rb
393
- - app/helpers/spina/files_helper.rb
413
+ - app/helpers/spina/attachments_helper.rb
394
414
  - app/helpers/spina/images_helper.rb
395
415
  - app/helpers/spina/pages_helper.rb
396
416
  - app/mailers/spina/user_mailer.rb
397
- - app/models/concerns/spina/image_collectable.rb
398
- - app/models/concerns/spina/optionable.rb
399
- - app/models/concerns/spina/part.rb
400
417
  - app/models/concerns/spina/partable.rb
418
+ - app/models/concerns/spina/translated_content.rb
401
419
  - app/models/spina/account.rb
402
420
  - app/models/spina/application_record.rb
403
421
  - app/models/spina/attachment.rb
404
- - app/models/spina/attachment_collection.rb
405
422
  - app/models/spina/current.rb
406
423
  - app/models/spina/image.rb
407
- - app/models/spina/image_collection.rb
408
- - app/models/spina/image_collections_image.rb
409
- - app/models/spina/layout_part.rb
410
- - app/models/spina/line.rb
411
424
  - app/models/spina/media_folder.rb
412
425
  - app/models/spina/navigation.rb
413
426
  - app/models/spina/navigation_item.rb
414
- - app/models/spina/option.rb
415
427
  - app/models/spina/page.rb
416
- - app/models/spina/page_part.rb
428
+ - app/models/spina/parts/attachment.rb
429
+ - app/models/spina/parts/base.rb
430
+ - app/models/spina/parts/image.rb
431
+ - app/models/spina/parts/image_collection.rb
432
+ - app/models/spina/parts/line.rb
433
+ - app/models/spina/parts/option.rb
434
+ - app/models/spina/parts/repeater.rb
435
+ - app/models/spina/parts/repeater_content.rb
436
+ - app/models/spina/parts/text.rb
417
437
  - app/models/spina/resource.rb
418
438
  - app/models/spina/rewrite_rule.rb
419
439
  - app/models/spina/setting.rb
420
- - app/models/spina/structure.rb
421
- - app/models/spina/structure_item.rb
422
- - app/models/spina/structure_part.rb
423
- - app/models/spina/text.rb
424
440
  - app/models/spina/user.rb
441
+ - app/presenters/spina/content_presenter.rb
425
442
  - app/presenters/spina/menu_presenter.rb
426
- - app/views/dummy/show.html.haml
427
443
  - app/views/layouts/spina/admin/admin.html.haml
428
444
  - app/views/layouts/spina/admin/media_library.html.haml
429
445
  - app/views/layouts/spina/admin/pages.html.haml
@@ -436,30 +452,25 @@ files:
436
452
  - app/views/spina/admin/accounts/social.html.haml
437
453
  - app/views/spina/admin/accounts/style.html.haml
438
454
  - app/views/spina/admin/attachments/_attachment.html.haml
439
- - app/views/spina/admin/attachments/_attachment_collection.html.haml
440
- - app/views/spina/admin/attachments/_select.html.haml
441
- - app/views/spina/admin/attachments/_select_collection.html.haml
442
455
  - app/views/spina/admin/attachments/create.js.erb
443
456
  - app/views/spina/admin/attachments/index.html.haml
444
- - app/views/spina/admin/attachments/insert.js.erb
445
- - app/views/spina/admin/attachments/insert_collection.js.coffee
446
- - app/views/spina/admin/attachments/select.js.erb
447
- - app/views/spina/admin/attachments/select_collection.js.erb
448
- - app/views/spina/admin/image_collections/_image_collection.html.haml
449
457
  - app/views/spina/admin/images/_form.html.haml
450
458
  - app/views/spina/admin/images/_image.html.haml
451
459
  - app/views/spina/admin/images/create.js.erb
452
460
  - app/views/spina/admin/images/index.html.haml
453
461
  - app/views/spina/admin/images/index.js.erb
454
- - app/views/spina/admin/layout_partables/lines/_form.html.haml
455
462
  - app/views/spina/admin/media_folders/_form.html.haml
456
463
  - app/views/spina/admin/media_folders/_media_folder.html.haml
457
464
  - app/views/spina/admin/media_folders/edit.js.erb
458
465
  - app/views/spina/admin/media_folders/new.js.erb
459
466
  - app/views/spina/admin/media_folders/show.html.haml
467
+ - app/views/spina/admin/media_picker/_image.html.haml
468
+ - app/views/spina/admin/media_picker/_media_picker.html.haml
469
+ - app/views/spina/admin/media_picker/_media_picker_grid.html.haml
460
470
  - app/views/spina/admin/media_picker/_modal.html.haml
461
471
  - app/views/spina/admin/media_picker/infinite_scroll.js.erb
462
472
  - app/views/spina/admin/media_picker/select.js.erb
473
+ - app/views/spina/admin/media_picker/show.html.haml
463
474
  - app/views/spina/admin/media_picker/show.js.erb
464
475
  - app/views/spina/admin/navigations/_navigation_item_nested_list.html.haml
465
476
  - app/views/spina/admin/navigations/_page.html.haml
@@ -477,16 +488,15 @@ files:
477
488
  - app/views/spina/admin/pages/index.html.haml
478
489
  - app/views/spina/admin/pages/new.html.haml
479
490
  - app/views/spina/admin/pages/update.js.coffee
480
- - app/views/spina/admin/partables/attachment_collections/_form.html.haml
481
- - app/views/spina/admin/partables/attachments/_form.html.haml
482
- - app/views/spina/admin/partables/image_collections/_form.html.haml
483
- - app/views/spina/admin/partables/images/_form.html.haml
484
- - app/views/spina/admin/partables/lines/_form.html.haml
485
- - app/views/spina/admin/partables/options/_form.html.haml
486
- - app/views/spina/admin/partables/photo_collections/_form.html.haml
487
- - app/views/spina/admin/partables/photos/_form.html.haml
488
- - app/views/spina/admin/partables/structures/_form.html.haml
489
- - app/views/spina/admin/partables/texts/_form.html.haml
491
+ - app/views/spina/admin/parts/attachments/_form.html.haml
492
+ - app/views/spina/admin/parts/image_collections/_fields.html.haml
493
+ - app/views/spina/admin/parts/image_collections/_form.html.haml
494
+ - app/views/spina/admin/parts/images/_form.html.haml
495
+ - app/views/spina/admin/parts/lines/_form.html.haml
496
+ - app/views/spina/admin/parts/options/_form.html.haml
497
+ - app/views/spina/admin/parts/repeaters/_fields.html.haml
498
+ - app/views/spina/admin/parts/repeaters/_form.html.haml
499
+ - app/views/spina/admin/parts/texts/_form.html.haml
490
500
  - app/views/spina/admin/password_resets/edit.html.haml
491
501
  - app/views/spina/admin/password_resets/new.html.haml
492
502
  - app/views/spina/admin/resources/edit.html.haml
@@ -499,9 +509,6 @@ files:
499
509
  - app/views/spina/admin/shared/_notifications.html.haml
500
510
  - app/views/spina/admin/shared/_primary_navigation.html.haml
501
511
  - app/views/spina/admin/shared/_rich_text_field.html.haml
502
- - app/views/spina/admin/structure_items/_fields.html.haml
503
- - app/views/spina/admin/structure_partables/attachment_collections/_form.html.haml
504
- - app/views/spina/admin/structure_partables/attachments/_form.html.haml
505
512
  - app/views/spina/admin/users/_form.html.haml
506
513
  - app/views/spina/admin/users/edit.html.haml
507
514
  - app/views/spina/admin/users/index.html.haml
@@ -537,6 +544,9 @@ files:
537
544
  - db/migrate/10_create_spina_image_collections.rb
538
545
  - db/migrate/11_create_spina_resources.rb
539
546
  - db/migrate/12_add_url_title_to_spina_page_translations.rb
547
+ - db/migrate/13_add_json_attributes_to_spina_accounts.rb
548
+ - db/migrate/14_add_json_attributes_to_spina_pages.rb
549
+ - db/migrate/15_add_slug_to_spina_resources.rb
540
550
  - db/migrate/1_create_spina_tables.rb
541
551
  - db/migrate/2_create_spina_translation_tables.rb
542
552
  - db/migrate/3_create_spina_navigations.rb
@@ -565,8 +575,10 @@ files:
565
575
  - lib/generators/spina/templates/config/initializers/themes/default.rb
566
576
  - lib/generators/spina/templates/config/initializers/themes/demo.rb
567
577
  - lib/spina.rb
578
+ - lib/spina/attr_json_spina_parts_model.rb
568
579
  - lib/spina/engine.rb
569
580
  - lib/spina/fontcustom/_ics_spina.scss
581
+ - lib/spina/part.rb
570
582
  - lib/spina/plugin.rb
571
583
  - lib/spina/railtie.rb
572
584
  - lib/spina/theme.rb
@@ -596,9 +608,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
596
608
  version: '0'
597
609
  required_rubygems_version: !ruby/object:Gem::Requirement
598
610
  requirements:
599
- - - ">="
611
+ - - ">"
600
612
  - !ruby/object:Gem::Version
601
- version: '0'
613
+ version: 1.3.1
602
614
  requirements: []
603
615
  rubygems_version: 3.0.3
604
616
  signing_key:
@@ -1,16 +0,0 @@
1
- ready = ->
2
- if $('.account-theme').length > 0
3
- layout_parts = $('.account-theme').data('layout-parts')
4
- show_layout_parts(layout_parts)
5
-
6
- $(document).on 'turbolinks:load', ready
7
-
8
- $(document).on 'change', '.account-theme select', ->
9
- layout_parts = $(this).find('option:selected').data('layout-parts').split(" ")
10
- show_layout_parts(layout_parts)
11
-
12
- show_layout_parts = (layout_parts) ->
13
- $('tr.layout-part').hide()
14
- for layout_part in layout_parts
15
- if layout_part
16
- $('tr.layout-part[data-name=' + layout_part + ']').show()
@@ -1,23 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module Spina
4
- module ImageCollectable
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- attr_reader :image_tokens, :image_positions
9
- end
10
-
11
- def image_tokens=(ids)
12
- self.image_ids = ids.split(",")
13
- end
14
-
15
- def image_positions=(positions)
16
- positions = positions.split(",")
17
- self.image_collections_images.each do |image|
18
- image.position = positions.index(image.image.try(:id).try(:to_s))
19
- end
20
- end
21
-
22
- end
23
- end
@@ -1,12 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module Spina
4
- module Optionable
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- attr_accessor :options
9
- end
10
-
11
- end
12
- end
@@ -1,38 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module Spina
4
- module Part
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- attr_accessor :position
9
-
10
- validates :name, :title, :partable_type, presence: true
11
-
12
- after_save -> { partable.try(:save) }
13
-
14
- scope :sorted, -> { order(:position) }
15
- end
16
-
17
- def to_s
18
- name
19
- end
20
-
21
- def content
22
- (partable || partable_type.constantize.new).content
23
- end
24
-
25
- def value
26
- partable.try(:value)
27
- end
28
-
29
- def partable_attributes=(attributes)
30
- if partable.present?
31
- partable.assign_attributes(attributes)
32
- else
33
- self.partable = self.partable_type.constantize.new(attributes)
34
- end
35
- end
36
-
37
- end
38
- end
@@ -1,20 +0,0 @@
1
- module Spina
2
- class AttachmentCollection < ApplicationRecord
3
-
4
- has_one :page_part, as: :page_partable
5
- has_many :structure_parts, as: :structure_partable
6
- has_and_belongs_to_many :attachments, join_table: 'spina_attachment_collections_attachments'
7
-
8
- attr_reader :attachment_tokens
9
- accepts_nested_attributes_for :attachments, allow_destroy: true
10
-
11
- def content
12
- self
13
- end
14
-
15
- def attachment_tokens=(ids)
16
- self.attachment_ids = ids.split(",")
17
- end
18
-
19
- end
20
- end
@@ -1,23 +0,0 @@
1
- module Spina
2
- class ImageCollection < ApplicationRecord
3
- include ImageCollectable
4
-
5
- has_one :page_part, as: :page_partable
6
- has_many :image_collections_images, autosave: true
7
- has_many :images, through: :image_collections_images
8
- has_many :structure_parts, as: :structure_partable
9
-
10
- accepts_nested_attributes_for :images, allow_destroy: true
11
-
12
- def content
13
- self
14
- end
15
-
16
- alias_method :old_update, :update
17
- def update(attributes)
18
- self.images.clear if attributes.reject{|key,value| key == "id" }.blank?
19
- old_update(attributes)
20
- end
21
-
22
- end
23
- end
@@ -1,6 +0,0 @@
1
- module Spina
2
- class ImageCollectionsImage < ApplicationRecord
3
- belongs_to :image
4
- belongs_to :image_collection
5
- end
6
- end
@@ -1,22 +0,0 @@
1
- module Spina
2
- class LayoutPart < ApplicationRecord
3
- include Part
4
- include Optionable
5
-
6
- belongs_to :account
7
- belongs_to :layout_partable, polymorphic: true
8
-
9
- accepts_nested_attributes_for :layout_partable, allow_destroy: true
10
-
11
- validates_uniqueness_of :name, scope: :account_id
12
-
13
- alias_attribute :partable, :layout_partable
14
- alias_attribute :partable_type, :layout_partable_type
15
- alias_method :layout_partable_attributes=, :partable_attributes=
16
-
17
- def position(theme)
18
- layout_parts = theme.layout_template[:layout_parts]
19
- layout_parts.index { |layout_part| layout_part == self.name }.to_i
20
- end
21
- end
22
- end
@@ -1,10 +0,0 @@
1
- module Spina
2
- class Line < ApplicationRecord
3
- extend Mobility
4
- translates :content, fallbacks: true
5
-
6
- has_many :page_parts, as: :page_partable
7
- has_many :layout_parts, as: :layout_partable
8
- has_many :structure_parts, as: :structure_partable
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- module Spina
2
- class Option < ApplicationRecord
3
- has_one :page_part, as: :page_partable
4
- has_one :layout_part, as: :layout_partable
5
- has_one :structure_part, as: :structure_partable
6
-
7
- def content
8
- I18n.t(['options',part.name,value].compact.join('.'))
9
- end
10
-
11
- private
12
-
13
- def part
14
- page_part || layout_part || structure_part
15
- end
16
- end
17
- end