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

Notifications and file losted #75

Merged
merged 2 commits into from
Jan 31, 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
Empty file.
9 changes: 5 additions & 4 deletions dist/js/components/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@
}
};

var buildNotif = function(text, timeout, showButton) {
var buildNotif = function(text, timeout, showButton, textButton) {
if(typeof text !== 'string') text = '';
timeout = (typeof timeout === 'number' ? timeout : 5000);
textButton = (typeof textButton === 'string' ? textButton : 'CANCEL');

var progress = '<div class="progress"><div class="determinate"></div></div>';
var btn = (showButton === true ? '<button class="btn pull-right" data-hide-notif="true">CANCEL</button>' : '');
var btn = (showButton === true ? '<button class="btn pull-right" data-hide-notif="true">'+ textButton +'</button>' : '');

var div = document.createElement('div');
div.setAttribute('class', 'notification');
Expand Down Expand Up @@ -202,12 +203,12 @@
}
}

phonon.notif = function(el, timeout, showButton) {
phonon.notif = function(el, timeout, showButton, textButton) {

if(arguments.length > 1) {

var text = el;
var nBuild = buildNotif(text, timeout, showButton);
var nBuild = buildNotif(text, timeout, showButton, textButton);
window.setTimeout(function() {
show(document.querySelector('#'+nBuild.id));
}, 10);
Expand Down
9 changes: 5 additions & 4 deletions dist/js/phonon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3085,12 +3085,13 @@ phonon.tagManager = (function () {
}
};

var buildNotif = function(text, timeout, showButton) {
var buildNotif = function(text, timeout, showButton, textButton) {
if(typeof text !== 'string') text = '';
timeout = (typeof timeout === 'number' ? timeout : 5000);
textButton = (typeof textButton === 'string' ? textButton : 'CANCEL');

var progress = '<div class="progress"><div class="determinate"></div></div>';
var btn = (showButton === true ? '<button class="btn pull-right" data-hide-notif="true">CANCEL</button>' : '');
var btn = (showButton === true ? '<button class="btn pull-right" data-hide-notif="true">'+ textButton +'</button>' : '');

var div = document.createElement('div');
div.setAttribute('class', 'notification');
Expand Down Expand Up @@ -3176,12 +3177,12 @@ phonon.tagManager = (function () {
}
}

phonon.notif = function(el, timeout, showButton) {
phonon.notif = function(el, timeout, showButton, textButton) {

if(arguments.length > 1) {

var text = el;
var nBuild = buildNotif(text, timeout, showButton);
var nBuild = buildNotif(text, timeout, showButton, textButton);
window.setTimeout(function() {
show(document.querySelector('#'+nBuild.id));
}, 10);
Expand Down
6 changes: 6 additions & 0 deletions examples/components/notifications-example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ <h1 class="title">Notifications</h1>
</header>
<div class="content">
<div class="padded-full">

<button class="btn btn-flat padded-bottom positive" id="show-notif-button">Show notification custom button</button>

<button class="btn btn-flat padded-bottom primary" id="show-auto-notif">Show another notification</button>

Expand Down Expand Up @@ -55,6 +57,10 @@ <h1 class="title">Notifications</h1>
document.querySelector('#show-auto-notif').on('tap', function() {
phonon.notif('HELLO', 3000, false);
});

document.querySelector('#show-notif-button').on('tap', function() {
phonon.notif('HELLO AGAIN :-p', 3000, true, 'Close' );
});

document.querySelector('#show-notif').on('tap', function() {
phonon.notif('#notif-example').show();
Expand Down