Skip to content

Commit

Permalink
Merge pull request #1204 from BogdanAlexandru/mct1198
Browse files Browse the repository at this point in the history
[Edit] Switch other edit actions to mct-control
  • Loading branch information
VWoeltjen authored Oct 5, 2016
2 parents c9c8998 + a34e89d commit 8a00181
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion platform/commonUI/edit/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ define([
"key": "cancel",
"category": "conclude-editing",
"implementation": CancelAction,
"name": "Cancel",
// Because we use the name as label for edit buttons and mct-control buttons need
// the label to be set to undefined in order to not apply the labeled CSS rule.
"name": undefined,
"cssclass": "icon-x no-label",
"description": "Discard changes made to these objects.",
"depends": []
Expand Down
15 changes: 8 additions & 7 deletions platform/commonUI/edit/res/templates/edit-action-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<mct-control key="'button'"
structure="{
text: saveActions[0].getMetadata().name,
click: saveActions[0].perform,
click: actionPerformer(saveActions[0]),
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
}">
</mct-control>
Expand All @@ -42,11 +42,12 @@
</span>

<span ng-repeat="currentAction in otherEditActions">
<a class='s-button {{currentAction.getMetadata().cssclass}}'
title='{{currentAction.getMetadata().name}}'
ng-click="currentAction.perform()"
ng-class="{ major: $index === 0 && saveActions.length === 0 }">
<span class="title-label">{{currentAction.getMetadata().name}}</span>
</a>
<mct-control key="'button'"
structure="{
text: currentAction.getMetadata().name,
click: actionPerformer(currentAction),
cssclass: currentAction.getMetadata().cssclass
}">
</mct-control>
</span>
</span>
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ define(
$scope.otherEditActions = $scope.action ?
$scope.action.getActions(OTHERS_ACTION_CONTEXT) :
[];

// Required because Angular does not allow 'bind'
// in expressions.
$scope.actionPerformer = function (action) {
return action.perform.bind(action);
};
}

// Update set of actions whenever the action capability
Expand Down

0 comments on commit 8a00181

Please sign in to comment.