card-mod-format 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ae4393c5ae29783e57eeb17d4840da0af745fa793c4d5f13dec9472ac7afe4d
4
- data.tar.gz: 24d7a9768c4865c532ba0da5e0a11841e6d3ddab744dbcaab25ab283a7c0a6a9
3
+ metadata.gz: 67ed16385e7b6824d96cea15a16d591ccfa5145e76b2e465055c511b6cbd488c
4
+ data.tar.gz: 16851adce8cd65675b4cf79cee69da95665a9aad37815102db3d857f5887e418
5
5
  SHA512:
6
- metadata.gz: 158b8bb6ba805b03972fca92ab9c31642f21ce53927213459d200209b2732e4121ef7bbf67b46a3289ca340dc017231ac10ac613085bda1f4d729d2b4713ff36
7
- data.tar.gz: f2e54e5296fe3826060a917c74dc514f0843de103c8b0b879ff66c8f18e7ab2acfcff8df147e6864973d401c67ba6cb609fa06b6f977f1ab254e3ee30c7466a5
6
+ metadata.gz: c1dbc1953803ea4c8883aaaf02c433fa1139e57a11e86328fd5a8573f6ec788cf04cf5ff662275cbed57de40bdec8d2b2c0a07130a9d2970bef2f7cf5810f255
7
+ data.tar.gz: 262193d1819548a43c1956c4a7b408bc13f28e60cae40b6744b345ddd0af06bf2a4ccff1cfb90a0cdac489b45037ee5123692b07aa06bd3db2009ce14fad6f2a
@@ -27,7 +27,7 @@ window.decko =
27
27
  #~~~~~ ( EVENTS )
28
28
 
29
29
  $(window).ready ->
30
- $.ajaxSetup cache: false
30
+ # $.ajaxSetup cache: false
31
31
 
32
32
  $('body').on 'click', '._confirm', ->
33
33
  confirm $(this).data('confirm-msg') || 'Are you sure?'
@@ -61,11 +61,9 @@ jQuery.fn.extend
61
61
  slotReload: (url) ->
62
62
  @each -> $(this)._slotReloadSingle url
63
63
 
64
- slotReloading: ()->
65
- # TODO: add default spinner behavior
66
-
67
- slotLoadingComplete: ()->
68
- # TODO: add default spinner behavior
64
+ startLoading: () ->
65
+ stopLoading: () ->
66
+ # TODO: add default spinner behavior
69
67
 
70
68
  slotUpdate: (newContent, mode) ->
71
69
  mode ||= "replace"
@@ -120,7 +118,7 @@ jQuery.fn.extend
120
118
  # that's where handleRemote gets the url from
121
119
  # .attr(href, url) only works for anchors
122
120
  $.rails.handleRemote $slot
123
- $slot.slotReloading()
121
+ $slot.startLoading()
124
122
 
125
123
  # ~~~~~~~~~~~~~~~~~~~~~~~~
126
124
  # "private" helper methods
@@ -65,8 +65,10 @@
65
65
  #
66
66
  #
67
67
  $(window).ready ->
68
- $('body').on 'ajax:send', '.slotter', (event, data) ->
69
- $(this).slot().slotReloading()
68
+ $('body').on 'ajax:send', '.slotter', () ->
69
+ slot = $(this).slot()
70
+ slot.hideErrorResponse()
71
+ slot.startLoading()
70
72
 
71
73
  $('body').on 'ajax:success', '.slotter', (event, data) ->
72
74
  $(this).slotterSuccess event, data
@@ -74,8 +76,8 @@ $(window).ready ->
74
76
  $('body').on 'ajax:error', '.slotter', (event, xhr) ->
75
77
  $(this).showErrorResponse xhr.status, xhr.responseText
76
78
 
77
- $('body').on 'ajax:complete', '.slotter', (event, data) ->
78
- $(this).slot().slotLoadingComplete()
79
+ $('body').on 'ajax:complete', '.slotter', () ->
80
+ $(this).slot().stopLoading()
79
81
 
80
82
  $('body').on 'click', 'button.slotter', ->
81
83
  return false if !$.rails.allowAction $(this)
@@ -184,6 +186,9 @@ jQuery.fn.extend
184
186
  @slot().find('.new-current-revision-id').text()
185
187
  )
186
188
 
189
+ hideErrorResponse: () ->
190
+ $(this).find(".card-notice").hide()
191
+
187
192
  updateModalOrigin: () ->
188
193
  if @overlaySlot()
189
194
  overlayOrigin = @slotOrigin("overlay")
@@ -53,13 +53,13 @@ i.call(this)}),!1!==this._start(e)&&this._repeat(null,t(e.currentTarget).hasClas
53
53
  */
54
54
  !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(window.jQuery)}(function(e){"use strict";var t=0,r=e,n="parseJSON";"JSON"in window&&"parse"in JSON&&(r=JSON,n="parse"),e.ajaxTransport("iframe",function(r){if(r.async){var n,a,o,i=r.initialIframeSrc||"javascript:false;";return{send:function(p,f){(n=e('<form style="display:none;"></form>')).attr("accept-charset",r.formAcceptCharset),o=/\?/.test(r.url)?"&":"?","DELETE"===r.type?(r.url=r.url+o+"_method=DELETE",r.type="POST"):"PUT"===r.type?(r.url=r.url+o+"_method=PUT",r.type="POST"):"PATCH"===r.type&&(r.url=r.url+o+"_method=PATCH",r.type="POST"),a=e('<iframe src="'+i+'" name="iframe-transport-'+(t+=1)+'"></iframe>').on("load",function(){var t,o=e.isArray(r.paramName)?r.paramName:[r.paramName];a.off("load").on("load",function(){var t;try{if(!(t=a.contents()).length||!t[0].firstChild)throw new Error}catch(r){t=undefined}f(200,"success",{iframe:t}),e('<iframe src="'+i+'"></iframe>').appendTo(n),window.setTimeout(function(){n.remove()},0)}),n.prop("target",a.prop("name")).prop("action",r.url).prop("method",r.type),r.formData&&e.each(r.formData,function(t,r){e('<input type="hidden"/>').prop("name",r.name).val(r.value).appendTo(n)}),r.fileInput&&r.fileInput.length&&"POST"===r.type&&(t=r.fileInput.clone(),r.fileInput.after(function(e){return t[e]}),r.paramName&&r.fileInput.each(function(t){e(this).prop("name",o[t]||r.paramName)}),n.append(r.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data"),r.fileInput.removeAttr("form")),window.setTimeout(function(){n.submit(),t&&t.length&&r.fileInput.each(function(r,n){var a=e(t[r]);e(n).prop("name",a.prop("name")).attr("form",a.attr("form")),a.replaceWith(n)})},0)}),n.append(a).appendTo(document.body)},abort:function(){a&&a.off("load").prop("src",i),n&&n.remove()}}}}),e.ajaxSetup({converters:{"iframe text":function(t){return t&&e(t[0].body).text()},"iframe json":function(t){return t&&r[n](e(t[0].body).text())},"iframe html":function(t){return t&&e(t[0].body).html()},"iframe xml":function(t){var r=t&&t[0];return r&&e.isXMLDoc(r)?r:e.parseXML(r.XMLDocument&&r.XMLDocument.xml||e(r.body).html())},"iframe script":function(t){return t&&e.globalEval(e(t[0].body).text())}}})});
55
55
  // decko.js.coffee
56
- (function(){window.decko={rootUrl:"",path:function(n){return n.match(/^\/|:\/\//)?n:decko.rootUrl+n},editors:{init:{},content:{},add:function(n,o,t){return decko.editors.init[n]=o,decko.editors.content[n]=t}},warn:function(n){if("undefined"!=typeof console&&null!==console)return console.log(n)},snakeCase:function(n){return n.replace(/([a-z])([A-Z])/g,function(n){return n[0]+"_"+n[1].toLowerCase()})}},$(window).ready(function(){return $.ajaxSetup({cache:!1}),$("body").on("click","._confirm",function(){return confirm($(this).data("confirm-msg")||"Are you sure?")})})}).call(this);
56
+ (function(){window.decko={rootUrl:"",path:function(n){return n.match(/^\/|:\/\//)?n:decko.rootUrl+n},editors:{init:{},content:{},add:function(n,o,t){return decko.editors.init[n]=o,decko.editors.content[n]=t}},warn:function(n){if("undefined"!=typeof console&&null!==console)return console.log(n)},snakeCase:function(n){return n.replace(/([a-z])([A-Z])/g,function(n){return n[0]+"_"+n[1].toLowerCase()})}},$(window).ready(function(){return $("body").on("click","._confirm",function(){return confirm($(this).data("confirm-msg")||"Are you sure?")})})}).call(this);
57
57
  // decko_jquery.js.coffee
58
58
  (function(){jQuery.fn.extend({findCard:function(n){return this.find("[data-card-id='"+n+"']")},isMain:function(){return this.slot().parent("#main")[0]},cardMark:function(){return this.data("cardId")?"~"+this.data("cardId"):this.data("cardName")},isMainOrMainModal:function(){var n;return(n=$(this)).closest(".modal")[0]&&(n=n.slotOrigin("modal")),n&&n.isMain()},notify:function(n,i){var a,t,d;return(t=(d=this.slot(i)).find(".card-notice"))[0]||(t=$('<div class="card-notice"></div>'),(a=d.find(".card-form"))[0]?$(a[0]).append(t):d.append(t)),t.html(n),t.show("blind")}})}).call(this);
59
59
  // slot.js.coffee
60
- (function(){var t,o,s;decko.slot={path:function(t,s,l){var e;return e=o(s),null!=l&&(e.slotter_mode=l),decko.path(t)+(t.match(/\?/)?"&":"?")+$.param(e)},ready:function(t){return $("document").ready(function(){return $("body").on("decko.slot.ready",".card-slot",function(o,s){return o.stopPropagation(),null!=s?t.call(this,$(this),$(s)):t.call(this,$(this))})})},destroy:function(t){return $("document").ready(function(){return $("body").on("decko.slot.destroy",".card-slot, ._modal-slot",function(o){return o.stopPropagation(),t.call(this,$(this))})})}},jQuery.fn.extend({isSlot:function(){return $(this).hasClass("card-slot")},triggerSlotReady:function(t){return this.isSlot()&&this.trigger("decko.slot.ready",t),this.find(".card-slot").trigger("decko.slot.ready",t)},slot:function(t,o){return null==t&&(t="success"),null==o&&(o="replace"),"modal"===o?this.modalSlot():this._slotSelect("slot-"+t+"-selector")||this._slotSelect("slot-selector")||this.closest(".card-slot")},slotUrl:function(){var t;return t=$(this),decko.slot.path(t.cardMark()+"/"+t.data("slot").view)},slotFind:function(t){switch(t){case"modal-origin":return this.slotOrigin("modal");case"overlay-origin":return this.slotOrigin("overlay");default:return s(this.closest(t),this.closest(".card-slot"),t)}},slotClear:function(){return this.trigger("decko.slot.destroy"),this.empty()},slotOrigin:function(t){var o,s;return s=this.closest("[data-"+t+"-origin-slot-id]").data(t+"-origin-slot-id"),(o=$("[data-slot-id="+s+"]")).length>0?o:decko.warn("couldn't find origin with slot id "+s)},slotReload:function(t){return this.each(function(){return $(this)._slotReloadSingle(t)})},slotReloading:function(){},slotLoadingComplete:function(){},slotUpdate:function(t,o){return o||(o="replace"),this.slotContent(t,o,$(this))},slotContent:function(t,o,s){var l;return"string"==typeof(l=$(t).length>0&&$(t)||t)?this.slot("success",o)._slotFillOrReplace(l,s):(l.hasClass("_overlay")?o="overlay":l.hasClass("_modal")&&(o="modal"),this.slot("success",o)._slotContentFromElement(l,o,s)),l},_slotContentFromElement:function(t,o,s){var l;return"overlay"===o?this.addOverlay(t,s):t.hasClass("_modal-slot")||"modal"===o?t.showAsModal(s):((l=this.data("slot-id"))&&t.attr("data-slot-id",l),this.trigger("decko.slot.destroy"),this._slotFillOrReplace(t,s),decko.contentLoaded(t,s))},_slotFillOrReplace:function(t,o){return this.hasClass("_fixed-slot")?this.html(t):this.replaceWith(t),decko.contentLoaded(this,o)},_slotSelect:function(t){var o,s;if(o=this.data(t))return(s=this.slotFind(o))&&s[0]&&s},_slotReloadSingle:function(t){var o;return o=$(this),null==t&&(t=o.slotUrl()),o.addClass("slotter"),o.data("url",t),o.data("remote",!0),o.attr("href",t),this[0].href=t,$.rails.handleRemote(o),o.slotReloading()}}),o=function(o){var s,l,e;return l={},null!=(s=$("#main").children(".card-slot").data("cardName"))&&(l.main=s),o&&(o.isMain()&&(l.is_main=!0),null!=(e=o.data("slot"))&&(t(e,l,"slot"),e.type&&(l.type=e.type))),l},t=function(o,s,l){return $.each(o,function(o,e){var n;return n=l+"["+decko.snakeCase(o)+"]","items"===o?t(e,s,n):s[n]=e})},s=function(t,o,s){for(;0===t.length&&o.length>0;)t=$(o).find(s),o=$(o).parent().closest(".card-slot");return 0===t.length?$(s):t}}).call(this);
60
+ (function(){var t,o,s;decko.slot={path:function(t,s,e){var l;return l=o(s),null!=e&&(l.slotter_mode=e),decko.path(t)+(t.match(/\?/)?"&":"?")+$.param(l)},ready:function(t){return $("document").ready(function(){return $("body").on("decko.slot.ready",".card-slot",function(o,s){return o.stopPropagation(),null!=s?t.call(this,$(this),$(s)):t.call(this,$(this))})})},destroy:function(t){return $("document").ready(function(){return $("body").on("decko.slot.destroy",".card-slot, ._modal-slot",function(o){return o.stopPropagation(),t.call(this,$(this))})})}},jQuery.fn.extend({isSlot:function(){return $(this).hasClass("card-slot")},triggerSlotReady:function(t){return this.isSlot()&&this.trigger("decko.slot.ready",t),this.find(".card-slot").trigger("decko.slot.ready",t)},slot:function(t,o){return null==t&&(t="success"),null==o&&(o="replace"),"modal"===o?this.modalSlot():this._slotSelect("slot-"+t+"-selector")||this._slotSelect("slot-selector")||this.closest(".card-slot")},slotUrl:function(){var t;return t=$(this),decko.slot.path(t.cardMark()+"/"+t.data("slot").view)},slotFind:function(t){switch(t){case"modal-origin":return this.slotOrigin("modal");case"overlay-origin":return this.slotOrigin("overlay");default:return s(this.closest(t),this.closest(".card-slot"),t)}},slotClear:function(){return this.trigger("decko.slot.destroy"),this.empty()},slotOrigin:function(t){var o,s;return s=this.closest("[data-"+t+"-origin-slot-id]").data(t+"-origin-slot-id"),(o=$("[data-slot-id="+s+"]")).length>0?o:decko.warn("couldn't find origin with slot id "+s)},slotReload:function(t){return this.each(function(){return $(this)._slotReloadSingle(t)})},startLoading:function(){},stopLoading:function(){},slotUpdate:function(t,o){return o||(o="replace"),this.slotContent(t,o,$(this))},slotContent:function(t,o,s){var e;return"string"==typeof(e=$(t).length>0&&$(t)||t)?this.slot("success",o)._slotFillOrReplace(e,s):(e.hasClass("_overlay")?o="overlay":e.hasClass("_modal")&&(o="modal"),this.slot("success",o)._slotContentFromElement(e,o,s)),e},_slotContentFromElement:function(t,o,s){var e;return"overlay"===o?this.addOverlay(t,s):t.hasClass("_modal-slot")||"modal"===o?t.showAsModal(s):((e=this.data("slot-id"))&&t.attr("data-slot-id",e),this.trigger("decko.slot.destroy"),this._slotFillOrReplace(t,s),decko.contentLoaded(t,s))},_slotFillOrReplace:function(t,o){return this.hasClass("_fixed-slot")?this.html(t):this.replaceWith(t),decko.contentLoaded(this,o)},_slotSelect:function(t){var o,s;if(o=this.data(t))return(s=this.slotFind(o))&&s[0]&&s},_slotReloadSingle:function(t){var o;return o=$(this),null==t&&(t=o.slotUrl()),o.addClass("slotter"),o.data("url",t),o.data("remote",!0),o.attr("href",t),this[0].href=t,$.rails.handleRemote(o),o.startLoading()}}),o=function(o){var s,e,l;return e={},null!=(s=$("#main").children(".card-slot").data("cardName"))&&(e.main=s),o&&(o.isMain()&&(e.is_main=!0),null!=(l=o.data("slot"))&&(t(l,e,"slot"),l.type&&(e.type=l.type))),e},t=function(o,s,e){return $.each(o,function(o,l){var n;return n=e+"["+decko.snakeCase(o)+"]","items"===o?t(l,s,n):s[n]=l})},s=function(t,o,s){for(;0===t.length&&o.length>0;)t=$(o).find(s),o=$(o).parent().closest(".card-slot");return 0===t.length?$(s):t}}).call(this);
61
61
  // slotter.js.coffee
62
- (function(){$(window).ready(function(){return $("body").on("ajax:send",".slotter",function(){return $(this).slot().slotReloading()}),$("body").on("ajax:success",".slotter",function(t,o){return $(this).slotterSuccess(t,o)}),$("body").on("ajax:error",".slotter",function(t,o){return $(this).showErrorResponse(o.status,o.responseText)}),$("body").on("ajax:complete",".slotter",function(){return $(this).slot().slotLoadingComplete()}),$("body").on("click","button.slotter",function(){return!!$.rails.allowAction($(this))&&$.rails.handleRemote($(this))}),$("body").on("click",'[data-bs-dismiss="overlay"]',function(){return $(this).slotFind(".card-slot._overlay").removeOverlay()}),$("body").on("click","._close-overlay-on-success",function(){return $(this).closeOnSuccess("overlay")}),$("body").on("click","._close-modal-on-success",function(){return $(this).closeOnSuccess("modal")}),$("body").on("click","._close-on-success",function(){return $(this).closeOnSuccess()}),$("body").on("click","._update-origin",function(){return $(this).closest(".slotter").data("slotter-mode","update-origin")}),$("body").on("submit","form.slotter",function(){var t;if((t=$(this)).data("main-success")&&t.isMainOrMainModal())return t.mainSuccess()}),$("body").on("ajax:beforeSend",".slotter",function(t,o,s){return $(this).slotterBeforeSend(s)}),$("body").on("ajax:beforeSend",".card-slot",function(t){return t.stopPropagation()}),$("body").on("ajax:send",".card-slot",function(t){return t.stopPropagation()})}),jQuery.fn.extend({mainSuccess:function(){var t;return t=$(this),$.each(t.data("main-success"),function(o,s){var e,i;return i="[name=success\\["+o+"\\]]",(e=t.find(i))[0]||(e=$('<input type="hidden" name="success['+o+']"/>'),t.append(e)),e.val(s)})},slotterSuccess:function(t,o){var s,e,i;if(this.hasClass("slotter")){if(!t.slotSuccessful)return this.showSuccessResponse(o,this.data("slotter-mode")),this.hasClass("_close-overlay")&&this.removeOverlay(),this.hasClass("_close-modal")&&this.closest(".modal").modal("hide"),this.hasClass("card-paging-link")&&(i=this.slot().offset().top,$("body").scrollTop(i)),this.data("update-foreign-slot")&&(s=this.slotFind(this.data("update-foreign-slot")),e=this.data("update-foreign-slot-url"),s.slotReload(e)),this.data("original-slotter-mode")&&this.attr("data-slotter-mode",this.data("original-slotter-mode")),this.data("original-slot-selector")&&this.attr("data-slot-selector",this.data("original-slot-selector")),t.slotSuccessful=!0}else console.log("warning: slotterSuccess called on non-slotter element "+this)},showSuccessResponse:function(t,o){if(t.redirect)return window.location=t.redirect;if(t.reload)return window.location.reload(!0);switch(o){case"silent-success":break;case"update-modal-origin":return this.updateModalOrigin();case"update-origin":return this.updateOrigin();default:return this.slotUpdate(t,o)}},showErrorResponse:function(t,o){return 403===t?$(o).showAsModal($(this)):900===t?$(o).showAsModal($(this)):(this.notify(o,"error"),409===t?this.slot().find(".current_revision_id").val(this.slot().find(".new-current-revision-id").text()):void 0)},updateModalOrigin:function(){return this.overlaySlot()?this.slotOrigin("overlay").updateOrigin():this.closest("#modal-container")[0]?this.updateOrigin():void 0},updateOrigin:function(){var t,o;if(null!=(o=this.overlaySlot()?"overlay":this.closest("#modal-container")[0]?"modal":void 0))return(t=this.slotOrigin(o))&&null!=t[0]?t.slotReload():void 0},registerAsOrigin:function(t,o){return o.hasClass("_modal-slot")&&(o=o.find(".modal-body")),o.attr("data-"+t+"-origin-slot-id",this.slot().data("slot-id"))},closeOnSuccess:function(t){var o;return o=this.closest(".slotter"),null==t&&(t=this.isInOverlay()?"overlay":"modal"),o.addClass("_close-"+t)},slotterBeforeSend:function(t){var o;if(o=this.slotterMode(),!t.noSlotParams&&!t.url.match(/home_view/)&&"modal"!==o&&"override"!==o)return t.url=decko.slot.path(t.url,this.slot(),o)},slotterMode:function(){var t;if(null!=(t=this.data("slotter-mode"))&&(!t.match(/origin/)||this.slotOrigin()))return t}})}).call(this);
62
+ (function(){$(window).ready(function(){return $("body").on("ajax:send",".slotter",function(){var t;return(t=$(this).slot()).hideErrorResponse(),t.startLoading()}),$("body").on("ajax:success",".slotter",function(t,o){return $(this).slotterSuccess(t,o)}),$("body").on("ajax:error",".slotter",function(t,o){return $(this).showErrorResponse(o.status,o.responseText)}),$("body").on("ajax:complete",".slotter",function(){return $(this).slot().stopLoading()}),$("body").on("click","button.slotter",function(){return!!$.rails.allowAction($(this))&&$.rails.handleRemote($(this))}),$("body").on("click",'[data-bs-dismiss="overlay"]',function(){return $(this).slotFind(".card-slot._overlay").removeOverlay()}),$("body").on("click","._close-overlay-on-success",function(){return $(this).closeOnSuccess("overlay")}),$("body").on("click","._close-modal-on-success",function(){return $(this).closeOnSuccess("modal")}),$("body").on("click","._close-on-success",function(){return $(this).closeOnSuccess()}),$("body").on("click","._update-origin",function(){return $(this).closest(".slotter").data("slotter-mode","update-origin")}),$("body").on("submit","form.slotter",function(){var t;if((t=$(this)).data("main-success")&&t.isMainOrMainModal())return t.mainSuccess()}),$("body").on("ajax:beforeSend",".slotter",function(t,o,s){return $(this).slotterBeforeSend(s)}),$("body").on("ajax:beforeSend",".card-slot",function(t){return t.stopPropagation()}),$("body").on("ajax:send",".card-slot",function(t){return t.stopPropagation()})}),jQuery.fn.extend({mainSuccess:function(){var t;return t=$(this),$.each(t.data("main-success"),function(o,s){var e,i;return i="[name=success\\["+o+"\\]]",(e=t.find(i))[0]||(e=$('<input type="hidden" name="success['+o+']"/>'),t.append(e)),e.val(s)})},slotterSuccess:function(t,o){var s,e,i;if(this.hasClass("slotter")){if(!t.slotSuccessful)return this.showSuccessResponse(o,this.data("slotter-mode")),this.hasClass("_close-overlay")&&this.removeOverlay(),this.hasClass("_close-modal")&&this.closest(".modal").modal("hide"),this.hasClass("card-paging-link")&&(i=this.slot().offset().top,$("body").scrollTop(i)),this.data("update-foreign-slot")&&(s=this.slotFind(this.data("update-foreign-slot")),e=this.data("update-foreign-slot-url"),s.slotReload(e)),this.data("original-slotter-mode")&&this.attr("data-slotter-mode",this.data("original-slotter-mode")),this.data("original-slot-selector")&&this.attr("data-slot-selector",this.data("original-slot-selector")),t.slotSuccessful=!0}else console.log("warning: slotterSuccess called on non-slotter element "+this)},showSuccessResponse:function(t,o){if(t.redirect)return window.location=t.redirect;if(t.reload)return window.location.reload(!0);switch(o){case"silent-success":break;case"update-modal-origin":return this.updateModalOrigin();case"update-origin":return this.updateOrigin();default:return this.slotUpdate(t,o)}},showErrorResponse:function(t,o){return 403===t?$(o).showAsModal($(this)):900===t?$(o).showAsModal($(this)):(this.notify(o,"error"),409===t?this.slot().find(".current_revision_id").val(this.slot().find(".new-current-revision-id").text()):void 0)},hideErrorResponse:function(){return $(this).find(".card-notice").hide()},updateModalOrigin:function(){return this.overlaySlot()?this.slotOrigin("overlay").updateOrigin():this.closest("#modal-container")[0]?this.updateOrigin():void 0},updateOrigin:function(){var t,o;if(null!=(o=this.overlaySlot()?"overlay":this.closest("#modal-container")[0]?"modal":void 0))return(t=this.slotOrigin(o))&&null!=t[0]?t.slotReload():void 0},registerAsOrigin:function(t,o){return o.hasClass("_modal-slot")&&(o=o.find(".modal-body")),o.attr("data-"+t+"-origin-slot-id",this.slot().data("slot-id"))},closeOnSuccess:function(t){var o;return o=this.closest(".slotter"),null==t&&(t=this.isInOverlay()?"overlay":"modal"),o.addClass("_close-"+t)},slotterBeforeSend:function(t){var o;if(o=this.slotterMode(),!t.noSlotParams&&!t.url.match(/home_view/)&&"modal"!==o&&"override"!==o)return t.url=decko.slot.path(t.url,this.slot(),o)},slotterMode:function(){var t;if(null!=(t=this.data("slotter-mode"))&&(!t.match(/origin/)||this.slotOrigin()))return t}})}).call(this);
63
63
  // slot_ready.js.coffee
64
64
  (function(){decko.slot.ready(function(a){return a.find("card-view-placeholder").each(function(){var a;if(!(a=$(this)).data("loading"))return a.data("loading",!0),$.get(a.data("url"),function(e){return a.replaceWith(e)})}),a.find("._disappear").delay(5e3).animate({height:0},1e3,function(){return $(this).hide()})})}).call(this);
65
65
  // clicks_and_hovers.js.coffee
data/data/real.yml CHANGED
@@ -65,3 +65,8 @@
65
65
  :self:
66
66
  :fields:
67
67
  :read: Anyone
68
+
69
+ - :name: "*noindex"
70
+ :codename: noindex
71
+ :type: :list
72
+
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for css (cascading stylesheet) views
5
6
  class CssFormat < Format
6
7
  register :css
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for csv (comma separated values) views
5
6
  class CsvFormat < Format
6
7
  register :csv
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for js (JavaScript) views
5
6
  class JsFormat < Format
6
7
  register :js
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for json (JavaScript Object Notation) views
5
6
  class JsonFormat < DataFormat
6
7
  register :json
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for rss (really simple syndication) views
5
6
  class RssFormat < HtmlFormat
6
7
  register :rss
7
8
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for plaintext views
5
6
  class TextFormat < Format
6
7
  register :text
7
8
  register :txt
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for xml (extensible markup language) views
5
6
  class XmlFormat < DataFormat
6
7
  register :xml
7
8
 
@@ -1,4 +1,5 @@
1
1
  class Card
2
+ # handle card-related uri paths
2
3
  class Path
3
4
  cattr_accessor :cast_params
4
5
  self.cast_params = { slot: { hide: :array, show: :array, wrap: :array } }.freeze
data/set/all/content.rb CHANGED
@@ -1,6 +1,6 @@
1
- format do
2
- ONE_LINE_CHARACTER_LIMIT = 60
1
+ ONE_LINE_CHARACTER_LIMIT = 60
3
2
 
3
+ format do
4
4
  # override to customize by set
5
5
  def chunk_list
6
6
  :default
data/set/all/csv.rb CHANGED
@@ -3,7 +3,7 @@ require "csv"
3
3
  format :csv do
4
4
  def show view, args
5
5
  view ||= :titled
6
- super view, args
6
+ super
7
7
  end
8
8
 
9
9
  def nests
@@ -24,7 +24,7 @@ format :csv do
24
24
  end
25
25
 
26
26
  view :body do
27
- item_cards.map { |item_card| nest item_card }
27
+ card.item_cards.map { |item_card| nest item_card }
28
28
  end
29
29
 
30
30
  view :row do
data/set/all/data.rb CHANGED
@@ -68,7 +68,7 @@ format :data do
68
68
  # NOCACHE because sometimes item_cards is dynamic.
69
69
  # could be safely cached for non-dynamic lists
70
70
  view :items, cache: :never do
71
- listing item_cards, view: (voo_items_view || :atom)
71
+ listing_list item_cards, view: voo_items_view || :atom
72
72
  end
73
73
 
74
74
  view :links do
data/set/all/demo.rb CHANGED
@@ -8,7 +8,7 @@ format :html do
8
8
  view :view_list do
9
9
  view_list.map do |v|
10
10
  wrap_with :p, [content_tag(:h3, v), render(v, show: :menu)]
11
- end.flatten.join ""
11
+ end.flatten.join
12
12
  end
13
13
 
14
14
  def view_list
data/set/all/haml.rb CHANGED
@@ -48,7 +48,7 @@ format do
48
48
 
49
49
  def haml_partial partial, locals={}
50
50
  locals[:template_path] ||= @template_path
51
- process_haml_template "_#{partial}".to_sym, locals
51
+ process_haml_template :"_#{partial}", locals
52
52
  end
53
53
 
54
54
  private
data/set/all/html/head.rb CHANGED
@@ -9,9 +9,14 @@ basket[:cache_seed_names] += [
9
9
  %i[all style],
10
10
  %i[all style asset_output],
11
11
  %i[all script],
12
- %i[script right content_options]
12
+ %i[script right content_options],
13
+ :noindex
13
14
  ]
14
15
 
16
+ def noindex?
17
+ unknown? || :noindex.card.include_item?(name)
18
+ end
19
+
15
20
  format do
16
21
  view :page_title, unknown: true, perms: :none do
17
22
  title_parts = [Card::Rule.global_setting(:title)]
@@ -21,6 +26,8 @@ format do
21
26
  end
22
27
 
23
28
  format :html do
29
+ delegate :noindex?, to: :card
30
+
24
31
  view :head, unknown: true, perms: :none, cache: :yes do
25
32
  basket[:head_views].map { |viewname| render viewname }.flatten.compact.join "\n"
26
33
  end
@@ -55,6 +62,8 @@ format :html do
55
62
  [nest(:style_mods, view: :remote_style_tags), head_stylesheet_path]
56
63
  end
57
64
 
65
+ private
66
+
58
67
  def head_stylesheet_path
59
68
  @head_stylesheet_path ||=
60
69
  tag "link", media: "all",
data/set/all/html/menu.rb CHANGED
@@ -7,6 +7,7 @@ format :html do
7
7
 
8
8
  view :menu, denial: :blank, unknown: true do
9
9
  return "" unless card.known?
10
+
10
11
  # would be preferable to do this with unknown: :blank, but that fails with view
11
12
  # caching on, because voo always thinks it's the root.
12
13
  wrap_with(:div, class: "card-menu #{menu_link_classes}") { menu_items }
@@ -149,7 +150,7 @@ format :html do
149
150
 
150
151
  def edit_link view=:edit, link_text: nil, text: "", modal: nil
151
152
  link_to_view view, link_text || "#{menu_icon} #{text}",
152
- edit_link_opts(modal: (modal || :lg))
153
+ edit_link_opts(modal: modal || :lg)
153
154
  end
154
155
 
155
156
  # Generates options hash for an edit link with optional parameters.
@@ -1,4 +1,4 @@
1
1
  %meta{ charset: "UTF-8" }
2
2
  %meta{ content: "width=device-width, initial-scale=1.0", name: "viewport" }
3
- - if card.unknown?
3
+ - if noindex?
4
4
  %meta{ content: "noindex", name: "robots"}
data/set/all/html/show.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  format :html do
2
2
  def show view, args
3
3
  content = send show_method, view, args
4
- Env.ajax? ? content : wrap_with_html_page(content)
4
+ Env.ajax? || no_layout? ? content : wrap_with_html_page(content)
5
5
  end
6
6
 
7
7
  wrapper :html_page do
@@ -9,7 +9,7 @@ format :html do
9
9
  <!DOCTYPE HTML>
10
10
  <html class="h-100">
11
11
  <head>
12
- #{nest card.rule_card(:head), view: :head_content}
12
+ #{head_content}
13
13
  </head>
14
14
  #{interior}
15
15
  </html>
@@ -18,6 +18,10 @@ format :html do
18
18
 
19
19
  private
20
20
 
21
+ def head_content
22
+ nest card.rule_card(:head), view: :head_content
23
+ end
24
+
21
25
  def show_without_page_layout view, args
22
26
  @main = true if params[:is_main] || args[:main]
23
27
  args.delete(:layout)
@@ -34,6 +38,12 @@ format :html do
34
38
  end
35
39
 
36
40
  def show_layout?
41
+ return false if no_layout?
42
+
37
43
  !Env.ajax? || params[:layout]
38
44
  end
45
+
46
+ def no_layout?
47
+ params[:layout] == "none"
48
+ end
39
49
  end
data/set/all/html/wrap.rb CHANGED
@@ -49,7 +49,7 @@ format :html do
49
49
 
50
50
  def slot_cardname
51
51
  name = card.name
52
- name = card.new? && name.compound? ? name.url_key : name
52
+ name = name.url_key if card.new? && name.compound?
53
53
  h name
54
54
  end
55
55
 
@@ -122,7 +122,7 @@ format :html do
122
122
  end
123
123
 
124
124
  def no_main_wrap?
125
- Env.ajax? || params[:layout] == "none"
125
+ Env.ajax? || no_layout?
126
126
  end
127
127
 
128
128
  def wrap_with tag, content_or_args={}, html_args={}, &block
@@ -140,21 +140,21 @@ format :html do
140
140
  private
141
141
 
142
142
  def content_items_within_wrap content, args
143
- content = block_given? ? yield(args) : content
143
+ content = yield(args) if block_given?
144
144
  content.compact
145
145
  end
146
146
 
147
147
  def content_within_wrap content
148
- content = block_given? ? yield : content
148
+ content = yield if block_given?
149
149
  output(content).to_s.html_safe
150
150
  end
151
151
 
152
152
  def html_escape_except_quotes string
153
153
  # to be used inside single quotes (makes for readable json attributes)
154
- string.to_s.gsub(/&/, "&amp;")
155
- .gsub(/'/, "&apos;")
156
- .gsub(/>/, "&gt;")
157
- .gsub(/</, "&lt;")
154
+ string.to_s.gsub("&", "&amp;")
155
+ .gsub("'", "&apos;")
156
+ .gsub(">", "&gt;")
157
+ .gsub("<", "&lt;")
158
158
  end
159
159
 
160
160
  wrapper :div, :div
data/set/all/links.rb CHANGED
@@ -112,13 +112,13 @@ format :html do
112
112
  name = Card::Name[cardish]
113
113
  slotterify opts if opts[:slotter]
114
114
  add_known_or_wanted_class opts, name
115
- super name, (text || name), opts
115
+ super(name, text || name, opts)
116
116
  end
117
117
 
118
118
  # in HTML, #link_to_view defaults to a remote link with rel="nofollow".
119
119
  def link_to_view view, text=nil, opts={}
120
120
  slotterify opts
121
- super view, (text || view), opts
121
+ super(view, text || view, opts)
122
122
  end
123
123
 
124
124
  # in HTML, #link_to_resource automatically adds a target to external resources
data/set/all/title.rb CHANGED
@@ -32,7 +32,7 @@ format :html do
32
32
  def title_in_context title=nil
33
33
  title = title&.html_safe
34
34
  # escape titles generated from card names, but not those set explicitly
35
- h super(title)
35
+ h super
36
36
  end
37
37
 
38
38
  def wrapped_title title
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
8
8
  - Philipp Kühl
9
9
  - Gerry Gleason
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-11-22 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: card
@@ -18,28 +17,28 @@ dependencies:
18
17
  requirements:
19
18
  - - '='
20
19
  - !ruby/object:Gem::Version
21
- version: 1.108.1
20
+ version: 1.109.0
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  requirements:
26
25
  - - '='
27
26
  - !ruby/object:Gem::Version
28
- version: 1.108.1
27
+ version: 1.109.0
29
28
  - !ruby/object:Gem::Dependency
30
29
  name: card-mod-content
31
30
  requirement: !ruby/object:Gem::Requirement
32
31
  requirements:
33
32
  - - '='
34
33
  - !ruby/object:Gem::Version
35
- version: 0.18.1
34
+ version: 0.19.0
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
39
38
  requirements:
40
39
  - - '='
41
40
  - !ruby/object:Gem::Version
42
- version: 0.18.1
41
+ version: 0.19.0
43
42
  description: ''
44
43
  email:
45
44
  - info@decko.org
@@ -69,7 +68,7 @@ files:
69
68
  - config/locales/de.yml
70
69
  - config/locales/en.yml
71
70
  - data/files/credit_image.svg
72
- - data/files/mod_format_script_asset_output/file.js
71
+ - data/files/mod_format/script/asset_output/file.js
73
72
  - data/real.yml
74
73
  - lib/card/format/css_format.rb
75
74
  - lib/card/format/csv_format.rb
@@ -216,7 +215,6 @@ metadata:
216
215
  documentation_url: http://docs.decko.org/
217
216
  card-mod: format
218
217
  card-mod-group: gem-defaults
219
- post_install_message:
220
218
  rdoc_options: []
221
219
  require_paths:
222
220
  - lib
@@ -224,15 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
222
  requirements:
225
223
  - - ">="
226
224
  - !ruby/object:Gem::Version
227
- version: '3.0'
225
+ version: '3.2'
228
226
  required_rubygems_version: !ruby/object:Gem::Requirement
229
227
  requirements:
230
228
  - - ">="
231
229
  - !ruby/object:Gem::Version
232
230
  version: '0'
233
231
  requirements: []
234
- rubygems_version: 3.5.10
235
- signing_key:
232
+ rubygems_version: 3.6.8
236
233
  specification_version: 4
237
234
  summary: format
238
235
  test_files: []