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

Unable to use @html, @touch widgets #15

Open
jakub-g opened this issue Sep 13, 2013 · 9 comments
Open

Unable to use @html, @touch widgets #15

jakub-g opened this issue Sep 13, 2013 · 9 comments
Assignees

Comments

@jakub-g
Copy link
Contributor

jakub-g commented Sep 13, 2013

Trying to use a widget from the library other than @aria, like

{@touch:Dialog {
} /}

results in an error message:

Template error: found widget library 'touch', which is undeclared in the wlibs parameter of the 'Template' statement.

but since in the template view, there's no {Template} statement, it's impossible to add wlibs by the user.

I'm wondering if it wouldn't be better to not do any magical insertion of {Template} in TPL, or wrapping the code in the tpl script in a function call, but just initialize the textareas with the full skeletons needed?

Regarding tpl scripts, with the default value of

({
    $classpath:'InstantTemplateScript',
    $prototype : {
      myMethod: function() {
      }
    }
})

there's a warning in the last line about missing semicolon. But when one inserts it, there's a parse error, probably because the code from the textarea is then appended to the function name and evaled, so there's sth like someFunc(({ // json here });)

@juliandescottes
Copy link
Owner

Yes that's a good point.

In the beginning I wanted to prevent the user to change the classpath of his classes (which would break the application).

But I leaked it already for the templateScript, so I can just go ahead and put it everywhere.

tldr; I agree, I'll change this.

@jakub-g
Copy link
Contributor Author

jakub-g commented Sep 13, 2013

BTW I've discovered that when editing the tpl script, there are real HTTP requests done to retrieve the URL matching the classpath. Just try adding some new method to the script, and writing some dummy code, with Fiddler open:

404s

Perhaps some hack is needed after initializing the app to prevent it.

Funny enough, it's always TestScript.js regardless of what I put in the classpath of the tpl script.

@juliandescottes
Copy link
Owner

The call is coming from the Template, not the template script, so it will always try to load TestScript.

But thanks for the info, I'll have a look.

@ghost ghost assigned juliandescottes Sep 13, 2013
@juliandescottes
Copy link
Owner

Small comment : html widgets can already be used because they were added to the Aria Templates environment of instantat. I just added the touch widget lib as well so it should be usable as well.

aria.core.AppEnvironment.setEnvironment({
defaultWidgetLibs : {
    "aria" : "aria.widgets.AriaLib", 
    "html" : "aria.html.HtmlLibrary", 
  "touch" : "aria.touch.widgets.TouchWidgetLib"
}
});

Still working on removing the magic though ...

@juliandescottes
Copy link
Owner

As mentioned above, touch widget library has been added by commit 60b32ce

@juliandescottes
Copy link
Owner

@jakub-g what about moving this issue to https://github.com/ariatemplates/instant.ariatemplates.com ? There's no link between this repository and the new one, and even though I like shuffling around this old piece of code, I think it would be better to push for improvements on the official app ?

@juliandescottes
Copy link
Owner

update : I have a "magic-free" version working, and which remains backward compatible with previously created snippets. I'll upload it on monday.

404 on TestScript : It occurs as soon as you change the classpath defined in the tplScript. The template is always configured with $hasScript : true and has the classpath Test. Normally just before the template is loaded, the tplScriptDefinition is preloaded in the cache and there is no call. However here, since the classpath of the tplScript has been changed, the template tries to load its dependency, and of course fails. I could maybe have a fake tplScript available at this location, that would alert "Hey, don't change the classpath of the tplScript, that's dangerous, duh" or something like this :)

@juliandescottes
Copy link
Owner

@jakub-g should be fixed by 45ef828

Old instants should be converted to the new format. I tested only a few of them and didn't see any issue. Let me know if you spot regressions.

@jakub-g
Copy link
Contributor Author

jakub-g commented Sep 17, 2013

@juliandescottes thanks! I'll let you know if I spot something.
I'll discuss with the team what to do in the future regarding the double-issues like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants