beyond_canvas 0.19.0.pre → 0.22.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -45
  3. data/app/assets/javascripts/beyond_canvas/base.js +30 -13
  4. data/app/assets/stylesheets/beyond_canvas/base.scss +6 -4
  5. data/app/assets/stylesheets/beyond_canvas/components/_breadcrumbs.scss +4 -0
  6. data/app/assets/stylesheets/beyond_canvas/components/_buttons.scss +44 -0
  7. data/app/assets/stylesheets/beyond_canvas/components/_collapse.scss +30 -0
  8. data/app/assets/stylesheets/beyond_canvas/components/_flash.scss +2 -1
  9. data/app/assets/stylesheets/beyond_canvas/components/_grids.scss +2 -2
  10. data/app/assets/stylesheets/beyond_canvas/components/_inputs.scss +6 -0
  11. data/app/assets/stylesheets/beyond_canvas/components/_links.scss +29 -1
  12. data/app/assets/stylesheets/beyond_canvas/components/_margins.scss +4 -0
  13. data/app/assets/stylesheets/beyond_canvas/components/_menu.scss +10 -0
  14. data/app/assets/stylesheets/beyond_canvas/components/_modals.scss +1 -1
  15. data/app/assets/stylesheets/beyond_canvas/components/_notices.scss +1 -2
  16. data/app/assets/stylesheets/beyond_canvas/components/_select2.scss +70 -0
  17. data/app/assets/stylesheets/beyond_canvas/components/_statuses.scss +27 -0
  18. data/app/assets/stylesheets/beyond_canvas/components/_texts.scss +8 -0
  19. data/app/assets/stylesheets/beyond_canvas/settings/_variables.scss +44 -3
  20. data/app/assets/stylesheets/beyond_canvas/utilities/_mixins.scss +9 -0
  21. data/app/controllers/beyond_canvas/application_controller.rb +1 -0
  22. data/app/helpers/beyond_canvas/application_helper.rb +22 -1
  23. data/app/helpers/beyond_canvas/controller_helper.rb +9 -0
  24. data/app/helpers/beyond_canvas/statuses_helper.rb +26 -0
  25. data/app/javascript/beyond_canvas/base.js +1 -0
  26. data/app/javascript/beyond_canvas/initializers/buttons.js +39 -27
  27. data/app/javascript/beyond_canvas/initializers/collapse.js +8 -0
  28. data/app/javascript/beyond_canvas/initializers/flash.js +1 -1
  29. data/app/views/beyond_canvas/shared/_breadcrumbs.html.erb +5 -2
  30. data/app/views/layouts/beyond_canvas/application.html.erb +1 -1
  31. data/lib/beyond_canvas/engine.rb +1 -4
  32. data/lib/beyond_canvas/version.rb +1 -1
  33. data/lib/generators/beyond_canvas/controller/controller_generator.rb +1 -5
  34. data/lib/generators/beyond_canvas/controller/templates/{controller.erb → shops_controller.rb} +1 -1
  35. data/lib/generators/beyond_canvas/custom_menu/templates/beyond_canvas_custom_menu.html.erb +6 -6
  36. data/lib/generators/beyond_canvas/custom_styles/templates/beyond_canvas_custom_styles.scss +33 -0
  37. data/lib/generators/beyond_canvas/install/templates/beyond_canvas.rb.erb +1 -1
  38. data/lib/models/concerns/utils.rb +5 -4
  39. metadata +9 -4
  40. data/app/assets/stylesheets/beyond_canvas/components/_containers.scss +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8497d52ad577ad1bd0cdebd09e869d11ea2887a31fdc989b1bef6a17857dc2c8
4
- data.tar.gz: cb77eecd56a81ab9bfc2f222e6899f9c689f5ede39d1b4410d7c45074dbd4e96
3
+ metadata.gz: 7a4ead3a43e09b4b3e09f2b34189ae10000390b92cc9114311229b3b7564cdd7
4
+ data.tar.gz: b1f7cf8af577809cff6869bb70e5dae13b79ba9af101e462e41b1ab6bafa3d8d
5
5
  SHA512:
6
- metadata.gz: ee33312698d87e1449db902b91374a5b35f17d872f6e3c132a4bf758676f05a4574fee66fbfdf7dbce3f67b43f8dc524579dbe687307c72f8f21711770bbf93c
7
- data.tar.gz: 2869d5f1ab74828a384dc090d745497542739729d6874b4cf8c913a01fee58be62205e08d93d1abcfcda41eba0337d97db758fe3531fb555b38758e11609af2d
6
+ metadata.gz: 53c3c8df6355da6859e55458b3cec85b6caaf1dac8fcce848e5dd590636d42c1018f9765fd5f8b8e478bc2d79c6d503b9fa8211fdccb317b9af1ab509cf26a51
7
+ data.tar.gz: a29c6b62aae56c8a3dc379252a22c6b84f8c014a38011669b5b2d3939009927631eae03f2b2663b688703c17b736e0cf2431fcc10003641e404cc97998128144
data/README.md CHANGED
@@ -3,59 +3,17 @@
3
3
  ![Gem Version](https://img.shields.io/gem/v/beyond_canvas?label=gem%20version)
4
4
  ![License](https://img.shields.io/github/license/ePages-de/beyond_canvas)
5
5
 
6
- ## Installation
7
-
8
- 1. Add this line to your application's Gemfile:
9
-
10
- ```ruby
11
- gem "beyond_canvas"
12
- ```
13
-
14
- 1. Then execute:
15
-
16
- ```bash
17
- $ bundle install
18
- ```
19
-
20
- 1. Restart your server and rename `application.css` to `application.scss` or `application.sass` (in case you prefer to use the `sass` syntax):
21
-
22
- ```bash
23
- $ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
24
- ```
25
-
26
- 1. Delete _all_ Sprockets directives in `application.scss` (`require`, `require_tree` and `require_self`) and use Sass’s native `@import` instead ([Here's why?](https://content.pivotal.io/blog/structure-your-sass-files-with-import)).
27
-
28
- 1. Import Beyond Canvas at the beginning of `application.scss`. Any other styles must be imported after Beyond Canvas to avoid issues:
29
-
30
- ```scss
31
- @import 'beyond_canvas'
32
- ```
33
-
34
- 1. Add the following to `application.js`:
35
-
36
- ```js
37
- //= require beyond_canvas
38
- ```
39
-
40
- 1. Run the generator:
41
-
42
- ```bash
43
- $ rails g beyond_canvas:install
44
- ```
45
-
46
- This will generate `config/initializers/beyond_canvas.rb` file, used for general Beyond Canvas configuration. Read [this wiki entry](https://github.com/ePages-de/beyond_canvas/wiki/Initializer) to get more information about the different configuration options.
47
-
48
6
  ## Documentation
49
7
 
50
- TBD
8
+ Please see the [Beyond Canvas wiki](https://github.com/ePages-de/beyond_canvas/wiki) for additional information about the gem and its features.
51
9
 
52
10
  ## Contributing
53
11
 
54
12
  Please see [CONTRIBUTING](https://github.com/ePages-de/beyond_canvas/blob/master/CONTRIBUTING.md).
55
13
 
56
- ## Changelog
14
+ ## Change log
57
15
 
58
- Beyond Canvas's changelog is available [here](https://github.com/ePages-de/beyond_canvas/blob/master/CHANGELOG.md).
16
+ Beyond Canvas's change log is available [here](https://github.com/ePages-de/beyond_canvas/blob/master/CHANGELOG.md).
59
17
 
60
18
  ## License
61
19
 
@@ -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() {
@@ -81,7 +98,7 @@
81
98
  $(".flash").addClass("flash--shown");
82
99
  }, 100);
83
100
  };
84
- $(document).on("click", ".flash", function() {
101
+ $(document).on("click", ".flash__close", function() {
85
102
  closeAlert();
86
103
  });
87
104
  $(document).on("ready page:load turbolinks:load", onDOMReady);
@@ -8,12 +8,13 @@
8
8
  @import "utilities/functions";
9
9
  @import "utilities/mixins";
10
10
 
11
+ @import "components/action_bar";
11
12
  @import "components/actions";
12
13
  @import "components/breadcrumbs";
13
14
  @import "components/buttons";
14
15
  @import "components/cards";
16
+ @import "components/collapse";
15
17
  @import "components/comments";
16
- @import "components/containers";
17
18
  @import "components/debug";
18
19
  @import "components/flash";
19
20
  @import "components/forms";
@@ -24,14 +25,15 @@
24
25
  @import "components/main";
25
26
  @import "components/margins";
26
27
  @import "components/markdown";
27
- @import "components/action_bar";
28
+ @import "components/menu";
28
29
  @import "components/modals";
29
30
  @import "components/notices";
30
31
  @import "components/relative";
31
32
  @import "components/scrollbox";
33
+ @import "components/select2";
32
34
  @import "components/sidebar";
33
35
  @import "components/spinner";
34
- @import "components/menu";
36
+ @import "components/statuses";
35
37
  @import "components/tables";
36
- @import "components/titles";
37
38
  @import "components/texts";
39
+ @import "components/titles";
@@ -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;
@@ -18,6 +18,16 @@
18
18
  transition: $main-transition;
19
19
  }
20
20
 
21
+ %button_disabled {
22
+ border-color: $button-disabled-background;
23
+ background-color: $button-disabled-background;
24
+ pointer-events: none;
25
+ color: $button-disabled-color;
26
+ text-shadow: $button-disabled-text-shadow;
27
+ border-bottom-color: #aaaaaa;
28
+ }
29
+
30
+
21
31
  @mixin button-solid($background, $color) {
22
32
  @include background-color-darken($background, 10%);
23
33
 
@@ -63,6 +73,10 @@
63
73
  }
64
74
  }
65
75
 
76
+ input[type=file][disabled] ~ .button__transparent--primary {
77
+ @extend %button_disabled;
78
+ }
79
+
66
80
  .button {
67
81
  &__solid {
68
82
  &--primary {
@@ -70,6 +84,11 @@
70
84
 
71
85
  @include button-solid($button-primary-background, $button-primary-color);
72
86
  @include button-border($button-primary-background);
87
+
88
+ &:disabled,
89
+ &[disabled] {
90
+ @extend %button_disabled;
91
+ }
73
92
  }
74
93
 
75
94
  &--secondary {
@@ -77,6 +96,11 @@
77
96
 
78
97
  @include button-solid($button-secondary-background, $button-secondary-color);
79
98
  @include button-border($button-secondary-background);
99
+
100
+ &:disabled,
101
+ &[disabled] {
102
+ @extend %button_disabled;
103
+ }
80
104
  }
81
105
 
82
106
  &--danger {
@@ -84,6 +108,11 @@
84
108
 
85
109
  @include button-solid($button-danger-background, $button-danger-color);
86
110
  @include button-border($button-danger-background);
111
+
112
+ &:disabled,
113
+ &[disabled] {
114
+ @extend %button_disabled;
115
+ }
87
116
  }
88
117
  }
89
118
 
@@ -93,6 +122,11 @@
93
122
 
94
123
  @include button-transparent($button-primary-background);
95
124
  @include button-border($button-primary-background);
125
+
126
+ &:disabled,
127
+ &[disabled] {
128
+ @extend %button_disabled;
129
+ }
96
130
  }
97
131
 
98
132
  &--secondary {
@@ -100,6 +134,11 @@
100
134
 
101
135
  @include button-transparent($button-secondary-background);
102
136
  @include button-border($button-secondary-background);
137
+
138
+ &:disabled,
139
+ &[disabled] {
140
+ @extend %button_disabled;
141
+ }
103
142
  }
104
143
 
105
144
  &--danger {
@@ -107,6 +146,11 @@
107
146
 
108
147
  @include button-transparent($button-danger-background);
109
148
  @include button-border($button-danger-background);
149
+
150
+ &:disabled,
151
+ &[disabled] {
152
+ @extend %button_disabled;
153
+ }
110
154
  }
111
155
  }
112
156
  }
@@ -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
+ }
@@ -40,7 +40,8 @@
40
40
  background-color: $flash-warning;
41
41
  }
42
42
 
43
- &--error {
43
+ &--error,
44
+ &--alert {
44
45
  background-color: $flash-error;
45
46
  }
46
47
  }
@@ -1,8 +1,8 @@
1
1
  .grid {
2
2
  &__container {
3
3
  display: grid;
4
- gap: 40px;
5
- grid-template-columns: repeat(auto-fill, 385px);
4
+ gap: 40px;
5
+ grid-template-columns: repeat(auto-fill, 385px);
6
6
  }
7
7
 
8
8
  &__item {
@@ -9,6 +9,12 @@ select {
9
9
  outline: none;
10
10
  padding: 6px 8px;
11
11
  width: 100%;
12
+
13
+ &:disabled {
14
+ background-color: $input-disabled-background !important;
15
+ color: $input-disabled-color;
16
+ opacity: 1;
17
+ }
12
18
  }
13
19
 
14
20
  #{$all-text-inputs} {
@@ -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,4 +1,8 @@
1
1
  .margin {
2
+ &--clear {
3
+ margin: 0 !important;
4
+ }
5
+
2
6
  &--top {
3
7
  margin-top: 30px;
4
8
  }
@@ -15,14 +15,24 @@
15
15
  height: $menu-logo-height;
16
16
  }
17
17
 
18
+ &--left {
19
+ display: inherit;
20
+ }
21
+
18
22
  &--center {
19
23
  left: 50%;
20
24
  position: absolute;
21
25
  transform: translateX(-50%);
26
+ display: inherit;
27
+ }
28
+
29
+ &--right {
30
+ display: inherit;
22
31
  }
23
32
 
24
33
  &__item {
25
34
  @include margin(0 15px);
35
+ line-height: 1;
26
36
  color: $menu-item-color;
27
37
 
28
38
  &:hover {
@@ -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
  }
@@ -0,0 +1,70 @@
1
+ .beyond-canvas {
2
+
3
+ .select2-dropdown--above {
4
+ border-top: 1px solid $select2-border-color-focus !important;
5
+ }
6
+
7
+ .select2-container--default .select2-selection--multiple {
8
+ border: 1px solid $select2-border-color;
9
+ border-radius: 3px;
10
+ }
11
+
12
+ .select2-container--default.select2-container--focus .select2-selection--multiple{
13
+ border: 1px solid $select2-border-color-focus;
14
+ }
15
+
16
+ .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
17
+ .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
18
+ border-bottom-left-radius: 0;
19
+ border-bottom-right-radius: 0;
20
+ border-color: $select2-border-color-focus;
21
+ }
22
+
23
+ .select2-container--default.select2-container--disabled .select2-selection--multiple {
24
+ background-color: $select2-disabled-background;
25
+ pointer-events: none;
26
+ }
27
+
28
+ .select2-container--default .select2-results__option--highlighted[aria-selected] {
29
+ background-color: $select2-option-hover-background;
30
+ color: $select2-option-hover-color;
31
+ }
32
+
33
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
34
+ background-color: $select2-tag-background;
35
+ color: $select2-tag-color;
36
+ font-weight: bold;
37
+ font-size: 11px;
38
+ border-radius: 3px;
39
+ border: none;
40
+ padding: 3px 7px 4px;
41
+ display: flex;
42
+ align-items: center;
43
+ flex-direction: row-reverse;
44
+ }
45
+
46
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
47
+ margin-left: 8px;
48
+ color: $select2-close-icon-color;
49
+ font-size: 18px;
50
+ line-height: 0;
51
+
52
+ &:hover {
53
+ color: $select2-close-icon-color-hover;
54
+ }
55
+ }
56
+
57
+ .select2-dropdown{
58
+ border: 1px solid $input-border-color-focus;
59
+ border-top: none;
60
+ z-index: 9999999;
61
+ }
62
+
63
+ .select2-results__option {
64
+ font-weight: 700;
65
+ }
66
+
67
+ .select2-results__option[aria-selected=true] {
68
+ display: none;
69
+ }
70
+ }
@@ -0,0 +1,27 @@
1
+ .status {
2
+ @include padding(4px 6px);
3
+ font-size: 12px;
4
+ border-radius: 3px;
5
+ line-height: 1.2;
6
+ font-weight: 500;
7
+
8
+ &--good {
9
+ background-color: $status-good-background;
10
+ color: $status-good-color;
11
+ }
12
+
13
+ &--warning {
14
+ background-color: $status-warning-background;
15
+ color: $status-warning-color;
16
+ }
17
+
18
+ &--danger {
19
+ background-color: $status-danger-background;
20
+ color: $status-danger-color;
21
+ }
22
+
23
+ &--neutral {
24
+ border: 1px solid $status-neutral-background;
25
+ color: $status-neutral-color;
26
+ }
27
+ }
@@ -1,7 +1,15 @@
1
1
  .text {
2
2
  &__align {
3
+ &--left {
4
+ text-align: left;
5
+ }
6
+
3
7
  &--center {
4
8
  text-align: center;
5
9
  }
10
+
11
+ &--right {
12
+ text-align: right;
13
+ }
6
14
  }
7
15
  }
@@ -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
@@ -54,6 +55,10 @@ $button-secondary-color: $white !default;
54
55
  $button-danger-background: $palette-danger !default;
55
56
  $button-danger-color: $white !default;
56
57
 
58
+ $button-disabled-background: rgb(208,208,208) !default;
59
+ $button-disabled-color: rgb(144,144,144) !default;
60
+ $button-disabled-text-shadow: 1px 1px 0 $white !default;
61
+
57
62
  $button-border-radius: 3px !default;
58
63
  $button-box-shadow: true !default;
59
64
  $button-font-weight: 700;
@@ -68,7 +73,7 @@ $card-box-shadow: 0 2px 7px rgba($black, 0.2) !default;
68
73
  $card-padding: 40px;
69
74
  $card-margin: 30px;
70
75
  $card-separator-color: rgb(222, 222, 222) !default;
71
- $card-separator-spacing: 50px;
76
+ $card-separator-spacing: 40px;
72
77
  $card-title-color: rgb(247, 133, 96) !default;
73
78
 
74
79
  // ************************************************************
@@ -90,6 +95,8 @@ $label-color: rgb(128, 128, 128) !default;
90
95
  $input-border-color: rgb(217, 216, 195) !default;
91
96
  $input-border-color-focus: $palette-primary !default;
92
97
  $input-errors-color: $palette-danger !default;
98
+ $input-disabled-background: rgb(245,244,239) !default;
99
+ $input-disabled-color: rgb(163,161,137) !default;
93
100
 
94
101
  // ************************************************************
95
102
  // Checkboxes
@@ -161,12 +168,26 @@ $notice-error-background: rgb(218, 60, 60) !default;
161
168
  $notice-border-radius: 4px !default;
162
169
  $notice-color: rgb(153, 153, 153) !default;
163
170
 
171
+ // ************************************************************
172
+ // Status
173
+ // ************************************************************
174
+
175
+ $status-good-background: rgb(205,225,165) !default;
176
+ $status-good-color: rgb(85,110,41) !default;
177
+ $status-warning-background: rgb(249,220,166) !default;
178
+ $status-warning-color: rgb(178,120,18) !default;
179
+ $status-danger-background: rgb(247,174,163) !default;
180
+ $status-danger-color: rgb(164,35,34) !default;
181
+ $status-neutral-background: rgb(224,223,205) !default;
182
+ $status-neutral-color: rgb(155,151,100) !default;
183
+
164
184
  // ************************************************************
165
185
  // Breadcrums
166
186
  // ************************************************************
167
187
 
168
- $breadcrum-color: rgb(122, 118, 76) !default;
169
- $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;
170
191
 
171
192
  // ************************************************************
172
193
  // Titles
@@ -224,3 +245,23 @@ $modal-padding: 10px;
224
245
  $modal-width: 650px;
225
246
  $modal-close-icon-color: #8b8b8b !default;
226
247
  $modal-background-color: rgba(0, 0, 0, 0.5) !default;
248
+
249
+ // ************************************************************
250
+ // Select2
251
+ // ************************************************************
252
+
253
+ $select2-border-color: $input-border-color !default;
254
+ $select2-border-color-focus: $input-border-color-focus !default;
255
+ $select2-close-icon-color: #79764b !default;
256
+ $select2-close-icon-color-hover: darken($select2-close-icon-color, 15%) !default;
257
+ $select2-tag-background: rgb(223, 222, 204) !default;
258
+ $select2-tag-color: rgb(122, 118, 76) !default;
259
+ $select2-disabled-background: rgb(245, 244, 239) !default;
260
+ $select2-option-hover-background: rgb(229, 241, 240) !default;
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;
@@ -7,5 +7,6 @@ module BeyondCanvas
7
7
  include ::BeyondCanvas::StatusCodes
8
8
  include ::BeyondCanvas::AuthenticationsHelper
9
9
  include ::BeyondCanvas::DebugHelper
10
+ include ::BeyondCanvas::ControllerHelper
10
11
  end
11
12
  end
@@ -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'
@@ -46,7 +67,7 @@ module BeyondCanvas
46
67
  inline_svg_tag 'icons/flash_info.svg'
47
68
  when 'warning'
48
69
  inline_svg_tag 'icons/flash_warning.svg'
49
- when 'error'
70
+ when 'error', 'alert'
50
71
  inline_svg_tag 'icons/flash_error.svg'
51
72
  else
52
73
  inline_svg_tag 'icons/flash_info.svg'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ module ControllerHelper # :nodoc:
5
+ def beyond_canvas_controller?
6
+ self.class.const_defined?(:BeyondCanvas)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ module StatusesHelper # :nodoc:
5
+ %i[good warning danger neutral].each do |method|
6
+ define_method :"status_#{method}" do |name = nil, html_options = nil, &block|
7
+ status_render(method, name, html_options, &block)
8
+ end
9
+ end
10
+
11
+ private
12
+
13
+ def status_render(method, name = nil, html_options = nil, &block)
14
+ if block_given?
15
+ html_options = name
16
+ name = block
17
+ end
18
+
19
+ html_options ||= {}
20
+
21
+ html_options.merge!(class: "status status--#{method}") { |_key, old_val, new_val| [new_val, old_val].join(' ') }
22
+
23
+ content_tag('span', block_given? ? capture(&name) : name, html_options)
24
+ end
25
+ end
26
+ end
@@ -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);
@@ -9,7 +9,7 @@
9
9
  }, 100);
10
10
  };
11
11
 
12
- $(document).on('click', '.flash', function () {
12
+ $(document).on('click', '.flash__close', function () {
13
13
  closeAlert();
14
14
  });
15
15
 
@@ -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>
@@ -3,7 +3,7 @@
3
3
  <html>
4
4
  <%= render 'beyond_canvas/shared/head' %>
5
5
 
6
- <body class="body--application"<% if is_cockpit_app? && Rails.env.development? %> style="display: flex;"<% end %>>
6
+ <body class="beyond-canvas body--application"<% if is_cockpit_app? && Rails.env.development? %> style="display: flex;"<% end %>>
7
7
 
8
8
  <%= render 'beyond_canvas/shared/sidebar' %>
9
9
 
@@ -24,13 +24,10 @@ module BeyondCanvas
24
24
  include ::BeyondCanvas::StatusCodes
25
25
  include ::BeyondCanvas::AuthenticationsHelper
26
26
  include ::BeyondCanvas::DebugHelper
27
+ include ::BeyondCanvas::ControllerHelper
27
28
 
28
29
  ::ActionController::Base.helper BeyondCanvas::Engine.helpers
29
30
  end
30
-
31
- ActiveSupport.on_load :action_mailer do
32
- layout 'beyond_canvas/mailer'
33
- end
34
31
  end
35
32
  end
36
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeyondCanvas
4
- VERSION = '0.19.0.pre'
4
+ VERSION = '0.22.0.pre'
5
5
  end
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/generators/active_record'
4
-
5
3
  module BeyondCanvas
6
4
  module Generators
7
5
  class ControllerGenerator < Rails::Generators::Base # :nodoc:
8
6
  desc 'Creates an inherited Beyond Canvas controller in the app/controllers folder'
9
7
 
10
- argument :scope, required: true, desc: 'The scope to create the controller, e.g. shops, users'
11
-
12
8
  source_root File.expand_path('templates', __dir__)
13
9
 
14
10
  def create_controller
15
- template 'controller.erb', "app/controllers/#{scope}_controller.rb"
11
+ template 'shops_controller.rb', "app/controllers/shops_controller.rb"
16
12
  end
17
13
  end
18
14
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class <%= scope.camelize %>Controller < BeyondCanvas::AuthenticationsController
3
+ class ShopsController < BeyondCanvas::AuthenticationsController
4
4
  # before_action :configure_params, only: [:install]
5
5
 
6
6
  # def new
@@ -7,25 +7,25 @@
7
7
  <div class="menu--center">
8
8
 
9
9
  <%
10
- =begin
10
+ =begin %>
11
11
  Add here your menu links. You can use `menu__item` as class name and add
12
12
  `menu__item--selected` as secondary class for selected menu item. E.g:
13
13
 
14
14
  <%= link_to 'About us', about_us_path, class: "menu__item #{ 'menu__item--selected' if params[:controller] == 'about_us' }" %>
15
15
  <%= link_to 'Support', support_path, class: "menu__item #{ 'menu__item--selected' if params[:controller] == 'support' }" %>
16
- =end
17
- %>
16
+ <%
17
+ =end %>
18
18
 
19
19
  </div>
20
20
 
21
21
  <div class="menu--right">
22
22
 
23
23
  <%
24
- =begin
24
+ =begin %>
25
25
  You can also add here some content that will be right-aligned, like a user
26
26
  avatar image or a dropdown account menu.
27
- =end
28
- %>
27
+ <%
28
+ =end %>
29
29
 
30
30
  </div>
31
31
 
@@ -47,6 +47,10 @@
47
47
  // $button-danger-background: $palette-danger;
48
48
  // $button-danger-color: $white;
49
49
 
50
+ // $button-disabled-background: rgb(208,208,208);
51
+ // $button-disabled-color: rgb(144,144,144);
52
+ // $button-disabled-text-shadow: 1px 1px 0 $white;
53
+
50
54
  // $button-border-radius: 3px;
51
55
  // $button-box-shadow: true;
52
56
 
@@ -77,6 +81,8 @@
77
81
  // $input-border-color: rgb(217, 216, 195);
78
82
  // $input-border-color-focus: $palette-primary;
79
83
  // $input-errors-color: $palette-danger;
84
+ // $input-disabled-background: rgb(245,244,239);
85
+ // $input-disabled-color: rgb(163,161,137);
80
86
 
81
87
  // ************************************************************
82
88
  // Checkboxes
@@ -148,6 +154,19 @@
148
154
  // $notice-border-radius: 4px;
149
155
  // $notice-color: rgb(153, 153, 153);
150
156
 
157
+ // ************************************************************
158
+ // Status
159
+ // ************************************************************
160
+
161
+ // $status-good-background: rgb(205,225,165);
162
+ // $status-good-color: rgb(85,110,41);
163
+ // $status-warning-background: rgb(249,220,166);
164
+ // $status-warning-color: rgb(178,120,18);
165
+ // $status-danger-background: rgb(247,174,163);
166
+ // $status-danger-color: rgb(164,35,34);
167
+ // $status-neutral-background: rgb(224,223,205);
168
+ // $status-neutral-color: rgb(155,151,100);
169
+
151
170
  // ************************************************************
152
171
  // Breadcrums
153
172
  // ************************************************************
@@ -197,3 +216,17 @@
197
216
 
198
217
  // $modal-close-icon-color: #8b8b8b;
199
218
  // $modal-background-color: rgba(0, 0, 0, 0.5);
219
+
220
+ // ************************************************************
221
+ // Select2
222
+ // ************************************************************
223
+
224
+ // $select2-border-color: $input-border-color;
225
+ // $select2-border-color-focus: $input-border-color-focus;
226
+ // $select2-close-icon-color: #79764b;
227
+ // $select2-close-icon-color-hover: darken($select2-close-icon-color, 15%);
228
+ // $select2-tag-background: rgb(223, 222, 204);
229
+ // $select2-tag-color: rgb(122, 118, 76);
230
+ // $select2-disabled-background: rgb(245, 244, 239);
231
+ // $select2-option-hover-background: rgb(229, 241, 240);
232
+ // $select2-option-hover-color: rgb(62, 62, 62);
@@ -83,7 +83,7 @@ BeyondCanvas.setup do |config|
83
83
  #
84
84
  <% unless @skip_webpacker %># <% end %>config.skip_webpacker = <%= @skip_webpacker %>
85
85
 
86
- # ==> Authentication with ePages Beyond API
86
+ # ==> Database encryption
87
87
 
88
88
  config.encryption_key = '<%= SecureRandom.hex(32) %>'
89
89
  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.19.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-10-09 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
@@ -252,8 +252,10 @@ files:
252
252
  - app/assets/stylesheets/beyond_canvas/components/_notices.scss
253
253
  - app/assets/stylesheets/beyond_canvas/components/_relative.scss
254
254
  - app/assets/stylesheets/beyond_canvas/components/_scrollbox.scss
255
+ - app/assets/stylesheets/beyond_canvas/components/_select2.scss
255
256
  - app/assets/stylesheets/beyond_canvas/components/_sidebar.scss
256
257
  - app/assets/stylesheets/beyond_canvas/components/_spinner.scss
258
+ - app/assets/stylesheets/beyond_canvas/components/_statuses.scss
257
259
  - app/assets/stylesheets/beyond_canvas/components/_tables.scss
258
260
  - app/assets/stylesheets/beyond_canvas/components/_texts.scss
259
261
  - app/assets/stylesheets/beyond_canvas/components/_titles.scss
@@ -275,10 +277,13 @@ files:
275
277
  - app/helpers/beyond_canvas/application_helper.rb
276
278
  - app/helpers/beyond_canvas/authentications_helper.rb
277
279
  - app/helpers/beyond_canvas/cockpit_app_helper.rb
280
+ - app/helpers/beyond_canvas/controller_helper.rb
278
281
  - app/helpers/beyond_canvas/debug_helper.rb
279
282
  - app/helpers/beyond_canvas/locale_switch_helper.rb
283
+ - app/helpers/beyond_canvas/statuses_helper.rb
280
284
  - app/javascript/beyond_canvas/base.js
281
285
  - app/javascript/beyond_canvas/initializers/buttons.js
286
+ - app/javascript/beyond_canvas/initializers/collapse.js
282
287
  - app/javascript/beyond_canvas/initializers/flash.js
283
288
  - app/javascript/beyond_canvas/initializers/inputs.js
284
289
  - app/javascript/beyond_canvas/initializers/modals.js
@@ -317,7 +322,7 @@ files:
317
322
  - lib/generators/beyond_canvas/assets/templates/beyond_canvas.scss
318
323
  - lib/generators/beyond_canvas/beyond_api/beyond_api_generator.rb
319
324
  - lib/generators/beyond_canvas/controller/controller_generator.rb
320
- - lib/generators/beyond_canvas/controller/templates/controller.erb
325
+ - lib/generators/beyond_canvas/controller/templates/shops_controller.rb
321
326
  - lib/generators/beyond_canvas/custom_menu/custom_menu_generator.rb
322
327
  - lib/generators/beyond_canvas/custom_menu/templates/beyond_canvas_custom_menu.html.erb
323
328
  - lib/generators/beyond_canvas/custom_styles/custom_styles_generator.rb
@@ -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
- }