I am writing a new JIRA gadget. I want to have a user preference field called Version which can be loaded dynamically from the backend via a REST call.
Please help with the approach and code.
THanks
Hi,
You can refer existing Gadget's according to there standard they have created what you want
e.g
view: { template: function(args) { var gadget = this; var projectList = AJS.$("<ul/>"); AJS.$(args.projectData.projects).each(function() { projectList.append( AJS.$("<li/>").append( AJS.$("<a/>").attr({ target: "_parent", title: gadgets.util.escapeString(this.description), href: "__ATLASSIAN_BASE_URL__" + "/browse/" + this.key }).text(this.name) ) ); }); gadget.getView().html(projectList); }, args: [{ key: "projectData", ajaxOptions: function() { return { url: "/rest/tutorial-gadget/1.0/projects.json" }; } }] }
may be it will work for you .
please refer https://developer.atlassian.com/display/GADGETS/Gadget+Developer+Documentation it will helpful for you.
Thanks Tousif. But this will not be a user preference then. Also I am looking for more of a dropdown than a numbered list or unnumbered list.
Your thoughts ? Do you know of sample code which displays dropdown ?
Hi Techie Guy,
<Optional feature="atlassian.util"/> #oauth #supportedLocales("gadget.common,gadget.user.activity")<UserPref name="projectpicker" datatype="hidden"/>you can specify the customized user preferences. e.g VersionAJS.gadget.fields.projectsOrCategoriesPicker(gadget, "projectpicker"), -- it will get focused on load.this way you can add project picker. or any if you still want to add simple select field manually you can refer the
https://developer.atlassian.com/display/GADGETS/Gadget+Developer+Documentation
It looks like you're new here. Sign in or register to get started.