diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-09 00:41:57 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-09 00:41:57 +0200 |
commit | 5230a8e0a06a5d67d6c13f2359bc51be07b4fb5a (patch) | |
tree | 5df1cfe674759003b1599f7334448f9c7f00637d /ishtar_common/static | |
parent | 06f8d8f45d5c08ec9ed17cee4836f3311703e6df (diff) | |
download | Ishtar-5230a8e0a06a5d67d6c13f2359bc51be07b4fb5a.tar.bz2 Ishtar-5230a8e0a06a5d67d6c13f2359bc51be07b4fb5a.zip |
Shortcut menu: menu is now dynamic - selected items filter dependant items (refs #2996) - can now pin items from sheet (refs #3078)
Diffstat (limited to 'ishtar_common/static')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 58 | ||||
-rw-r--r-- | ishtar_common/static/media/style.css | 34 |
2 files changed, 83 insertions, 9 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 4d82cb238..fecefe0a9 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -1,5 +1,5 @@ - /* CSRFToken management */ + $.ajaxSetup({ beforeSend: function(xhr, settings) { function getCookie(name) { @@ -23,6 +23,8 @@ beforeSend: function(xhr, settings) { } }}); +var shortcut_url = ''; + function manage_async_link(event){ event.preventDefault(); var url = $(this).attr('href'); @@ -36,30 +38,66 @@ function manage_async_link(event){ function get_next_table_id(){} function get_previous_table_id(){} -$(document).ready(function(){ - $("#main_menu > ul > li > ul").hide(); - $("#main_menu ul ul .selected").parents().show(); - var items = new Array('file', 'operation'); +function init_shortcut_menu(html){ + $("#progress").hide(); + $("#context_menu").html(html); + $(".chosen-select").chosen(); $("#current_file").change(function(){ $.post('/' + url_path + 'update-current-item/', - {item:'file', value:$("#current_file").val()} + {item:'file', value:$("#current_file").val()}, + load_shortcut_menu ); }); $("#current_operation").change(function(){ $.post('/' + url_path + 'update-current-item/', - {item:'operation', value:$("#current_operation").val()} + {item:'operation', value:$("#current_operation").val()}, + load_shortcut_menu ); }); $("#current_contextrecord").change(function(){ $.post('/' + url_path + 'update-current-item/', - {item:'contextrecord', value:$("#current_contextrecord").val()} + {item:'contextrecord', value:$("#current_contextrecord").val()}, + load_shortcut_menu ); }); $("#current_find").change(function(){ $.post('/' + url_path + 'update-current-item/', - {item:'find', value:$("#current_find").val()} + {item:'find', value:$("#current_find").val()}, + load_shortcut_menu ); }); +} + +function display_info(msg){ + $('#message .information .content').html(msg); + $('#message').fadeIn('slow'); + $('#message .information').fadeIn('slow'); + setTimeout( + function(){ + $('#message .information').fadeOut('slow'); + $('#message').fadeOut('slow'); + }, 5000); +} + +function load_shortcut_menu(){ + if (!shortcut_url) return; + $("#progress").show(); + $.ajax({ + url: shortcut_url, + cache: false, + success:function(html){ + init_shortcut_menu(html); + }, + error:function(XMLHttpRequest, textStatus, errorThrows){ + $("#progress").hide(); + } + }); +} + +$(document).ready(function(){ + $("#main_menu > ul > li > ul").hide(); + $("#main_menu ul ul .selected").parents().show(); + var items = new Array('file', 'operation'); if ($(document).height() < 1.5*$(window).height()){ $('#to_bottom_arrow').hide(); $('#to_top_arrow').hide(); @@ -67,6 +105,7 @@ $(document).ready(function(){ $('#language_selector').change(function(){ $('#language_form').submit(); }); + load_shortcut_menu(); if ($.isFunction($(".prettyPhoto a").prettyPhoto)){ $(".prettyPhoto a").prettyPhoto({'social_tools':''}); } @@ -74,6 +113,7 @@ $(document).ready(function(){ $(this).attr('class', $(this).children("option:selected").attr('class')); }); $("a.async-link").click(manage_async_link); + $(".chosen-select").chosen(); }); $(document).on("click", '#to_bottom_arrow', function(){ diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index ebd13d4b7..bff3ef473 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -21,6 +21,8 @@ div.form, ul.form { } /* color */ + +.pin-action, #window hr, #context_menu .red, a, a.remove { @@ -46,6 +48,7 @@ a.add-button, color:#000; } +.chosen-container, #context_menu .green, #context_menu .red, #context_menu .orange, @@ -248,6 +251,13 @@ button.ui-widget-header:hover { z-index: 100 !important; } +.chosen-container-active.chosen-with-drop .chosen-single, +.chosen-container-single .chosen-single{ + background: none; + background-color: #fff; + border-radius:4px; +} + textarea, input[type=text], input[type=password], @@ -293,6 +303,26 @@ div.nav-button{ border: 0 solid transparent; } +#message, +#message div{ + display: none; +} + +#message { + z-index: 42200; + position: absolute; + top: 5px; + right: 5px; + background: #fff; + padding: 0.5em 1em; + border: 1px solid; + border-radius: 3px; +} + +#message span{ + padding: 0 1em; +} + #to_bottom_arrow{ bottom:80px; } @@ -731,6 +761,10 @@ ul.form .help_text{ font-style: normal; } +.pin-action:hover{ + cursor:pointer; +} + .autocomplete{ width:350px; } |