Disables buttons if an editNeed is called with a nonEditable uri, and displays error message as a footer
Disables buttons if an createFromTemplateNeed is called with a notUsableAsTemplate uri, and displays error message as a footer
@@ -102,8 +102,8 @@ function genComponentConf() {
</div>
<div class="cp__footer" >
<won-labelled-hr label="::'done?'" class="cp__footer__labelledhr"></won-labelled-hr>
- <won-publish-button on-publish="self.publish(persona)" is-valid="self.isValid()" show-personas="self.isHoldable" ng-if="self.showCreateInput && !self.isEditFromNeed"></won-publish-button>
- <div class="cp__footer__edit" ng-if="self.loggedIn && self.showCreateInput && self.isEditFromNeed">
+ <won-publish-button on-publish="self.publish(persona)" is-valid="self.isValid()" show-personas="self.isHoldable" ng-if="self.showCreateInput && !self.isEditFromNeed && self.isFromNeedUsableAsTemplate"></won-publish-button>
+ <div class="cp__footer__edit" ng-if="self.loggedIn && self.showCreateInput && self.isEditFromNeed && self.isFromNeedEditable">
<button class="cp__footer__edit__save won-button--filled red" ng-click="self.save()">
Save
</button>
@@ -111,6 +111,12 @@ function genComponentConf() {
Cancel
</button>
</div>
+ <div class="cp__footer__error" ng-if="self.showCreateInput && self.isEditFromNeed && !self.isFromNeedEditable">
+ Can't edit this need (need not owned or doesn't have a matching usecase)
+ </div>
+ <div class="cp__footer__error" ng-if="self.showCreateInput && self.isCreateFromNeed && !self.isFromNeedUsableAsTemplate">
+ Can't use this need as a template (need is owned or doesn't have a matching usecase)
+ </div>
</div>
`;
@@ -221,6 +227,8 @@ function genComponentConf() {
isEditFromNeed,
isFromNeedLoading,
isFromNeedToLoad,
+ isFromNeedEditable: needUtils.isEditable(fromNeed),
+ isFromNeedUsableAsTemplate: needUtils.isUsableAsTemplate(fromNeed),
isHoldable: useCaseUtils.isHoldable(useCase),
hasFromNeedFailedToLoad,
showCreateInput:
