Tab completion for ejs tags such as <% %> - visual-studio-code

I am using ejs for my template engine. In the .ejs files, it is fine to tab completion with normal html tags. However, I cannot find a way to tab completion for ejs tags such as <% %>``<%= %> etc. How could I make it?

Related

Is it possible to incorporate ejs code into grapesjs?

I'm using grapesjs on a project and I want the user to be able to drag in a block that would add an ejs script, for example <%= data.title %>
I've tried doing it just like that, but the exported html is <%= data.title %<
plus it looks ugly in the editor.
Has anyone had a similar problem and made a solution?

Popover isn't working when attribute is injected after page renders.

I'm trying to use popover for certain parts of paragraphs that I'm fetching from my DB and using ng-repeat I load to my html and serve to the front-end.
The relevant part of my DOM, looks like this
<div ng-repeat="i in comments" class="ng-scope">
<div popover="test2" class="task ng-binding"> text1
<span popover="test" class="highlight-a">text2</span>
</div>
</div>
the ... is injected into the DOM from after some process in the back-end, so the basically the DOM is modified after it loads and renders.
At this point, clicking on the won't trigger any popovers.
I'm wondering if there's a work-around for re-initiating the popovers or anything like that. Even when I call on to load the popover in the end of the process it doesn't work.

Submit button not work while using ClientValidation of asp.net mvc 2.0

I have one form with text box, submit button, drop down list ..... I'm using <%Html.EnableClientValidation(); %> to validate all the elements in my form. But the probem is when I write <% using (Html.BeginForm()){ }%>, the validation works, But when I click on the submit button, it did nothing even though I complete all the condition of each elements. And the submit button is submitting while I use <form method="post"> instead of <% using (Html.BeginForm()){ }%>.
I use jquery tab in my view, so I have more than one submit button that do different task(I test the value of the submit button in my controller).
Could any one tell me, what did I wrong here?
Thanks in advanced.
I'd make sure that you wrap your entire form in the braces when using the <% using (Html.BeginForm()){ }%>. If your submit button is not contained within those braces, then it will not cause the form to post.
<% using(Html.BeginForm()) { %>
... form elements here ...
<% } %>
When you use this method, remove the other form tags on the page as this syntax is equivalent to writing:
<form>
... form elements here ...
</form>

Typo3: adding elements inside an list item <LI>

Im trying to get something like this:
<ul>
<li>
<h3>Some header</h3>
<p>Some text</p>
</li>
</ul>
inside a Text element, but when I try to apply the blocktype to the content of the <li>, it applies it to the whole content.
Im using rtehtmlarea. What can I do?
Strange - this works in my installation. You should check the RTE configuration in page TSconfig. I assume something like this:
RTE.default.proc {
allowTagsOutside = img,hr,[your Tags]
}
Another suggestion is: Disable the Rich Text Editor (there is a checkbox below the textarea), enter your tags, then enable it again. The tag structure should be preserved.
If not, drop me a line, I will post my RTE configuration.
If you need a waterproof solution, try playing around with your RTE.default typoscript.

Limit JavaScript and CSS files on ASP.NET MVC 2 Master Page based on Model and View content

I want to include certain .js and .css files only on pages that need them.
For example, my EditorTemplate DateTime.ascx needs files anytimec.js and anytimec.css.
That template is applied whenever I use either the EditorFor or EditorForModel helper methods in a view for a model with a DateTime type value.
My technique:
I've put this condition into the <head> section of my master page. It checks for a DateTime type property in the ModelMetadata.
<% if (this.ViewData.ModelMetadata.Properties.Any(p => p.ModelType == typeof(DateTime))) { %>
<link href="../../Content/anytimec.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/anytimec.js" type="text/javascript"></script>
<% } %>
This has two problems:
Fails if I have nested child models of type DateTime
Unnecessarily triggered by views without EditorFor or EditorForModel methods (example: DisplayForModel)
How can I improve this technique?
Personally, I would use a partial view and an ASP Content Placeholder.
In the Views/Shared have a partial view EditorScripts.ascx which contains the tags defining the scripts to be included in your editing pages.
Then put a placeholder in the Site.Master <head> tag, something like this:
<asp:ContentPlaceHolder ID="HeadContent" runat="server" />
The, in any view that you want/need the scripts, put this code:
<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
<% Html.RenderPartial("EditorScripts"); %>
</asp:Content>
This isn't a perfect solution and isn't as dynamic as you would like. The reason for using a partial view is that if you decide to update or add more scripts to those views, then you only have to update it in one location.
Another way would be to have a Editor.Master page that contains these scripts and other editor specific things then have that master use the Site.Master as it's master page. Then all editor views would have the Editor.Master as their master page.
HTH
I think the telerik web asset manager allows you to accomplish what you want and is open source.