In Webstorm is there any support for "partial" views?
For example, I have a chunk of html that will be injected (via angular.js) into the main page. If I'm working on that chunk and I create a new CSS tag, the "Create Selector" will not list any css files since they are not referenced in the partial, but rather in the "parent" view.
From what I can tell it only looks for CSS files that are referenced in the head tag. Normally this makes perfect sense; don't create new CSS properties in a file that won't be available. But in the case of partial views, they will be injected into a page that has several CSS files linked to it. Is there any way to inform Webstorm that these are partial views and that the CSS files will be available at runtime? In other words, these partial views are children of a parent view, and I'd like Webstorm to be aware of this hierarchy.
Related
I want to implement the feature for admins to set custom templates. Like they can place themes or templates in a particular folder relative to the home folder.
Each theme may have a folder and some config or preview for example(optional).
1) First I need to figure out how to set custom templates dir for an app.
2) Then I can probably do listdir and get all the folders and then give the admin an option to select the dir.
3) A setting list to specify additonal template folders by users.
1 is the problem.
The main question I want answer for is how to set custom template dir which can be modified anytime.
I found out that askbot (the SO clone) implements this kinda theming where you can place themes in subfolders a folder and the admin can select the folder which he/she wants the templates.
I am new to Django. I guess you can do it using jinja templating.
http://jinja.pocoo.org/
Add a common styling to one html page(base.html)
and then extend the base html to whichever pages u want using extends-- check out template inheritance in the above link
Also you can get some cool templates in bootstrap.. checkout their template section. https://www.w3schools.com/bootstrap/bootstrap_templates.asp
Good luck!
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.
I want to know if it's possible to hide all the template view in html page.
I am using backbone and underscore to load templates like following
app.View.ShoppingPanelView = Backbone.View.extend({
template: _.template($('#shopping-sideline').html()),
.....
and in my jsp page i do
<jsp:include page="includes/templates-shopping.jsp" />
Now i see using firebug that all my templates are visible.
is it possible somehow i hide the templates in final html page. The reason is the as you can see the templates contains the code and don't want to display how internal things are structured.
In my opinion it makes no sense working SPA. Why don't you load it when are really necessary?
You can Load a template only when it is necessary using the lazy load concept. Try to separate all of your template files inside html files and use !text to load then.
For example, let's suppose that you just want to display a view(or template) when some button is clicked, so your code will look like this.
events:
"click #someButton": "showNewView"
showNewView:->
require['pathToNewTemplateOrView'], (TemplateOrView)->
view = new TemplateOrView()
This way your template or view will just be displayed when the button is clicked.
Another thing that I always avoid logic inside my templates, things like If statements.
Try to do that inside your views, and make sure that your view are just reflecting what is on your model.
Hope it helps.
this is probably a newbie Qs... i am using Sitecore 7 for my web application, and this is what i have so far
Data Template - this has only one field called "Title" to display page specific title
One Layout - this is pointing to my cshtml file under asp.net mvc project path. This has complete markup starting from Doctype. The title tag under head tag uses Sitecore's Html extension to render the field "Title" from template mentioned in #1. This also renders sitecore's View via placeholder called "page-body" under body tag of layout.
I have created a View Rendering pointing to Razor view in my asp.net mvc project. This view simply has h1 calling out hello world.
The Sitecore/Content/Home item (from sitecore's master tree) uses the template created in #1 and uses the layout created in #2. This item has one and only one Rendering created in #3
Now when i hit the root from my local sitecore website, everything looks good! I see Hello World in H1 tag under body tag with complete html makrup mentioned in layout...
This is where things starts getting complicated... Now i want my View Rendering (created in #3) to refer a CSS file which is specific to this Rendering only. This CSS will not be referred to all the pages. Of course I want to add the reference into the head as link href. So tried using asp.net mvs "Section" but i keep getting that sweet error "file cannot be requested directly because it calls the rendersection method..." So i realized that my view rendering doesn't have any #{Layout = "..."} and ofcourse which is controlled by sitecore engine!!
So i still went ahead and added Layout reference in my view Rendering's cshtml file and refer to the same layout file that Sitecore Engine would (i.e. #2 above). I still have same error.
Then i found a post Using sections in Editor/Display templates which is essentially for Scripts and tried implementing for CSS. But this didn't work either because View Rendering executes after the Helper in head tag gets executed so my CSS reference never go spit out in stream. BTW for Scripts this solution works perfect because scripts rendering helper is called after the Sitecore's view rendering.
At this point i am totally stuck for "How can i get my CSS ref for View Rendering in head tag". Any sitecore experts to help here?
So it's definitely a more advanced customization, but we do this using Cassette and a customization to the renderLayout pipeline. Use of this pipeline solves your issue of the helper in the head tag being called before your view renderings.
Extend the view rendering template (/sitecore/templates/System/Layout/Renderings/View rendering) and add a field that stores the name of a Cassette bundle you want to include on the page.
In your RenderLayoutProcessor, loop through all the page renderings (Sitecore.Context.Page.Renderings), inspect the rendering item for the bundle field (rendering.RenderingItem.InnerItem[YOUR_FIELD]), and call Cassette's Bundles.Reference.
In the header of your main layout, call Cassette's Bundles.RenderStylesheets().
You can also accomplish this without Cassette, but it makes the bundling, referencing, and inclusion of scripts and stylesheets much easier.
The other advantage to this approach is that it does not break Sitecore caching. Any approach which requires code to execute in your View rendering will render Sitecore HTML caching useless, because when the rendering is cached, your code will not execute and the page styling will be broken.
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.