This is a migrated thread and some comments may be shown as answers.

Javascript templates

21 Answers 100 Views
Code Templates
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 05 Jul 2010, 02:10 PM
The jQuery $ identifier seems to be confusing my attempts at templates

How can I get a $(document).ready template?

If I dont put the inital $ in the template, then it seems to work, but the generated code comes out formated a little gimpily...I think becasue it wants to line up the braces with the word "function"

This is what generates:
(document).ready(function() 
                 { 
                     //Code
                 }); 

This is what I'm looking for
(document).ready(function(){ 
   //Code 
}); 

(obviously with the $ identifier at the start as well...)


21 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 09 Jul 2010, 12:05 PM
Hi Steve,

Thanks for contacting us.

 There are two problems with your template. First we do not support $ in the templates. We use it as a special character indicating place holder.
The second issue is with our JavaScript formatter. Currently we do not support

(document).ready(function(){
   //Code
});

I have created a tasks in our Public Issue Tracking System and I have added some Telerik points to your account to compensate for your efforts.


Sincerely yours,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Jul 2010, 12:52 PM
Is there a special character which I could use to have it generate a $?...jQuery is so handy it would be awesome to have templates...
0
Jordan
Telerik team
answered on 13 Jul 2010, 10:45 AM
Hi Steve,

 Unfortunately  you can't do that with the current version and the new version, we will release this week. I have increased the priority of the task and have moved the bug for the service pack.

Regards,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Nov 2010, 04:28 AM
Any updates on this with the latest internal build?

It doesn't come with any template samples for me to look at...
0
Tsviatko Yovtchev
Telerik team
answered on 08 Nov 2010, 11:21 AM
Hello Steve,

 Yes you could escape the $ in templates now using the '\' character. Have a look at http://blogs.telerik.com/justcodeteam/posts/10-09-06/justcode_code_templates.aspx for a complete description of the template syntax now.

What do you mean by saying the latest internal build does nto come with any template samples? There area bunch of default templates now for every supported language including Javascript. Don't you see these?

Greetings,
Tsviatko Yovtchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 08 Nov 2010, 04:51 PM
I don't see anything listed under the JustCode Options Templates\C# section

So I guess you have embedded templates we can't change?

Anyway...Im not really able to Add new templates.  Click Add, type in the template, give it an Acro, and hit save...nothing shows in the box.
0
Tsviatko Yovtchev
Telerik team
answered on 09 Nov 2010, 10:10 AM
Really? That's a major issue then. You should get templates listed for all the languages and you should be able to add new ones.

Could you, please, send over your AppData\Roaming\JustCode\userConfiguration.xml file? You may want to start a new ticket for that. Also, it'd be nice to have a look at the content of your AppData\Local\JustCode\Logs folder.

Kind regards,
Tsviatko Yovtchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Nov 2010, 01:59 PM
Sure, ticket has been entered
0
Tsviatko Yovtchev
Telerik team
answered on 09 Nov 2010, 03:07 PM
Ah I see now. I am quite certain you have the Web Ui Test Studio installed. Am I rgiht?

What happens is that our version of Telerik Controls collides with theirs. Consequently soem of them won't get displayed. That's how the grid that holds the templates does not get displayed at all. When you install the official release that comes out this week that problem will be gone since the versions will be in sync. And we are gonna fix the issue as a whole in teh service pack to come.

Otherwise the templates should be working for you even now. Please, try typing "f" and then shift + space. That should expand the for template for one thing.

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Nov 2010, 03:22 PM
Ah ha!  So Q3 2010 is this week! :D

Yeah I have WebUI installed, and f Shift-Space worked fine.

I really need to at least see what's available to me as far as templates go in that grid.  What would be even slicker is some way to see the templates in the code window as well..  Like if I make some templates but I don't use them often I might forget the shortcut to get them, maybe something like Shift-space on a new line with no text on it opens a list of templates, select enter activates it (or something like that)

I remember templates in the "other companies product" having that issue too...I had so many templates but could never remember what I set as the activation.
0
Tsviatko Yovtchev
Telerik team
answered on 09 Nov 2010, 03:49 PM
Well you could use Alt+End and a popup menu with all the templates appears. However, as their number and length grows it starts getting unusable. We are going to take care of that problem in the service pack. Right now it's still usable for the default templates.
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Nov 2010, 05:00 PM
Yeah Alt-End is close, but has its issues

1) Doesn't show the Acronym to activate (that I can see), so Alt-End defeats the ease-of-use of the shortcuts
2) It shows the Code which will be inserted instead of an Alias which is way easier for a list ("RadGrid ItemDataBound" for example)
0
Tsviatko Yovtchev
Telerik team
answered on 10 Nov 2010, 10:09 AM
Yep, we are working on these already. They just could not make it to the official release. They are either gonna be part of the service pack or of the next official release. So, stay tuned.
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 11 Nov 2010, 07:53 PM
Ok, so I can do jQuery templates now, but FYI the formatting of document.ready is non-standard still

$(document).ready(function()
                  {
      
                  });
0
Tsviatko Yovtchev
Telerik team
answered on 15 Nov 2010, 02:59 PM
Hello Steve,

 Could you send over the definition of that template so that I can see what goes wrong with it? That looks like something we'd like to fix :)

Sincerely yours,
Tsviatko Yovtchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 15 Nov 2010, 03:12 PM
Its on my work PC right now, but should be easy to replicate...there's not much to it :)
0
Tsviatko Yovtchev
Telerik team
answered on 16 Nov 2010, 03:54 PM
Well, under the assumption that your template is a single line of text you could keep it on a single line by switching off the JustCode->Options->COdeStyle->JavaScript->General->Adjust Lines on Autoformat. That will keep the anonymous function you provide as an argument in one line.
See What's New in JustCode in Q3 2010 on Thursday, November 18, 2010 11:00 AM - 12:00 PM EST: Register here>>
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 16 Nov 2010, 04:08 PM
This is the jQuery template I made

\$(document).ready(function(){
     
});

Here's the thing, I don't WANT to keep turning all these functions off...I do like a lot of what JustCode is helping me do, but it seems that the answer for all the little quirks in one area, is to turn something else...off
0
Deyan Varchev
Telerik team
answered on 24 Nov 2010, 11:24 AM
Hello Steve,
 
 Sorry for the late response. It appears that we have some gaps in the way we format JavaScript. modifying JustCode's formatting settings is won't be enough to get the format that you are trying to achieve for this template. The best you can get is by turning off two options -
1. JustCode | Options | Code Style | JavaScript | New Lines -> Place open brace on new line for functions.
2. JustCode | Options | Code Style | JavaScript | Indentation -> Align multiline call arguments.

That's as much as you can get without disabling JustCode's JavaScript formatting. After switching those off you will have the last line indented and not aligned to the beginning. This was intentionally done as it brings more readability to your code. However we will be enhancing greatly our formatting for our next release so this will be improved with additional options.

Greetings,
Deyan
the Telerik team
Browse the videos here>> to help you get started with JustCode
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 25 Nov 2010, 03:16 AM
Please spend the time to make it more intelligent :)

I really don't want to keep turning features off because they are useful in other places :/

I'm sure corp wants you to keep adding new big things for each Q release...but there's a lot of room to improve the existing things...like templates...or intelligence behind the closing quotes\braces...

Although...I must say I'm super glad to have the structure highlighting...very nice job guys (I missed having that)
0
Deyan Varchev
Telerik team
answered on 26 Nov 2010, 04:37 PM
Hello Steve,

 Thanks for the nice words. Client feedback is the most important factor that affects our planning and development efforts. We implemented structural highlighting as a result of client requests. We try to listen and please as much as possible our clients so you can be sure that there will be great improvements in this area for the next Q release. In fact formatting will be one of the main areas where JustCode will change in the near future.

Greetings,
Deyan
the Telerik team
Browse the videos here>> to help you get started with JustCode
Tags
Code Templates
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Jordan
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Tsviatko Yovtchev
Telerik team
Deyan Varchev
Telerik team
Share this question
or