Where can I put a Django custom template tag to get it used by a customised Django admin template? - django-templates

I have a customised version of base-site.html which is kept in templates/admin.
I would like to use a custom template tag in base-site.html.
Normally I would put a custom template tag in a templatetags package within an app.
In this case, the template is rendered for the admin app, which is outside of my source tree.
Where should I put a custom template tag, so that the admin app uses it when rendering my custom base-site.html?

I just put the custom template tag in with all the application custom template tags and it worked without any trouble.

Related

Prevent TinyMCE from removing invalid HTML ( :attribue-name)

I have a program that essentially uses a vue template for its own rendering purposes. Basically templates are designed in Vue and pasted into a TinyMCE editor in the admin panel.
However anytime there is a bound attribute such as :src="field_name" Tiny removes the attribute completely. I am assuming this is because its not valid HTML so my question is there a setting to force Tiny to keep these attributes?

How can I use Vue 3.x in Shopify theme editor?

From this Shopify article Integration with the theme editor, it said that:
When merchants customize sections, the HTML of those sections is dynamically added, removed, or re-rendered directly onto the existing DOM without reloading the entire page.
JavaScript that runs when the page loads will not run again when a section is re-rendered or added to the page. This poses a problem for any custom scripts that would need to be re-run.
I am trying to use Vue 3.x in Shopify theme sections. When a section setting is changed, the section variable is changed (like {{ section.settings.button_color }}. However, the js is not run again, how can I load this updated section value into Vue app?

Nuxt layout and getting static content

I have a header on every page thats generally static — besides the button that needs to update based on the page. Ideally I would like to have a variable called link in static/content/xxx
and then to call it from layouts/default. However it does not seem that I have access to any of the variables in my static content. Being new to vue and nuxt I was hoping for some guidance. I tried using asyncData however, it doesn't seem to get called at all in my layout.
a layout is a static wrapper that will wrap your main content. the main idea behind using layout is to not write the same content again and again. If you work with Vue only project than this type of functionality can be accessed by the using the child routes.
just add the common layout as the parent Component and the changed or different content as the child components.
back to the point, if you have different button content depending upon the pages than don't place it in the layout instead pass through the components individually.
whereas the static folder in the nuxt application holds the data that should not be changed such as the css files or external script files just take and example of bootstrap and jquery these are the libraries that are embeded in the application, instead of changing their internals we just use them. this type of content is placed in static directory (folder)
I hope it helps

How to add script and css references on demand for a Razor page?

Context
I've created a Blazor Server App using the Visual Studio 2019 template.
I will have different pages, and those pages may require different script and css references in the html <head> element.
Question
Instead of add all in advance in _Hosts.cshtml, how can I add some of them "on demand" when a particular .razor page is rendering (which requires that script...)?
In the OnAfterRenderAsync event of that component, call js interop that will look for the specific link or script tags you need and add them to the DOM if they are missing. Depending on how your code and assets are structured, you may have to hardcode the entire js string in your component, unless you can have the needed function in a js file that is always loaded

Big commerce add active class using handlebar

I am using the cornerstone theme and I need an active class for the current navigation. I have used the jQuery and javascript but I want to use the handlebars HTML template engine.
Yes, It is possible to Handlebar.
You can put {{is_active}} in navigation iteration loop in handlebar.
{{#if is_active}}active{{#if}}