I am playing with ember-ci and trying to figure out where I should put the files. Most tutorials that I have found, put them in one file and it just works.
This is my application. My problem is that the templates/application.hbs doesn't render the views/index.html and the views/about/html which according to what I've read, it should render it on the outlet of the application template.
Should I put these files somewhere else?
I just went through your application. Here are a couple of mistakes I noticed.
You are putting html files in the views folder.
The template files should be put inside the templates folder with the extension hbs.
In you templates, you are specifying 'data-template-name'. But that is not necessary. Just put whatever html you want to display in that hbs file. The name of this file is the relevant part. Ember-cli uses a custom resolver. It resolves controllers, templates, view... etc based on the name of the file. You may want to go the project site to see the naming conventions. Its a bit different than the naming conventions in ember site.
Okay now here are the steps I did to get you site working.
Moved the files index.html and about.html from the views folder to the templates folder. I changed the extension of both these files to.hbs`.
Removed the script tags inside the 2 templates mentioned above.
Related
Django 3.0.6
For one model I need a modified admin site template.
Namely, I want to modify this template:
admin/includes/fieldset.html
I have copied the fieldset.html from Django package directory and placed it like this:
/my_project/image/templates/admin/includes/fieldset.html
Here image is my application. It is this application that needs a modified admin template.
The problem is that all other models also get this template. And the used template filters don't receive necessary params and explode.
Documentation: https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#set-up-your-projects-admin-template-directories
Well, I got confused and fail to organize the necessary directories structure.
How can I use the modified template only for one Image app?
You have a couple of issues. Firstly, only the following templates can be overridden per-app or per-model:
actions.html
app_index.html
change_form.html
change_form_object_tools.html
change_list.html
change_list_object_tools.html
change_list_results.html
date_hierarchy.html
delete_confirmation.html
object_history.html
pagination.html
popup_response.html
prepopulated_fields_js.html
search_form.html
submit_line.html
fieldset.html isn't in there, so you'll need to see if the including template(s) is in this list, and if it is, replace this template and use it to include your own version of fieldset.html.
Also, your location (slightly modified since can't override included templates per-app): /my_project/image/templates/admin/template.html isn't quite right. This will overwrite that template for every app. To do it per-app, you need a further subdirectory under admin:
/my_project/image/templates/admin/image/template.html
The reason for this is that templates don't really care about which app they're in, so the fact that the template lives in your image app doesn't mean anything to Django, the convention of putting them in your app's sub-directory is solely to avoid overriding templates that you don't intend to.
I'm using Joomla 3.4 and want to open popup with some article only.
I have this link to load into popop: index.php?option=com_content&view=article&catid=13&Itemid=176&id=6&tmpl=component
I know that I must add tmpl=component but when I add this it load system CSS, JS and HTML layout. It doesn't load active template CSS, JS etc. Why is this happening? Without this attribute it load whole page with active template.
Thanks for advice.
Never mind! I have already done this. I just need to edit component.php file in template.
OK so I found the solution.
I just create file named 'component.php' in the template root folder and edit it as I want. I include my CSS, JS, etc to the file with my specific HTML. So if I add tmpl=component to the URL it looks for compoment.php file. That's all.
I could not find any info on overriding a Joomla plugin in my template.
Some forums claimed there was no plugin override, and the Joomla documentation (being the menacing forest that it is) either has nothing on the subject, or the page is hard to find.
So how can we override the output of a Joomla plugin in the same was we override the output of com_content or mod_contact?
I have found a way to do this:
Navigate to <joomla_homefolder>/administrator/language/<your_language>/
Search for the plugin's corresponding language file.
Copy the file name, EXCLUDING the language prefix (ie en-GB.) and the .ini suffix.
In your template create a folder named html (a common practice for template overrides).
In the html folder create a subfolder and name with the language file name as you copied it in step 3.
Navigate to the tmpl subfolder in the plugin's path: <joomla_homefolder>/plugins/<plugin_type>/<plugin_name>/tmpl
Copy the view file you wish to override into the folder you've created in step 5.
Modify the copied file to override the plugins output.
For example -
To change the page navigation buttons - modify the output of <joomla_homefolder>/plugins/content/pagenavigation:
Go into <joomla_homefolder>/administrator/language/en-GB/ and find the file named en-GB.plg_content_pagenavigation.ini.
From the filename copy only plg_content_pagenavigation.
Create a folder named html (If it does not exist already) in your theme, inside it create a subfolder and name it plg_content_pagenavigation.
Copy the view file <joomla_homefolder>/plugins/content/pagenavigation/tmpl/default.php into the plg_content_pagenavigation folder you just created.
Modify the file.
Note: I have tried it only with Joomla 3.1.
The method may not work with some plugins.
Good Luck.
In joomla 3 you can override plugins output only, that's why the origin plugin must be implemented with a tmpl.
The naming convention of the folder in you [template]/html is
plg_[type*]_[pluginElement]
Template overridden native joomla plugins is only the pagenavigation.
type* : obviously there's no sense to be other than content but if it's custom plugin no one can stop you.
On a Joomla 3.1 install, I am using the Simple Image Gallery plugin and I felt the need to override it in order to add extra functionality to each thumbnail of the gallery.
I copied all of the contents of <joomla_homefolder>/plugins/content/jw_sig/jw_sig/tmpl/ into the folder <joomla_homefolder>/templates/protostar/html/jw_sig/ and I was then able to modify both the default.php file for output modifications, and the accompanying template.css file for styling modifications. This successfully overrides the plugin's output without risking issues during future updates.
Of course, this will not work with all plugins, but it offers another alternative if you have a plugin that was nice enough to be developed with a tmpl folder.
No you can't override the same way because there is not tmpl folder because plugins really should not be rendering though of course a lot do. You probably need to clone the plugin and make a the layout your want possibly using a jlayout to make it easier to manage.
Elin's answer is not quite correct for Joomla 2.5-3.x. Some plugins do render screen output and have /tmpl folders that you may be able to override. See http://docs.joomla.org/Layout_Overrides_in_Joomla
In some cases you may need to create alternative views within the plugin /tmpl folder. For example, some of the simple, newer custom content components that use JForms let you add fields to com_content articles and select a view template for each field. Then overrides for com_content are generated dynamically to display the custom fields. Each field type can be displayed in the component area through plugins, or in a module, or within the template code, but it will use the /tmpl file you selected for the field in the CCK component. If there is a way to override the different field views from within the template folder, it must require an arcane menu structure I haven't been able to discover.
I've started working on a django project that has couple apps that are used entirely through templatetags through other apps. Voting app, comments app..etc
Although am faced with a challenge when it comes to rendering assets for that particular templatetag (css,js).
I already have a base.html with blocks for css and js but how would I be able to access them using templatetags to append related assets. Currently am heavily relying on inclusion templates and I did a lot of research and it seems impossible to touch blocks.
any advise? even if I would change the approach of using blocks am open to any suggestion
it seems perfectly reasonable to tell the users of your library (app) that they must include your css/js somewhere in their template. E.g. django crispy-forms does this. Just give them some sample code to include in their base template
The Django documentation states the following clearly:
Not every template in contrib\admin\templates\admin may be overridden per app or per model.
It then lists the ones that can, and base.html, base_site.html and index.html – the ones I'm interested in – are not among those listed. They can be overridden per-project, but not per-app.
My question is: is there a way around this that doesn't involve editing the code inside django.contrib.admin? I'm willing to consider some monkeypatching solutions :-). I really want my app to have custom versions of those three files inside its templates directory, and have each project that uses the app to use those.
The reason I'm interested is that I'm creating a large, reusable app with a heavily customized admin interface, and per-project overrides of the "core" templates aren't the best solution, since I'd have to copy the custom templates to the template directory of each project that the app gets used in. Releasing new versions of the app with new modifications to those core templates would mean re-copying everything to the affected projects. Ugh.
I understand the reasoning behind the decision to only make a select few templates overridable per-app; after all, if overriding them all was possible, which app's overridden admin would take precedence?
But in my case, the app will be the "centerpiece" of several client projects, with other apps in those projects merely being in a supporting role.
CSS-based customization of the existing templates only gets you so far, and I'm hesitant to rely on JavaScript DOM manipulation solutions unless absolutely necessary.
One solution that comes to mind is to place the custom base.html etc. templates inside appname/templates/admin/ and then symlink them to the project's templates folder. That way any updates to the app will automatically take effect on the project level.
Symlinking is probably my method of choice if nothing better is suggested, but I'd like to hear if anyone has a nicer solution.
As I see your goal is to override templates for entire project, not for app or for model, but you don't want to put templates in project's template folder.
So you should just create 'base.html', etc. in 'your_app/templates/admin' folder.
Next you have to tell django that templates should be loaded not only from project's template folder, but also from your app's folder.
This can be done using TEMPLATES_DIR variable in settings.py file, smth. like that:
TEMPLATE_DIRS = (
os.path.join(PROJECT_PATH, 'templates'),
os.path.join(PROJECT_PATH, 'my_app','templates'),
)