refactoring show/hide/position functions
This commit is contained in:
@@ -7,29 +7,21 @@ var removalist = function() {
|
||||
function handleMenuClick() {
|
||||
$( '.menu li' ).click(function(e) {
|
||||
if ($(e.target).hasClass('transform')) {
|
||||
$('.dialog-overlay').show();
|
||||
$('.dialog-container').show();
|
||||
util.show('dialog');
|
||||
util.render('bulkEdit', 'dialog-content');
|
||||
$('.cancelButton').click(function(e) {
|
||||
$('.dialog-overlay').hide();
|
||||
$('.dialog-container').hide();
|
||||
util.hide('dialog');
|
||||
})
|
||||
$('.menu').hide();
|
||||
$('.menu-overlay').hide();
|
||||
util.hide('menu');
|
||||
}
|
||||
|
||||
if ($(e.target).hasClass('csv')) {
|
||||
window.location.href = app.csvUrl;
|
||||
}
|
||||
if ($(e.target).hasClass('csv')) window.location.href = app.csvUrl;
|
||||
|
||||
if ($(e.target).hasClass('json')) {
|
||||
window.location.href = app.csvUrl;
|
||||
}
|
||||
if ($(e.target).hasClass('json')) window.location.href = "_rewrite/api/json";
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$('.menu').hide();
|
||||
$('.menu-overlay').hide();
|
||||
util.hide('menu');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ app.after = {
|
||||
},
|
||||
dataTable: function() {
|
||||
$('.column-header-menu').click(function(e) {
|
||||
util.show('menu', e);
|
||||
util.position('menu', e);
|
||||
util.render('columnActions', 'menu');
|
||||
});
|
||||
},
|
||||
actions: function() {
|
||||
$('.button').click(function(e) {
|
||||
util.show('menu', e, {left: -60});
|
||||
util.position('menu', e, {left: -60});
|
||||
util.render('exportActions', 'menu');
|
||||
});
|
||||
},
|
||||
|
||||
@@ -24,7 +24,17 @@ var util = function() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
function show( thing, elem, offset ) {
|
||||
function show( thing ) {
|
||||
$('.' + thing ).show();
|
||||
$('.' + thing + '-overlay').show();
|
||||
}
|
||||
|
||||
function hide( thing ) {
|
||||
$('.' + thing ).hide();
|
||||
$('.' + thing + '-overlay').hide();
|
||||
}
|
||||
|
||||
function position( thing, elem, offset ) {
|
||||
var position = $(elem.target).offset();
|
||||
if (offset) {
|
||||
if (offset.top) position.top += offset.top;
|
||||
@@ -136,6 +146,8 @@ var util = function() {
|
||||
return {
|
||||
inURL: inURL,
|
||||
show: show,
|
||||
hide: hide,
|
||||
position: position,
|
||||
render: render,
|
||||
formatMetadata:formatMetadata,
|
||||
getBaseURL:getBaseURL,
|
||||
|
||||
Reference in New Issue
Block a user