Skip to content

Commit a51c33c

Browse files
mzerebamzereba
authored andcommitted
Working todo app (insert, update, delete)
1 parent 14d2a31 commit a51c33c

File tree

9 files changed

+31034
-0
lines changed

9 files changed

+31034
-0
lines changed

css/app.css

Lines changed: 579 additions & 0 deletions
Large diffs are not rendered by default.

css/bootstrap.css

Lines changed: 6026 additions & 0 deletions
Large diffs are not rendered by default.

images/bg.png

2.08 KB
Loading

js/angular/angular-animate.js

Lines changed: 2138 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
angular.module('ui.bootstrap.modal', [])
2+
.constant('modalConfig', {
3+
backdrop: true,
4+
escape: true
5+
})
6+
.directive('modal', ['$parse', 'modalConfig', function($parse, modalConfig) {
7+
var backdropEl;
8+
var body = angular.element(document.getElementsByTagName('body')[0]);
9+
return {
10+
restrict: 'EA',
11+
link: function(scope, elm, attrs) {
12+
var opts = angular.extend({}, modalConfig, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options));
13+
var shownExpr = attrs.modal || attrs.show;
14+
var setClosed;
15+
if (attrs.close) {
16+
setClosed = function() {
17+
scope.$apply(attrs.close);
18+
};
19+
} else {
20+
setClosed = function() {
21+
scope.$apply(function() {
22+
$parse(shownExpr).assign(scope, false);
23+
});
24+
};
25+
}
26+
elm.addClass('modal');
27+
if (opts.backdrop && !backdropEl) {
28+
backdropEl = angular.element('<div class="modal-backdrop"></div>');
29+
backdropEl.css('display','none');
30+
body.append(backdropEl);
31+
}
32+
function setShown(shown) {
33+
scope.$apply(function() {
34+
model.assign(scope, shown);
35+
});
36+
}
37+
function escapeClose(evt) {
38+
if (evt.which === 27) { setClosed(); }
39+
}
40+
function clickClose() {
41+
setClosed();
42+
}
43+
function close() {
44+
if (opts.escape) { body.unbind('keyup', escapeClose); }
45+
if (opts.backdrop) {
46+
backdropEl.css('display', 'none').removeClass('in');
47+
backdropEl.unbind('click', clickClose);
48+
}
49+
elm.css('display', 'none').removeClass('in');
50+
body.removeClass('modal-open');
51+
}
52+
function open() {
53+
if (opts.escape) { body.bind('keyup', escapeClose); }
54+
if (opts.backdrop) {
55+
backdropEl.css('display', 'block').addClass('in');
56+
if(opts.backdrop != "static") {
57+
backdropEl.bind('click', clickClose);
58+
}
59+
}
60+
elm.css('display', 'block').addClass('in');
61+
body.addClass('modal-open');
62+
}
63+
scope.$watch(shownExpr, function(isShown, oldShown) {
64+
if (isShown) {
65+
open();
66+
} else {
67+
close();
68+
}
69+
});
70+
}
71+
};
72+
}]);

0 commit comments

Comments
 (0)