Javascript templates

22 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jul 2010 Link to this post

    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...)


  2. Jordan
    Admin
    Jordan avatar
    123 posts

    Posted 09 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Jul 2010 Link to this post

    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...
  5. Jordan
    Admin
    Jordan avatar
    123 posts

    Posted 13 Jul 2010 Link to this post

    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
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 04 Nov 2010 Link to this post

    Any updates on this with the latest internal build?

    It doesn't come with any template samples for me to look at...
  7. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 08 Nov 2010 Link to this post

    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
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 08 Nov 2010 Link to this post

    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.
  9. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 09 Nov 2010 Link to this post

    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
  10. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Nov 2010 Link to this post

    Sure, ticket has been entered
  11. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 09 Nov 2010 Link to this post

    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
  12. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Nov 2010 Link to this post

    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.
  13. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 09 Nov 2010 Link to this post

    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
  14. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Nov 2010 Link to this post

    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)
  15. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 10 Nov 2010 Link to this post

    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
  16. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Nov 2010 Link to this post

    Ok, so I can do jQuery templates now, but FYI the formatting of document.ready is non-standard still

    $(document).ready(function()
                      {
          
                      });
  17. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 15 Nov 2010 Link to this post

    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
  18. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 Nov 2010 Link to this post

    Its on my work PC right now, but should be easy to replicate...there's not much to it :)
  19. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 16 Nov 2010 Link to this post

    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>>
  20. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 16 Nov 2010 Link to this post

    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
  21. Deyan Varchev
    Admin
    Deyan Varchev avatar
    150 posts

    Posted 24 Nov 2010 Link to this post

    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
  22. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 24 Nov 2010 Link to this post

    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)
  23. Deyan Varchev
    Admin
    Deyan Varchev avatar
    150 posts

    Posted 26 Nov 2010 Link to this post

    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
Back to Top
DevCraft banner