refactoring show/hide/position functions
This commit is contained in:
parent
a9d4117b24
commit
f48f8dbffa
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" style="display: none; z-index: 101; "> </div>
|
||||
<div class="dialog-container ui-draggable" style="display: none; z-index: 102; top: 101px; ">
|
||||
<div class="dialog ui-draggable" style="display: none; z-index: 102; top: 101px; ">
|
||||
<div class="dialog-frame" style="width: 700px; visibility: visible; ">
|
||||
<div id="dialog-content" class="dialog-border">
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<script type='text/mustache' id="exportActionsTemplate">
|
||||
<li><a class="csv" href="JavaScript:void(0);">CSV</a></li>
|
||||
<li><a class="csv" href="JavaScript:void(0);">JSON</a></li>
|
||||
<li><a class="json" href="JavaScript:void(0);">JSON</a></li>
|
||||
</script>
|
||||
|
||||
<script type='text/mustache' id="columnActionsTemplate">
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -877,7 +877,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.dialog-container {
|
||||
.dialog {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user