1)
I am trying to include BranchSelector in my project, which was created as repository-hook.
It means that Stash.template.branchSelector.field is already in.
But there are some mistakes caught during debug.
They repetead in example https://bitbucket.org/atlassian/stash-example-hook-protect-ref. (this tutorial doesnt work)
Uncaught Error: Module 'eve' is already defined. require-lite.js:20 define require-lite.js:20 (anonymous function) raphael.js:226 (anonymous function) raphael.js:227 ------------------------------------------------------------------- Uncaught TypeError: Cannot read property 'defaults' of undefined select2-override.js:8 (anonymous function) select2-override.js:8 ---------------------------------------------------------------- Uncaught TypeError: Cannot call method 'getProject' of undefined revision-reference-selector.js:181 RevisionReferenceSelector.getBranchesUrl revision-reference-selector.js:181 RevisionReferenceSelector.defaults.$.extend.tabs.url revision-reference-selector.js:78 getRawOrFunctionVal searchable-selector.js:811 SearchableSelector._getOption searchable-selector.js:588 SearchableSelector._getOptionVal searchable-selector.js:565 SearchableSelector.getResults searchable-selector.js:630 loadInternal paged-scrollable.js:220 PagedScrollable.init paged-scrollable.js:83 SearchableSelector._populateScrollable searchable-selector.js:476 SearchableSelector._initialiseDialogContent searchable-selector.js:356 SearchableSelector.init.dialog.AJS.InlineDialog.offsetY searchable-selector.js:176 AJS.InlineDialog.initPopup inline-dialog.js:252 AJS.InlineDialog.hasBoundOnExternalClick inline-dialog.js:318 jQuery.event.dispatch jquery.js:3058 jQuery.event.add.elemData.handle.eventHandle
2)
Also, I cant understand the way and params
/** * @param config * @param? errors */
are passed to simple.soy in example mentioned above. And what the meaning of them.
3)
Does calling a template is the one way to include BranchSelector in my form?
PS: Although Errors are caught, BranchSelector is rendered but there is no any refs in dropdown.
Community moderators have prevented the ability to post new answers.
1)
I _believe_ your first error is related to a bug in how we load resources for the hooks, when you're in devmode. https://ecosystem.atlassian.net/browse/PLUGWEB-44 . That should already be fixed in the latest version of Stash. You might also be able to explicitly turn batching back on with -Dplugin.webresource.batching.off=false, but I haven't verified that.
What's happening is that we are requesting new resources for your hook, but _all_ resources are being reloaded. So scripts that can't be run twice are failing.
2)
$config will hold the Settings object for your plugin, where each key in the object correspends to the name of your form input.
$errors is similar, and holds any errors for each field. You can see how these is used int he example plugin to populate the form with a previously entered value, and to display errors if there are any: https://bitbucket.org/atlassian/stash-example-hook-protect-ref/src/1e6a2fd4f5b365293a85458fbc19b5e108734bff/src/main/resources/static/simple.soy?at=master
3)
Yes, calling the template is currently the only supported way to include the BranchSelector.
Is there a different method you would prefer? Is there something about the template method that you dislike? Would be great to get any feedback you have about how you would like to use our APIs.
Thank a lot for answer! I'll check your suggestions on 1 and 2 soon.
And 3: I really dont understand why Atlassian chose to provide access to BranchSelector within a template. It is not common when there are many dynamically renedered BranchSelectors on page. It is simple dropdown menu, in most of cases the one on page. For me preferably to have JS-lib with description of one or two functions which retrieve branches from context. But I am newbie, so it is not evident for me profit of template solution.
My conclusion that I couldnt force BranchSelector work, and even dont understand why.
> There is no _working_ tutorials on it.
> And in consectary of Atlassian docs (https://developer.atlassian.com/display/AUI/Soy+Templates) may be I hit on bug of Experiment?
I am close to write own JS which get branches from repository context. It seems to be easier. May be your suggestions will be helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the feedback. We were especially mindful that the devs writing Git hooks in Java might be less familiar with Javascript and front-end coding in general, so we wanted to offer a template for simplicity. We're looking at expand our APIs, so your feedback is helpful.
The fact that the template didn't work is unfortunate, but if you hit the bug I mentioned, almost no code would work - BranchSelector or otherwise. Only when you move your code into production would it start working.
In response to that link - AUI's Soy templates are experimental simply because they are reserving the right to change those templates. However, it's unlikely that they will be changing them at this point. There are no bugs expected in those templates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.