Commits

Rich Manalang [Atlassian]  committed b44b6ce

Some fixes for Martin

  • Participants
  • Parent commits 476f952

Comments (0)

Files changed (4)

     </build>
     <properties>
         <jira.version>5.0</jira.version>
-        <amps.version>3.10.1</amps.version>
+        <amps.version>4.1-SNAPSHOT</amps.version>
     </properties>
 </project>

File src/main/resources/atlassian-plugin.xml

     <component-import key="i18nResolver" interface="com.atlassian.sal.api.message.I18nResolver"/>
     <component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
     <component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider"/>
+    <component-import key="webResourceManager" interface="com.atlassian.plugin.webresource.WebResourceManager" />
+
+    <template-context-item key="webResourceManagerContextItem" component-ref="webResourceManager" context-key="webResourceManager" name="Web Resource Manager Context Item"/>
     <template-context-item key="i18nContextItem" component-ref="i18nResolver" context-key="i18n"
                            name="I18n Context Item"/>
 

File src/main/resources/js/main.min.js

  * see: http://github.com/jrburke/almond for details
  */
 
-(function(){var a,b,c;(function(d){function l(a,b){var c=b&&b.split("/"),d=g.map,e=d&&d["*"]||{},f,h,i,j,k,l,m;if(a&&a.charAt(0)==="."&&b){c=c.slice(0,c.length-1),a=c.concat(a.split("/"));for(k=0;m=a[k];k++)if(m===".")a.splice(k,1),k-=1;else if(m===".."){if(k===1&&(a[2]===".."||a[0]===".."))return!0;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((c||e)&&d){f=a.split("/");for(k=f.length;k>0;k-=1){h=f.slice(0,k).join("/");if(c)for(l=c.length;l>0;l-=1){i=d[c.slice(0,l).join("/")];if(i){i=i[h];if(i){j=i;break}}}j=j||e[h];if(j){f.splice(0,k,j),a=f.join("/");break}}}return a}function m(a,b){return function(){return k.apply(d,i.call(arguments,0).concat([a,b]))}}function n(a){return function(b){return l(b,a)}}function o(a){return function(b){e[a]=b}}function p(a){if(f.hasOwnProperty(a)){var b=f[a];delete f[a],h[a]=!0,j.apply(d,b)}if(!e.hasOwnProperty(a))throw new Error("No "+a);return e[a]}function q(a,b){var c,d,e=a.indexOf("!");return e!==-1?(c=l(a.slice(0,e),b),a=a.slice(e+1),d=p(c),d&&d.normalize?a=d.normalize(a,n(b)):a=l(a,b)):a=l(a,b),{f:c?c+"!"+a:a,n:a,p:d}}function r(a){return function(){return g&&g.config&&g.config[a]||{}}}var e={},f={},g={},h={},i=[].slice,j,k;j=function(a,b,c,g){var i=[],j,k,l,n,s,t;g=g||a;if(typeof c=="function"){b=!b.length&&c.length?["require","exports","module"]:b;for(t=0;t<b.length;t++){s=q(b[t],g),l=s.f;if(l==="require")i[t]=m(a);else if(l==="exports")i[t]=e[a]={},j=!0;else if(l==="module")k=i[t]={id:a,uri:"",exports:e[a],config:r(a)};else if(e.hasOwnProperty(l)||f.hasOwnProperty(l))i[t]=p(l);else if(s.p)s.p.load(s.n,m(g,!0),o(l),{}),i[t]=e[l];else if(!h[l])throw new Error(a+" missing "+l)}n=c.apply(e[a],i);if(a)if(k&&k.exports!==d&&k.exports!==e[a])e[a]=k.exports;else if(n!==d||!j)e[a]=n}else a&&(e[a]=c)},a=b=k=function(a,b,c,e){return typeof a=="string"?p(q(a,b).f):(a.splice||(g=a,b.splice?(a=b,b=c,c=null):a=d),b=b||function(){},e?j(d,a,b,c):setTimeout(function(){j(d,a,b,c)},15),k)},k.config=function(a){return g=a,k},c=function(a,b,c){b.splice||(c=b,b=[]),f[a]=[a,b,c]},c.amd={jQuery:!0}})(),c("vendor/almond",function(){}),c("config",{restPath:"/jira/rest",projectKey:"TRAVEL",issueTypeName:"Travel Request",bookTransitionName:"Book",customFields:{origin:{name:"Origin"},destination:{name:"Destination"},departDate:{name:"Depart Date"},returnDate:{name:"Return Date"},purchaseAmt:{name:"Purchase Amount"},currency:{name:"Currency"}}}),c("helpers",[],function(){return window.statusButton=function(a){switch(a){case"Open":return"btn-info";case"Approved":return"btn-success";case"Denied":return"btn-danger";case"Booked":return"btn-inverse"}},window.parseExchangeRate=function(a){var b,c;return b=a.query.results.row.name,c=parseFloat(a.query.results.row.rate,10),$("#costin").html(parseFloat($("#cost").val()*c).round(2).format(2)+" AUD")},window.handlePlaceJSONP=function(a){return window.typeahead.process(_.map(a,function(a){return a.replace(/NS/,"NSW")}))}});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/user_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/user?username="+this.id},b.prototype.initialize=function(a){var b=this;return this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b}(Backbone.Model)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/current_user_model",["require","../config","./user_model"],function(a){var b,c,d;return d=a("../config"),c=a("./user_model"),b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+d.restPath+"/auth/1/session",b.prototype.initialize=function(){return this.fetch()},b.prototype.fetch=function(){var a=this;return b.__super__.fetch.apply(this,arguments).done(function(){return new c({id:a.get("name"),callback:function(b){return a.set("profile",b),a.setLoggedIn()}})})},b.prototype.setLoggedIn=function(){return $(".curruser").html(this.get("profile").displayName),$(".avatar").attr("src",this.get("profile").avatarUrls["48x48"])},b}(Backbone.Model)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/project_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/project/"+c.projectKey,b.prototype.initialize=function(){return this.fetch().done(function(a){return this.id=a.id})},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/saved_trip_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/issue/"+this.key},b.prototype.initialize=function(a){var b=this;this.key=a&&a.key?a.key:"";if(this.key)return this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b.prototype.parse=function(a){return a.fields?_.extend(a.fields,{id:a.id,key:a.key}):a},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/trip_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/issue"},b.prototype.initialize=function(a){var b=this;return this.errors=[],this.bind("error",function(a,c){return console.log("TripModel Error",arguments),b.errors=c,c})},b.prototype.parse=function(a){return a.fields?_.extend(a.fields,{id:a.id,key:a.key}):a},b.prototype.validate={summary:{required:!0},description:{required:!0},origin:{required:!0},destination:{required:!0},departDate:{required:!0},returnDate:{required:!0},purchaseAmt:{required:!0},currency:{required:!0},assignee:{required:!0}},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/custom_fields_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.setFields=d(this.setFields,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/field",b.prototype.initialize=function(){return this.fetch().done(this.setFields)},b.prototype.setFields=function(){var a=this;return _.each(c.customFields,function(b){var c;return c=a.find(function(a){return a.attributes.name===b.name}),_.extend(b,c.attributes)})},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/issue_types_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.findTravelReqIssueType=d(this.findTravelReqIssueType,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/issuetype",b.prototype.initialize=function(){return this.fetch().done(this.findTravelReqIssueType)},b.prototype.findTravelReqIssueType=function(){var a;return a=this.find(function(a){return a.attributes.name===c.issueTypeName}),this.id=a.attributes.id},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/trips_collection",["require","../config","../models/trip_model"],function(a){var b,c,e;return e=a("../config"),b=a("../models/trip_model"),c=function(a){function c(){return this.comparator=d(this.comparator,this),c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.url=""+e.restPath+"/api/2/search",c.prototype.model=b,c.prototype.comparator=function(a,b){return a.get(e.customFields.departDate.id)<b.get(e.customFields.returnDate.id)},c.prototype.parse=function(a){var b=this;return _.map(a.issues,function(a){return _.extend(a.fields,{id:a.id,key:a.key})})},c}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/users_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(a){return""+c.restPath+"/api/2/user/search?username="+this.q},b.prototype.initialize=function(a){var b=this;return this.q=a.q,this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/add_trip_view",["require","../config","../models/trip_model","../models/saved_trip_model","../collections/users_collection"],function(a){var b,c,e,g,h;return h=a("../config"),e=a("../models/trip_model"),c=a("../models/saved_trip_model"),g=a("../collections/users_collection"),b=function(a){function b(){return this.showInvalid=d(this.showInvalid,this),this.render=d(this.render,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.el=$("#addtrip"),b.prototype.template=_.template($("#addtrip-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.events={"change #cost":"updateConvertedRate","change #curr":"updateConvertedRate","submit #add-trip-form":"saveTrip"},b.prototype.render=function(){var a=this;return this.$el.html(this.template()),$("#depart-date").data("date",Date.create().format("{M}/{dd}/{yyyy}")),$("#return-date").data("date",Date.create().addDays(7).format("{M}/{dd}/{yyyy}")),$("div.date").datepicker(),$(".place.from").typeahead({property:"origin",source:function(b,c){console.log(1,a);if(c.length<3)return;return window.typeahead=b,a.getPlace(c)}}),$(".place.to").typeahead({property:"destination",source:function(b,c){if(c.length<3)return;return window.typeahead=b,a.getPlace(c)}}),$("#assignee").typeahead({source:function(a,b){if(b.length<3)return;return new g({q:b,callback:function(b){return a.process(_.pluck(b,"name"))}})}}),$("#cost, #curr").on("change keyup",function(){}),this},b.prototype.getRate=function(a,b){var c;return $("#currscript").remove(),c=document.createElement("script"),c.setAttribute("src","http://query.yahooapis.com/v1/public/yql?q=select%20rate%2Cname%20from%20csv%20where%20url%3D'http%3A%2F%2Fdownload.finance.yahoo.com%2Fd%2Fquotes%3Fs%3D"+a+b+"%253DX%26f%3Dl1n'%20and%20columns%3D'rate%2Cname'&format=json&callback=parseExchangeRate"),c.setAttribute("id","currscript"),document.body.appendChild(c)},b.prototype.updateConvertedRate=function(){return this.getRate($("#curr").val(),"AUD")},b.prototype.getPlace=function(a){var b;return $("#placescript").remove(),b=document.createElement("script"),b.setAttribute("src","http://gd.geobytes.com/AutoCompleteCity?q="+a+"&callback=handlePlaceJSONP"),b.setAttribute("id","placescript"),document.body.appendChild(b)},b.prototype.focus=function(){var a,b=this;return a=function(){return b.$el.find("input[type='text']:first").focus()},setTimeout(a,0)},b.prototype.showInvalid=function(a,b){var c;for(c in b)this.$el.find("."+c).addClass("error");return!1},b.prototype.showSavedToast=function(){return this.flash=new FlashView({flash:{title:"Success",message:"Your travel approval request has been saved and sent for approval"}})},b.prototype.saveTrip=function(){var a,b,d,f=this;return this.$(".error").removeClass("error"),b=$("form").serializeObject(),b[h.customFields.departDate.id]=Date.create($("#depart-date input").data("date")).format(Date.ISO8601_DATETIME),b[h.customFields.returnDate.id]=Date.create($("#return-date input").data("date")).format(Date.ISO8601_DATETIME),d={fields:{issuetype:{id:issuetype.id},project:{id:project.id}}},_.extend(d.fields,b.summary?{summary:b.summary}:void 0),_.extend(d.fields,b.description?{description:b.description}:void 0),b.origin&&(d.fields[h.customFields.origin.id]=b.origin),b.destination&&(d.fields[h.customFields.destination.id]=b.destination),b[h.customFields.departDate.id]&&(d.fields[h.customFields.departDate.id]=b[h.customFields.departDate.id]),b[h.customFields.returnDate.id]&&(d.fields[h.customFields.returnDate.id]=b[h.customFields.returnDate.id]),b.purchaseAmt&&(d.fields[h.customFields.purchaseAmt.id]=parseInt(b.purchaseAmt)),b.currency&&(d.fields[h.customFields.currency.id]={},d.fields[h.customFields.currency.id].value=b.currency),_.extend(d.fields,b.assignee?{assignee:{name:"alex"}}:void 0),this.model=new e,this.model.on("error",this.showInvalid),this.model.set(b),this.model.errors.length===0&&(a=this.model.save(d,{success:function(a,b){var d;return f.render(),f.showSavedToast(),console.log("success",f,arguments),d=new c({key:b.key,callback:function(a){return console.log("callback",d),f.collection.add(d)}})},error:function(a,b){}})),!1},b}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/flash_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.tagName="div",b.prototype.className="alert",b.prototype.template=_.template($("#flash-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.render=function(){return this.options.flash["class"]&&this.$el.addClass(this.options.flash["class"]),this.$el.html(this.template(this.options.flash)).prependTo(".flash")},b}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/my_trip_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.template=_.template($("#mytrip-template").html()),b.prototype.tagName="tr",b.prototype.initialize=function(a){return this.model.bind("change",this.render),this.model.bind("destroy",this.remove)},b.prototype.render=function(){if(this.model)return this.$el.html(this.template(this.model))},b.prototype.remove=function(){return this.$el.remove()},b}(Backbone.View)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/my_trips_view",["require","./my_trip_view"],function(a){var b,c;return b=a("./my_trip_view"),c=function(a){function c(){return this.addOne=d(this.addOne,this),c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.el=$("#mytrips"),c.prototype.template=_.template($("#mytrips-template").html()),c.prototype.initialize=function(a){return this.collection.on("add",this.addOne),this.collection.on("change",this.render,this),this.render()},c.prototype.render=function(){return this.$el.html(this.template()),this.addAll()},c.prototype.addOne=function(a){var c;return c=new b({model:a}),c.render(),this.$el.find("#mytrips-rows").prepend(c.el),a.bind("remove",c.remove)},c.prototype.addAll=function(){return this.collection.each(this.addOne)},c}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/pending_trips_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.el=$("#pendingtrips-rows"),b.prototype.template=_.template($("#pendingtrips-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.events={"click .complete-booking":"completeBooking"},b.prototype.completeBooking=function(a){var b,c,d=this;return b=$(a.currentTarget),c=b.data(),$.get(""+config.restPath+"/api/2/issue/"+c.key+"/transitions",function(a){var e;return e=_.find(a.transitions,function(a){return a.name===config.bookTransitionName}),$.ajax({url:""+config.restPath+"/api/2/issue/"+c.key+"/transitions",type:"post",dataType:"json",contentType:"application/json",processData:!1,data:JSON.stringify({transition:{id:e.id}}),success:function(){return b.removeClass("btn-success").addClass("btn-inverse").addClass("disabled").html("Booked"),d.collection.get(c.id).set("status",{name:"Booked"},{silent:!0}),d.collection.trigger("change")}})}),!1},b.prototype.render=function(){var a=this;return this.collection.filter(function(a){return a.attributes.status.name==="Approved"}).sort(function(a,b){return a.get(config.customFields.departDate.id)>b.get(config.customFields.returnDate.id)}).each(function(b){return a.$el.append(a.template(b))})},b}(Backbone.View)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("router",[],function(){var a;return a=function(a){function b(){return this.addTrip=d(this.addTrip,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.routes={"":"addTrip",trips:"myTrips","trip/book":"bookTrip","trip/new":"addTrip","*path":"notFound"},b.prototype.initialize=function(a){return this.addTripView=a.addTripView},b.prototype.before=function(){return $(".flash .alert").remove()},b.prototype.activate=function(a){return $(".content").addClass("hidden"),$("#"+a).removeClass("hidden"),$(".topnav").removeClass("active"),$("."+a).addClass("active"),this},b.prototype.addTrip=function(){return this.activate("addtrip"),this.addTripView.focus()},b.prototype.myTrips=function(){return this.activate("mytrips")},b.prototype.bookTrip=function(){return this.activate("booktrip")},b.prototype.notFound=function(){return this.activate("404")},b}(Backbone.Router)}),c("app",["require","config","helpers","models/user_model","models/current_user_model","models/project_model","models/saved_trip_model","models/trip_model","collections/custom_fields_collection","collections/issue_types_collection","collections/trips_collection","collections/users_collection","views/add_trip_view","views/flash_view","views/my_trip_view","views/my_trips_view","views/pending_trips_view","router"],function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;return s=a("config"),v=a("helpers"),o=a("models/user_model"),c=a("models/current_user_model"),j=a("models/project_model"),l=a("models/saved_trip_model"),m=a("models/trip_model"),d=a("collections/custom_fields_collection"),f=a("collections/issue_types_collection"),n=a("collections/trips_collection"),p=a("collections/users_collection"),b=a("views/add_trip_view"),e=a("views/flash_view"),g=a("views/my_trip_view"),h=a("views/my_trips_view"),i=a("views/pending_trips_view"),k=a("router"),window.config=s,t=new c,y=new n,x=new j,w=new f,u=new d,q=new b({collection:y}),y.fetch().done(function(){var a,b;return a=new h({collection:y}),b=new i({collection:y})}),r=new k({addTripView:q}),Backbone.history.start()}),b(["app"]),c("main",function(){})})()
+(function(){var a,b,c;(function(d){function l(a,b){var c=b&&b.split("/"),d=g.map,e=d&&d["*"]||{},f,h,i,j,k,l,m;if(a&&a.charAt(0)==="."&&b){c=c.slice(0,c.length-1),a=c.concat(a.split("/"));for(k=0;m=a[k];k++)if(m===".")a.splice(k,1),k-=1;else if(m===".."){if(k===1&&(a[2]===".."||a[0]===".."))return!0;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((c||e)&&d){f=a.split("/");for(k=f.length;k>0;k-=1){h=f.slice(0,k).join("/");if(c)for(l=c.length;l>0;l-=1){i=d[c.slice(0,l).join("/")];if(i){i=i[h];if(i){j=i;break}}}j=j||e[h];if(j){f.splice(0,k,j),a=f.join("/");break}}}return a}function m(a,b){return function(){return k.apply(d,i.call(arguments,0).concat([a,b]))}}function n(a){return function(b){return l(b,a)}}function o(a){return function(b){e[a]=b}}function p(a){if(f.hasOwnProperty(a)){var b=f[a];delete f[a],h[a]=!0,j.apply(d,b)}if(!e.hasOwnProperty(a))throw new Error("No "+a);return e[a]}function q(a,b){var c,d,e=a.indexOf("!");return e!==-1?(c=l(a.slice(0,e),b),a=a.slice(e+1),d=p(c),d&&d.normalize?a=d.normalize(a,n(b)):a=l(a,b)):a=l(a,b),{f:c?c+"!"+a:a,n:a,p:d}}function r(a){return function(){return g&&g.config&&g.config[a]||{}}}var e={},f={},g={},h={},i=[].slice,j,k;j=function(a,b,c,g){var i=[],j,k,l,n,s,t;g=g||a;if(typeof c=="function"){b=!b.length&&c.length?["require","exports","module"]:b;for(t=0;t<b.length;t++){s=q(b[t],g),l=s.f;if(l==="require")i[t]=m(a);else if(l==="exports")i[t]=e[a]={},j=!0;else if(l==="module")k=i[t]={id:a,uri:"",exports:e[a],config:r(a)};else if(e.hasOwnProperty(l)||f.hasOwnProperty(l))i[t]=p(l);else if(s.p)s.p.load(s.n,m(g,!0),o(l),{}),i[t]=e[l];else if(!h[l])throw new Error(a+" missing "+l)}n=c.apply(e[a],i);if(a)if(k&&k.exports!==d&&k.exports!==e[a])e[a]=k.exports;else if(n!==d||!j)e[a]=n}else a&&(e[a]=c)},a=b=k=function(a,b,c,e){return typeof a=="string"?p(q(a,b).f):(a.splice||(g=a,b.splice?(a=b,b=c,c=null):a=d),b=b||function(){},e?j(d,a,b,c):setTimeout(function(){j(d,a,b,c)},15),k)},k.config=function(a){return g=a,k},c=function(a,b,c){b.splice||(c=b,b=[]),f[a]=[a,b,c]},c.amd={jQuery:!0}})(),c("vendor/almond",function(){}),c("config",{restPath:"/rest",projectKey:"TRAVEL",issueTypeName:"Travel Request",bookTransitionName:"Book",customFields:{origin:{name:"Origin"},destination:{name:"Destination"},departDate:{name:"Depart Date"},returnDate:{name:"Return Date"},purchaseAmt:{name:"Purchase Amount"},currency:{name:"Currency"}}}),c("helpers",[],function(){return window.statusButton=function(a){switch(a){case"Open":return"btn-info";case"Approved":return"btn-success";case"Denied":return"btn-danger";case"Booked":return"btn-inverse"}},window.parseExchangeRate=function(a){var b,c;return b=a.query.results.row.name,c=parseFloat(a.query.results.row.rate,10),$("#costin").html(parseFloat($("#cost").val()*c).round(2).format(2)+" AUD")},window.handlePlaceJSONP=function(a){return window.typeahead.process(_.map(a,function(a){return a.replace(/NS/,"NSW")}))}});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/user_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/user?username="+this.id},b.prototype.initialize=function(a){var b=this;return this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b}(Backbone.Model)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/current_user_model",["require","../config","./user_model"],function(a){var b,c,d;return d=a("../config"),c=a("./user_model"),b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+d.restPath+"/auth/1/session",b.prototype.initialize=function(){return this.fetch()},b.prototype.fetch=function(){var a=this;return b.__super__.fetch.apply(this,arguments).done(function(){return new c({id:a.get("name"),callback:function(b){return a.set("profile",b),a.setLoggedIn()}})})},b.prototype.setLoggedIn=function(){return $(".curruser").html(this.get("profile").displayName),$(".avatar").attr("src",this.get("profile").avatarUrls["48x48"])},b}(Backbone.Model)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/project_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/project/"+c.projectKey,b.prototype.initialize=function(){return this.fetch().done(function(a){return this.id=a.id})},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/saved_trip_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/issue/"+this.key},b.prototype.initialize=function(a){var b=this;this.key=a&&a.key?a.key:"";if(this.key)return this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b.prototype.parse=function(a){return a.fields?_.extend(a.fields,{id:a.id,key:a.key}):a},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("models/trip_model",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(){return""+c.restPath+"/api/2/issue"},b.prototype.initialize=function(a){var b=this;return this.errors=[],this.bind("error",function(a,c){return console.log("TripModel Error",arguments),b.errors=c,c})},b.prototype.parse=function(a){return a.fields?_.extend(a.fields,{id:a.id,key:a.key}):a},b.prototype.validate={summary:{required:!0},description:{required:!0},origin:{required:!0},destination:{required:!0},departDate:{required:!0},returnDate:{required:!0},purchaseAmt:{required:!0},currency:{required:!0},assignee:{required:!0}},b}(Backbone.Model)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/custom_fields_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.setFields=d(this.setFields,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/field",b.prototype.initialize=function(){return this.fetch().done(this.setFields)},b.prototype.setFields=function(){var a=this;return _.each(c.customFields,function(b){var c;return c=a.find(function(a){return a.attributes.name===b.name}),_.extend(b,c.attributes)})},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/issue_types_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.findTravelReqIssueType=d(this.findTravelReqIssueType,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=""+c.restPath+"/api/2/issuetype",b.prototype.initialize=function(){return this.fetch().done(this.findTravelReqIssueType)},b.prototype.findTravelReqIssueType=function(){var a;return a=this.find(function(a){return a.attributes.name===c.issueTypeName}),this.id=a.attributes.id},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/trips_collection",["require","../config","../models/trip_model"],function(a){var b,c,e;return e=a("../config"),b=a("../models/trip_model"),c=function(a){function c(){return this.comparator=d(this.comparator,this),c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.url=""+e.restPath+"/api/2/search",c.prototype.model=b,c.prototype.comparator=function(a,b){return a.get(e.customFields.departDate.id)<b.get(e.customFields.returnDate.id)},c.prototype.parse=function(a){var b=this;return _.map(a.issues,function(a){return _.extend(a.fields,{id:a.id,key:a.key})})},c}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("collections/users_collection",["require","../config"],function(a){var b,c;return c=a("../config"),b=function(a){function b(){return this.url=d(this.url,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.url=function(a){return""+c.restPath+"/api/2/user/search?username="+this.q},b.prototype.initialize=function(a){var b=this;return this.q=a.q,this.fetch(a).done(function(b){if(a.callback)return a.callback(b)})},b}(Backbone.Collection)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/add_trip_view",["require","../config","../models/trip_model","../models/saved_trip_model","../collections/users_collection"],function(a){var b,c,e,g,h;return h=a("../config"),e=a("../models/trip_model"),c=a("../models/saved_trip_model"),g=a("../collections/users_collection"),b=function(a){function b(){return this.showInvalid=d(this.showInvalid,this),this.render=d(this.render,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.el=$("#addtrip"),b.prototype.template=_.template($("#addtrip-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.events={"change #cost":"updateConvertedRate","change #curr":"updateConvertedRate","submit #add-trip-form":"saveTrip"},b.prototype.render=function(){var a=this;return this.$el.html(this.template()),$("#depart-date").data("date",Date.create().format("{M}/{dd}/{yyyy}")),$("#return-date").data("date",Date.create().addDays(7).format("{M}/{dd}/{yyyy}")),$("div.date").datepicker(),$(".place.from").typeahead({property:"origin",source:function(b,c){console.log(1,a);if(c.length<3)return;return window.typeahead=b,a.getPlace(c)}}),$(".place.to").typeahead({property:"destination",source:function(b,c){if(c.length<3)return;return window.typeahead=b,a.getPlace(c)}}),$("#assignee").typeahead({source:function(a,b){if(b.length<3)return;return new g({q:b,callback:function(b){return a.process(_.pluck(b,"name"))}})}}),$("#cost, #curr").on("change keyup",function(){}),this},b.prototype.getRate=function(a,b){var c;return $("#currscript").remove(),c=document.createElement("script"),c.setAttribute("src","http://query.yahooapis.com/v1/public/yql?q=select%20rate%2Cname%20from%20csv%20where%20url%3D'http%3A%2F%2Fdownload.finance.yahoo.com%2Fd%2Fquotes%3Fs%3D"+a+b+"%253DX%26f%3Dl1n'%20and%20columns%3D'rate%2Cname'&format=json&callback=parseExchangeRate"),c.setAttribute("id","currscript"),document.body.appendChild(c)},b.prototype.updateConvertedRate=function(){return this.getRate($("#curr").val(),"AUD")},b.prototype.getPlace=function(a){var b;return $("#placescript").remove(),b=document.createElement("script"),b.setAttribute("src","http://gd.geobytes.com/AutoCompleteCity?q="+a+"&callback=handlePlaceJSONP"),b.setAttribute("id","placescript"),document.body.appendChild(b)},b.prototype.focus=function(){var a,b=this;return a=function(){return b.$el.find("input[type='text']:first").focus()},setTimeout(a,0)},b.prototype.showInvalid=function(a,b){var c;for(c in b)this.$el.find("."+c).addClass("error");return!1},b.prototype.showSavedToast=function(){return this.flash=new FlashView({flash:{title:"Success",message:"Your travel approval request has been saved and sent for approval"}})},b.prototype.saveTrip=function(){var a,b,d,f=this;return this.$(".error").removeClass("error"),b=$("form").serializeObject(),b[h.customFields.departDate.id]=Date.create($("#depart-date input").data("date")).format(Date.ISO8601_DATETIME),b[h.customFields.returnDate.id]=Date.create($("#return-date input").data("date")).format(Date.ISO8601_DATETIME),d={fields:{issuetype:{id:issuetype.id},project:{id:project.id}}},_.extend(d.fields,b.summary?{summary:b.summary}:void 0),_.extend(d.fields,b.description?{description:b.description}:void 0),b.origin&&(d.fields[h.customFields.origin.id]=b.origin),b.destination&&(d.fields[h.customFields.destination.id]=b.destination),b[h.customFields.departDate.id]&&(d.fields[h.customFields.departDate.id]=b[h.customFields.departDate.id]),b[h.customFields.returnDate.id]&&(d.fields[h.customFields.returnDate.id]=b[h.customFields.returnDate.id]),b.purchaseAmt&&(d.fields[h.customFields.purchaseAmt.id]=parseInt(b.purchaseAmt)),b.currency&&(d.fields[h.customFields.currency.id]={},d.fields[h.customFields.currency.id].value=b.currency),_.extend(d.fields,b.assignee?{assignee:{name:"alex"}}:void 0),this.model=new e,this.model.on("error",this.showInvalid),this.model.set(b),this.model.errors.length===0&&(a=this.model.save(d,{success:function(a,b){var d;return f.render(),f.showSavedToast(),console.log("success",f,arguments),d=new c({key:b.key,callback:function(a){return console.log("callback",d),f.collection.add(d)}})},error:function(a,b){}})),!1},b}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/flash_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.tagName="div",b.prototype.className="alert",b.prototype.template=_.template($("#flash-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.render=function(){return this.options.flash["class"]&&this.$el.addClass(this.options.flash["class"]),this.$el.html(this.template(this.options.flash)).prependTo(".flash")},b}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/my_trip_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.template=_.template($("#mytrip-template").html()),b.prototype.tagName="tr",b.prototype.initialize=function(a){return this.model.bind("change",this.render),this.model.bind("destroy",this.remove)},b.prototype.render=function(){if(this.model)return this.$el.html(this.template(this.model))},b.prototype.remove=function(){return this.$el.remove()},b}(Backbone.View)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/my_trips_view",["require","./my_trip_view"],function(a){var b,c;return b=a("./my_trip_view"),c=function(a){function c(){return this.addOne=d(this.addOne,this),c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.el=$("#mytrips"),c.prototype.template=_.template($("#mytrips-template").html()),c.prototype.initialize=function(a){return this.collection.on("add",this.addOne),this.collection.on("change",this.render,this),this.render()},c.prototype.render=function(){return this.$el.html(this.template()),this.addAll()},c.prototype.addOne=function(a){var c;return c=new b({model:a}),c.render(),this.$el.find("#mytrips-rows").prepend(c.el),a.bind("remove",c.remove)},c.prototype.addAll=function(){return this.collection.each(this.addOne)},c}(Backbone.View)});var e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("views/pending_trips_view",[],function(){var a;return a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.el=$("#pendingtrips-rows"),b.prototype.template=_.template($("#pendingtrips-template").html()),b.prototype.initialize=function(a){return this.render()},b.prototype.events={"click .complete-booking":"completeBooking"},b.prototype.completeBooking=function(a){var b,c,d=this;return b=$(a.currentTarget),c=b.data(),$.get(""+config.restPath+"/api/2/issue/"+c.key+"/transitions",function(a){var e;return e=_.find(a.transitions,function(a){return a.name===config.bookTransitionName}),$.ajax({url:""+config.restPath+"/api/2/issue/"+c.key+"/transitions",type:"post",dataType:"json",contentType:"application/json",processData:!1,data:JSON.stringify({transition:{id:e.id}}),success:function(){return b.removeClass("btn-success").addClass("btn-inverse").addClass("disabled").html("Booked"),d.collection.get(c.id).set("status",{name:"Booked"},{silent:!0}),d.collection.trigger("change")}})}),!1},b.prototype.render=function(){var a=this;return this.collection.filter(function(a){return a.attributes.status.name==="Approved"}).sort(function(a,b){return a.get(config.customFields.departDate.id)>b.get(config.customFields.returnDate.id)}).each(function(b){return a.$el.append(a.template(b))})},b}(Backbone.View)});var d=function(a,b){return function(){return a.apply(b,arguments)}},e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c("router",[],function(){var a;return a=function(a){function b(){return this.addTrip=d(this.addTrip,this),b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.routes={"":"addTrip",trips:"myTrips","trip/book":"bookTrip","trip/new":"addTrip","*path":"notFound"},b.prototype.initialize=function(a){return this.addTripView=a.addTripView},b.prototype.before=function(){return $(".flash .alert").remove()},b.prototype.activate=function(a){return $(".content").addClass("hidden"),$("#"+a).removeClass("hidden"),$(".topnav").removeClass("active"),$("."+a).addClass("active"),this},b.prototype.addTrip=function(){return this.activate("addtrip"),this.addTripView.focus()},b.prototype.myTrips=function(){return this.activate("mytrips")},b.prototype.bookTrip=function(){return this.activate("booktrip")},b.prototype.notFound=function(){return this.activate("404")},b}(Backbone.Router)}),c("app",["require","config","helpers","models/user_model","models/current_user_model","models/project_model","models/saved_trip_model","models/trip_model","collections/custom_fields_collection","collections/issue_types_collection","collections/trips_collection","collections/users_collection","views/add_trip_view","views/flash_view","views/my_trip_view","views/my_trips_view","views/pending_trips_view","router"],function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;return s=a("config"),v=a("helpers"),o=a("models/user_model"),c=a("models/current_user_model"),j=a("models/project_model"),l=a("models/saved_trip_model"),m=a("models/trip_model"),d=a("collections/custom_fields_collection"),f=a("collections/issue_types_collection"),n=a("collections/trips_collection"),p=a("collections/users_collection"),b=a("views/add_trip_view"),e=a("views/flash_view"),g=a("views/my_trip_view"),h=a("views/my_trips_view"),i=a("views/pending_trips_view"),k=a("router"),window.config=s,t=new c,y=new n,x=new j,w=new f,u=new d,q=new b({collection:y}),y.fetch().done(function(){var a,b;return a=new h({collection:y}),b=new i({collection:y})}),r=new k({addTripView:q}),Backbone.history.start()}),b(["app"]),c("main",function(){})})()

File src/main/resources/templates/travel/success.vm

 #set($assets = "$req.baseUrl/download/resources/com.atlassian.labs.travel.TravelApprovals:travel-assets")
+$webResourceManager.requireResourcesForContext("livereload")
 <!DOCTYPE html>
 <html lang="en">
 <head>
     </div>
 </div>
 <script src="$assets/js/vendor/libs.min.js"></script>
-
-<script data-main="$assets/js/main" src="$assets/js/vendor/require.js"></script>
+<!--script data-main="$assets/js/main" src="$assets/js/vendor/require.js"></script-->
 <!-- For production, uncomment the minified version and comment out the above require.js -->
-<!--script src="$assets/js/main.min.js"></script-->
+<script src="$assets/js/main.min.js"></script>
 </body>
 </html>