diff options
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 58 |
1 files changed, 49 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(){ |