-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from crossroads/master
September2019Release1
- Loading branch information
Showing
10 changed files
with
131 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
import AuthorizeRoute from './../authorize'; | ||
import AuthorizeRoute from "./../authorize"; | ||
|
||
export default AuthorizeRoute.extend({ | ||
|
||
model() { | ||
return this.store.peekAll('offer'); | ||
let cachedRecords = this.store.peekAll("offer"); | ||
if (cachedRecords.get("length")) { | ||
return cachedRecords; | ||
} | ||
return this.store.findAll("offer"); | ||
}, | ||
|
||
redirect(my_offers) { | ||
var route = this; | ||
switch(my_offers.get('length')) { | ||
case 0 : route.transitionTo('offers.new'); break; | ||
case 1 : | ||
if(my_offers.get('firstObject.state') === 'draft') { | ||
var firstOffer = my_offers.get('firstObject'); | ||
if(firstOffer.get('itemCount') === 0) { | ||
route.transitionTo('offer', firstOffer); | ||
switch (my_offers.get("length")) { | ||
case 0: | ||
route.transitionTo("offers.new"); | ||
break; | ||
case 1: | ||
if (my_offers.get("firstObject.state") === "draft") { | ||
var firstOffer = my_offers.get("firstObject"); | ||
if (firstOffer.get("itemCount") === 0) { | ||
route.transitionTo("offer", firstOffer); | ||
} else { | ||
route.transitionTo('offer.offer_details', firstOffer); | ||
route.transitionTo("offer.offer_details", firstOffer); | ||
} | ||
} | ||
} | ||
}, | ||
|
||
renderTemplate() { | ||
this.render(); // default template | ||
this.render('appMenuList', { | ||
into: 'offers/index', | ||
outlet: 'appMenuList', | ||
controller: 'application' | ||
this.render("appMenuList", { | ||
into: "offers/index", | ||
outlet: "appMenuList", | ||
controller: "application" | ||
}); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.