effective_bootstrap 1.21.8 → 1.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_bootstrap.js +1 -0
- data/app/assets/javascripts/effective_clipboard/clipboard.js +7 -0
- data/app/assets/javascripts/effective_clipboard/initialize.js.coffee +18 -0
- data/app/assets/javascripts/effective_clipboard/input.js +2 -0
- data/app/helpers/effective_bootstrap_helper.rb +22 -0
- data/app/models/effective/form_inputs/article_editor.rb +17 -2
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a467a4fe312e0651bc2409e811c5c269d8cd22b1e1a6d9e8da0276f869b7c0ac
|
|
4
|
+
data.tar.gz: 6941de835560bd2da4c879ee49ef466e2cfb81beffead24208cd01aec390f17e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 151044a9c7dd52a14328dd559f7759c91087b21bb65e68be7178c3741ce8a46c81b845fc4899e6b1fe8f3ab83dc5b6feb396799f4b2761020f24798944f49777
|
|
7
|
+
data.tar.gz: 977c6a1f0c3850c662003006822a71d8b86b28b4fda47f900eb6d8ab4444497208e3392b19552d54c2a1be384bb4e95e91f9d00961d28453aaad387fd87cf855
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* clipboard.js v2.0.11
|
|
3
|
+
* https://clipboardjs.com/
|
|
4
|
+
*
|
|
5
|
+
* Licensed MIT © Zeno Rocha
|
|
6
|
+
*/
|
|
7
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=o(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=o(t.value,e):(n=r()(t),c("copy")),n};function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,o=t.container,e=t.target,t=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==e){if(!e||"object"!==l(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return t?f(t,{container:o}):e?"cut"===n?a(e):f(e,{container:o}):void 0};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(n){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=v(n);return t=o?(t=v(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),e=this,!(t=t)||"object"!==p(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){t="data-clipboard-".concat(t);if(e.hasAttribute(t))return e.getAttribute(t)}var b=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(r,i());var t,e,n,o=h(r);function r(t,e){var n;return function(t){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this),(n=o.call(this)).resolveOptions(e),n.listenClick(t),n}return t=r,n=[{key:"copy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(t,e)}},{key:"cut",value:function(t){return a(t)}},{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof t?[t]:t,e=!!document.queryCommandSupported;return t.forEach(function(t){e=e&&!!document.queryCommandSupported(t)}),e}}],(e=[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===p(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=u()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",t=s({action:n,container:this.container,target:this.target(e),text:this.text(e)});this.emit(t?"success":"error",{action:n,text:t,trigger:e,clearSelection:function(){e&&e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(t){return m("action",t)}},{key:"defaultTarget",value:function(t){t=m("target",t);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(t){return m("text",t)}},{key:"destroy",value:function(){this.listener.destroy()}}])&&d(t.prototype,e),n&&d(t,n),r}()},828:function(t){var e;"undefined"==typeof Element||Element.prototype.matches||((e=Element.prototype).matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector),t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},438:function(t,e,n){var u=n(828);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=u(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},879:function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},370:function(t,e,n){var f=n(879),l=n(438);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!f.string(e))throw new TypeError("Second argument must be a String");if(!f.fn(n))throw new TypeError("Third argument must be a Function");if(f.node(t))return c=e,a=n,(u=t).addEventListener(c,a),{destroy:function(){u.removeEventListener(c,a)}};if(f.nodeList(t))return o=t,r=e,i=n,Array.prototype.forEach.call(o,function(t){t.addEventListener(r,i)}),{destroy:function(){Array.prototype.forEach.call(o,function(t){t.removeEventListener(r,i)})}};if(f.string(t))return t=t,e=e,n=n,l(document.body,t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,u,c,a}},817:function(t){t.exports=function(t){var e,n="SELECT"===t.nodeName?(t.focus(),t.value):"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName?((e=t.hasAttribute("readonly"))||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),e||t.removeAttribute("readonly"),t.value):(t.hasAttribute("contenteditable")&&t.focus(),n=window.getSelection(),(e=document.createRange()).selectNodeContents(t),n.removeAllRanges(),n.addRange(e),n.toString());return n}},279:function(t){function e(){}e.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,u=o.length;i<u;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=e,t.exports.TinyEmitter=e}},r={},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o(686).default;function o(t){if(r[t])return r[t].exports;var e=r[t]={exports:{}};return n[t](e,e.exports,o),e.exports}var n,r});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
initialize = ->
|
|
2
|
+
$buttons = $('.btn-clipboard-copy:not(.initialized)')
|
|
3
|
+
return if $buttons.length == 0
|
|
4
|
+
|
|
5
|
+
clipboard = new ClipboardJS('.btn-clipboard-copy',
|
|
6
|
+
text: (trigger) -> $(trigger).data('clipboard')
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
clipboard.on 'success', (event) ->
|
|
10
|
+
$obj = $(event.trigger).text('Copied!').focus().blur()
|
|
11
|
+
setTimeout((-> $obj.html($obj.data('clipboard-label'))), 1500)
|
|
12
|
+
|
|
13
|
+
$buttons.on 'click', (event) -> event.preventDefault()
|
|
14
|
+
|
|
15
|
+
$buttons.addClass('initialized')
|
|
16
|
+
|
|
17
|
+
$ -> initialize()
|
|
18
|
+
$(document).on 'turbolinks:load', -> initialize()
|
|
@@ -91,6 +91,21 @@ module EffectiveBootstrapHelper
|
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
+
def clipboard_copy(text, opts = {})
|
|
95
|
+
opts[:label] ||= 'Copy to Clipboard'
|
|
96
|
+
opts[:class] ||= 'btn btn-secondary'
|
|
97
|
+
|
|
98
|
+
label = (icon('clipboard', class: 'small-1') + ' ' + opts[:label]).html_safe
|
|
99
|
+
|
|
100
|
+
content_tag(
|
|
101
|
+
:button,
|
|
102
|
+
label,
|
|
103
|
+
class: ['btn-clipboard-copy', opts[:class]].compact.join(' '),
|
|
104
|
+
type: 'button',
|
|
105
|
+
'data-clipboard': text,
|
|
106
|
+
'data-clipboard-label': label
|
|
107
|
+
)
|
|
108
|
+
end
|
|
94
109
|
|
|
95
110
|
# https://getbootstrap.com/docs/4.0/components/collapse/
|
|
96
111
|
|
|
@@ -281,6 +296,13 @@ module EffectiveBootstrapHelper
|
|
|
281
296
|
nil
|
|
282
297
|
end
|
|
283
298
|
|
|
299
|
+
def dropdown_clipboard_copy(text, opts = {})
|
|
300
|
+
opts[:label] ||= 'Copy to Clipboard'
|
|
301
|
+
|
|
302
|
+
options = { 'data-clipboard': text, 'data-clipboard-label': opts[:label], class: 'btn-clipboard-copy' }
|
|
303
|
+
dropdown_link_to(opts[:label], '#', options.merge(opts))
|
|
304
|
+
end
|
|
305
|
+
|
|
284
306
|
# Works with dots ao and dropdown do
|
|
285
307
|
def dropdown_divider(options = {})
|
|
286
308
|
options[:class] = [options[:class], 'dropdown-divider'].compact.join(' ')
|
|
@@ -131,7 +131,7 @@ module Effective
|
|
|
131
131
|
editor: { csscache: true, https: true, drop: false },
|
|
132
132
|
embed: false,
|
|
133
133
|
image: false,
|
|
134
|
-
plugins: ['blockcode', 'cellcolor', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style']
|
|
134
|
+
plugins: ['blockcode', 'cellcolor', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style'].compact
|
|
135
135
|
)
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -148,7 +148,7 @@ module Effective
|
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
def input_js_options
|
|
151
|
-
case mode
|
|
151
|
+
options = case mode
|
|
152
152
|
when :default, :admin
|
|
153
153
|
default_mode.merge(active_storage: active_storage, css: css, custom: { css: custom_css })
|
|
154
154
|
when :email
|
|
@@ -158,6 +158,12 @@ module Effective
|
|
|
158
158
|
else
|
|
159
159
|
raise("unexpected mode: #{mode}. Try :default, :email, or :restricted")
|
|
160
160
|
end
|
|
161
|
+
|
|
162
|
+
if counter
|
|
163
|
+
options[:plugins] << 'counter'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
options
|
|
161
167
|
end
|
|
162
168
|
|
|
163
169
|
def css
|
|
@@ -188,6 +194,15 @@ module Effective
|
|
|
188
194
|
end
|
|
189
195
|
end
|
|
190
196
|
|
|
197
|
+
def counter
|
|
198
|
+
return @counter unless @counter.nil?
|
|
199
|
+
|
|
200
|
+
@counter = if options.key?(:counter)
|
|
201
|
+
options.delete(:counter)
|
|
202
|
+
else
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
191
206
|
def select_mode
|
|
192
207
|
EffectiveResources.authorized?(@template, :admin, :effective_article_editor) ? :default : :restricted
|
|
193
208
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_bootstrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.21.
|
|
4
|
+
version: 1.21.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -452,6 +452,9 @@ files:
|
|
|
452
452
|
- app/assets/javascripts/effective_ck_editor/input.js
|
|
453
453
|
- app/assets/javascripts/effective_clear/initialize.js.coffee
|
|
454
454
|
- app/assets/javascripts/effective_clear/input.js
|
|
455
|
+
- app/assets/javascripts/effective_clipboard/clipboard.js
|
|
456
|
+
- app/assets/javascripts/effective_clipboard/initialize.js.coffee
|
|
457
|
+
- app/assets/javascripts/effective_clipboard/input.js
|
|
455
458
|
- app/assets/javascripts/effective_date/initialize.js.coffee
|
|
456
459
|
- app/assets/javascripts/effective_date/input.js
|
|
457
460
|
- app/assets/javascripts/effective_datetime/bootstrap-datetimepicker.js
|