Commit 0324659d authored by Evren Kutar's avatar Evren Kutar

ADD button styling and confirm field type

parent a078fb71
<div class="form-group schema-form-submit {{form.htmlClass}}">
<button class="btn {{ form.style || 'btn-default' }}"
type="button"
ng-disabled="form.readonly"
uib-popover-template="'confirmPopoverTemplate.html'"
popover-title="{{form.title}}"
popover-placement="bottom"
popover-trigger="outsideClick">
<span ng-if="form.icon" class="{{form.icon}}"></span>
{{form.title}}
</button>
<script type="text/ng-template" id="confirmPopoverTemplate.html">
<div>{{form.title}}</div>
<div class="form-group">
<p>{{form.confirm_message}}</p>
<button class="btn btn-default" ng-click="form.confirm()"></button>
</div>
</script>
</div>
\ No newline at end of file
......@@ -229,10 +229,14 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
var buttonClass = (buttonPositions[v.position] || buttonPositions.bottom);
var redirectTo = scope.modalElements ? false : true;
// in case backend needs styling the buttons
// it needs to send style key with options below
// btn-default btn-primary btn-success btn-info btn warning
// btn-danger is default
scope.form[scope.form.indexOf(k)] = {
type: v.type,
title: v.title,
style: "btn-danger hide " + buttonClass,
style: (v.style || "btn-danger")+" hide " + buttonClass,
onClick: function () {
delete scope.form_params.cmd;
delete scope.form_params.flow;
......@@ -508,6 +512,24 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
}
},
confirm: {
default: function (scope, v, k) {
scope.form[scope.form.indexOf(k)] = {
type: "template",
title: v.title,
confirm_message: v.confirm_message,
templateUrl: "shared/templates/confirm.html",
name: k,
key: k,
cmd: v.cmd,
confirm: function () {
console.log(v.cmd);
// send cmd with submit
}
};
}
},
date: {
default: function (scope, v, k) {
$log.debug('date:', scope.model[k]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment