Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding ajax-loading of remote templates. #24

Closed
wants to merge 6 commits into from

Conversation

@ccoenen
Copy link

commented Aug 4, 2011

Hey there,

for a project of mine, we needed to load templates on demand.
This introduces the loadTemplates() api, including unit-tests. We based our work off of v0.9.

it achieves a similar functionality to cbas' loading of external files. (https://github.com/andyet/ICanHaz.js/pull/16). His functionality could easily be implemented on top of this commit.

I included unit tests, in case you're curious, If you have any questions don't hesitate to ask!

@ccoenen

This comment has been minimized.

Copy link
Author

commented Aug 5, 2011

I was adding the functionality for partials. This works the same way as partials do in ruby: include a leading underscore. This works quite well for me, but i'm open for comments.

@@ -5,7 +5,7 @@
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen" />
<script src="jquery-1.4.4.min.js"></script>
<script src="qunit/qunit.js"></script>
<script src="../ICanHaz.min.js"></script>
<script src="../ICanHaz.js"></script>

This comment has been minimized.

Copy link
@ccoenen

ccoenen Aug 5, 2011

Author

this was just done to make the testing easier for me, no need to pull this change.

This comment has been minimized.

Copy link
@viswaug

viswaug Aug 26, 2011

I think the following line is misplaced in the current version
self[script.hasClass('partial') ? 'addPartial' : 'addTemplate'](script.attr%28'id'%29, text);

i think it should go inside the
if (!script.attr('src')) {

sebdeckers and others added some commits Jul 18, 2011

Added asynchronous remote loading of templates and partials. Pass a c…
…allback to ich.grabTemplates() or ich.refresh() to use this on page load.
integrated the code from Pull Request cbas, commit
67b4f6a and used my existing helper to shorten things a
litte. Should be a superset of Pull Request 16 now.
@HenrikJoreteg

This comment has been minimized.

Copy link
Owner

commented Dec 8, 2011

Hi guys, really sorry it took me so long to get back to you on this stuff. We've been crazy busy putting on KRTConf and launching andbang. Not to mention bringing on a handful of new folks. Anyway, I wrote an explanation on the other request by cbas. Just adding it here as well. Thank you for doing this, I hope it worked great for your projects, but I don't quite think it's the right fit to apply it for everyone. Thanks for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.