summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates/blocks')
-rw-r--r--ishtar_common/templates/blocks/DataTables.html94
-rw-r--r--ishtar_common/templates/blocks/bs_form_snippet.html20
2 files changed, 37 insertions, 77 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> &nbsp;
- <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'];
diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html
index 95b8ac086..0f5f9d83d 100644
--- a/ishtar_common/templates/blocks/bs_form_snippet.html
+++ b/ishtar_common/templates/blocks/bs_form_snippet.html
@@ -12,6 +12,7 @@
</div>{% endif %}
{% endfor %}
+{% csrf_token %}
{% for field in form.visible_fields %}
{% if form.SEARCH_AND_SELECT %}
{{field}}
@@ -48,22 +49,9 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
+ <div class="form-group col-12" id="advanced-search-info"></div>
</div>
- <div class="modal-body form-row">
- <div class="form-group col-12" id="advanced-search-info">
- </div>
- <div class="form-group col-12">
- <p class="text-center">
- <button type="button"
- class="btn btn-primary advanced-search-valid">
- {% trans "Add" %}</button>
- <button type="button"
- class="btn btn-secondary advanced-search-clear">
- {% trans 'Clear' %}</button>
- <button type="button" class="btn btn-secondary"
- data-dismiss="modal">{% trans 'Close' %}</button>
- </p>
- </div>
+ <div class="modal-body body-scroll">
<hr>
{% endif %}
{% if field.name in form.HEADERS %}
@@ -91,6 +79,8 @@
{% if search and forloop.counter0 >= 1 %}
</div>
+ </div>
+ <div class="modal-footer">
<div class="form-group col-12">
<p class="text-center">
<button type="button"