card-mod-bar_and_box 0.14.2 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4a5b4a3f116284992963ed8c7f6efc053f90a95d78907a453713067870a4ebb
4
- data.tar.gz: 834aed273be48c4ceb4779e7719b5009342a082a6dfb431e8349a322c4659afc
3
+ metadata.gz: d9400c0c6f38327f88bab979f8c06d29c4efe149258d33184df1baf071374ff6
4
+ data.tar.gz: 86694f07f1d3a00b58502a28753cd73e3f0ed87d2d9ed5057325bab2865c237a
5
5
  SHA512:
6
- metadata.gz: c19a6c7277659f1ae318cb5f925787f07fdf9fe755033d57e6a9b4eeaaf4f4f3f9de327971211e65eb09fec32c68d79361c106da7b1db1c2b6918cf6b8f58103
7
- data.tar.gz: 0a0243f19c0e36d0e950545f3d3890122575ff05ead45e9e3b6cbf93e884f894572fde6f6098cc46bd2ad7997ae4c7dc2a9c76c36134491399327803c84324cd
6
+ metadata.gz: d2d00c0307d14a7bfebc6093757aa58142155943d7eb1b6f2f1b4dbc28dc4e5a0a07a3ab7ae29e423b8e2c22dd9a1c0d5e46a10a3a29dee203b422f195039934
7
+ data.tar.gz: 96306c241ae3f72e8fac25f0398b4bd0716d8d0749ab372ada59861874f3bb284dc578566cd46d26c486fcd62b767e4951d32e212254817b50f7c8b507754ad0
@@ -0,0 +1,28 @@
1
+ $(window).ready ->
2
+ # $("body").on "click", ".bar-menu", (e) ->
3
+ # e.stopImmediatePropagation()
4
+
5
+ $(document).on 'click', "._card-link", (event) ->
6
+ cl = $(this)
7
+ if cl.data("skip") == "on"
8
+ cl.data "skip", null
9
+ else if openInNewTab event
10
+ window.open cardLinkPath(cl), "_tab_" + Math.floor(Math.random() * 1000)
11
+ else if cl.closest("._card-link-modal")[0]
12
+ cl.find("._modal-page-link").trigger "click"
13
+ else
14
+ window.location = cardLinkPath(cl)
15
+
16
+ openInNewTab = (event) -> event.metaKey
17
+ cardLinkPath = (cl) -> decko.path(cl.data("cardLinkUrl") ||cl.data("cardLinkName"))
18
+
19
+ decko.slot.ready (slot)->
20
+ # note: by using slot ready, we can make sure this event is triggered early
21
+ slot.find("._card-link a, ._card-link ._card-link-clickable").on "click", (event) ->
22
+ a = $(this)
23
+ if a.hasClass("_over-card-link") || a.closest("._over-card-link")[0]
24
+ # skip card link action
25
+ a.closest("._card-link").data "skip", "on"
26
+ else
27
+ # don't follow original link
28
+ event.preventDefault()
@@ -0,0 +1,12 @@
1
+ # TODO: move to list mod when possible
2
+ # (currently not because list mod comes before jquery)
3
+
4
+ $("body").on "click", "._click-multiselect-editor ._select-item", (event) ->
5
+ $(this).closest("._select-item").toggleClass("selected")
6
+ event.stopPropagation()
7
+
8
+ $("body").on "click", "._click-select-editor ._select-item", (event) ->
9
+ selectEditor = $(this).closest("._click-select-editor")
10
+ selectEditor.find(".selected").removeClass("selected")
11
+ $(this).closest("._select-item").addClass("selected")
12
+ event.stopPropagation()
@@ -0,0 +1,106 @@
1
+ $bar_stripe_color: $dark !default;
2
+
3
+ .bar {
4
+ border: 1px solid $border-color;
5
+ &:hover {
6
+ cursor: pointer;
7
+ > .bar-body, > .bar-menu, > .accordion-header >.accordion-button {
8
+ background-color: $gray-200;
9
+ }
10
+ }
11
+ }
12
+
13
+ .selected .bar, .selected .box {
14
+ border: 3px solid $primary !important;
15
+ }
16
+
17
+ .bar-accordion {
18
+ .accordion-body {
19
+ padding: 0;
20
+ .bar {
21
+ border-left: 1px solid $border-color !important;
22
+ }
23
+ }
24
+ }
25
+
26
+
27
+ .bar {
28
+ border-left: 3px solid $bar_stripe_color !important;
29
+
30
+ .media {
31
+ width: 100%
32
+ }
33
+ .media-left {
34
+ max-width: 25%
35
+ }
36
+ }
37
+
38
+ .bar-left, .bar-right, .bar-middle {
39
+ display: flex;
40
+ padding: 0.5rem;
41
+ flex-wrap: wrap;
42
+ align-items: center;
43
+ }
44
+
45
+ .bar-left {
46
+ font-weight: bold;
47
+ align-items: flex-start;
48
+ }
49
+
50
+ .bar-middle {
51
+ justify-content: center;
52
+ }
53
+
54
+ .bar-right {
55
+ justify-content: flex-end;
56
+ }
57
+
58
+ .bar-menu {
59
+ min-width: 3em;
60
+ width: 3em;
61
+ display: flex;
62
+ align-items: center;
63
+ }
64
+
65
+ .bar-body {
66
+ width: 100%;
67
+ display: flex;
68
+ }
69
+
70
+ .bar.with-bar-menu .bar-body {
71
+ width: calc(100% - 3em);
72
+ }
73
+
74
+ .bar-menu-button {
75
+ padding: 0.2em 0.75em;
76
+ &:hover {
77
+ background-color: $secondary;
78
+ color: $white;
79
+ border-radius: 5px;
80
+ }
81
+ // disable bootstrap dropdown caret
82
+ &:after {
83
+ display: none;
84
+ }
85
+ }
86
+
87
+ // links in bar menu
88
+ .bar-menu-list a i {
89
+ padding-right: 0.4em;
90
+ }
91
+
92
+ // card submenu in accordion bar
93
+ .accordion-subheader > .card-menu {
94
+ position: static;
95
+ background: inherit !important;
96
+ }
97
+
98
+ @include media-breakpoint-up(md) {
99
+ .bar-menu-button {
100
+ display: none;
101
+ }
102
+
103
+ ._card-link:hover .bar-menu-button {
104
+ display: block;
105
+ }
106
+ }
@@ -0,0 +1,66 @@
1
+ $box_stripe_color: $secondary !default;
2
+
3
+ .box {
4
+ border: 1px solid $border-color;
5
+ box-shadow: $box-shadow-sm;
6
+ &:hover {
7
+ box-shadow: $box-shadow-lg;
8
+ cursor: pointer
9
+ }
10
+ border-top: 3px solid $box_stripe_color;
11
+ width: 320px;
12
+ }
13
+
14
+ .box-top {
15
+ display: flex;
16
+ min-height: 60px;
17
+ flex-direction: column;
18
+ justify-content: center;
19
+ overflow: auto;
20
+ h1, h2, h3, h4, h5, h6, div, span, a {
21
+ white-space: nowrap;
22
+ overflow: hidden;
23
+ text-overflow: ellipsis;
24
+ }
25
+ }
26
+
27
+ .box-middle {
28
+ min-height: 180px;
29
+ overflow: hidden;
30
+ text-overflow: ellipsis;
31
+ display: flex;
32
+ justify-content: center;
33
+ img {
34
+ object-fit: contain;
35
+ height: 130px;
36
+ width: 190px;
37
+ }
38
+ i {
39
+ display: flex;
40
+ justify-content: center;
41
+ min-height: 130px;
42
+ align-items: center;
43
+ font-size: 70px;
44
+ color: $text-muted;
45
+ }
46
+ }
47
+
48
+ .box-bottom {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: space-around;
52
+ }
53
+
54
+ // card-list in which items are in box view
55
+ .card-list-box {
56
+ display: flex;
57
+ flex-wrap: wrap;
58
+ justify-content: center;
59
+ }
60
+
61
+ // wrapper around box in list context
62
+ .item-box {
63
+ display: inline-block;
64
+ padding: 10px 1%;
65
+ vertical-align: top;
66
+ }
@@ -29,7 +29,7 @@
29
29
  border: 1px solid #eee;
30
30
  border-radius: 0;
31
31
 
32
- background-color: #f8f9fa;
32
+ background-color: $gray-100;
33
33
 
34
34
  margin-right: 0.5rem;
35
35
  overflow: hidden;
@@ -56,6 +56,7 @@
56
56
  max-width: 100%;
57
57
  max-height: 100%;
58
58
  height: auto;
59
+ display: inline !important;
59
60
  }
60
61
  }
61
62
 
@@ -77,3 +78,17 @@
77
78
  padding: 4px;
78
79
  }
79
80
  }
81
+
82
+ .media {
83
+ display: flex;
84
+ }
85
+ .media-body {
86
+ .media-heading {
87
+ a {
88
+ color: inherit;
89
+ }
90
+ }
91
+ .media-text {
92
+ clear: both;
93
+ }
94
+ }
@@ -0,0 +1,4 @@
1
+ // bar_and_box.js.coffee
2
+ (function(){var n,a;$(window).ready(function(){return $(document).on("click","._card-link",function(i){var r;return"on"===(r=$(this)).data("skip")?r.data("skip",null):a(i)?window.open(n(r),"_tab_"+Math.floor(1e3*Math.random())):r.closest("._card-link-modal")[0]?r.find("._modal-page-link").trigger("click"):window.location=n(r)})}),a=function(n){return n.metaKey},n=function(n){return decko.path(n.data("cardLinkUrl")||n.data("cardLinkName"))},decko.slot.ready(function(n){return n.find("._card-link a, ._card-link ._card-link-clickable").on("click",function(n){var a;return(a=$(this)).hasClass("_over-card-link")||a.closest("._over-card-link")[0]?a.closest("._card-link").data("skip","on"):n.preventDefault()})})}).call(this);
3
+ // click_select.js.coffee
4
+ (function(){$("body").on("click","._click-multiselect-editor ._select-item",function(e){return $(this).closest("._select-item").toggleClass("selected"),e.stopPropagation()}),$("body").on("click","._click-select-editor ._select-item",function(e){return $(this).closest("._click-select-editor").find(".selected").removeClass("selected"),$(this).closest("._select-item").addClass("selected"),e.stopPropagation()})}).call(this);
@@ -1,4 +1,4 @@
1
- .media{media_opts}
1
+ .media{ media_opts }
2
2
  .media-left
3
3
  = nest image_card, view: :boxed, size: size
4
4
  .media-body{ class: "media-body-#{size}" }
data/set/all/bar.haml CHANGED
@@ -1,12 +1,4 @@
1
- .collapsed-bar.nodblclick{ class: classy("bar"), data: wrap_data(false) }
2
- %div{ class: classy("bar-body") }
3
- - if voo.show? :bar_left
4
- %div{ class: classy("bar-left") }
5
- = render :bar_left
6
- - if voo.show? :bar_middle
7
- %div{ class: classy("bar-middle") }
8
- = render :bar_middle
9
- - if voo.show? :bar_right
10
- %div{ class: classy("bar-right") }
11
- = render :bar_right
12
- = render :bar_nav
1
+ - class_up "bar", "with-bar-menu" if voo.show? :bar_menu
2
+ .nodblclick.d-flex._card-link{ class: classy("bar"), data: bar_wrap_data }
3
+ = render_bar_body
4
+ = render_bar_menu
data/set/all/bar.rb CHANGED
@@ -1,107 +1,85 @@
1
1
  format :html do
2
2
  setting :bar_cols
3
- setting :info_bar_cols
4
-
5
- view :info_bar do
6
- render_bar show: :bar_middle
7
- end
8
-
9
- before :bar do
10
- class_up "bar", card.safe_set_keys
11
- end
12
-
13
- view :bar, unknown: :unknown_bar do
14
- voo.hide :bar_middle
15
- class_up_bar_sides(voo.show?(:bar_middle))
16
- # NOTE: above cannot be in `before`, because before blocks run before viz processing
17
- wrap do
18
- voo.hide! :bar_collapse_link
19
- voo.hide :edit_link, :full_page_link, :bridge_link
20
- voo.hide :bar_bottom # needed for toggle
21
- haml :bar
22
- end
23
- end
3
+ setting :mini_bar_cols
24
4
 
25
5
  bar_cols 9, 3
26
- info_bar_cols 5, 4, 3
27
-
28
- view :unknown_bar, unknown: true do
29
- voo.hide! :bar_middle, :bar_bottom, :bar_nav
30
- wrap { haml :bar }
31
- end
6
+ mini_bar_cols 9, 3
32
7
 
33
- before :expanded_bar do
34
- class_up "bar", card.safe_set_keys
8
+ view :bar, unknown: :mini_bar do
9
+ cols = bar_cols.size == 3 ? [mini_bar_cols, bar_cols] : [bar_cols]
10
+ prepare_bar(*cols)
11
+ build_bar
35
12
  end
36
13
 
37
- view :expanded_bar do
38
- class_up_bar_sides(false)
39
- wrap do
40
- voo.hide! :bar_expand_link
41
- haml :expanded_bar
42
- end
14
+ view :mini_bar, unknown: true do
15
+ prepare_bar mini_bar_cols
16
+ build_bar
43
17
  end
44
18
 
45
- def class_up_bar_sides middle
46
- class_up_cols %w[bar-left bar-right], bar_cols
47
- class_up_cols %w[bar-left bar-middle bar-right], info_bar_cols, "md" if middle
48
- end
19
+ view(:bar_left, unknown: true) { render_title }
20
+ view(:bar_middle, unknown: :blank) { "" }
21
+ view(:bar_right, unknown: :blank) { "" }
49
22
 
50
- def class_up_cols classes, cols, context=nil
51
- classes.each_with_index do |cls, i|
52
- class_up cls, ["col", context, cols[i]].compact.join("-")
53
- end
54
- end
55
-
56
- view :bar_left do
57
- bar_title
23
+ view :bar_bottom do
24
+ view = nest_mode == :edit ? :edit : :content
25
+ render view, home_view: view
58
26
  end
59
27
 
60
- def bar_title
61
- return render_missing if card.unknown?
62
-
63
- if voo.show?(:toggle)
64
- link_to_view bar_title_toggle_view, render_title
65
- else
66
- render_title
67
- end
68
- end
28
+ view :bar_menu, unknown: true, template: :haml
29
+ view :bar_body, unknown: true, template: :haml
69
30
 
70
- def bar_title_toggle_view
71
- voo.show?(:bar_bottom) ? :bar : :expanded_bar
31
+ view :accordion_bar, unknown: :mini_bar do
32
+ build_accordion_bar
72
33
  end
34
+ view :closed_bar, :accordion_bar
73
35
 
74
- view :bar_right, unknown: :blank do
75
- [(render(:short_content) unless voo.show?(:bar_middle)),
76
- render(:edit_button, optional: :hide)]
36
+ view :open_bar do
37
+ build_accordion_bar open: true
77
38
  end
39
+ view :expanded_bar, :open_bar
78
40
 
79
- view :bar_middle, unknown: :blank do
80
- render :short_content
41
+ def build_accordion_bar open: false
42
+ prepare_bar mini_bar_cols
43
+ class_up "accordion-item", "bar #{classy 'bar'}"
44
+ accordion_item render_bar_body,
45
+ subheader: render_menu,
46
+ body: render_bar_bottom,
47
+ open: open,
48
+ context: :accordion_bar
81
49
  end
82
50
 
83
- view :bar_bottom do
84
- render(nest_mode == :edit ? :edit : :core)
51
+ def build_bar
52
+ wrap { haml :bar }
85
53
  end
86
54
 
87
- view :bar_nav, unknown: true, wrap: { div: { class: "bar-nav" } } do
88
- [render_bar_expand_link,
89
- render_bar_collapse_link,
90
- render_full_page_link,
91
- render_edit_link,
92
- render_bridge_link]
55
+ def bar_menu_items
56
+ [
57
+ full_page_link(text: "page"),
58
+ modal_page_link(text: "modal"),
59
+ edit_link(:edit, text: card.new? ? "create" : "edit"),
60
+ bridge_link(text: "advanced")
61
+ ]
93
62
  end
94
63
 
95
- view :bar_expand_link, unknown: true do
96
- link_to_view :expanded_bar, icon_tag(:keyboard_arrow_down)
64
+ # NOTE: currently bar always turns to mini-bar at md
65
+ def prepare_bar two_cols, three_cols=nil
66
+ class_up "bar", full_page_card.safe_set_keys
67
+ class_up_cols %w[bar-left bar-right], two_cols
68
+ class_up "bar-middle", "d-none d-md-flex"
69
+ if three_cols
70
+ class_up_cols %w[bar-left bar-middle bar-right], three_cols, "md"
71
+ else
72
+ voo.hide :bar_middle
73
+ end
97
74
  end
98
75
 
99
- view :bar_collapse_link, unknown: true do
100
- link_to_view :bar, icon_tag(:keyboard_arrow_up)
76
+ def class_up_cols classes, cols, context=nil
77
+ classes.each_with_index do |cls, i|
78
+ class_up cls, ["col", context, cols[i]].compact.join("-")
79
+ end
101
80
  end
102
81
 
103
- view :edit_button do
104
- view = voo.edit == :inline ? :edit_inline : :edit
105
- link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary mr-2"
82
+ def bar_wrap_data
83
+ full_page_card == card ? wrap_data : full_page_card.format.wrap_data
106
84
  end
107
85
  end
@@ -0,0 +1,10 @@
1
+ .row.g-0{ class: classy("bar-body") }
2
+ - if voo.show? :bar_left
3
+ %div{ class: classy("bar-left") }
4
+ = render :bar_left
5
+ - if voo.show? :bar_middle
6
+ %div{ class: classy("bar-middle") }
7
+ = render :bar_middle
8
+ - if voo.show? :bar_right
9
+ %div{ class: classy("bar-right") }
10
+ = render :bar_right
@@ -0,0 +1,9 @@
1
+ .bar-menu.dropdown._over-card-link._card-link-clickable
2
+ .bar-menu-button.btn.dropdown-toggle{ "aria-expanded": "false",
3
+ "aria-haspopup": "true",
4
+ "data-bs-toggle": "dropdown" }
5
+ = icon_tag :more
6
+ .bar-menu-list.dropdown-menu{ "aria-labelledby": ".bar-menu-button" }
7
+ - bar_menu_items.each do |item|
8
+ .dropdown-item
9
+ = item
data/set/all/box.haml CHANGED
@@ -1,5 +1,5 @@
1
1
  - box_classes = css_classes classy("box"), card.safe_set_keys
2
- .card.nodblclick{ class: box_classes, data: wrap_data(false) }
2
+ .card._card-link.nodblclick{ class: box_classes, data: wrap_data }
3
3
  - if voo.show? :box_top
4
4
  .card-header.text-center{class: classy("box-top")}
5
5
  = render :box_top
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-bar_and_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.1
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: 2022-01-08 00:00:00.000000000 Z
13
+ date: 2023-03-29 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.104.2
21
+ version: 1.105.1
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.104.2
28
+ version: 1.105.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-style
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.14.2
35
+ version: 0.15.1
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.14.2
42
+ version: 0.15.1
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -47,14 +47,20 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
- - assets/style/style_image_box.scss
50
+ - assets/script/bar_and_box.js.coffee
51
+ - assets/script/click_select.js.coffee
52
+ - assets/style/bar.scss
53
+ - assets/style/box.scss
54
+ - assets/style/image_box.scss
55
+ - data/files/mod_bar_and_box_script_asset_output/file.js
51
56
  - set/abstract/media.rb
52
57
  - set/abstract/media/media_snippet.haml
53
58
  - set/all/bar.haml
54
59
  - set/all/bar.rb
60
+ - set/all/bar_body.haml
61
+ - set/all/bar_menu.haml
55
62
  - set/all/box.haml
56
63
  - set/all/box.rb
57
- - set/all/expanded_bar.haml
58
64
  - set/type/image.rb
59
65
  homepage: https://decko.org
60
66
  licenses:
@@ -66,6 +72,7 @@ metadata:
66
72
  wiki_uri: https://decko.org
67
73
  documentation_url: http://docs.decko.org/
68
74
  card-mod: bar_and_box
75
+ card-mod-group: gem-defaults
69
76
  post_install_message:
70
77
  rdoc_options: []
71
78
  require_paths:
@@ -81,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
88
  - !ruby/object:Gem::Version
82
89
  version: '0'
83
90
  requirements: []
84
- rubygems_version: 3.2.15
91
+ rubygems_version: 3.3.11
85
92
  signing_key:
86
93
  specification_version: 4
87
94
  summary: bar and box views
@@ -1,10 +0,0 @@
1
- .expanded-bar
2
- %div{ class: classy("bar-body") }
3
- .nodblclick{ class: classy("bar") }
4
- %div{ class: classy("bar-left") }
5
- = naming { render :bar_left }
6
- %div{ class: classy("bar-right") }
7
- = render :bar_right, hide: :short_content
8
- .bar-bottom
9
- = render :bar_bottom
10
- = render :bar_nav