This little module help you create JavaScript templates using the lightweight microtemplating JavaScript library designed by John Resig.

Create a module defining a theme for your JavaScript template and use some JavaScript to manipulate it.

More information about the JavaScript library : http://ejohn.org/blog/javascript-micro-templating/

There isn't yet a Drupal project that integrates this fast and powerfull librairy.

Code tested with http://pareview.sh/ script :
http://pareview.sh/pareview/httpgitdrupalorgsandboxtocab2407171git

Project page: https://www.drupal.org/sandbox/tocab/2407171
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/tocab/2407171.git microtemplating

Manual reviews of other projects :

Thanks!

Comments

tocab’s picture

Issue summary: View changes
tocab’s picture

Issue summary: View changes
mouhammed’s picture

Please add the project name to the git clone instruction.
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/tocab/2407171.git microtemplating
Third party library shouldn't be in your module. Use libraries module. See here https://www.drupal.org/node/1342238

tocab’s picture

Issue summary: View changes

git clone corrected.

For the library, it is not directly accessible from an URL (see http://ejohn.org/blog/javascript-micro-templating/) that's why I can't use this method.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

tocab’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
tocab’s picture

New commit : Fix an error due to a pareview correction.
I can't add spaces before or after "/" in microtemplating.js because it breaks the regular expression...
So I now get some errors on pareview, but they can't be fixed.

klausi’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: single application approval

Review of the 7.x-1.x branch (commit f65d486):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/microtemplating.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     80 | ERROR | [x] Doc comment star missing
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. js folder: appears to be 3rd party code. 3rd party code is not generally allowed on Drupal.org and should be deleted. This policy is described in the getting involved handbook. It also appears in the terms and conditions you agreed to when you signed up for Git access, which you may want to re-read, to be sure you're not violating other terms. The Libraries API module is a recommended method for adding 3rd party dependencies without directly including the code on Drupal.org.
  2. microtemplating_help(): check_plain() and filter_xss_admin() is wrong here since no user provided text is involved. You are only printing stuff from a trusted file.
  3. This project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project for you.

So the inclusion of the library is a blocker right now.

tocab’s picture

Hi klausi,
thanks for your review.

Point by point :

Code sniffer
Corrected in last commit.
Test case
For now there is no real specific code to test. It's just the usage of Drupal hooks.
Third party
The problem is that this library is not available through a third party URL. I would use the libraries API if only it was possible... This library is under the MIT licence which is compatible with the GPL licence. So it should not be a problem regarding the Licensing FAQ point 10.
Hook help
I just use the hook_help template available in the Module documentation guidelines page. Do you think I should still remove check_plain() and filter_xss_admin() ?
Too short
I understand the point. But I wanted to have first a usable module. I have other ideas for this module, for example, adding the possibility to choose the JS templating library that you want to use with an administration page and perhaps adding a way to choose the loading method with a CDN or not (something like the jquery_update module). Those things I will only develop if the module is accepted. With this first version I wanted to get a feedback.

Regarding the planned developments I perhaps misnamed the module which should probably better be 'js_templating' or something like this. What do you think ?

But I think the microtemplating "library" should be kept like this, because there is no other way of integrating it, and because it is well-known in the world of "javascript templating".

tocab’s picture

Status: Needs work » Needs review
klausi’s picture

Assigned: Unassigned » dman
Status: Needs review » Reviewed & tested by the community

I see, so looks RTBC to me otherwise. The project page could be a bit more descriptive, informing about the use case etc. See https://www.drupal.org/node/997024

Assigning to dman as he might have time to take a final look at this and do the single project promotion.

dman’s picture

I see your point about the third-party include, and I'd let that slide as the benefit of having it as a file there is greater than the reasons not to.

However, one page of code still is incredibly short. So short that half your code is just the help hook. I love doing sexy help hooks, but it really leaves this module pretty trivial to use as a project application.

I know there are a few existing projects of similar size that *just* add another hook_library like this does, but those alone would not pass these criteria if used as a project application either. But I do take your points about it's purpose.

Like Klausi - I think this would benefit from an example use case or demo before it would be really ready for release and consumption. It looks like your help text in README.md is halfway there.
I would suggest that if you were to provide a page or a test mini-module that demonstrates this utility in action that could be sufficient to push it over the line from "trivial" into "useful and usable". As your README states, this currently does nothing until a developer adds more code. So - if you provided that working code then we would be winning.

Also just as an idea - would you be able to use/expose this library to use as either/both a text filter or a field formatter? Either of those would be a lot clearer to use for site builders, and that approach is a lot more Drupally than just saying you can only use this as an appendage to your own custom theme code.

If this suggestion does not make sense (I really can't tell) then that is because your project page currently is a bit of a mystery, it doesn't really tell me what this does in terms of input or output, or why or when I would want to use it. So describing a real world use case on the project page to explain why this module would be used would also help this project a lot, and would be closer towards getting past the "too short, can't be tested, and does nothing" exemptions needed with this application.

So, if you were to provide a real-working mini-module using this, either as code or verbatim in the project page, then with Klausi's RTBC, it would just scrape in OK I think.
That would make it testable ("It works!") and that would be a stable place for a first release to build from as you describe in #9.
It's not policy to use a project application to promote a module that - as currently presented for evaluation - doesn't actually do anything tangible yet.

tocab’s picture

Assigned: dman » Unassigned
Status: Reviewed & tested by the community » Needs review

Hi dman,

Thank you for your response.

I've added an sub-module with a real-working example : a pure frontend todo list application.
After enabling the microtemplating_example module, go to /todos for the demo.

I hope it would help.

Thanks,

nabil.sadki’s picture

Automatic review

Review of the 7.x-1.x branch (commit f01fc3b):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    
    FILE: /var/www/drupal-7-pareview/pareview_temp/js/microtemplating.js
    ----------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 1 LINE
    ----------------------------------------------------------------------
     14 | ERROR | [x] Expected 1 space after "/"; 0 found
     14 | ERROR | [x] Expected 1 space before "/"; 0 found
     14 | ERROR | [x] Expected 1 space after "/"; 0 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    Time: 297ms; Memory: 9.5Mb
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

Source: http://pareview.sh/ - PAReview.sh online service

tocab’s picture

Thanks for the review nabil,
but as I said in #7, those errors, reported by pareview, can't be fixed.

klausi’s picture

Assigned: Unassigned » dman
Status: Needs review » Reviewed & tested by the community

Don't forget your project page; example module looks good, back to RTBC.

dman’s picture

Status: Reviewed & tested by the community » Fixed

That looks excellent tocab!

This example of usage is clear, and all the code (both original and mini-module) is very readable and meets Drupal expectations well.
(I feel) This little extra support addition takes this module from another "meh" third party integration thing to a well-supported plugin that folk will be able to re-use!
Thanks for your patience and timely response here.

Good luck, and I hope to see your project page grow as you add some real-world uses!


Thanks for your contribution, tocab !

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

tocab’s picture

Thank you.

I will take a look at those links and update the project page accordingly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.