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

Auto-load external template files #16

Closed
wants to merge 1 commit into from

Conversation

@sebdeckers
Copy link

commented Jul 18, 2011

Added asynchronous remote loading of templates and partials. Pass a callback to ich.grabTemplates() or ich.refresh() to use this on page load.

Reference the template/partial files:

<script type="text/html" src="assets/templates/user_profile.html"></script>

or

<script type="text/html" src="assets/templates/user_profile.html" class="partial"></script>

Note: The "id" attribute is optional. If not specified the template will be loaded as "ich.user_profile()" as the path and file extension are trimmed from the "src" attribute.

Example usage of the asynchronous callback:

$(function() {window.ich.grabTemplates(function() {
  $("foo").html(ich.user_profile());
})})
Added asynchronous remote loading of templates and partials. Pass a c…
…allback to ich.grabTemplates() or ich.refresh() to use this on page load.
@ccoenen

This comment has been minimized.

Copy link

commented Aug 5, 2011

I merged this functionality (sans class="partial", so far) into my pull-request https://github.com/andyet/ICanHaz.js/pull/24
Would you mind checking if this still functions as you intended?

@HenrikJoreteg

This comment has been minimized.

Copy link
Owner

commented Dec 8, 2011

I really appreciate you taking the time to do and submit this. However, I'm not quite convinced I want to merge this in for the following reasons:

  1. I'm not completely convinced remote template loading is within the scope of this project. Since it's easy enough to do on your own.
  2. If we did chose to include it, I'd like the syntax for remote template loading to be a bit cleaner. Perhaps something like ich.grabTemplates(URL). Where you return all your templates in a JSON object, or something.
  3. I need to think about this a bit more, so I'll close it in the meantime.

Again, thank you. Sorry to disappoint.

@sebdeckers

This comment has been minimized.

Copy link
Author

commented Dec 8, 2011

Thank you for the very polite pull refusal. :)

  1. Fair enough, KISS and all that.
  2. It would still need to be asynchronous though. I think a callback argument and/or returning a promise would be the cleanest solution. Do you have other ideas?
  3. Cool :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.