diff options
Diffstat (limited to 'ishtar_common/templates/blocks/DataTables.html')
| -rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 94 |
1 files changed, 32 insertions, 62 deletions
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 70d47cb8d..b5f669963 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -10,12 +10,6 @@ <p><a href="#" onclick="open_window('{{url_new}}');">{{new_message}}</a></p> {% endif %} -<div class="alert alert-info" role="alert" id="pinned_search_{{name}}"> - <i class="fa fa-thumb-tack"></i> - <strong>{% trans "Pinned search:" %}</strong> - <em><span id="pinned_search_content_{{name}}"></span></em> -</div> - <div class="modal fade table-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="modal_grid_{{name}}"> <div class="modal-dialog full modal-lg"> @@ -140,8 +134,6 @@ datatable_submit_search = function(){ return false; }; - - jQuery(document).ready(function(){ jQuery("#search_{{name}}").click(datatable_submit_search); @@ -162,16 +154,35 @@ jQuery(document).ready(function(){ "select": { "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %} }, - {% if multiple_select %}"buttons": [ - 'selectAll', - 'selectNone' - ], - "language": { - buttons: { - selectAll: "{% trans 'Select all items' %}", - selectNone: "{% trans 'Select none' %}" + {% if multiple_select or quick_actions %}"buttons": [ + {% for url, title, icon, target in quick_actions %} + { + {% if target == 'one' %}extend: 'selectedSingle', + {% elif target == 'many' %}extend: 'selected', + {% endif %} + className: "btn btn-success", + text: "{{icon}}", + titleAttr: "{{title}}", + action: function (e, dt, node, config) { + var url = dt_generate_qa_url(dt, "{{url}}"); + dt_qa_open(url); + return false; + } + }, + {% if not forloop.last %},{% endif %} + {% endfor %}{% if multiple_select %}{% if quick_actions%},{% endif %} + { + extend: 'selectAll', + text: '<i class="fa fa-check-circle-o"></i>', + titleAttr: "{% trans 'Select all items' %}" + }, + { + extend: 'selectNone', + text: '<i class="fa fa-times"></i>', + titleAttr: "{% trans 'Deselect' %}" } - }, + {% endif %} + ], "dom": 'lBtip', {% else %} "dom": 'ltip', @@ -190,49 +201,6 @@ jQuery(document).ready(function(){ if (datatables_i18n) datatable_options['language'] = datatables_i18n; datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options); -{% comment %} - - jQuery("#grid_{{name}}").jqGrid({ - url:'{{source}}', - datatype: "json", - mtype: 'GET', - colNames:['id', '', {{col_names|safe}}], - colModel:[ - {name:'id', index:'id', hidden:true}, - {name:'link', index:'link', width:30}, - {{extra_cols|safe}} - ], - height: 300, - sortname: '__default__', - viewrecords: true, - sortorder: "asc", - emptyrecords: "{{no_result}}", - loadtext: "{{loading}}", - pager: '#pager_{{name}}', - width: null, - shrinkToFit: false, - rowNum:20, - {% if multiple_select %}multiselect: true,{% endif %} - jsonReader : {repeatitems: false}, - loadError: function (jqXHR, textStatus, errorThrown) { - alert("{% trans "An error as occured during search. Check your query fields." %}"); - }, - beforeProcessing: function(data, status, xhr){ - $('#pinned_search_content_{{name}}').html(''); - for (idx in data){ - if (idx == 'pinned-search' && data[idx] != ''){ - $('#pinned_search_content_{{name}}').html(data[idx]); - } - } - if ($('#pinned_search_content_{{name}}').html()){ - $('#pinned_search_{{name}}').show(); - } else { - $('#pinned_search_{{name}}').hide(); - } - } - }); -{% endcomment %} - {% if multiple %} jQuery("#add_button_{{name}}").click(function (){ var mygrid = jQuery("#grid_{{name}}"); @@ -273,8 +241,10 @@ jQuery(document).ready(function(){ {% if multiple_select %} var value = ""; for (k in data){ - if (k > 0) value += ","; - value += data[k]['id']; + if (typeof data[k]['id'] != "undefined") { + if (value) value += ","; + value += data[k]['id']; + } } {% else %} var value = data[0]['id']; |
