Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.23.1.pre #76

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
eff95dd
Minor fixes
unabris Sep 14, 2021
80f285a
Call-to-main-routes (#62)
gersanco Sep 15, 2021
23ffe7b
Add missing variables (#63)
unabris Sep 21, 2021
bbfcddf
Fix product import error in button
Borja-de-la-Fuente Oct 14, 2021
c95d485
Add final empty line
Borja-de-la-Fuente Oct 14, 2021
4d3704a
Delete extra space
Borja-de-la-Fuente Oct 14, 2021
5c89465
Fix comments
Borja-de-la-Fuente Oct 14, 2021
3529c37
Merge pull request #67 from Borja-de-la-Fuente/v0.23.1.pre
Borja-de-la-Fuente Oct 14, 2021
5fe2c7a
Few fixes (#66)
Oct 15, 2021
cf299b3
Iframe policy
gersanco Oct 19, 2021
88ca9cb
Improve middleware (#69)
gersanco Oct 20, 2021
b5eb4e2
Fix set custom styles
gersanco Oct 20, 2021
c029655
Fix app installation and cookie settings
gersanco Oct 27, 2021
41f2f40
Fix redirect to iframe
gersanco Oct 28, 2021
89f5447
Add tooltip styles and helper
unabris Nov 4, 2021
1f09b5e
Add styles for fieldsets
unabris Nov 4, 2021
cf24203
Fix tooltip
unabris Nov 5, 2021
23175de
Add new way for collapse functions
unabris Nov 19, 2021
b395ea1
Add new way for collapse functions (#72)
unabris Nov 19, 2021
f5842bf
Make safari works with cockpit apps
gersanco Nov 23, 2021
f8d0ffa
Use custom step list title
Dec 7, 2021
599f0cb
Some cleaning of the code
Dec 7, 2021
4ee4621
Change safe_html to sanitize (security improve)
Dec 9, 2021
a63bd1b
Sanitize also step list title
Dec 9, 2021
bef4517
Code cleaning
Dec 9, 2021
a25bfa8
Merge pull request #74 from kengallego/custom-step-list-title
Dec 9, 2021
2a42b1a
Fix sanitize error
Dec 14, 2021
059f271
Merge pull request #75 from kengallego/custom-step-list-title
Dec 14, 2021
c906123
Merge remote-tracking branch 'upstream/v0.23.1.pre' into v0.23.1.pre
unabris Jan 27, 2022
cce9310
Use raw
unabris Jan 27, 2022
fff5077
Remove forgotten puts (#77)
gersanco Feb 11, 2022
07d7da1
Change scrollbox to scroll-shadow
kengallego Feb 23, 2022
7be9b42
Add missing line
kengallego Feb 23, 2022
a146420
Improve css
kengallego Feb 24, 2022
f42d369
Merge pull request #80 from kengallego/scroll-shadow
kengallego Feb 24, 2022
6905674
improve form actions css
kengallego Feb 24, 2022
6fffd5d
Merge pull request #81 from kengallego/scroll-shadow
kengallego Feb 24, 2022
776f9f4
Add Image field component
gersanco Feb 28, 2022
8d8ada2
Add button data attributes for image input field (#82)
gersanco Mar 1, 2022
4df7581
Refresh token when `to_session` is called (#83)
gersanco Mar 23, 2022
c90ca62
Display-concatenated-errors (#86)
gersanco Apr 20, 2022
cd6cfd5
Fix image text in app creation (#91)
k4th Jul 26, 2022
089a497
Image-tag-arguments (#92)
gersanco Oct 6, 2022
00c8368
Allow to include html options in the placeholder (#93)
gersanco Nov 4, 2022
1366c7a
Fix whiteline in toolbox
kengallego Feb 22, 2023
767fbd0
Merge pull request #104 from kengallego/whiteline-toolbox
kengallego Feb 23, 2023
381a423
Keep Image placeholder when there are image (#97)
gersanco Mar 3, 2023
95b01dd
Remove preview images
Mar 6, 2023
092692d
Get attributes from placeholder and remove styles (#105)
gersanco Mar 7, 2023
418a203
Remove references of figure_html_options and image_html_options (#106)
k4th Mar 15, 2023
d3ce2ff
Update gems (#107)
k4th Mar 30, 2023
4fb5ac5
Revert "Update gems (#107)" (#108)
k4th Mar 31, 2023
2e32685
Avoid subscribe to beyond webhooks when is not production (#109)
gersanco Mar 31, 2023
7589aff
adds event on click to clear previous selected file
citin Apr 4, 2023
fb99ccf
fix linter
citin Apr 12, 2023
64fab9d
Merge pull request #111 from citin/fix-upload-file-with-same-name
citin May 2, 2023
f9d641d
Fix js event firing multiple times (#112)
gersanco May 11, 2023
a6b49a3
Add test tools (#119)
k4th Jan 8, 2024
e6eb2f6
Fix issue (#120)
unabris Jan 10, 2024
515ce2d
V0.23.1.pre (#121)
unabris Jan 11, 2024
266ed5e
V0.23.1.pre (#122)
unabris Jan 11, 2024
4a68241
V0.23.1.pre (#123)
unabris Jan 11, 2024
c2d5340
Fix button_tag styling
kengallego Jan 29, 2024
feee460
Remove line break
kengallego Jan 29, 2024
782d56f
Merge pull request #124 from kengallego/fix-link-styling
kengallego Jan 29, 2024
b7f7d41
Fix issue with image_file_field (#125)
k4th Feb 5, 2024
39fd345
enhance tooltip using svg
citin Mar 4, 2024
0055079
adds left margin to tooltips
citin Mar 4, 2024
8c3290e
enhance modal styles and fix some bugs
citin Mar 6, 2024
97b5f1b
Merge pull request #126 from citin/enhance-tooltips
citin Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
"es6": true,
"jquery": true
},
"extends": [
"eslint:recommended"
],
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 11,
"sourceType": "module"
},
"rules": {
Expand All @@ -28,14 +26,8 @@
"allowTemplateLiterals": true
}
],
"semi": [
"error",
"always"
],
"init-declarations": [
"error",
"always"
],
"semi": ["error", "always"],
"init-declarations": ["error", "always"],
"no-undefined": "error"
}
}
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
### v0.23.1.pre

* deprecations
* Remove `link_to_with_icon`
* `external_link` icon will no longer be automatically added on `target="_blank"` anchors

* bug-fixes
* Minor style fixes
* Prevent checking custom styles when opening the app
* Remove unnecessary `URI.decode(signature)` call when validating open app request
* Remove unnecessary `terms` attribute from `Shop`
* Fix `#refresh_token` method when `client_credentials = true` is configured

* features
* Add a middleware to automatically configure cockpit app headers
* Add `image_file_field` component to upload images and render a `placeholder` if there is no image
* Add `image_attachment_tag` component to render images
* Add styles for `.svg` images that include `.surface`, `.bubbles` and `.outline` classes

* enhancements
* Allow to retrieve `client_credentials` token on any environment but `production`
* Add convenient `custom_styles?` and `client_credentials?` methods

### v0.23.0.pre

* deprecations
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
beyond_canvas (0.23.0.pre)
beyond_canvas (0.23.1.pre)
attr_encrypted (~> 3.1)
beyond_api (>= 0.18.0.pre)
bourbon (~> 7.0)
Expand Down Expand Up @@ -97,7 +97,7 @@ GEM
erubi (1.10.0)
faraday (0.17.4)
multipart-post (>= 1.2, < 3)
ffi (1.15.3)
ffi (1.15.4)
globalid (0.5.2)
activesupport (>= 5.0)
htmlentities (4.3.4)
Expand All @@ -111,23 +111,23 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.2.3)
jwt (2.3.0)
loaf (0.10.0)
railties (>= 3.2)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.1)
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.1)
mini_mime (1.1.2)
minitest (5.14.4)
multipart-post (2.1.1)
nio4r (2.5.8)
nokogiri (1.12.3-x86_64-darwin)
nokogiri (1.12.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.12.3-x86_64-linux)
nokogiri (1.12.5-x86_64-linux)
racc (~> 1.4)
parallel (1.20.1)
parser (3.0.2.0)
Expand All @@ -140,7 +140,7 @@ GEM
actionmailer (>= 3)
premailer (~> 1.7, >= 1.7.9)
public_suffix (4.0.6)
racc (1.5.2)
racc (1.6.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand All @@ -162,7 +162,7 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.1)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.4.1)
actionpack (= 6.1.4.1)
Expand Down Expand Up @@ -213,7 +213,7 @@ GEM
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.4.2)
zeitwerk (2.5.1)

PLATFORMS
x86_64-darwin-20
Expand All @@ -224,4 +224,4 @@ DEPENDENCIES
rubocop-rails (~> 2.5)

BUNDLED WITH
2.2.26
2.2.28
1 change: 1 addition & 0 deletions app/assets/images/icons/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions app/assets/images/icons/placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/images/icons/tooltip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 173 additions & 22 deletions app/assets/javascripts/beyond_canvas/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
//= require jquery3
//= require rails-ujs
//= require beyond_canvas/common_functions
//= require_self

(function(factory) {
Expand Down Expand Up @@ -91,12 +92,34 @@
}
});
(function($) {
$(document).on("click", "[data-toggle='collapse']", function(e) {
$(document).on("click", '[data-toggle="collapse"]', function(e) {
e.preventDefault();
$($(this).attr("data-target")).slideToggle();
$(this).find(".collapse__icon").toggleClass("collapse__icon--open");
var target = $(this).attr("data-target");
if ($(target).is(":hidden")) {
$(this).openCollapse();
} else {
$(this).closeCollapse();
}
});
})(jQuery);
$.fn.extend({
openCollapse: function openCollapse() {
var target = $(this).attr("data-target");
$(this).trigger("bc.collapse.open");
$(this).attr("data-visible", true);
$(this).find(".collapse__icon").addClass("collapse__icon--open");
$(target).slideDown();
$(this).trigger("bc.collapse.opened");
},
closeCollapse: function closeCollapse() {
var target = $(this).attr("data-target");
$(this).trigger("bc.collapse.close");
$(this).attr("data-visible", false);
$(this).find(".collapse__icon").removeClass("collapse__icon--open");
$(target).slideUp();
$(this).trigger("bc.collapse.closed");
}
});
(function($) {
var onDOMReady = function onDOMReady() {
$(".flash").each(function() {
Expand Down Expand Up @@ -128,29 +151,47 @@
});
(function($) {
var onDOMReady = function onDOMReady() {
$('input[type="file"]').each(function() {
var $input = $(this), $label = $(".input__file__text." + $input.attr("id")), labelVal = $label.html();
$input.on("change", function(e) {
var fileName = "";
if (this.files && this.files.length > 1) fileName = (this.getAttribute("data-multiple-caption") || "{count} files selected").replace("{count}", this.files.length); else if (e.target.value) fileName = e.target.value.split("\\").pop();
if (fileName) $label.html('<svg class="input__file__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z"/></svg>' + fileName); else $label.html(labelVal);
});
$input.on("focus", function() {
$input.addClass("has-focus");
}).on("blur", function() {
$input.removeClass("has-focus");
});
updateInputLabel();
initializeClearOnClickInputs();
addInputFocusClass();
removeInputFocusClass();
};
var updateInputLabel = function updateInputLabel() {
$("form").on("change", 'input[type="file"]', function(_ref) {
var _input$files, _input$getAttribute, _input$value;
var input = _ref.currentTarget;
var label = $(".input__file__text." + input.getAttribute("id"));
if (!label) return;
var noFileText = input.getAttribute("data-no-file-text");
var svgFileIcon = '\n <svg class="input__file__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n <path d="M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z"/>\n </svg>';
var fileName = ((_input$files = input.files) == null ? void 0 : _input$files.length) > 1 ? (_input$getAttribute = input.getAttribute("data-multiple-selection-text")) == null ? void 0 : _input$getAttribute.replace("{count}", input.files.length) : ((_input$value = input.value) == null ? void 0 : _input$value.split("\\").pop()) || "";
fileName ? label.html("" + svgFileIcon + fileName) : label.html(noFileText);
});
};
$(document).on("ready page:load turbolinks:load", function() {
var observer = new MutationObserver(function() {
return onDOMReady();
var addInputFocusClass = function addInputFocusClass() {
$("form").on("focus", 'input[type="file"]', function(_ref2) {
var input = _ref2.currentTarget;
input.addClass("has-focus");
});
onDOMReady();
observer.observe(document.body, {
childList: true,
subtree: true
};
var removeInputFocusClass = function removeInputFocusClass() {
$("form").on("blur", 'input[type="file"]', function(_ref3) {
var input = _ref3.currentTarget;
input.removeClass("has-focus");
});
};
var initializeClearOnClickInputs = function initializeClearOnClickInputs() {
$("form").on("click", 'input[type="file"][data-clear-on-click="true"]', function() {
var dt = new DataTransfer();
this.files = dt.files;
this.dispatchEvent(new Event("change", {
bubbles: true,
composed: true
}));
});
};
$(document).on("ready page:load turbolinks:load", function() {
return onDOMReady();
});
})(jQuery);
(function($) {
Expand Down Expand Up @@ -189,4 +230,114 @@
modal.trigger("bc.modal.hidden");
}
});
const template = `<style>:host{display:inline-block;position:relative}:host([hidden]){display:none}s{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;background:var(--scroll-shadow-top,radial-gradient(farthest-side at 50% 0,#0003,#0000)) top/100% var(--top),var(--scroll-shadow-bottom,radial-gradient(farthest-side at 50% 100%,#0003,#0000)) bottom/100% var(--bottom),var(--scroll-shadow-left,radial-gradient(farthest-side at 0,#0003,#0000)) left/var(--left) 100%,var(--scroll-shadow-right,radial-gradient(farthest-side at 100%,#0003,#0000)) right/var(--right) 100%;background-repeat:no-repeat}</style><slot></slot><s></s>`;
const updaters = new WeakMap();
class ScrollShadowElement extends HTMLElement {
constructor() {
super();
this.attachShadow({
mode: "open"
}).innerHTML = template;
updaters.set(this, new Updater(this.shadowRoot.lastElementChild));
}
static get observedAttributes() {
return [ "el" ];
}
get el() {
return this.getAttribute("el");
}
set el(value) {
this.setAttribute("el", value);
}
connectedCallback() {
this.shadowRoot.querySelector("slot").addEventListener("slotchange", () => this.start());
this.start();
}
disconnectedCallback() {
updaters.get(this).stop();
}
attributeChangedCallback(_name, oldValue, newValue) {
if (oldValue !== newValue) {
this.scrollEl = newValue ? this.querySelector(newValue) : null;
this.start();
}
}
start() {
updaters.get(this).start(this.scrollEl || this.firstElementChild, this.scrollEl ? this.firstElementChild : null);
}
}
class Updater {
constructor(targetElement) {
const update = this.update.bind(this, targetElement, getComputedStyle(targetElement));
this.handleScroll = throttle(update);
this.rO = new ResizeObserver(update);
this.mO = new MutationObserver(() => this.start(this.el, this.rootEl));
}
start(element, rootElement) {
if (this.el) this.stop();
if (element) {
element.addEventListener("scroll", this.handleScroll);
[ element, ...element.children ].forEach(el => this.rO.observe(el));
this.mO.observe(element, {
childList: true
});
this.el = element;
}
if (rootElement) {
this.rO.observe(rootElement);
this.rootEl = rootElement;
}
}
stop() {
this.el.removeEventListener("scroll", this.handleScroll);
this.mO.disconnect();
this.rO.disconnect();
this.el = this.rootEl = null;
}
update(targetElement, computedStyle) {
const {
el,
rootEl
} = this;
if (!el) return;
const maxSize = Number(computedStyle.getPropertyValue("--scroll-shadow-size")) || 14;
const style = {
"--top": clamp(el.scrollTop, 0, maxSize),
"--bottom": clamp(el.scrollHeight - el.offsetHeight - el.scrollTop, 0, maxSize),
"--left": clamp(el.scrollLeft, 0, maxSize),
"--right": clamp(el.scrollWidth - el.offsetWidth - el.scrollLeft, 0, maxSize)
};
if (rootEl) {
const clientRect = el.getBoundingClientRect();
const rootClientRect = rootEl.getBoundingClientRect();
Object.assign(style, {
top: clamp(clientRect.top - rootClientRect.top),
bottom: clamp(rootClientRect.bottom - clientRect.bottom),
left: clamp(clientRect.left - rootClientRect.left),
right: clamp(rootClientRect.right - clientRect.right)
});
}
for (const key in style) {
targetElement.style.setProperty(key, `${style[key]}px`);
}
}
}
function clamp(num, min = 0, max) {
if (num < min) return min;
if (num > max) return max;
return num;
}
function throttle(callback) {
let id = null;
return () => {
if (id) return;
id = requestAnimationFrame(() => {
callback();
id = null;
});
};
}
if ("customElements" in window && "ResizeObserver" in window) {
customElements.define("scroll-shadow", ScrollShadowElement);
}
});
Loading