card-mod-bar_and_box 0.14.1 → 0.15.0

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: 9ea9309777d7ec147c066012b730b527e4171fd4fbd04f08e22486fb8653a79f
4
- data.tar.gz: 2229cfa53db0a215f471f46a1ee76740e331028f2fa449083b2ea2b3ee10055c
3
+ metadata.gz: 19e480ee40d8bf0986ac447c8af7f1ed04105988d0ea135c164ea166e8668cc3
4
+ data.tar.gz: db52363442b89ed1f751c53fd3d4e017ce4d565858907306e84fa2d7623a2479
5
5
  SHA512:
6
- metadata.gz: afa8181c2e70ffbc12d66f593985465e0a190634fcad9e1edf8ceb443ba5810380edf71dcdbdaac10e462bb8fe834263dc232d63b035f5a9753b3be02a5e5cae
7
- data.tar.gz: 31057ef3ddf0b6157a55b0eadcbd77981f25fa7bc1ddc415fc811e180f6949b3f64c4c78914f20054583f45186a5924a5f209936a79b12ef217a315dff3a9a7c
6
+ metadata.gz: 1327eec75b2547829073c1b76d9f8044ff1b45031cb91cbe6246f7d1fb2c033f95ddab328dff4d2c4857260f8e1205898b77d94d8de4994420d10ee78841ff64
7
+ data.tar.gz: 397701174596444305af9841a2b909b9a2b396b8b2ab01af41447083e1b90fdad8ea7af23a9cdce5d83dbc28d3d57e0b701e80407901f0418f134ddf4ba969e3
@@ -0,0 +1,30 @@
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 cl.closest("._card-link-modal")[0]
10
+ cl.find("._modal-page-link").trigger "click"
11
+ else
12
+ url = decko.path cl.data("cardLinkName")
13
+ if openInNewTab event
14
+ window.open url, "_tab_" + Math.floor(Math.random() * 1000);
15
+ else
16
+ window.location = url
17
+
18
+ openInNewTab = (event) -> event.metaKey
19
+
20
+
21
+ decko.slot.ready (slot)->
22
+ # note: by using slot ready, we can make sure this event is triggered early
23
+ slot.find("._card-link a, ._card-link ._card-link-clickable").on "click", (event) ->
24
+ a = $(this)
25
+ if a.hasClass("_over-card-link") || a.closest("._over-card-link")[0]
26
+ # skip card link action
27
+ a.closest("._card-link").data "skip", "on"
28
+ else
29
+ # don't follow original link
30
+ 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,95 @@
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 {
18
+ border-left: 3px solid $bar_stripe_color !important;
19
+
20
+ .media {
21
+ width: 100%
22
+ }
23
+ .media-left {
24
+ max-width: 25%
25
+ }
26
+ }
27
+
28
+ .bar-left, .bar-right, .bar-middle {
29
+ display: flex;
30
+ padding: 0.5rem;
31
+ flex-wrap: wrap;
32
+ align-items: center;
33
+ }
34
+
35
+ .bar-left {
36
+ font-weight: bold;
37
+ align-items: flex-start;
38
+ }
39
+
40
+ .bar-middle {
41
+ justify-content: center;
42
+ }
43
+
44
+ .bar-right {
45
+ justify-content: flex-end;
46
+ }
47
+
48
+ .bar-menu {
49
+ width: 3em;
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+
54
+ .bar-body {
55
+ width: 100%;
56
+ display: flex;
57
+ }
58
+
59
+ .bar.with-bar-menu .bar-body {
60
+ width: calc(100% - 3em);
61
+ }
62
+
63
+ .bar-menu-button {
64
+ padding: 0.2em 0.75em;
65
+ &:hover {
66
+ background-color: $secondary;
67
+ color: $white;
68
+ border-radius: 5px;
69
+ }
70
+ // disable bootstrap dropdown caret
71
+ &:after {
72
+ display: none;
73
+ }
74
+ }
75
+
76
+ // links in bar menu
77
+ .bar-menu-list a i {
78
+ padding-right: 0.4em;
79
+ }
80
+
81
+ // card submenu in accordion bar
82
+ .accordion-subheader > .card-menu {
83
+ position: static;
84
+ background: inherit !important;
85
+ }
86
+
87
+ @include media-breakpoint-up(md) {
88
+ .bar-menu-button {
89
+ display: none;
90
+ }
91
+
92
+ ._card-link:hover .bar-menu-button {
93
+ display: block;
94
+ }
95
+ }
@@ -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;
@@ -77,3 +77,17 @@
77
77
  padding: 4px;
78
78
  }
79
79
  }
80
+
81
+ .media {
82
+ display: flex;
83
+ }
84
+ .media-body {
85
+ .media-heading {
86
+ a {
87
+ color: inherit;
88
+ }
89
+ }
90
+ .media-text {
91
+ clear: both;
92
+ }
93
+ }
@@ -0,0 +1,4 @@
1
+ // bar_and_box.js.coffee
2
+ (function(){$(window).ready(function(){return $(document).on("click","._card-link",function(){var n;return"on"===(n=$(this)).data("skip")?n.data("skip",null):n.closest("._card-link-modal")[0]?n.find("._modal-page-link").trigger("click"):window.location=decko.path(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);
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
+ %i.fa.fa-ellipsis-h
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.1
4
+ version: 0.15.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: 2022-01-04 00:00:00.000000000 Z
13
+ date: 2023-01-04 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.1
21
+ version: 1.105.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.104.1
28
+ version: 1.105.0
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.1
35
+ version: 0.15.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.14.1
42
+ version: 0.15.0
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