Commit eecabef5 authored by Romain Loth's avatar Romain Loth

terms table: new hybrid save/import button

parent dee8e918
...@@ -1413,13 +1413,6 @@ $("#Clean_All").click(function(){ ...@@ -1413,13 +1413,6 @@ $("#Clean_All").click(function(){
// $("#Clean_All, #Save_All").attr( "disabled", "disabled" ); // $("#Clean_All, #Save_All").attr( "disabled", "disabled" );
}); });
$("#Save_All").click(function(){
SaveLocalChanges()
});
$("#Save_All_Bottom").click(function(){
SaveLocalChanges()
});
// find all the consequences of changes from MAP => MAIN // find all the consequences of changes from MAP => MAIN
// ----------------------------------------------------- // -----------------------------------------------------
...@@ -2310,23 +2303,36 @@ function isNumeric(n) { ...@@ -2310,23 +2303,36 @@ function isNumeric(n) {
// (it can only go back OFF with a save action via page reload) // (it can only go back OFF with a save action via page reload)
function toggleNeedSave() { function toggleNeedSave() {
var icons = $(".needsaveicon")
var boxes = $('.savediv')
var topButton = $('#ImportListOrSaveAll')
var botButton = $('#Save_All_Bottom')
// change the status icons // change the status icons
$(".needsaveicon").removeClass("glyphicon-floppy-saved"); icons.removeClass("glyphicon-floppy-saved");
$(".needsaveicon").addClass("glyphicon-floppy-remove"); icons.removeClass("glyphicon-import");
$(".needsaveicon").css("color","red"); icons.addClass("glyphicon-exclamation-sign");
$(".needsaveicon").css("font-size","120%"); icons.css("color","red");
icons.css("font-size","120%");
// give new text to the hybrid save/import button
topButton.html("<b>Save all changes</b>")
// save_divs get a new tooltip title // save_divs get a new tooltip title
$('.savediv').prop('title', "Click to save all changes to DB") boxes.prop('title', "Click to save all changes to DB")
// activate the buttons // activate the buttons
$('#Save_All').prop('disabled', false) ; topButton.prop('disabled', false) ;
$('#Save_All').removeClass("btn-muted"); topButton.removeClass("btn-warning");
$('#Save_All').addClass("btn-success"); topButton.addClass("btn-success");
botButton.prop('disabled', false) ;
botButton.removeClass("btn-muted");
botButton.addClass("btn-success");
$('#Save_All_Bottom').prop('disabled', false) ; // bind the onclick events (it also replaces the default import onclick for the hybrid button)
$('#Save_All_Bottom').removeClass("btn-muted"); topButton.attr("onclick","SaveLocalChanges()");
$('#Save_All_Bottom').addClass("btn-success"); botButton.attr("onclick","SaveLocalChanges()");
// toggle the global var ON // toggle the global var ON
_NeedSave = true _NeedSave = true
......
...@@ -126,19 +126,11 @@ em { ...@@ -126,19 +126,11 @@ em {
</center> </center>
</h2> </h2>
<div class="savediv pull-left" style="margin-top:1.5em;padding-right:1em;" title="No changes to save"> <div class="savediv pull-left" style="margin-top:1.5em;padding-right:1em;" title="No changes to save">
<!-- need save status --> <!-- save/import icon -->
<span class="needsaveicon glyphicon glyphicon-floppy-saved"></span> <span class="needsaveicon glyphicon glyphicon-import"></span>
&nbsp;
<!-- save button -->
<button id="Save_All" class="btn btn-muted" disabled style="font-size:120%">
<b>Save all changes</b>
</button>
<br/>
<br/>
<!-- import icon -->
<span class="glyphicon glyphicon-import"></span>
&nbsp; &nbsp;
<button id="ImportList" class="btn btn-warning" style="font-size:120%" <!-- save/import button -->
<button id="ImportListOrSaveAll" class="btn btn-warning" style="font-size:120%"
onclick="$('#csvimport').modal('show');"> onclick="$('#csvimport').modal('show');">
<b>Import a Termlist</b> <b>Import a Termlist</b>
</button> </button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment