Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Add submit button directive #993

Merged
merged 2 commits into from
Mar 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/javascripts/ng-admin/Crud/CrudModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ CrudModule.directive('maListButton', require('./button/maListButton'));
CrudModule.directive('maDeleteButton', require('./button/maDeleteButton'));
CrudModule.directive('maBatchDeleteButton', require('./button/maBatchDeleteButton'));
CrudModule.directive('maExportToCsvButton', require('./button/maExportToCsvButton'));
CrudModule.directive('maSubmitButton', require('./button/maSubmitButton'));
CrudModule.directive('maViewBatchActions', require('./button/maViewBatchActions'));

CrudModule.directive('maShowItem', require('./show/maShowItem'));
Expand Down
20 changes: 20 additions & 0 deletions src/javascripts/ng-admin/Crud/button/maSubmitButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Save button
*
* Usage:
* <ma-submit-button label="Save changes"></ma-submit-button>
*/
export default function maSubmitButtonDirective() {
return {
restrict: 'E',
scope: {
label: '@',
},
link: function (scope) {
scope.label = scope.label || 'Save';
},
template: '<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> {{ label }}</button>'
};
}

maSubmitButtonDirective.$inject = [];
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/form/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1 compile="::formController.title">

<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Submit</button>
<ma-submit-button label="Submit"></ma-submit-button>
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/form/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 compile="::formController.title">

<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Save Changes</button>
<ma-submit-button label="Save Changes"></ma-submit-button>
</div>
</div>
</form>
Expand Down