Skip to content

Commit

Permalink
Added notifications when a user changes settings.
Browse files Browse the repository at this point in the history
+Added checkmarks to growl notification boxes
  • Loading branch information
jtanderson committed Mar 28, 2012
1 parent 0c21928 commit 602645b
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 13 deletions.
2 changes: 1 addition & 1 deletion application/views/settings.php
Expand Up @@ -15,7 +15,7 @@
<input type="hidden" id="PK_UserNum" value="<?php echo $this->session->userdata('LocalID');?>"/>
<div id="message_container">
<div id="DEFAULT_warning" style="display:none;" class="message">
<a href="#" onclick="removeWarning(this);" class="remove_warning"><img style="height: 15px; width: 15px;" src="/cdn/img/moblin-close.png"/></a>
<a href="#" onclick="MainObj.removeWarning(this);" class="remove_warning"><img style="height: 15px; width: 15px;" src="/cdn/img/moblin-close.png"/></a>
<table>
<tr>
<td><img src="/cdn/img/Red_triangle_alert_icon.png" class="error_img"/></td>
Expand Down
5 changes: 5 additions & 0 deletions cdn/css/main.css
Expand Up @@ -401,4 +401,9 @@ legend span.current{
legend span:hover{
color: #c3c3c3;
/* background-color: #222;*/
}

div.growlUI { background: url(/cdn/img/check36.png) no-repeat 10px 10px; }
div.growlUI h1, div.growlUI h2 {
color: white; padding: 5px 5px 5px 75px; text-align: left
}
Binary file added cdn/img/check36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cdn/img/check48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions cdn/js/_uncompressed/main.js
Expand Up @@ -94,6 +94,33 @@ MainObj.displayWarning = function(text){
}
}


MainObj.displayMessage = function(text, options){
if ( options == undefined ){options = {}};
if ( text != undefined && typeof(text) == "string" ){
var container = $('#message_container');
var newErrorBox = $('#DEFAULT_warning').clone();
var idx = $('#message_container').find("[id$=_warning]").not("#DEFAULT_warning").length;
newErrorBox.attr('id', idx+'_warning');
newErrorBox.find('.warning_text').html(text);
// newErrorBox.css('display','');

if ( options.classes != undefined ){
newErrorBox.addClass(options.classes)
}

if ( options.fadeout != undefined ){
setTimeout(function(){newErrorBox.fadeOut(1000);}, options.fadeout);
}

container.append(newErrorBox);
newErrorBox.fadeIn(1000);
} else {
console.log("Warning: displayMessage function called with unacceptable parameters.");
}
}


/**
* Function removeWarning
*
Expand Down
21 changes: 20 additions & 1 deletion cdn/js/_uncompressed/settings.js
Expand Up @@ -120,15 +120,34 @@ SettingsObj.saveSettings = function(){
// console.log( postData );
}


/**
* Sends the data to the backend and displays confirmation
*
* @author Joseph T. Anderson <jtanderson@ratiocaeli.com>
* @since 2012-03-26
* @version 2012-03-26
*
* @param el An element that holds the setting to update
*/
SettingsObj.updateSetting = function(el){
var postData = {};
postData[$(el).attr('id')] = $(el).val();
$.post('/homeAjax/updateSetting', postData, function(json){
// TODO: Add some sort of confirmation
if ( json.success ){
$.growlUI('System Notification', 'The changes have been saved.');
}
}, 'json');
}


/**
* Sets up the tab interface events.
*
* @author Joseph T. Anderson <jtanderson@ratiocaeli.com>
* @since 2012-03-26
* @version 2012-03-26
*/
SettingsObj.setTabEvents = function(){
$('legend span').each( function(){
$(this).click( function(){
Expand Down
4 changes: 2 additions & 2 deletions cdn/js/jquery/jquery.blockUI.js
Expand Up @@ -36,8 +36,8 @@ $.unblockUI = function(opts) { remove(window, opts); };
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (title) $m.append('<h2>'+title+'</h2>');
if (message) $m.append('<h4>'+message+'</h4>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
Expand Down
18 changes: 9 additions & 9 deletions cdn/js/jquery/jquery.blockUI.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 602645b

Please sign in to comment.