five-two-nw-olivander 0.2.0.7 → 0.2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/controllers/input_control_association_controller.js +34 -0
- data/app/assets/javascripts/olivander/rails-ujs.esm.js +2 -0
- data/app/components/olivander/components/resource_form_component.html.haml +17 -24
- data/app/components/olivander/components/resource_form_component.rb +48 -0
- data/app/controllers/concerns/olivander/resources/crud_controller.rb +4 -4
- data/app/views/application/edit.html.haml +2 -0
- data/config/initializers/simple_form.rb +1 -1
- data/lib/olivander/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03db809e6a048326facbf9b2af1d2a41b97ed6931c338a931e923ce092687e0
|
4
|
+
data.tar.gz: 2f879a0e932ce2732c3a595b3ede5e3c76767c8e69d2ebe50afbfa38793c5d7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f50ce97f66bd83cc7f79e8c17debfeb371be45abf09aed81e722c95cf220a7641e3ccbdf67bd87e139e8c96c7a6595028bb3865e65f160f961d24e84fe574f5
|
7
|
+
data.tar.gz: c036f2874e20c609005eb82143899b7ce2c61dc178e016ba6240d02df763025af0c3e634019219c2827695d875f67ae197ecc36be2f7dc10afda44c2a752a879
|
@@ -5,9 +5,18 @@ export default class extends Controller {
|
|
5
5
|
connect() {
|
6
6
|
var self = this,
|
7
7
|
el = self.element;
|
8
|
+
|
8
9
|
if (!$(el).hasClass("select2-hidden-accessible")) {
|
9
10
|
$(el).select2({
|
10
11
|
dropdownParent: $(el).parent(),
|
12
|
+
tags: el.dataset.taggable == 'true',
|
13
|
+
createTag: function (tag) {
|
14
|
+
return {
|
15
|
+
id: tag.term,
|
16
|
+
text: tag.term,
|
17
|
+
isNew : true
|
18
|
+
};
|
19
|
+
},
|
11
20
|
ajax: {
|
12
21
|
url: el.dataset.collectionPath,
|
13
22
|
delay: 250,
|
@@ -23,6 +32,31 @@ export default class extends Controller {
|
|
23
32
|
}) };
|
24
33
|
}
|
25
34
|
}
|
35
|
+
}).on('select2:select', function (e) {
|
36
|
+
let tag = e.params.data;
|
37
|
+
if (tag.isNew === true)
|
38
|
+
{
|
39
|
+
let csrfToken = document.querySelector("[name='csrf-token']").content,
|
40
|
+
data = new FormData()
|
41
|
+
data.append("authenticity_token", document.querySelector('meta[name="csrf-token"]').content)
|
42
|
+
data.append(el.dataset.tagFieldName, tag.text)
|
43
|
+
fetch(el.dataset.collectionPath, {
|
44
|
+
method: 'POST',
|
45
|
+
headers: {
|
46
|
+
"X-CSRF-Token": csrfToken,
|
47
|
+
Accept: "application/json"
|
48
|
+
},
|
49
|
+
body: data
|
50
|
+
})
|
51
|
+
.then(r => r.json())
|
52
|
+
.then(function(json) {
|
53
|
+
$(el).find(`option[value='${tag.id}']`).each(function(idx, opt) {
|
54
|
+
opt.value = json.id
|
55
|
+
})
|
56
|
+
$(el).select2().trigger('change')
|
57
|
+
return true
|
58
|
+
})
|
59
|
+
}
|
26
60
|
})
|
27
61
|
}
|
28
62
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
const t="a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]";const e={selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"};const n="select[data-remote], input[data-remote], textarea[data-remote]";const o="form:not([data-turbo=true])";const a="form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])";const r="input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled";const c="input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled";const s="input[name][type=file]:not([disabled])";const i="a[data-disable-with], a[data-disable]";const u="button[data-remote][data-disable-with], button[data-remote][data-disable]";let l=null;const loadCSPNonce=()=>{const t=document.querySelector("meta[name=csp-nonce]");return l=t&&t.content};const cspNonce=()=>l||loadCSPNonce();const d=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;const matches=function(t,e){return e.exclude?d.call(t,e.selector)&&!d.call(t,e.exclude):d.call(t,e)};const m="_ujsData";const getData=(t,e)=>t[m]?t[m][e]:void 0;const setData=function(t,e,n){t[m]||(t[m]={});return t[m][e]=n};const $=t=>Array.prototype.slice.call(document.querySelectorAll(t));const isContentEditable=function(t){var e=false;do{if(t.isContentEditable){e=true;break}t=t.parentElement}while(t);return e};const csrfToken=()=>{const t=document.querySelector("meta[name=csrf-token]");return t&&t.content};const csrfParam=()=>{const t=document.querySelector("meta[name=csrf-param]");return t&&t.content};const CSRFProtection=t=>{const e=csrfToken();if(e)return t.setRequestHeader("X-CSRF-Token",e)};const refreshCSRFTokens=()=>{const t=csrfToken();const e=csrfParam();if(t&&e)return $('form input[name="'+e+'"]').forEach((e=>e.value=t))};const p={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"};const ajax=t=>{t=prepareOptions(t);var e=createXHR(t,(function(){const n=processResponse(e.response!=null?e.response:e.responseText,e.getResponseHeader("Content-Type"));Math.floor(e.status/100)===2?typeof t.success==="function"&&t.success(n,e.statusText,e):typeof t.error==="function"&&t.error(n,e.statusText,e);return typeof t.complete==="function"?t.complete(e,e.statusText):void 0}));return!(t.beforeSend&&!t.beforeSend(e,t))&&(e.readyState===XMLHttpRequest.OPENED?e.send(t.data):void 0)};var prepareOptions=function(t){t.url=t.url||location.href;t.type=t.type.toUpperCase();t.type==="GET"&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data);t.dataType in p||(t.dataType="*");t.accept=p[t.dataType];t.dataType!=="*"&&(t.accept+=", */*; q=0.01");return t};var createXHR=function(t,e){const n=new XMLHttpRequest;n.open(t.type,t.url,true);n.setRequestHeader("Accept",t.accept);typeof t.data==="string"&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");if(!t.crossDomain){n.setRequestHeader("X-Requested-With","XMLHttpRequest");CSRFProtection(n)}n.withCredentials=!!t.withCredentials;n.onreadystatechange=function(){if(n.readyState===XMLHttpRequest.DONE)return e(n)};return n};var processResponse=function(t,e){if(typeof t==="string"&&typeof e==="string")if(e.match(/\bjson\b/))try{t=JSON.parse(t)}catch(t){}else if(e.match(/\b(?:java|ecma)script\b/)){const e=document.createElement("script");e.setAttribute("nonce",cspNonce());e.text=t;document.head.appendChild(e).parentNode.removeChild(e)}else if(e.match(/\b(xml|html|svg)\b/)){const n=new DOMParser;e=e.replace(/;.+/,"");try{t=n.parseFromString(t,e)}catch(t){}}return t};const href=t=>t.href;const isCrossDomain=function(t){const e=document.createElement("a");e.href=location.href;const n=document.createElement("a");try{n.href=t;return!((!n.protocol||n.protocol===":")&&!n.host||e.protocol+"//"+e.host===n.protocol+"//"+n.host)}catch(t){return true}};let f;let{CustomEvent:b}=window;if(typeof b!=="function"){b=function(t,e){const n=document.createEvent("CustomEvent");n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail);return n};b.prototype=window.Event.prototype;({preventDefault:f}=b.prototype);b.prototype.preventDefault=function(){const t=f.call(this);this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get(){return true}});return t}}const fire=(t,e,n)=>{const o=new b(e,{bubbles:true,cancelable:true,detail:n});t.dispatchEvent(o);return!o.defaultPrevented};const stopEverything=t=>{fire(t.target,"ujs:everythingStopped");t.preventDefault();t.stopPropagation();t.stopImmediatePropagation()};const delegate=(t,e,n,o)=>t.addEventListener(n,(function(t){let{target:n}=t;while(!!(n instanceof Element)&&!matches(n,e))n=n.parentNode;if(n instanceof Element&&o.call(n,t)===false){t.preventDefault();t.stopPropagation()}}));const toArray=t=>Array.prototype.slice.call(t);const serializeElement=(t,e)=>{let n=[t];matches(t,"form")&&(n=toArray(t.elements));const o=[];n.forEach((function(t){t.name&&!t.disabled&&(matches(t,"fieldset[disabled] *")||(matches(t,"select")?toArray(t.options).forEach((function(e){e.selected&&o.push({name:t.name,value:e.value})})):(t.checked||["radio","checkbox","submit"].indexOf(t.type)===-1)&&o.push({name:t.name,value:t.value})))}));e&&o.push(e);return o.map((function(t){return t.name?`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`:t})).join("&")};const formElements=(t,e)=>matches(t,"form")?toArray(t.elements).filter((t=>matches(t,e))):toArray(t.querySelectorAll(e));const handleConfirmWithRails=t=>function(e){allowAction(this,t)||stopEverything(e)};const confirm=(t,e)=>window.confirm(t);var allowAction=function(t,e){let n;const o=t.getAttribute("data-confirm");if(!o)return true;let a=false;if(fire(t,"confirm")){try{a=e.confirm(o,t)}catch(t){}n=fire(t,"confirm:complete",[a])}return a&&n};const handleDisabledElement=function(t){const e=this;e.disabled&&stopEverything(t)};const enableElement=t=>{let e;if(t instanceof Event){if(isXhrRedirect(t))return;e=t.target}else e=t;if(!isContentEditable(e))return matches(e,i)?enableLinkElement(e):matches(e,u)||matches(e,c)?enableFormElement(e):matches(e,o)?enableFormElements(e):void 0};const disableElement=t=>{const e=t instanceof Event?t.target:t;if(!isContentEditable(e))return matches(e,i)?disableLinkElement(e):matches(e,u)||matches(e,r)?disableFormElement(e):matches(e,o)?disableFormElements(e):void 0};var disableLinkElement=function(t){if(getData(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");if(e!=null){setData(t,"ujs:enable-with",t.innerHTML);t.innerHTML=e}t.addEventListener("click",stopEverything);return setData(t,"ujs:disabled",true)};var enableLinkElement=function(t){const e=getData(t,"ujs:enable-with");if(e!=null){t.innerHTML=e;setData(t,"ujs:enable-with",null)}t.removeEventListener("click",stopEverything);return setData(t,"ujs:disabled",null)};var disableFormElements=t=>formElements(t,r).forEach(disableFormElement);var disableFormElement=function(t){if(getData(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");if(e!=null)if(matches(t,"button")){setData(t,"ujs:enable-with",t.innerHTML);t.innerHTML=e}else{setData(t,"ujs:enable-with",t.value);t.value=e}t.disabled=true;return setData(t,"ujs:disabled",true)};var enableFormElements=t=>formElements(t,c).forEach((t=>enableFormElement(t)));var enableFormElement=function(t){const e=getData(t,"ujs:enable-with");if(e!=null){matches(t,"button")?t.innerHTML=e:t.value=e;setData(t,"ujs:enable-with",null)}t.disabled=false;return setData(t,"ujs:disabled",null)};var isXhrRedirect=function(t){const e=t.detail?t.detail[0]:void 0;return e&&e.getResponseHeader("X-Xhr-Redirect")};const handleMethodWithRails=t=>function(e){const n=this;const o=n.getAttribute("data-method");if(!o)return;if(isContentEditable(this))return;const a=t.href(n);const r=csrfToken();const c=csrfParam();const s=document.createElement("form");let i=`<input name='_method' value='${o}' type='hidden' />`;c&&r&&!isCrossDomain(a)&&(i+=`<input name='${c}' value='${r}' type='hidden' />`);i+='<input type="submit" />';s.method="post";s.action=a;s.target=n.target;s.innerHTML=i;s.style.display="none";document.body.appendChild(s);s.querySelector('[type="submit"]').click();stopEverything(e)};const isRemote=function(t){const e=t.getAttribute("data-remote");return e!=null&&e!=="false"};const handleRemoteWithRails=t=>function(a){let r,c,s;const i=this;if(!isRemote(i))return true;if(!fire(i,"ajax:before")){fire(i,"ajax:stopped");return false}if(isContentEditable(i)){fire(i,"ajax:stopped");return false}const u=i.getAttribute("data-with-credentials");const l=i.getAttribute("data-type")||"script";if(matches(i,o)){const t=getData(i,"ujs:submit-button");c=getData(i,"ujs:submit-button-formmethod")||i.getAttribute("method")||"get";s=getData(i,"ujs:submit-button-formaction")||i.getAttribute("action")||location.href;c.toUpperCase()==="GET"&&(s=s.replace(/\?.*$/,""));if(i.enctype==="multipart/form-data"){r=new FormData(i);t!=null&&r.append(t.name,t.value)}else r=serializeElement(i,t);setData(i,"ujs:submit-button",null);setData(i,"ujs:submit-button-formmethod",null);setData(i,"ujs:submit-button-formaction",null)}else if(matches(i,e)||matches(i,n)){c=i.getAttribute("data-method");s=i.getAttribute("data-url");r=serializeElement(i,i.getAttribute("data-params"))}else{c=i.getAttribute("data-method");s=t.href(i);r=i.getAttribute("data-params")}ajax({type:c||"GET",url:s,data:r,dataType:l,beforeSend(t,e){if(fire(i,"ajax:beforeSend",[t,e]))return fire(i,"ajax:send",[t]);fire(i,"ajax:stopped");return false},success(...t){return fire(i,"ajax:success",t)},error(...t){return fire(i,"ajax:error",t)},complete(...t){return fire(i,"ajax:complete",t)},crossDomain:isCrossDomain(s),withCredentials:u!=null&&u!=="false"});stopEverything(a)};const formSubmitButtonClick=function(t){const e=this;const{form:n}=e;if(n){e.name&&setData(n,"ujs:submit-button",{name:e.name,value:e.value});setData(n,"ujs:formnovalidate-button",e.formNoValidate);setData(n,"ujs:submit-button-formaction",e.getAttribute("formaction"));return setData(n,"ujs:submit-button-formmethod",e.getAttribute("formmethod"))}};const preventInsignificantClick=function(t){const e=this;const n=(e.getAttribute("data-method")||"GET").toUpperCase();const o=e.getAttribute("data-params");const a=t.metaKey||t.ctrlKey;const r=a&&n==="GET"&&!o;const c=t.button!=null&&t.button!==0;(c||r)&&t.stopImmediatePropagation()};const h={$:$,ajax:ajax,buttonClickSelector:e,buttonDisableSelector:u,confirm:confirm,cspNonce:cspNonce,csrfToken:csrfToken,csrfParam:csrfParam,CSRFProtection:CSRFProtection,delegate:delegate,disableElement:disableElement,enableElement:enableElement,fileInputSelector:s,fire:fire,formElements:formElements,formEnableSelector:c,formDisableSelector:r,formInputClickSelector:a,formSubmitButtonClick:formSubmitButtonClick,formSubmitSelector:o,getData:getData,handleDisabledElement:handleDisabledElement,href:href,inputChangeSelector:n,isCrossDomain:isCrossDomain,linkClickSelector:t,linkDisableSelector:i,loadCSPNonce:loadCSPNonce,matches:matches,preventInsignificantClick:preventInsignificantClick,refreshCSRFTokens:refreshCSRFTokens,serializeElement:serializeElement,setData:setData,stopEverything:stopEverything};const y=handleConfirmWithRails(h);h.handleConfirm=y;const j=handleMethodWithRails(h);h.handleMethod=j;const v=handleRemoteWithRails(h);h.handleRemote=v;const start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");window.addEventListener("pageshow",(function(){$(c).forEach((function(t){getData(t,"ujs:disabled")&&enableElement(t)}));$(i).forEach((function(t){getData(t,"ujs:disabled")&&enableElement(t)}))}));delegate(document,i,"ajax:complete",enableElement);delegate(document,i,"ajax:stopped",enableElement);delegate(document,u,"ajax:complete",enableElement);delegate(document,u,"ajax:stopped",enableElement);delegate(document,t,"click",preventInsignificantClick);delegate(document,t,"click",handleDisabledElement);delegate(document,t,"click",y);delegate(document,t,"click",disableElement);delegate(document,t,"click",v);delegate(document,t,"click",j);delegate(document,e,"click",preventInsignificantClick);delegate(document,e,"click",handleDisabledElement);delegate(document,e,"click",y);delegate(document,e,"click",disableElement);delegate(document,e,"click",v);delegate(document,n,"change",handleDisabledElement);delegate(document,n,"change",y);delegate(document,n,"change",v);delegate(document,o,"submit",handleDisabledElement);delegate(document,o,"submit",y);delegate(document,o,"submit",v);delegate(document,o,"submit",(t=>setTimeout((()=>disableElement(t)),13)));delegate(document,o,"ajax:send",disableElement);delegate(document,o,"ajax:complete",enableElement);delegate(document,a,"click",preventInsignificantClick);delegate(document,a,"click",handleDisabledElement);delegate(document,a,"click",y);delegate(document,a,"click",formSubmitButtonClick);document.addEventListener("DOMContentLoaded",refreshCSRFTokens);document.addEventListener("DOMContentLoaded",loadCSPNonce);return window._rails_loaded=true};h.start=start;if(typeof jQuery!=="undefined"&&jQuery&&jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=h;jQuery.ajaxPrefilter((function(t,e,n){if(!t.crossDomain)return CSRFProtection(n)}))}export{h as default};
|
2
|
+
//# sourceMappingURL=rails-ujs.esm.js.map
|
@@ -1,24 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
-
|
17
|
-
|
18
|
-
= @f.input field.sym, selected: collection, collection: [collection].flatten, disabled: !field.editable, input_html: { data: { collection_path: collection_path, controller: controllers } }
|
19
|
-
-else
|
20
|
-
= @f.association field.sym, collection: [collection].flatten, disabled: !field.editable, input_html: { data: { collection_path: collection_path, controller: controllers } }
|
21
|
-
- when :boolean
|
22
|
-
= @f.input field.sym, disabled: !field.editable, as: field.type.to_sym, input_html: { data: { controller: "input-control-#{field.type}" } }, wrapper: :checkbox
|
23
|
-
- else
|
24
|
-
= @f.input field.sym, disabled: !field.editable, as: field.type.to_sym, input_html: { rows: 10, data: { controller: "input-control-#{field.type}" } }
|
1
|
+
%div{ data: { controller: "#{@resource.class.name.underscore.gsub('_', '-').gsub('/', '--')}-form" } }
|
2
|
+
- @resource.class.resource_field_groups.select{ |x| x.editable }.each do |rfg|
|
3
|
+
%h3= resource_field_group_label(@resource.class, rfg.key) unless rfg.key == :default
|
4
|
+
- rfg.sections.each do |section|
|
5
|
+
.row
|
6
|
+
- section.fields.each do |field|
|
7
|
+
%div{ class: section.column_class }
|
8
|
+
- if association?(field)
|
9
|
+
- collection = collection_for(field)
|
10
|
+
- if one_through?(field)
|
11
|
+
= @f.input field.sym, collection: [collection].flatten, disabled: !field.editable, input_html: { data: association_data_hash_for(field) }, selected: collection
|
12
|
+
- else
|
13
|
+
= @f.association field.sym, collection: [collection].flatten, disabled: !field.editable, input_html: { data: association_data_hash_for(field) }
|
14
|
+
- elsif boolean?(field)
|
15
|
+
= @f.input field.sym, disabled: !field.editable, as: field.type.to_sym, input_html: { data: { controller: "input-control-#{field.type}" } }
|
16
|
+
- else
|
17
|
+
= @f.input field.sym, disabled: !field.editable, as: field.type.to_sym, input_html: { rows: 10, data: { controller: "input-control-#{field.type}" } }
|
@@ -8,4 +8,52 @@ class Olivander::Components::ResourceFormComponent < ViewComponent::Base
|
|
8
8
|
@f = form_builder
|
9
9
|
super
|
10
10
|
end
|
11
|
+
|
12
|
+
def collection_for(field)
|
13
|
+
@f.object.send(field.sym)
|
14
|
+
end
|
15
|
+
|
16
|
+
def association_data_hash_for(field)
|
17
|
+
{
|
18
|
+
collection_path: collection_path_for(field),
|
19
|
+
controller: "association-#{@resource.class.name.underscore.dasherize.gsub('/', '-')}-#{field.sym} input-control-association",
|
20
|
+
taggable: taggable?(field),
|
21
|
+
tag_field_name: tag_field_name(field)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def taggable?(field)
|
26
|
+
method_key = "#{field.sym}_taggable?"
|
27
|
+
return false unless @resource.class.respond_to?(method_key)
|
28
|
+
|
29
|
+
@resource.class.send(method_key)
|
30
|
+
end
|
31
|
+
|
32
|
+
def tag_field_name(field)
|
33
|
+
return '' unless taggable?(field)
|
34
|
+
|
35
|
+
@resource.class.send("#{field.sym}_tag_field_name")
|
36
|
+
end
|
37
|
+
|
38
|
+
def collection_path_for(field)
|
39
|
+
begin
|
40
|
+
polymorphic_path(@resource.class.reflect_on_association(field.sym).klass, format: :json)
|
41
|
+
rescue
|
42
|
+
''
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def association?(field)
|
47
|
+
%i[
|
48
|
+
association belongs_to_association has_many_association has_many_through_association has_and_belongs_to_many_reflection has_one_through_association
|
49
|
+
].include?(field.type)
|
50
|
+
end
|
51
|
+
|
52
|
+
def one_through?(field)
|
53
|
+
field.type == :has_one_through_association
|
54
|
+
end
|
55
|
+
|
56
|
+
def boolean?(field)
|
57
|
+
field.type == :boolean
|
58
|
+
end
|
11
59
|
end
|
@@ -92,8 +92,8 @@ module Olivander
|
|
92
92
|
render(action) # action.js.erb
|
93
93
|
end
|
94
94
|
|
95
|
-
format.
|
96
|
-
|
95
|
+
format.json { render json: resource }
|
96
|
+
format.turbo_stream {}
|
97
97
|
end
|
98
98
|
else # Default
|
99
99
|
respond_to do |format|
|
@@ -107,8 +107,8 @@ module Olivander
|
|
107
107
|
render(:member_action, locals: { action: action })
|
108
108
|
end
|
109
109
|
|
110
|
-
format.
|
111
|
-
|
110
|
+
format.json { render json: resource }
|
111
|
+
format.turbo_stream {}
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
- @resource = instance_variable_get('@' + resource.name) if resource.name
|
3
3
|
|
4
4
|
- if @resource
|
5
|
+
= render_optional_partial 'form_before'
|
5
6
|
.row
|
6
7
|
.col-12{ data: { controller: [controller.class.name.gsub('Controller', '').underscore.dasherize.gsub('/', '--'), action_name].join('-') } }
|
7
8
|
= render_resource_form(@resource)
|
9
|
+
= render_optional_partial 'form_after'
|
@@ -205,7 +205,7 @@ SimpleForm.setup do |config|
|
|
205
205
|
# config.wrapper_mappings = { string: :prepend }
|
206
206
|
config.wrapper_mappings = {
|
207
207
|
boolean: :vertical_boolean,
|
208
|
-
check_boxes: :
|
208
|
+
check_boxes: :vertical_collection,
|
209
209
|
# date: :horizontal_multi_select,
|
210
210
|
# datetime: :horizontal_multi_select,
|
211
211
|
# file: :horizontal_file,
|
data/lib/olivander/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: five-two-nw-olivander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- app/assets/javascripts/controllers/modal_controller.js
|
218
218
|
- app/assets/javascripts/controllers/turbo_flash_controller.js
|
219
219
|
- app/assets/javascripts/olivander/flash_toast.js
|
220
|
+
- app/assets/javascripts/olivander/rails-ujs.esm.js
|
220
221
|
- app/assets/stylesheets/adminlte.css
|
221
222
|
- app/assets/stylesheets/fa-fix.scss
|
222
223
|
- app/assets/stylesheets/olivander/application.css
|