Skip to content

Commit 74df11a

Browse files
committed
doc() add dialog demo
1 parent 35509d9 commit 74df11a

File tree

3 files changed

+76
-26
lines changed

3 files changed

+76
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A PNotify 2.0 port heavily based on [angular-pines-notify](https://github.com/my
1616

1717
### Demo
1818

19-
[Check out the demo here!](https://cdn.rawgit.com/jacqueslareau/angular-pnotify/0.0.2/demo/index.html)
19+
[Check out the demo here!](http://pnotify.jlareau.com/demo/)
2020

2121
### Install
2222

demo/index.html

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
<meta charset="utf-8">
66

7-
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
8-
<link rel="stylesheet" href="//cdn.jsdelivr.net/pnotify/2.0.0/pnotify.all.min.css">
7+
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
8+
<link rel="stylesheet" href="/bower_components/pnotify/pnotify.core.css">
99

10-
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
11-
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
12-
<script src="//cdn.jsdelivr.net/pnotify/2.0.0/pnotify.all.min.js"></script>
13-
<script src="https://cdn.rawgit.com/jacqueslareau/angular-pnotify/0.0.2/src/angular-pnotify.js"></script>
10+
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
11+
<script src="/bower_components/angular/angular.min.js"></script>
12+
<script src="/bower_components/pnotify/pnotify.core.js"></script>
13+
<script src="/bower_components/pnotify/pnotify.confirm.js"></script>
14+
<script src="/src/angular-pnotify.js"></script>
1415

1516
</head>
1617

@@ -27,40 +28,65 @@ <h1>angular-pnotify demo</h1>
2728
<p>View source for more details.</p>
2829
<hr>
2930

30-
<p><code>notificationService.success('Successing text')</code></p>
31+
<p><pre>notificationService.success('Successing text')</pre></p>
3132
<p><button ng-click="success()" class="btn btn-success">Success</button></p>
3233
<hr>
3334

34-
<p><code>notificationService.info('Infomative text')</code></p>
35+
<p><pre>notificationService.info('Infomative text')</pre></p>
3536
<p><button ng-click="info()" class="btn btn-info">Info</button></p>
3637
<hr>
3738

38-
<p><code>notificationService.notice('Notice text')</code></p>
39+
<p><pre>notificationService.notice('Notice text')</pre></p>
3940
<p><button ng-click="notice()" class="btn btn-warning">Notice</button></p>
4041
<hr>
4142

42-
<p><code>notificationService.error('Error text')</code></p>
43+
<p><pre>notificationService.error('Error text')</pre></p>
4344
<p><button ng-click="error()" class="btn btn-danger">Error</button></p>
4445
<hr>
4546

4647
<p>Use the generic PNotify object.</p>
4748
<p>
48-
<code>
49-
notificationService.notify({
50-
title: 'The notice title.',
51-
title_escape: false,
52-
text: 'The notice text.',
53-
text_escape: false,
54-
styling: "bootstrap3",
55-
type: "notice",
56-
icon: true
57-
});
58-
</code>
49+
<pre>
50+
notificationService.notify({
51+
title: 'The notice title.',
52+
title_escape: false,
53+
text: 'The notice text.',
54+
text_escape: false,
55+
styling: "bootstrap3",
56+
type: "notice",
57+
icon: true
58+
});
59+
</pre>
5960
</p>
6061
<p><button ng-click="generic()" class="btn btn-primary">Generic PNotify</button></p>
61-
62-
</div>
63-
62+
<hr>
63+
64+
<p>
65+
<pre>
66+
notificationService.notify({
67+
title: 'Confirmation Needed',
68+
text: 'Are you sure?',
69+
hide: false,
70+
confirm: {
71+
confirm: true
72+
},
73+
buttons: {
74+
closer: false,
75+
sticker: false
76+
},
77+
history: {
78+
history: false
79+
}
80+
}).get().on('pnotify.confirm', function() {
81+
alert('Ok, cool.');
82+
}).on('pnotify.cancel', function() {
83+
alert('Oh ok. Chicken, I see.');
84+
});
85+
</pre>
86+
87+
</p>
88+
<p><button ng-click="confirmDialog()" class="btn btn-primary">Confirm dialog</button></p>
89+
6490
</div>
6591

6692
<script>
@@ -102,6 +128,30 @@ <h1>angular-pnotify demo</h1>
102128

103129
};
104130

131+
$scope.confirmDialog = function() {
132+
133+
notificationService.notify({
134+
title: 'Confirmation Needed',
135+
text: 'Are you sure?',
136+
hide: false,
137+
confirm: {
138+
confirm: true
139+
},
140+
buttons: {
141+
closer: false,
142+
sticker: false
143+
},
144+
history: {
145+
history: false
146+
}
147+
}).get().on('pnotify.confirm', function() {
148+
alert('Ok, cool.');
149+
}).on('pnotify.cancel', function() {
150+
alert('Oh ok. Chicken, I see.');
151+
});
152+
153+
};
154+
105155
}]);
106156

107157
</script>

src/angular-pnotify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ angular.module('jlareau.pnotify', [])
5454
},
5555

5656
notify: function(hash) {
57-
new PNotify(hash);
57+
return new PNotify(hash);
5858
}
5959

6060
};

0 commit comments

Comments
 (0)