card-mod-format 0.16.0 → 0.17.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 +4 -4
- data/assets/script/decko/slot.js.coffee +11 -4
- data/assets/script/decko/slotter.js.coffee +24 -2
- data/assets/style/menu.scss +6 -3
- data/config/admin.yml +30 -0
- data/config/locales/en.yml +1 -0
- data/data/files/mod_format_script_asset_output/file.js +2 -2
- data/lib/card/format/csv_format.rb +1 -1
- data/set/all/csv.rb +2 -2
- data/set/all/demo.rb +5 -1
- data/set/all/html/error.rb +2 -2
- data/set/all/html/frame.rb +6 -4
- data/set/all/html/menu.rb +64 -26
- data/set/all/html/views.rb +1 -1
- data/set/all/html/wrap.rb +1 -0
- data/set/all/links.rb +10 -3
- data/set/all/yaml.rb +4 -1
- data/set/type/cardtype.rb +4 -0
- data/set/type/mod.rb +15 -0
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b0ff2d377bf5c92b381014dfde8b3ac4f2bc62567bad7a83a152fbe21b63d5a
|
4
|
+
data.tar.gz: '09619cfd84f48a855c3b18e0f126bf4b02ecaaf26f995d3930b98934357597dd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abb03121966bc5bb5e764034547882bcfcb49b0275d5df26521fa706ece8d70f52e2125bd60e802d1c936fe9f97f932f1de5c375b55a7326c047ba082e89541e
|
7
|
+
data.tar.gz: f72af9bc82fe9ad28b41bc04ffe03f754838467f3956d0ed443940331129dfe49b91b340f0f1a69e45f8993a2b4a494315e612c96da43df10c7b07062661249a
|
@@ -1,7 +1,8 @@
|
|
1
1
|
decko.slot =
|
2
2
|
# returns full path with slot parameters
|
3
|
-
path: (path, slot)->
|
3
|
+
path: (path, slot, slotterMode)->
|
4
4
|
params = slotPathParams slot
|
5
|
+
params["slotter_mode"] = slotterMode if slotterMode?
|
5
6
|
decko.path(path) + ( (if path.match /\?/ then '&' else '?') + $.param(params) )
|
6
7
|
|
7
8
|
ready: (func)->
|
@@ -19,7 +20,6 @@ decko.slot =
|
|
19
20
|
e.stopPropagation()
|
20
21
|
func.call this, $(this)
|
21
22
|
|
22
|
-
|
23
23
|
jQuery.fn.extend
|
24
24
|
isSlot: -> $(this).hasClass "card-slot"
|
25
25
|
|
@@ -53,7 +53,7 @@ jQuery.fn.extend
|
|
53
53
|
overlaySlot = @closest("[data-#{type}-origin-slot-id]")
|
54
54
|
origin_slot_id = overlaySlot.data("#{type}-origin-slot-id")
|
55
55
|
origin_slot = $("[data-slot-id=#{origin_slot_id}]")
|
56
|
-
if origin_slot
|
56
|
+
if origin_slot.length > 0
|
57
57
|
origin_slot
|
58
58
|
else
|
59
59
|
decko.warn "couldn't find origin with slot id #{origin_slot_id}"
|
@@ -61,12 +61,18 @@ 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
|
69
|
+
|
64
70
|
slotUpdate: (newContent, mode) ->
|
65
71
|
mode ||= "replace"
|
66
72
|
@slotContent newContent, mode, $(this)
|
67
73
|
|
68
74
|
slotContent: (newContent, mode, $slotter) ->
|
69
|
-
v = $(newContent)
|
75
|
+
v = $(newContent).length > 0 && $(newContent) || newContent
|
70
76
|
|
71
77
|
if typeof(v) == "string"
|
72
78
|
# Needed to support "TEXT: result" pattern in success (eg deleting nested cards)
|
@@ -114,6 +120,7 @@ jQuery.fn.extend
|
|
114
120
|
# that's where handleRemote gets the url from
|
115
121
|
# .attr(href, url) only works for anchors
|
116
122
|
$.rails.handleRemote $slot
|
123
|
+
$slot.slotReloading()
|
117
124
|
|
118
125
|
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
119
126
|
# "private" helper methods
|
@@ -65,12 +65,18 @@
|
|
65
65
|
#
|
66
66
|
#
|
67
67
|
$(window).ready ->
|
68
|
+
$('body').on 'ajax:send', '.slotter', (event, data) ->
|
69
|
+
$(this).slot().slotReloading()
|
70
|
+
|
68
71
|
$('body').on 'ajax:success', '.slotter', (event, data) ->
|
69
72
|
$(this).slotterSuccess event, data
|
70
73
|
|
71
74
|
$('body').on 'ajax:error', '.slotter', (event, xhr) ->
|
72
75
|
$(this).showErrorResponse xhr.status, xhr.responseText
|
73
76
|
|
77
|
+
$('body').on 'ajax:complete', '.slotter', (event, data) ->
|
78
|
+
$(this).slot().slotLoadingComplete()
|
79
|
+
|
74
80
|
$('body').on 'click', 'button.slotter', ->
|
75
81
|
return false if !$.rails.allowAction $(this)
|
76
82
|
$.rails.handleRemote $(this)
|
@@ -103,6 +109,15 @@ $(window).ready ->
|
|
103
109
|
$('body').on 'ajax:beforeSend', '.slotter', (event, xhr, opt)->
|
104
110
|
$(this).slotterBeforeSend opt
|
105
111
|
|
112
|
+
# NOTE: without the following two propagation checks, slotter events can propagate
|
113
|
+
# from one slot to another and cause weird problems, as with the type editor
|
114
|
+
$('body').on 'ajax:beforeSend', '.card-slot', (event)->
|
115
|
+
event.stopPropagation()
|
116
|
+
|
117
|
+
$('body').on 'ajax:send', '.card-slot', (event)->
|
118
|
+
event.stopPropagation()
|
119
|
+
|
120
|
+
|
106
121
|
jQuery.fn.extend
|
107
122
|
mainSuccess: ()->
|
108
123
|
form = $(this)
|
@@ -204,7 +219,14 @@ jQuery.fn.extend
|
|
204
219
|
|
205
220
|
slotterBeforeSend: (opt) ->
|
206
221
|
# avoiding duplication. could be better test?
|
222
|
+
mode = @slotterMode()
|
223
|
+
|
207
224
|
return if opt.noSlotParams or opt.url.match(/home_view/) or
|
208
|
-
|
225
|
+
mode == "modal" or mode == "override"
|
226
|
+
|
227
|
+
opt.url = decko.slot.path opt.url, @slot(), mode
|
209
228
|
|
210
|
-
|
229
|
+
slotterMode: () ->
|
230
|
+
mode = @data "slotter-mode"
|
231
|
+
return if !mode? || (mode.match(/origin/) && !@slotOrigin())
|
232
|
+
mode
|
data/assets/style/menu.scss
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
position: absolute;
|
7
7
|
right: 8px;
|
8
8
|
top: 5px;
|
9
|
+
width: auto;
|
9
10
|
}
|
10
11
|
|
11
12
|
.d0-card-content, .titled-view > .d0-card-header {
|
@@ -14,8 +15,10 @@
|
|
14
15
|
}
|
15
16
|
}
|
16
17
|
|
17
|
-
.d0-card-content .
|
18
|
-
|
18
|
+
.d0-card-content, .labeled-view {
|
19
|
+
.card-menu i {
|
20
|
+
font-size: 1.2em
|
21
|
+
}
|
19
22
|
}
|
20
23
|
|
21
24
|
.modal-menu, .overlay-menu {
|
@@ -33,7 +36,7 @@
|
|
33
36
|
// Hover over these, and only the card menus that are immediate children will appear
|
34
37
|
.card-slot > .d0-card-frame > .d0-card-header,
|
35
38
|
.card-slot > .d0-card-header,
|
36
|
-
.card-slot.labeled-view
|
39
|
+
.card-slot.labeled-view,
|
37
40
|
.card-slot,
|
38
41
|
.card > .card-body,
|
39
42
|
.card > .card-header {
|
data/config/admin.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
configurations:
|
2
|
+
basic:
|
3
|
+
- title
|
4
|
+
- head
|
5
|
+
- credit
|
6
|
+
cardtypes:
|
7
|
+
text:
|
8
|
+
- basic
|
9
|
+
- plain_text
|
10
|
+
- html
|
11
|
+
- phrase
|
12
|
+
scripting:
|
13
|
+
- json
|
14
|
+
data:
|
15
|
+
- number
|
16
|
+
- toggle
|
17
|
+
- uri
|
18
|
+
views:
|
19
|
+
- name
|
20
|
+
- link
|
21
|
+
- url_link
|
22
|
+
- content
|
23
|
+
- short_content
|
24
|
+
- core
|
25
|
+
- raw
|
26
|
+
- titled
|
27
|
+
- labeled
|
28
|
+
- smart_label
|
29
|
+
- title
|
30
|
+
- title_link
|
data/config/locales/en.yml
CHANGED
@@ -57,9 +57,9 @@ i.call(this)}),!1!==this._start(e)&&this._repeat(null,t(e.currentTarget).hasClas
|
|
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){var e;return e=o(s),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"),
|
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);
|
61
61
|
// slotter.js.coffee
|
62
|
-
(function(){$(window).ready(function(){return $("body").on("ajax:success",".slotter",function(t,
|
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);
|
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/set/all/csv.rb
CHANGED
@@ -20,10 +20,10 @@ format :csv do
|
|
20
20
|
|
21
21
|
view :titled do
|
22
22
|
voo.items[:view] ||= :row
|
23
|
-
(render_header +
|
23
|
+
(render_header + render_body).map { |row| CSV.generate_line row }.join
|
24
24
|
end
|
25
25
|
|
26
|
-
view :
|
26
|
+
view :body do
|
27
27
|
item_cards.map { |item_card| nest item_card }
|
28
28
|
end
|
29
29
|
|
data/set/all/demo.rb
CHANGED
@@ -28,11 +28,15 @@ format :html do
|
|
28
28
|
def view_select
|
29
29
|
card_form :get, success: { view: :demo } do
|
30
30
|
select_tag :demo_view,
|
31
|
-
options_for_select(
|
31
|
+
options_for_select(all_views_from_admin_config, demo_view),
|
32
32
|
class: "_submit-on-select"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def all_views_from_admin_config
|
37
|
+
card.all_admin_configs_of_category("views").map(&:codename)
|
38
|
+
end
|
39
|
+
|
36
40
|
def all_views
|
37
41
|
Card::Set::Format::AbstractFormat::ViewDefinition
|
38
42
|
.views.slice(*self.class.ancestors).values.map(&:keys).flatten.uniq.sort
|
data/set/all/html/error.rb
CHANGED
@@ -147,14 +147,14 @@ format :html do
|
|
147
147
|
|
148
148
|
def signin_link
|
149
149
|
link_to_card :signin, t(:account_sign_in)&.downcase,
|
150
|
-
class: "signin-link",
|
150
|
+
class: "signin-link", path: { view: :titled }
|
151
151
|
end
|
152
152
|
|
153
153
|
def signup_link
|
154
154
|
return unless signup_ok?
|
155
155
|
|
156
156
|
link_to_card :signup, t(:account_sign_up)&.downcase,
|
157
|
-
class: "signup-link",
|
157
|
+
class: "signup-link", path: { action: :new }
|
158
158
|
end
|
159
159
|
|
160
160
|
def signup_ok?
|
data/set/all/html/frame.rb
CHANGED
@@ -36,14 +36,16 @@ format :html do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def panel &block
|
40
|
+
wrap_with :div, class: classy("d0-card-frame"), &block
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
39
45
|
def frame_and_form action, form_opts={}, &block
|
40
46
|
form_opts ||= {}
|
41
47
|
frame do
|
42
48
|
card_form action, form_opts, &block
|
43
49
|
end
|
44
50
|
end
|
45
|
-
|
46
|
-
def panel &block
|
47
|
-
wrap_with :div, class: classy("d0-card-frame"), &block
|
48
|
-
end
|
49
51
|
end
|
data/set/all/html/menu.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
format :html do
|
2
|
+
view :menu_block do
|
3
|
+
wrap_with :div, class: "menu-block position-relative py-2" do
|
4
|
+
[render_menu, " "]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
view :menu, denial: :blank, unknown: true do
|
3
9
|
return "" unless card.known?
|
4
10
|
# would be preferable to do this with unknown: :blank, but that fails with view
|
@@ -6,6 +12,29 @@ format :html do
|
|
6
12
|
wrap_with(:div, class: "card-menu #{menu_link_classes}") { menu_items }
|
7
13
|
end
|
8
14
|
|
15
|
+
view :edit_link, unknown: true, denial: :blank do
|
16
|
+
edit_link edit_link_view
|
17
|
+
end
|
18
|
+
|
19
|
+
view :edit_button do
|
20
|
+
view = voo.edit == :inline ? :edit_inline : :edit
|
21
|
+
link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary me-2"
|
22
|
+
end
|
23
|
+
|
24
|
+
view :full_page_link do
|
25
|
+
full_page_link
|
26
|
+
end
|
27
|
+
|
28
|
+
view :board_link, unknown: true do
|
29
|
+
board_link
|
30
|
+
end
|
31
|
+
|
32
|
+
# no caching because help_text view doesn't cache, and we can't have a
|
33
|
+
# stub in the data-content attribute or it will get html escaped.
|
34
|
+
view :help_link, cache: :never, unknown: true do
|
35
|
+
help_link render_help_text, help_title
|
36
|
+
end
|
37
|
+
|
9
38
|
def menu_edit_link
|
10
39
|
case voo.edit
|
11
40
|
when :inline
|
@@ -36,40 +65,34 @@ format :html do
|
|
36
65
|
end
|
37
66
|
end
|
38
67
|
|
39
|
-
view :edit_link, unknown: true, denial: :blank do
|
40
|
-
edit_link edit_link_view
|
41
|
-
end
|
42
|
-
|
43
|
-
view :edit_button do
|
44
|
-
view = voo.edit == :inline ? :edit_inline : :edit
|
45
|
-
link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary me-2"
|
46
|
-
end
|
47
|
-
|
48
68
|
def edit_link_view
|
49
69
|
:edit
|
50
70
|
end
|
51
71
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
72
|
+
# Generates a link to a board with optional parameters.
|
73
|
+
#
|
74
|
+
# @param [String] text The text displayed on the link.
|
75
|
+
# @param [Boolean] in_modal (true) Indicates whether the board
|
76
|
+
# link should open in a modal.
|
77
|
+
# @param [Boolean] confirm (false) Indicates whether to show a
|
78
|
+
# confirmation for potential data loss.
|
79
|
+
#
|
80
|
+
# @return [String] The HTML code for the board link.
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# board_link(text: "Advanced", in_modal: true, confirm: true)
|
60
84
|
def board_link text: "", in_modal: true, confirm: false
|
61
|
-
opts = {
|
85
|
+
opts = {
|
86
|
+
class: "board-link",
|
87
|
+
title: "Advanced",
|
88
|
+
"data-bs-toggle": "tooltip",
|
89
|
+
"data-bs-placement": "bottom"
|
90
|
+
}
|
62
91
|
opts["data-slotter-mode"] = "modal-replace" if in_modal
|
63
92
|
confirm_edit_loss opts if confirm
|
64
93
|
link_to_view :board, "#{board_icon} #{text}", opts
|
65
94
|
end
|
66
95
|
|
67
|
-
# no caching because help_text view doesn't cache, and we can't have a
|
68
|
-
# stub in the data-content attribute or it will get html escaped.
|
69
|
-
view :help_link, cache: :never, unknown: true do
|
70
|
-
help_link render_help_text, help_title
|
71
|
-
end
|
72
|
-
|
73
96
|
def help_link text=nil, title=nil
|
74
97
|
opts = help_popover_opts text, title
|
75
98
|
add_class opts, "_card-menu-popover"
|
@@ -129,9 +152,24 @@ format :html do
|
|
129
152
|
edit_link_opts(modal: (modal || :lg))
|
130
153
|
end
|
131
154
|
|
132
|
-
#
|
155
|
+
# Generates options hash for an edit link with optional parameters.
|
156
|
+
#
|
157
|
+
# @param [Symbol] modal (nil) The modal class to use for the edit link.
|
158
|
+
#
|
159
|
+
# @return [Hash] The options hash for the edit link.
|
160
|
+
#
|
161
|
+
# @example
|
162
|
+
# edit_link_opts(modal: "custom-modal")
|
163
|
+
# #=> { class: 'edit-link', title: 'Edit', 'data-bs-toggle': 'tooltip',
|
164
|
+
# 'data-bs-placement': 'bottom', 'data-slotter-mode': 'modal',
|
165
|
+
# 'data-modal-class': 'modal-custom-modal' }
|
133
166
|
def edit_link_opts modal: nil
|
134
|
-
opts = {
|
167
|
+
opts = {
|
168
|
+
class: classy("edit-link"),
|
169
|
+
title: "Edit",
|
170
|
+
"data-bs-toggle": "tooltip",
|
171
|
+
"data-bs-placement": "bottom"
|
172
|
+
}
|
135
173
|
if modal
|
136
174
|
opts[:"data-slotter-mode"] = "modal"
|
137
175
|
opts[:"data-modal-class"] = "modal-#{modal}"
|
data/set/all/html/views.rb
CHANGED
@@ -67,7 +67,7 @@ format :html do
|
|
67
67
|
view :labeled, unknown: :labeled do
|
68
68
|
@content_body = true
|
69
69
|
wrap(true, class: "row") do
|
70
|
-
labeled(render_title, wrap_body {
|
70
|
+
[labeled(render_title, wrap_body { render_labeled_content }), render_menu]
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
data/set/all/html/wrap.rb
CHANGED
data/set/all/links.rb
CHANGED
@@ -26,9 +26,10 @@ format do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# link to a card other than the current card.
|
29
|
-
# @param cardish [Integer, Symbol, String, Card]
|
30
|
-
# @param text [String]
|
31
|
-
# @param opts [Hash]
|
29
|
+
# @param cardish [Integer, Symbol, String, Card]: A card identifier
|
30
|
+
# @param text [String], optional: The text content of the link.
|
31
|
+
# @param opts [Hash], optional: Additional options for the link.
|
32
|
+
# @return [String] HTML markup for the generated link.
|
32
33
|
def link_to_card cardish, text=nil, opts={}
|
33
34
|
add_to_path opts, mark: Card::Name[cardish]
|
34
35
|
link_to text, opts
|
@@ -79,6 +80,12 @@ format do
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
83
|
+
# Adds key-value pairs from a new hash to the 'path' key
|
84
|
+
# in the given options dictionary.
|
85
|
+
# @params opts [dict]: The options dictionary to be modified.
|
86
|
+
# @params new_hash [dict]: The new hash containing
|
87
|
+
# key-value pairs to be added to the 'path'.
|
88
|
+
# @return [Hash] The value of opts[:path]
|
82
89
|
def add_to_path opts, new_hash
|
83
90
|
opts[:path] = (opts[:path] || {}).merge new_hash
|
84
91
|
end
|
data/set/all/yaml.rb
CHANGED
data/set/type/cardtype.rb
CHANGED
data/set/type/mod.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
format :html do
|
2
|
+
view :admin do
|
3
|
+
render_core
|
4
|
+
end
|
5
|
+
|
6
|
+
view :bar_right do
|
7
|
+
%w[settings configurations tasks cardtypes scripts styles].filter do |name|
|
8
|
+
card.send("#{name}?")
|
9
|
+
end.join ", "
|
10
|
+
end
|
11
|
+
|
12
|
+
def before_bar
|
13
|
+
voo.show :bar_middle
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.107.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.107.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-content
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.17.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.17.0
|
43
43
|
description: ''
|
44
44
|
email:
|
45
45
|
- info@decko.org
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- assets/style/messaging.scss
|
66
66
|
- assets/style/misc.scss
|
67
67
|
- assets/style/open_and_closed.scss
|
68
|
+
- config/admin.yml
|
68
69
|
- config/locales/de.yml
|
69
70
|
- config/locales/en.yml
|
70
71
|
- data/files/credit_image.svg
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- set/type/cardtype.rb
|
124
125
|
- set/type/html.rb
|
125
126
|
- set/type/json.rb
|
127
|
+
- set/type/mod.rb
|
126
128
|
- set/type/number.rb
|
127
129
|
- set/type/phrase.rb
|
128
130
|
- set/type/plain_text.rb
|
@@ -222,14 +224,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
224
|
requirements:
|
223
225
|
- - ">="
|
224
226
|
- !ruby/object:Gem::Version
|
225
|
-
version: '
|
227
|
+
version: '3.0'
|
226
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
229
|
requirements:
|
228
230
|
- - ">="
|
229
231
|
- !ruby/object:Gem::Version
|
230
232
|
version: '0'
|
231
233
|
requirements: []
|
232
|
-
rubygems_version: 3.
|
234
|
+
rubygems_version: 3.5.10
|
233
235
|
signing_key:
|
234
236
|
specification_version: 4
|
235
237
|
summary: format
|