ModalDemo running

This commit is contained in:
2016-07-05 17:08:03 +02:00
parent e19d1efb23
commit 7a1a4a654c
2 changed files with 79 additions and 27 deletions
@@ -298,3 +298,55 @@ transactionControllers.controller('TransactionDetailCtrl', [ '$scope', '$routePa
} ]); } ]);
transactionControllers.controller('ModalDemoCtrl', function ($scope, $uibModal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.animationsEnabled = true;
$scope.open = function (size) {
var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
$scope.toggleAnimation = function () {
$scope.animationsEnabled = !$scope.animationsEnabled;
};
});
// Please note that $uibModalInstance represents a modal window (instance) dependency.
// It is not the same as the $uibModal service used above.
transactionControllers.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$uibModalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
});
@@ -10,8 +10,6 @@
<div class="col-md-offset-4 col-md-4 col-xs-offset-1 col-xs-10"> <div class="col-md-offset-4 col-md-4 col-xs-offset-1 col-xs-10">
<br />
<div ng-show="lastSubmission" class="lastSubmission col-xs-offset-1 alert alert-info" role="alert"> <div ng-show="lastSubmission" class="lastSubmission col-xs-offset-1 alert alert-info" role="alert">
{{lastSubmission.date | date:'dd.MM.yyyy'}} {{lastSubmission.date | date:'dd.MM.yyyy'}}
<span ng-class="{ 'color-green': lastSubmission.amount > 0, 'color-red': lastSubmission.amount < 0 }">{{lastSubmission.amount}}&nbsp;</span> <span ng-class="{ 'color-green': lastSubmission.amount > 0, 'color-red': lastSubmission.amount < 0 }">{{lastSubmission.amount}}&nbsp;</span>
@@ -19,7 +17,7 @@
<span style='color: red; font-weight: bold;'><a href='' ng-click='deleteLastSubmission()'>löschen</a></span> <span style='color: red; font-weight: bold;'><a href='' ng-click='deleteLastSubmission()'>löschen</a></span>
</div> </div>
<div class="row"> <div class="row" style="margin-top:2em;">
<form name="form" ng-submit="postTransaction()"> <form name="form" ng-submit="postTransaction()">
<div class="row form-group"> <div class="row form-group">
@@ -67,7 +65,7 @@
class="form-control"> class="form-control">
</div> </div>
<div class="row form-group"> <div class="row form-group" ng-show="accountUsers.length > 1">
<label for="expenseInput">Auslage</label> <label for="expenseInput">Auslage</label>
<div> <div>
&nbsp;<label class='userLabel'><input id='noCreditorRadioButton' name='expenseBy' ng-model='transaction.creditor' type='radio' value='' checked='checked' />&nbsp;Keine&nbsp;&nbsp;</label> &nbsp;<label class='userLabel'><input id='noCreditorRadioButton' name='expenseBy' ng-model='transaction.creditor' type='radio' value='' checked='checked' />&nbsp;Keine&nbsp;&nbsp;</label>
@@ -82,6 +80,7 @@
</form> </form>
</div> </div>
<div class="row">
<table class="listing"> <table class="listing">
<tr> <tr>
<th>Datum</th> <th>Datum</th>
@@ -103,8 +102,9 @@
<div style="margin-top: 2em; text-align: center;"> <div style="margin-top: 2em; text-align: center;">
<span ng-repeat="user in accountUsers">{{user.name}} {{user.outstandings | number : 2}}&nbsp;<br/></span> <span ng-repeat="user in accountUsers">{{user.name}} {{user.outstandings | number : 2}}&nbsp;<br/></span>
</div> </div>
</div>
<!-- div ng-controller="ModalDemoCtrl"> <div ng-controller="ModalDemoCtrl">
<script type="text/ng-template" id="myModalContent.html"> <script type="text/ng-template" id="myModalContent.html">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">I'm a modal!</h3> <h3 class="modal-title">I'm a modal!</h3>
@@ -128,7 +128,7 @@
<button type="button" class="btn btn-default" ng-click="open('sm')">Small modal</button> <button type="button" class="btn btn-default" ng-click="open('sm')">Small modal</button>
<button type="button" class="btn btn-default" ng-click="toggleAnimation()">Toggle Animation ({{ animationsEnabled }})</button> <button type="button" class="btn btn-default" ng-click="toggleAnimation()">Toggle Animation ({{ animationsEnabled }})</button>
<div ng-show="selected">Selection from a modal: {{ selected }}</div> <div ng-show="selected">Selection from a modal: {{ selected }}</div>
</div--> </div>
<!-- div> <!-- div>
<pre style="font-size: 75%; color: darkgray;">{{account | json}}</pre> <pre style="font-size: 75%; color: darkgray;">{{account | json}}</pre>