DjangoCMS aldryn-bootstrap3 link/button add a custom field (data-toggle) - twitter-bootstrap-3

i am using DjangoCMS with aldryn-bootstrap3 and i need extra attributes on the button/link element. Is it possible to add extra attributes to an element? I need data-* attributes
thank you!
btw: screenshot is fake :)

You can install the package called djangocms-attributes-field to edit attributes (including data-*) via the front-end editor.

Here is my quick and dirty workaround:
i edit the template:
./templates/aldryn_bootstrap3/plugins/button.html
aldryn_bootstrap3 button template
{% if 'modal' in instance.classes %}
data-toggle="modal"
{% endif %}
So if i edit the class "modal" data-toggle="modal" appears.

Related

Customizing Accordion Based On Product Selected

So I am wondering how I can change the image under an accordion section for just one product page and not the others. I see in the code of the product page template where the image is located but I am not experienced enough to know how to change it for just the one product. Is there a way to do this without needing to create a whole new template?
Website: https://auntethels.com (I'm trying to change the image under "heating instructions" for just the Lentil Chili Pot Pie product page)
Not sure if it helps but here is the code snippet I found: 1
(I need the 'directions.png' to be different for just the one page.)
I've been able to make other changes she needed but this one has stumped me :( I tried to reach the developer who made the custom site but he has stopped replying so I'm on my own for this one.
you can conditionally render the accordion with product handle
{% if product.handle == 'cumin-lentil-pot-pie-vegetarian'%}
<div class="accordion">
<h4>Heating Instructions</h4>
<button class="x">✕</button>
<p class="answer"><img src="//cdn.shopify.com/s/files/1/0332/6997/3128/t/15/assets/directions.png?v=63874448465039500411650314323" alt="Directions"></p>
</div>
{% endif %}

Remove a particular section from {{ content_for_layout }} in shopify template

I am trying to customize Supply theme in shopify In theme.liquid file and i can see {{ content_for_layout }} which loads slider, featured collection etc.Now I want to remove slider from that section.Can anyone suggest which file I should check ?
Please find for setting_data.json there you can find all declared values. There you can search for "content_for_index".

How to disable the select element in Materialize CSS with VUE?

Goodnight.
Working with VUE and MaterializeCSS I'm having problems using since I need to list a number of options from an array of objects filled in from an Ajax request but apparently VUE is hiding the information by creating a new under the main one.
Then I would like to know if anyone knows how to deactivate an element of the Materilizecss framework? In this case . Thank you.
If someone works for you:
Add the browser-default class to the but indicate in the display: block style because for some reason it hides it.
<select class="browser-default" style="display:block" v-model="category_id">
<option v-for="category in arrayCategories" :key="category.id" :value="category.id" v-text="category.name"></option>
</select>
Greetings.

django-autocomplete-light how to copy multi select fields

I'm using django-autocomplete-light with django 1.8.
I want to be able to copy the selected contents from one autocomplete field into another which requires overriding javascript code.
I tried duplicating the html content inside the autocomplete tool into another one in the browser debugger which looked good but when I click the save button in the admin page, it ignores my copied value.
Any ideas?
It works if you use an empty form for #form_template as such:
<div class = 'table' id="form_template" style="display:none">
{{ formset.empty_form }}
</div>
<div class = 'table'>
<table>
<!-- don't use #form_template in your actual form -->
From github issue

Liquid variable scope between Layout and Template

Is is possible to define liquid variables in a layout file that are visible in the template files?
Variables defined in a layout (e.g. theme.liquid) are visible to any snippets included via <% include %> (and vice versa).
Variables defined in a template (e.g. index.liquid) are visible in any snippets included via <% include %> (e.g. product-grid-item.liquid) and are also visible in the layout file.
And yet variables defined in a layout don't seem to be visible to the template. Presumably the template is evaluated prior to the evaluation of the layout. Is there any way to override this behavior?
Currently in Shopify, Liquid variables cannot be passed from the layout into the template.
One way to get around this would be to do the same logic twice, perhaps in a snippet. Then place the same snippet in both the Layout and the template.
Also worth noting on the subject of Shopify Liquid scope as it isn't documented anywhere is that variables defined inside of sections are scoped inside of that section and cannot be access outside.
EDIT:
Also on the subject of Shopify Liquid variable scope.
There is now also the {% render %} tag which forces a snippet to be called with the required variables explicitly passed in.
For example you could do this with include
{% assign name = 'cart' %}
{% include 'icon' %}
Alternatively, you can use the render tag which has some performance benefits. Just ensure you explicitly pass the name variable.
{% render 'icon' name: 'cart' %}
<!-- OR -->
{% assign name = 'cart' %}
{% render 'icon' name: name %}
The benefit of using render is that the variables are always scoped to the snippet which can prevent some confusing bugs. Additional there is a big speed performance on Shopify's server which will improve the Time to First Byte.