beyond_canvas 0.21.0.pre → 0.22.0.pre

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: 8090819de67a4cd59730d513d833430cb0314693d92614a40b150603e9e569bc
4
- data.tar.gz: 447fc7161eda427ad167d616265322f33db7f42bf232c9dd642f900f730a1afa
3
+ metadata.gz: 7a4ead3a43e09b4b3e09f2b34189ae10000390b92cc9114311229b3b7564cdd7
4
+ data.tar.gz: b1f7cf8af577809cff6869bb70e5dae13b79ba9af101e462e41b1ab6bafa3d8d
5
5
  SHA512:
6
- metadata.gz: e99a7527ad594aa9c3805d6d422c13030252e0c8b9d614bc3bef1c29bbef358093bebfffe80f6dad4e1799345ce38835ed2398e70eed6b4eef5babb5c5ffba5c
7
- data.tar.gz: 7f725871fca780a660973273cae8b4102d98f1f9f49633e4b9ed2a496e23388a7aac61e8940575f023ab213cca894be65d6e6e2ca1e4db16577a30997091d435
6
+ metadata.gz: 53c3c8df6355da6859e55458b3cec85b6caaf1dac8fcce848e5dd590636d42c1018f9765fd5f8b8e478bc2d79c6d503b9fa8211fdccb317b9af1ab509cf26a51
7
+ data.tar.gz: a29c6b62aae56c8a3dc379252a22c6b84f8c014a38011669b5b2d3939009927631eae03f2b2663b688703c17b736e0cf2431fcc10003641e404cc97998128144
@@ -23,25 +23,18 @@
23
23
  });
24
24
  });
25
25
  $(BUTTON_SELECTORS).each(function() {
26
- var button = $(this);
27
- button.width(button.width());
28
- button.data("oldWidth", button.width());
29
- if (button.find(".spinner").length == 0) {
30
- button.prepend('\n <div class="spinner">\n <div class="bounce1"></div>\n <div class="bounce2"></div>\n <div class="bounce3"></div>\n </div>');
31
- }
32
- button.closest("form").on("ajax:success", function() {
33
- $.restoreActionElements();
34
- }).on("ajax:error", function() {
35
- $.restoreActionElements();
36
- });
26
+ $(this).buildButton();
37
27
  });
38
28
  };
39
29
  $(document).on("confirm:complete", function() {
40
30
  $.restoreActionElements();
41
31
  });
42
32
  $(document).on("click", BUTTON_SELECTORS, function() {
33
+ var button = $(this);
43
34
  $.disableActionElements();
44
- $(this).showSpinner();
35
+ if (!button.hasClass("button--no-spinner")) {
36
+ $(this).showSpinner();
37
+ }
45
38
  });
46
39
  $(document).on("ready page:load turbolinks:load", onDOMReady);
47
40
  })(jQuery);
@@ -64,6 +57,23 @@
64
57
  }
65
58
  });
66
59
  $.fn.extend({
60
+ buildButton: function buildButton() {
61
+ var button = $(this);
62
+ if (button.is("[class^=button]")) {
63
+ if (!button.hasClass("button--no-spinner")) {
64
+ button.width(button.width());
65
+ button.data("oldWidth", button.width());
66
+ if (button.find(".spinner").length == 0) {
67
+ button.prepend('\n <div class="spinner">\n <div class="bounce1"></div>\n <div class="bounce2"></div>\n <div class="bounce3"></div>\n </div>');
68
+ }
69
+ }
70
+ button.closest("form").on("ajax:success", function() {
71
+ $.restoreActionElements();
72
+ }).on("ajax:error", function() {
73
+ $.restoreActionElements();
74
+ });
75
+ }
76
+ },
67
77
  showSpinner: function showSpinner() {
68
78
  var button = $(this);
69
79
  button.width(button.width() + $(".spinner").outerWidth(true));
@@ -72,6 +82,13 @@
72
82
  }, SPINNER_ANIMATION_TIMEOUT);
73
83
  }
74
84
  });
85
+ (function($) {
86
+ $(document).on("click", "[data-toggle='collapse']", function(e) {
87
+ e.preventDefault();
88
+ $($(this).attr("data-target")).slideToggle();
89
+ $(this).find(".collapse__icon").toggleClass("collapse__icon--open");
90
+ });
91
+ })(jQuery);
75
92
  (function($) {
76
93
  var onDOMReady = function onDOMReady() {
77
94
  $(".flash").each(function() {
@@ -13,8 +13,8 @@
13
13
  @import "components/breadcrumbs";
14
14
  @import "components/buttons";
15
15
  @import "components/cards";
16
+ @import "components/collapse";
16
17
  @import "components/comments";
17
- @import "components/containers";
18
18
  @import "components/debug";
19
19
  @import "components/flash";
20
20
  @import "components/forms";
@@ -21,6 +21,10 @@
21
21
  &__item {
22
22
  color: $breadcrum-color-current;
23
23
 
24
+ &:hover {
25
+ color: $breadcrum-color-hover
26
+ }
27
+
24
28
  &--current {
25
29
  color: $breadcrum-color;
26
30
  pointer-events: none;
@@ -0,0 +1,30 @@
1
+ .collapse {
2
+
3
+ &:not(:last-child) {
4
+ margin-bottom: 24px;
5
+ }
6
+
7
+ &__content {
8
+ display: none;
9
+ }
10
+
11
+ &__button {
12
+ color: $palette-primary;
13
+ font-weight: 700;
14
+ cursor: pointer;
15
+ display: table;
16
+ line-height: 1;
17
+ margin-bottom: 4px;
18
+ }
19
+
20
+ &__icon {
21
+ @include size(10px);
22
+
23
+ fill: $palette-primary;
24
+ margin-right: 2px;
25
+
26
+ &--open {
27
+ transform: rotate(90deg);
28
+ }
29
+ }
30
+ }
@@ -1,17 +1,45 @@
1
+ %link_disabled {
2
+ @include color-darken($link-disabled-color, 10%);
3
+
4
+ cursor: not-allowed;
5
+ pointer-events: none;
6
+ }
7
+
8
+ %link {
9
+ line-height: 1.2;
10
+ }
11
+
1
12
  .link {
2
13
  &__icon {
3
- margin-right: 10px;
14
+ @include size(14px);
15
+
16
+ margin-right: 6px;
4
17
  }
5
18
 
6
19
  &--primary {
7
20
  @include color-darken($link-primary-color, 10%);
21
+
22
+ @extend %link;
8
23
  }
9
24
 
10
25
  &--secondary {
11
26
  @include color-darken($link-secondary-color, 10%);
27
+
28
+ @extend %link;
12
29
  }
13
30
 
14
31
  &--danger {
15
32
  @include color-darken($link-danger-color, 10%);
33
+
34
+ @extend %link;
35
+ }
36
+
37
+ &--primary,
38
+ &--secondary,
39
+ &--danger {
40
+ &:disabled,
41
+ &[disabled] {
42
+ @extend %link_disabled;
43
+ }
16
44
  }
17
45
  }
@@ -1,10 +1,10 @@
1
1
  .modal {
2
2
 
3
3
  &__background {
4
+ @include position(fixed, 0 0 0 0);
4
5
  width: 100%;
5
6
  height: 100%;
6
7
  background-color: $modal-background-color;
7
- position: absolute;
8
8
  z-index: 99999;
9
9
  justify-content: center;
10
10
  align-items: center;
@@ -52,7 +52,6 @@
52
52
  @include padding(8px 14px);
53
53
 
54
54
  color: $notice-color;
55
- display: flex;
56
- align-items: center;
55
+ display: block;
57
56
  }
58
57
  }
@@ -1,5 +1,9 @@
1
1
  .beyond-canvas {
2
2
 
3
+ .select2-dropdown--above {
4
+ border-top: 1px solid $select2-border-color-focus !important;
5
+ }
6
+
3
7
  .select2-container--default .select2-selection--multiple {
4
8
  border: 1px solid $select2-border-color;
5
9
  border-radius: 3px;
@@ -53,6 +57,7 @@
53
57
  .select2-dropdown{
54
58
  border: 1px solid $input-border-color-focus;
55
59
  border-top: none;
60
+ z-index: 9999999;
56
61
  }
57
62
 
58
63
  .select2-results__option {
@@ -40,6 +40,7 @@ $headline-line-height: 1;
40
40
  $link-primary-color: darken($palette-primary, 10%) !default;
41
41
  $link-secondary-color: darken($palette-cancel, 10%) !default;
42
42
  $link-danger-color: darken($palette-danger, 10%) !default;
43
+ $link-disabled-color: rgb(208,208,208) !default;
43
44
 
44
45
  // ************************************************************
45
46
  // Buttons
@@ -72,7 +73,7 @@ $card-box-shadow: 0 2px 7px rgba($black, 0.2) !default;
72
73
  $card-padding: 40px;
73
74
  $card-margin: 30px;
74
75
  $card-separator-color: rgb(222, 222, 222) !default;
75
- $card-separator-spacing: 50px;
76
+ $card-separator-spacing: 40px;
76
77
  $card-title-color: rgb(247, 133, 96) !default;
77
78
 
78
79
  // ************************************************************
@@ -184,8 +185,9 @@ $status-neutral-color: rgb(155,151,100) !default;
184
185
  // Breadcrums
185
186
  // ************************************************************
186
187
 
187
- $breadcrum-color: rgb(122, 118, 76) !default;
188
- $breadcrum-color-current: rgb(61, 149, 137) !default;
188
+ $breadcrum-color: rgb(112, 110, 77) !default;
189
+ $breadcrum-color-hover: rgb(67, 65, 46) !default;
190
+ $breadcrum-color-current: rgb(112, 110, 77) !default;
189
191
 
190
192
  // ************************************************************
191
193
  // Titles
@@ -257,3 +259,9 @@ $select2-tag-color: rgb(122, 118, 76) !default;
257
259
  $select2-disabled-background: rgb(245, 244, 239) !default;
258
260
  $select2-option-hover-background: rgb(229, 241, 240) !default;
259
261
  $select2-option-hover-color: rgb(62, 62, 62) !default;
262
+
263
+ // ************************************************************
264
+ // Collapsibles
265
+ // ************************************************************
266
+
267
+ $collapsible-color: $palette-primary !default
@@ -12,6 +12,15 @@
12
12
  color: $color;
13
13
  transition: $main-transition;
14
14
 
15
+ svg {
16
+ fill: $color;
17
+
18
+ &:hover {
19
+ fill: darken($color, $percent);
20
+ transition: $main-transition;
21
+ }
22
+ }
23
+
15
24
  &:hover {
16
25
  color: darken($color, $percent);
17
26
  transition: $main-transition;
@@ -36,8 +36,29 @@ module BeyondCanvas
36
36
  end
37
37
  end
38
38
 
39
+ def collapse(name, html_options = nil, &block)
40
+ html_options ||= {}
41
+ id = unique_id(:collapse)
42
+
43
+ html_options.merge!(class: 'collapse__content') { |_key, old_val, new_val| [new_val, old_val].join(' ') }
44
+ html_options.merge!(id: id)
45
+
46
+ content_tag('div', class: 'collapse') do
47
+ content_tag('a', class: 'collapse__button', data: { toggle: 'collapse', target: "##{id}" }) do
48
+ (inline_svg_tag('icons/arrow_right.svg', class: 'collapse__icon') + name).html_safe
49
+ end +
50
+ content_tag('div', html_options) do
51
+ yield block if block_given?
52
+ end
53
+ end
54
+ end
55
+
39
56
  private
40
57
 
58
+ def unique_id(attribute)
59
+ "#{attribute}_#{DateTime.now.strftime('%Q') + rand(10_000).to_s}"
60
+ end
61
+
41
62
  def get_flash_icon(key)
42
63
  case key
43
64
  when 'success', 'notice'
@@ -1,6 +1,7 @@
1
1
  import 'jquery';
2
2
 
3
3
  import './initializers/buttons';
4
+ import './initializers/collapse';
4
5
  import './initializers/flash';
5
6
  import './initializers/inputs';
6
7
  import './initializers/modals';
@@ -2,7 +2,7 @@ const SPINNER_ANIMATION_TIMEOUT = 125;
2
2
  const BUTTON_SELECTORS = '[class^="button"]';
3
3
 
4
4
  (function ($) {
5
- const onDOMReady = function (e) {
5
+ const onDOMReady = function () {
6
6
  const inputs = $('input, textarea, select').not(
7
7
  ':input[type=button], :input[type=submit], :input[type=reset]'
8
8
  );
@@ -19,31 +19,7 @@ const BUTTON_SELECTORS = '[class^="button"]';
19
19
  });
20
20
 
21
21
  $(BUTTON_SELECTORS).each(function () {
22
- var button = $(this);
23
-
24
- // Add width attribute and save old width
25
- button.width(button.width());
26
- button.data('oldWidth', button.width());
27
-
28
- // Add the spinner
29
- if (button.find('.spinner').length == 0) {
30
- button.prepend(`
31
- <div class="spinner">
32
- <div class="bounce1"></div>
33
- <div class="bounce2"></div>
34
- <div class="bounce3"></div>
35
- </div>`);
36
- }
37
-
38
- // Bind ajax:success and ajax:error to the form the button belongs to
39
- button
40
- .closest('form')
41
- .on('ajax:success', function () {
42
- $.restoreActionElements();
43
- })
44
- .on('ajax:error', function () {
45
- $.restoreActionElements();
46
- });
22
+ $(this).buildButton();
47
23
  });
48
24
  };
49
25
 
@@ -52,8 +28,13 @@ const BUTTON_SELECTORS = '[class^="button"]';
52
28
  });
53
29
 
54
30
  $(document).on('click', BUTTON_SELECTORS, function () {
31
+ var button = $(this);
32
+
55
33
  $.disableActionElements();
56
- $(this).showSpinner();
34
+
35
+ if (!button.hasClass('button--no-spinner')) {
36
+ $(this).showSpinner();
37
+ }
57
38
  });
58
39
 
59
40
  $(document).on('ready page:load turbolinks:load', onDOMReady);
@@ -84,6 +65,37 @@ $.extend({
84
65
  });
85
66
 
86
67
  $.fn.extend({
68
+ buildButton: function() {
69
+ var button = $(this);
70
+
71
+ if (button.is('[class^=button]')) {
72
+ if (!button.hasClass('button--no-spinner')) {
73
+ // Add width attribute and save old width
74
+ button.width(button.width());
75
+ button.data('oldWidth', button.width());
76
+
77
+ // Add the spinner
78
+ if (button.find('.spinner').length == 0) {
79
+ button.prepend(`
80
+ <div class="spinner">
81
+ <div class="bounce1"></div>
82
+ <div class="bounce2"></div>
83
+ <div class="bounce3"></div>
84
+ </div>`);
85
+ }
86
+ }
87
+
88
+ // Bind ajax:success and ajax:error to the form the button belongs to
89
+ button
90
+ .closest('form')
91
+ .on('ajax:success', function () {
92
+ $.restoreActionElements();
93
+ })
94
+ .on('ajax:error', function () {
95
+ $.restoreActionElements();
96
+ });
97
+ }
98
+ },
87
99
  showSpinner: function () {
88
100
  var button = $(this);
89
101
 
@@ -0,0 +1,8 @@
1
+ (function ($) {
2
+ $(document).on('click', "[data-toggle='collapse']", function (e) {
3
+ e.preventDefault();
4
+
5
+ $($(this).attr('data-target')).slideToggle();
6
+ $(this).find('.collapse__icon').toggleClass('collapse__icon--open');
7
+ });
8
+ })(jQuery);
@@ -1,12 +1,15 @@
1
- <% if is_cockpit_app? %>
1
+ <% if is_cockpit_app? && breadcrumb_trail.count.positive? %>
2
2
 
3
3
  <div class='breadcrumbs'>
4
4
 
5
5
  <%= inline_svg_tag 'icons/home.svg' %>
6
6
 
7
+ <% i = 1 %>
8
+
7
9
  <% breadcrumb_trail do |crumb| %>
8
10
  <%= link_to crumb.name, crumb.url, class: "breadcrumb__item#{ '--current' if crumb.current? }" %>
9
- <% unless crumb.current? %><%= inline_svg_tag 'icons/arrow_right.svg' %><% end %>
11
+ <% unless i == breadcrumb_trail.count || crumb.current? %><%= inline_svg_tag 'icons/arrow_right.svg' %><% end %>
12
+ <% i += 1 %>
10
13
  <% end %>
11
14
 
12
15
  </div>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeyondCanvas
4
- VERSION = '0.21.0.pre'
4
+ VERSION = '0.22.0.pre'
5
5
  end
@@ -40,15 +40,16 @@ module BeyondCanvas
40
40
  #
41
41
  def to_session
42
42
  BeyondApi::Session.new(api_url: beyond_api_url,
43
- access_token: beyond_access_token,
44
- refresh_token: beyond_refresh_token)
43
+ access_token: beyond_access_token,
44
+ refresh_token: beyond_refresh_token)
45
45
  end
46
46
 
47
47
  #
48
48
  # Returns the shop url
49
49
  #
50
- def url
51
- "https://#{URI.parse(beyond_api_url).host}"
50
+ def url(path = nil, params = nil)
51
+ path = path[1..-1] if path&.chr == '/'
52
+ "https://#{URI.parse(beyond_api_url).host}/#{path}#{'?' +params&.to_query if params.present?}"
52
53
  end
53
54
 
54
55
  def has_scope?(scope)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0.pre
4
+ version: 0.22.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-11-13 00:00:00.000000000 Z
13
+ date: 2020-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: attr_encrypted
@@ -235,8 +235,8 @@ files:
235
235
  - app/assets/stylesheets/beyond_canvas/components/_breadcrumbs.scss
236
236
  - app/assets/stylesheets/beyond_canvas/components/_buttons.scss
237
237
  - app/assets/stylesheets/beyond_canvas/components/_cards.scss
238
+ - app/assets/stylesheets/beyond_canvas/components/_collapse.scss
238
239
  - app/assets/stylesheets/beyond_canvas/components/_comments.scss
239
- - app/assets/stylesheets/beyond_canvas/components/_containers.scss
240
240
  - app/assets/stylesheets/beyond_canvas/components/_debug.scss
241
241
  - app/assets/stylesheets/beyond_canvas/components/_flash.scss
242
242
  - app/assets/stylesheets/beyond_canvas/components/_forms.scss
@@ -283,6 +283,7 @@ files:
283
283
  - app/helpers/beyond_canvas/statuses_helper.rb
284
284
  - app/javascript/beyond_canvas/base.js
285
285
  - app/javascript/beyond_canvas/initializers/buttons.js
286
+ - app/javascript/beyond_canvas/initializers/collapse.js
286
287
  - app/javascript/beyond_canvas/initializers/flash.js
287
288
  - app/javascript/beyond_canvas/initializers/inputs.js
288
289
  - app/javascript/beyond_canvas/initializers/modals.js
@@ -1,37 +0,0 @@
1
- $columns: 2, 3, 4;
2
-
3
- .container {
4
- width: 100%;
5
- display: flex;
6
- flex-wrap: wrap;
7
-
8
- &--center {
9
- justify-content: center;
10
- }
11
-
12
- &__column {
13
-
14
- @each $column in $columns {
15
-
16
- &--#{$column} {
17
- width: 100%;
18
-
19
- @media (min-width: $laptop) {
20
- width: calc((100% - (#{$column} - 1) * #{$container-spacing}) / #{$column});
21
-
22
- &:not(:last-child) {
23
- margin-right: $container-spacing;
24
- }
25
- }
26
-
27
- &:not(:last-child) {
28
- margin-bottom: $container-spacing;
29
-
30
- @media (min-width: $laptop) {
31
- margin-bottom: 0;
32
- }
33
- }
34
- }
35
- }
36
- }
37
- }