diff --git a/src/sunstone/public/css/application.css b/src/sunstone/public/css/application.css
index cfbc279b7b..488a0d9d54 100644
--- a/src/sunstone/public/css/application.css
+++ b/src/sunstone/public/css/application.css
@@ -313,6 +313,13 @@ hr{margin:18px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff
.button.disabled.secondary, .button[disabled].secondary { background-color: #e9e9e9; }
.button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary:hover, .button[disabled].secondary:focus { background-color: #e9e9e9; outline: none; }
+/* Alerts ---------------------- */
+div.alert-box { display: block; padding: 6px 7px 7px; font-weight: bold; font-size: 12px; color: white; background-color: #2ba6cb; border: 1px solid rgba(0, 0, 0, 0.1); margin-bottom: 12px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); position: relative; }
+div.alert-box.success { background-color: #5da423; color: #fff; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); }
+div.alert-box.alert { background-color: #c60f13; color: #fff; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); }
+div.alert-box.secondary { background-color: #e9e9e9; color: #505050; text-shadow: 0 1px rgba(255, 255, 255, 0.3); }
+div.alert-box a.close { color: #333; position: absolute; right: 4px; top: -1px; font-size: 17px; opacity: 0.2; padding: 4px; }
+div.alert-box a.close:hover, div.alert-box a.close:focus { opacity: 0.4; }
/* Don't use native buttons on iOS */
input[type=submit].button, button.button { -webkit-appearance: none; }
@@ -332,11 +339,11 @@ input[type=submit].button, button.button { -webkit-appearance: none; }
/* Tooltips ---------------------- */
-.has-tip { border-bottom: dotted 1px #cccccc; cursor: help; font-weight: bold; color: #333333; }
-.has-tip:hover, .has-tip:focus { border-bottom: dotted 1px #196177; color: #2ba6cb; }
+.has-tip { cursor: help; font-weight: bold; color: #333333; }
+.has-tip:hover, .has-tip:focus { color: #2ba6cb; }
.has-tip.tip-left, .has-tip.tip-right { float: none !important; }
-.tooltip { display: none; background: black; background: rgba(0, 0, 0, 0.85); position: absolute; color: white; font-weight: bold; font-size: 12px; padding: 5px; z-index: 999; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; line-height: normal; }
+.tooltip { display: none; background: black; background: rgba(0, 0, 0, 0.85); position: absolute; color: white; font-weight: bold; font-size: 12px; padding: 5px; z-index: 1003; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; line-height: normal; }
.tooltip > .nub { display: block; width: 0; height: 0; border: solid 5px; border-color: transparent transparent black transparent; border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent; position: absolute; top: -10px; left: 10px; }
.tooltip.tip-override > .nub { border-color: transparent transparent black transparent !important; border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent !important; top: -10px !important; }
.tooltip.tip-top > .nub, .tooltip.tip-centered-top > .nub { border-color: black transparent transparent transparent; border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent; top: auto; bottom: -10px; }
@@ -1006,7 +1013,7 @@ div.wizard_tab {
}
div.wizard_internal_tab {
- height: auto;
+ height: 405px;
width: 54em;
}
diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js
index 94b372c001..20331503c1 100644
--- a/src/sunstone/public/js/plugins/templates-tab.js
+++ b/src/sunstone/public/js/plugins/templates-tab.js
@@ -1111,7 +1111,7 @@ function setupCreateTemplateDialog(){
{ "sWidth": "35px", "aTargets": [1,6,11,12] },
{ "sWidth": "100px", "aTargets": [5,7] },
{ "sWidth": "150px", "aTargets": [8] },
- { "bVisible": false, "aTargets": [0,2,3,6,7,9,8,12]}
+ { "bVisible": false, "aTargets": [0,2,3,6,9,8,12]}
],
"oLanguage": (datatable_lang != "") ?
{
@@ -1133,6 +1133,7 @@ function setupCreateTemplateDialog(){
});
updateView(image_list_array, dataTable_template_images);
+ dataTable_template_images.fnFilter("OS|DATABLOCK|CDROM", 7, true)
},
error: onError
});
@@ -1163,7 +1164,9 @@ function setupCreateTemplateDialog(){
else {
$('#image_selected', disk_section).toggle();
$('#select_image', disk_section).hide();
- }
+ }
+
+ $('.alert-box', disk_section).hide();
previous_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
@@ -1393,6 +1396,8 @@ function setupCreateTemplateDialog(){
// Add delete button for this tab
$('li.'+str_nic_tab_id).append("Remove Tab");
+
+ var nic_section = $('div#' + str_nic_tab_id);
var dataTable_template_networks = $('#'+str_datatable_id, dialog).dataTable({
"bJQueryUI": true,
@@ -1437,7 +1442,7 @@ function setupCreateTemplateDialog(){
- $('#'+str_nic_tab_id+'_search', $('div#' + str_nic_tab_id)).keyup(function(){
+ $('#'+str_nic_tab_id+'_search', nic_section).keyup(function(){
dataTable_template_networks.fnFilter( $(this).val() );
})
@@ -1461,28 +1466,29 @@ function setupCreateTemplateDialog(){
$("td:first", previous_row).parent().children().each(function(){$(this).removeClass('markrow');});
}
else {
- $('#network_selected', $('div#' + str_nic_tab_id)).toggle();
- $('#select_network', $('div#' + str_nic_tab_id)).hide();
+ $('#network_selected', nic_section).toggle();
+ $('#select_network', nic_section).hide();
}
+ $('.alert-box', nic_section).hide();
previous_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
- $('#NETWORK', $('div#' + str_nic_tab_id)).text(aData[4]);
- $('#NETWORK_ID', $('div#' + str_nic_tab_id)).val(aData[1]);
+ $('#NETWORK', nic_section).text(aData[4]);
+ $('#NETWORK_ID', nic_section).val(aData[1]);
return false;
});
- $('.advanced', $('div#' + str_nic_tab_id)).hide();
+ $('.advanced', nic_section).hide();
- $('#advanced', $('div#' + str_nic_tab_id)).click(function(){
- $('.advanced', $('div#' + str_nic_tab_id)).toggle();
+ $('#advanced', nic_section).click(function(){
+ $('.advanced', nic_section).toggle();
return false;
});
- setupTips($('div#' + str_nic_tab_id));
+ setupTips(nic_section);
number_of_nics++;
nics_index++;
@@ -1697,37 +1703,39 @@ function setupCreateTemplateDialog(){
tabs.append(html_tab_content).tabs('add', '#os_tab', 'OS Booting');
$( "#template_create_tabs a[href='#os_tab']").parent().remove("span")
- $('#tabs-bootos', dialog).tabs();
+ var os_section = $('div#os_tab', dialog);
+
+ $('#tabs-bootos', os_section).tabs();
// Select Image or Volatile disk. The div is hidden depending on the selection, and the
// vm_param class is included to be computed when the template is generated.
$("input[name='kernel_type']").change(function(){
if ($("input[name='kernel_type']:checked").val() == "kernel_ds") {
- $("div.kernel_ds", $('div#os_tab')).toggle();
- $("div#kernel_ds_inputs", $('div#os_tab')).addClass('vm_param');
- $("div.kernel_path", $('div#os_tab')).hide();
- $("div#kernel_path_inputs", $('div#os_tab')).removeClass('vm_param');
+ $("div.kernel_ds", os_section).toggle();
+ $("div#kernel_ds_inputs", os_section).addClass('vm_param');
+ $("div.kernel_path", os_section).hide();
+ $("div#kernel_path_inputs", os_section).removeClass('vm_param');
}
else {
- $("div.kernel_ds", $('div#os_tab')).hide();
- $("div#kernel_ds_inputs", $('div#os_tab')).removeClass('vm_param');
- $("div.kernel_path", $('div#os_tab')).toggle();
- $("div#kernel_path_inputs", $('div#os_tab')).addClass('vm_param');
+ $("div.kernel_ds", os_section).hide();
+ $("div#kernel_ds_inputs", os_section).removeClass('vm_param');
+ $("div.kernel_path", os_section).toggle();
+ $("div#kernel_path_inputs", os_section).addClass('vm_param');
}
});
$("input[name='initrd_type']").change(function(){
if ($("input[name='initrd_type']:checked").val() == "initrd_ds") {
- $("div.initrd_ds", $('div#os_tab')).toggle();
- $("div#initrd_ds_inputs", $('div#os_tab')).addClass('vm_param');
- $("div.initrd_path", $('div#os_tab')).hide();
- $("div#initrd_path_inputs", $('div#os_tab')).removeClass('vm_param');
+ $("div.initrd_ds", os_section).toggle();
+ $("div#initrd_ds_inputs", os_section).addClass('vm_param');
+ $("div.initrd_path", os_section).hide();
+ $("div#initrd_path_inputs", os_section).removeClass('vm_param');
}
else {
- $("div.initrd_ds", $('div#os_tab')).hide();
- $("div#initrd_ds_inputs", $('div#os_tab')).removeClass('vm_param');
- $("div.initrd_path", $('div#os_tab')).toggle();
- $("div#initrd_path_inputs", $('div#os_tab')).addClass('vm_param');
+ $("div.initrd_ds", os_section).hide();
+ $("div#initrd_ds_inputs", os_section).removeClass('vm_param');
+ $("div.initrd_path", os_section).toggle();
+ $("div#initrd_path_inputs", os_section).addClass('vm_param');
}
});
@@ -1796,8 +1804,10 @@ function setupCreateTemplateDialog(){
previous_kernel_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
- $('#KERNEL', $('div#os_tab')).text(aData[4]);
- $('#KERNEL_DS', $('div#os_tab')).val("$FILE[IMAGE_ID="+ aData[1] +"]");
+ $('.kernel_ds .alert-box', os_section).hide();
+
+ $('#KERNEL', os_section).text(aData[4]);
+ $('#KERNEL_DS', os_section).val("$FILE[IMAGE_ID="+ aData[1] +"]");
return false;
});
@@ -1872,9 +1882,11 @@ function setupCreateTemplateDialog(){
$("td:first", previous_initrd_row).parent().children().each(function(){$(this).removeClass('markrow');});
previous_initrd_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
-
- $('#INITRD', $('div#os_tab')).text(aData[4]);
- $('#INITRD_DS', $('div#os_tab')).val("$FILE[IMAGE_ID="+ aData[1] +"]");
+
+ $('.initrd_ds .alert-box', os_section).hide();
+
+ $('#INITRD', os_section).text(aData[4]);
+ $('#INITRD_DS', os_section).val("$FILE[IMAGE_ID="+ aData[1] +"]");
return false;
});
@@ -1885,15 +1897,15 @@ function setupCreateTemplateDialog(){
$('fieldset.advanced', $('div##advanced_os')).toggle();
return false;
});
-
- setupTips($('div#os_tab'));
}
/**************************************************************************
INPUT/OUTPUT TAB
- **************************************************************************/
+ $('.kernel_ds .alert-box', os_section).hide();
+ **************
+ ************************************************************/
var add_io_tab = function() {
var html_tab_content = '
'+
@@ -2041,9 +2053,6 @@ function setupCreateTemplateDialog(){
$( "#io_tab span.ui-icon-close" ).live( "click", function() {
$(this).closest("tr").remove()
});
-
-
- setupTips($('div#io_tab'));
}
/**************************************************************************
@@ -2232,7 +2241,7 @@ function setupCreateTemplateDialog(){
$.each(images_list,function(){
image_list_array.push(imageElementArray(this));
});
- console.log(image_list_array);
+
updateView(image_list_array, datTable_template_context);
datTable_template_context.fnFilter("CONTEXT", 7)
},
@@ -2288,6 +2297,8 @@ function setupCreateTemplateDialog(){
$('#select_files', dialog).toggle();
}
+ $('.alert-box', $('div#context_tab')).hide();
+
generate_context_files();
return false;
@@ -2421,16 +2432,22 @@ function setupCreateTemplateDialog(){
'
'+
''+
'
'+
- '
'+
- '
PACKING '+
+ '
'+
+ ' Packing '+
+ '
'+
+ '
'+
'
'+tr("Pack the VMs in the cluster nodes to reduce VM fragmentation")+'
'+
'
'+
- '
'+
- '
STRIPING '+
+ '
'+
+ ' Stripping '+
+ '
'+
+ '
'+
'
'+tr("Spread the VMs in the cluster nodes")+'
'+
'
'+
- '
'+
- '
LOAD-AWARE'+
+ '
'+
+ ' Load-aware'+
+ '
'+
+ '
'+
'
'+tr("Maximize the resources available to VMs in a node")+'
'+
'
'+
'
'+
@@ -2540,6 +2557,8 @@ function setupCreateTemplateDialog(){
$('#select_hosts', dialog).toggle();
}
+ $('.alert-box', $('div#placement_tab .host_select')).hide();
+
generate_requirements();
return false;
@@ -2644,6 +2663,8 @@ function setupCreateTemplateDialog(){
$('#select_clusters', dialog).toggle();
}
+ $('.alert-box', $('div#placement_tab .cluster_select')).hide();
+
generate_requirements();
return false;
@@ -3184,14 +3205,25 @@ function fillTemplatePopUp(request, response){
var rows = dataTable_template_images.fnGetNodes();
+ var clicked = false
for (var j=0;j
×'+
+'';
+
+ $(".dataTables_wrapper", disk_section).append(alert);
+ }
},
error: onError
});
@@ -3250,12 +3282,23 @@ function fillTemplatePopUp(request, response){
var rows = dataTable_template_networks.fnGetNodes();
+ var clicked = false;
for (var j=0;j
×'+
+'';
+
+ $(".dataTables_wrapper", nic_section).append(alert);
}
}
},
@@ -3314,15 +3357,25 @@ function fillTemplatePopUp(request, response){
var rows = dataTable_template.fnGetNodes();
+ var match = regexp.exec(os.KERNEL_DS)
+ var clicked = false;
for (var j=0;j
×'+
+'';
+
+ $("#tabs-kernel .dataTables_wrapper", os_section).append(alert);
+ }
},
error: onError
});
@@ -3352,16 +3405,26 @@ function fillTemplatePopUp(request, response){
dataTable_template.fnFilter("RAMDISK", 6)
var rows = dataTable_template.fnGetNodes();
-
+ var match = regexp.exec(os.INITRD_DS);
+ var clicked = false;
for (var j=0;j
×'+
+' ';
+
+ $("#tabs-ramdisk .dataTables_wrapper", os_section).append(alert);
+ }
},
error: onError
});
@@ -3482,11 +3545,25 @@ function fillTemplatePopUp(request, response){
var current_row = $(rows[j]);
var row_id = $(rows[j]).find("td:eq(0)").html();
- if ($.inArray(row_id, files) != -1) {
+ var in_array = $.inArray(row_id, files)
+ if (in_array != -1) {
+ files.splice(in_array, 1);
// TBD check if all the files were clicked
rows[j].click();
}
}
+
+ if (files.length != 0) {
+ if (!clicked) {
+ var alert = ''+
+ tr('The following FILES: ') + files.join(', ') + tr(" do not exist any more") +
+ '
×'+
+ '
';
+
+ $(".dataTables_wrapper", context_section).append(alert);
+ }
+ }
+
},
error: onError
});
@@ -3756,6 +3833,8 @@ $(document).ready(function(){
tableCheckboxesListener(dataTable_templates);
infoListener(dataTable_templates,'Template.showinfo');
+$(document).foundationTooltips();
+$(document).foundationAlerts();
$('div#templates_tab div.legend_div').hide();
});
diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js
index 1523b6f4e9..81a0f8c4e6 100644
--- a/src/sunstone/public/js/sunstone-util.js
+++ b/src/sunstone/public/js/sunstone-util.js
@@ -519,38 +519,53 @@ function getValue(filter_str,filter_col,value_col,dataTable){
//displays the tip information on mouseover.
function setupTips(context){
+ $('ui-dialog').css('z-index', '1000')
//For each tip in this context
$('div.tip',context).each(function(){
+ // //store the text
+ // var obj = $(this);
+ // var tip = obj.html();
+ // //replace the text with an icon and spans
+ // obj.html('');
+ // obj.append('');
+//
+ // obj.append('');
+//
+ // //add the text to .tipspan
+ // $('span.tipspan',obj).html(tip);
+ // //make sure it is not floating in the wrong place
+ // obj.parent().append('');
+ // //hide the text
+ // $('span.tipspan',obj).hide();
+//
+ // //When the mouse is hovering on the icon we fadein/out
+ // //the tip text
+ // $('span.info_icon',obj).hover(function(e){
+ // var icon = $(this);
+ // var top, left;
+ // top = e.pageY - 15;// - $(this).parents('#create_vm_dialog').offset().top - 15;
+ // left = e.pageX + 15;// - $(this).parents('#create_vm_dialog').offset().left;
+ // icon.next().css(
+ // {"top":top+"px",
+ // "left":left+"px"});
+ // icon.next().fadeIn();
+ // },function(){
+ // $(this).next().fadeOut();
+ // });
//store the text
var obj = $(this);
+ obj.removeClass('tip');
var tip = obj.html();
//replace the text with an icon and spans
- obj.html('');
- obj.append('');
+ console.log(tip)
+ obj.html('');
- obj.append('');
+ //obj.append('');
//add the text to .tipspan
- $('span.tipspan',obj).html(tip);
- //make sure it is not floating in the wrong place
- obj.parent().append('');
- //hide the text
- $('span.tipspan',obj).hide();
+ //$('span.has-tip',obj).html(tip);
+
- //When the mouse is hovering on the icon we fadein/out
- //the tip text
- $('span.info_icon',obj).hover(function(e){
- var icon = $(this);
- var top, left;
- top = e.pageY - 15;// - $(this).parents('#create_vm_dialog').offset().top - 15;
- left = e.pageX + 15;// - $(this).parents('#create_vm_dialog').offset().left;
- icon.next().css(
- {"top":top+"px",
- "left":left+"px"});
- icon.next().fadeIn();
- },function(){
- $(this).next().fadeOut();
- });
});
}
@@ -1581,4 +1596,217 @@ function insert_permissions_table(resource_type,resource_id, owner, group, vm_ui
return str;
-}
\ No newline at end of file
+}
+
+
+
+/*
+ * jQuery Foundation Tooltips 2.0.2
+ * http://foundation.zurb.com
+ * Copyright 2012, ZURB
+ * Free to use under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+*/
+
+/*jslint unparam: true, browser: true, indent: 2 */
+
+;(function ($, window, undefined) {
+ 'use strict';
+
+ var settings = {
+ bodyHeight : 0,
+ selector : '.has-tip',
+ additionalInheritableClasses : [],
+ tooltipClass : '.tooltip',
+ tipTemplate : function (selector, content) {
+ return '' + content + '';
+ }
+ },
+ methods = {
+ init : function (options) {
+ settings = $.extend(settings, options);
+
+ // alias the old targetClass option
+ settings.selector = settings.targetClass ? settings.targetClass : settings.selector;
+
+ return this.each(function () {
+ var $body = $('body');
+
+
+ $body.on('mouseenter.tooltip mouseleave.tooltip', settings.selector, function (e) {
+ var $this = $(this);
+
+ if (e.type === 'mouseenter') {
+ methods.showOrCreateTip($this);
+ } else if (e.type === 'mouseleave') {
+ methods.hide($this);
+ }
+ });
+
+ $(this).data('tooltips', true);
+
+ });
+ },
+ showOrCreateTip : function ($target, content) {
+ var $tip = methods.getTip($target);
+
+ if ($tip && $tip.length > 0) {
+ methods.show($target);
+ } else {
+ methods.create($target, content);
+ }
+ },
+ getTip : function ($target) {
+ var selector = methods.selector($target),
+ tip = null;
+
+ if (selector) {
+ tip = $('span[data-selector=' + selector + ']' + settings.tooltipClass);
+ }
+ return (tip.length > 0) ? tip : false;
+ },
+ selector : function ($target) {
+ var id = $target.attr('id'),
+ dataSelector = $target.data('selector');
+
+ if (id === undefined && dataSelector === undefined) {
+ dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
+ $target.attr('data-selector', dataSelector);
+ }
+ return (id) ? id : dataSelector;
+ },
+ create : function ($target, content) {
+ var $tip = $(settings.tipTemplate(methods.selector($target),
+ $('').html(content ? content : $target.attr('title')).html())),
+ classes = methods.inheritable_classes($target);
+
+ $tip.addClass(classes).appendTo('body');
+ $target.removeAttr('title');
+ methods.show($target);
+ },
+ reposition : function (target, tip, classes) {
+ var width, nub, nubHeight, nubWidth, column, objPos;
+
+ tip.css('visibility', 'hidden').show();
+
+ width = target.data('width');
+ nub = tip.children('.nub');
+ nubHeight = nub.outerHeight();
+ nubWidth = nub.outerWidth();
+
+ objPos = function (obj, top, right, bottom, left, width) {
+ return obj.css({
+ 'top' : top,
+ 'bottom' : bottom,
+ 'left' : left,
+ 'right' : right,
+ 'max-width' : (width) ? width : 'auto'
+ }).end();
+ };
+
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left, width);
+ objPos(nub, -nubHeight, 'auto', 'auto', 10);
+
+ if ($(window).width() < 767) {
+ column = target.closest('.columns');
+
+ if (column.length < 0) {
+ // if not using Foundation
+ column = $('body');
+ }
+ tip.width(column.outerWidth() - 25).css('left', 15).addClass('tip-override');
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
+ } else {
+ if (classes && classes.indexOf('tip-top') > -1) {
+ objPos(tip, (target.offset().top - tip.outerHeight() - nubHeight), 'auto', 'auto', target.offset().left, width)
+ .removeClass('tip-override');
+ objPos(nub, 'auto', 'auto', -nubHeight, 'auto');
+ } else if (classes && classes.indexOf('tip-left') > -1) {
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left - tip.outerWidth() - 10), width)
+ .removeClass('tip-override');
+ objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), -nubHeight, 'auto', 'auto');
+ } else if (classes && classes.indexOf('tip-right') > -1) {
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left + target.outerWidth() + 10), width)
+ .removeClass('tip-override');
+ objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), 'auto', 'auto', -nubHeight);
+ } else if (classes && classes.indexOf('tip-centered-top') > -1) {
+ objPos(tip, (target.offset().top - tip.outerHeight() - nubHeight), 'auto', 'auto', (target.offset().left + ((target.outerWidth() - tip.outerWidth()) / 2) ), width)
+ .removeClass('tip-override');
+ objPos(nub, 'auto', ((tip.outerWidth() / 2) -(nubHeight / 2)), -nubHeight, 'auto');
+ } else if (classes && classes.indexOf('tip-centered-bottom') > -1) {
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', (target.offset().left + ((target.outerWidth() - tip.outerWidth()) / 2) ), width)
+ .removeClass('tip-override');
+ objPos(nub, -nubHeight, ((tip.outerWidth() / 2) -(nubHeight / 2)), 'auto', 'auto');
+ }
+ }
+ tip.css('visibility', 'visible').hide();
+ },
+ inheritable_classes : function (target) {
+ var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'tip-centered-top', 'tip-centered-bottom', 'noradius'].concat(settings.additionalInheritableClasses),
+ classes = target.attr('class'),
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
+ if ($.inArray(el, inheritables) !== -1) {
+ return el;
+ }
+ }).join(' ') : '';
+
+ return $.trim(filtered);
+ },
+ show : function ($target) {
+ var $tip = methods.getTip($target);
+
+ methods.reposition($target, $tip, $target.attr('class'));
+ $tip.fadeIn(150);
+ },
+ hide : function ($target) {
+ var $tip = methods.getTip($target);
+
+ $tip.fadeOut(150);
+ },
+ reload : function () {
+ var $self = $(this);
+
+ return ($self.data('tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
+ },
+ destroy : function () {
+ return this.each(function () {
+ $(window).off('.tooltip');
+ $(settings.selector).off('.tooltip');
+ $(settings.tooltipClass).each(function (i) {
+ $($(settings.selector).get(i)).attr('title', $(this).text());
+ }).remove();
+ });
+ }
+ };
+
+ $.fn.foundationTooltips = function (method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method) {
+ return methods.init.apply(this, arguments);
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.foundationTooltips');
+ }
+ };
+}(jQuery, this));
+
+;(function ($, window, undefined) {
+ 'use strict';
+
+ $.fn.foundationAlerts = function (options) {
+ var settings = $.extend({
+ callback: $.noop
+ }, options);
+
+ $(document).on("click", ".alert-box a.close", function (e) {
+ e.preventDefault();
+ $(this).closest(".alert-box").fadeOut(function () {
+ $(this).remove();
+ // Do something else after the alert closes
+ settings.callback();
+ });
+ });
+
+ };
+
+})(jQuery, this);