summaryrefslogtreecommitdiff
path: root/ishtar_common/templates
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r--ishtar_common/templates/base.html1
-rw-r--r--ishtar_common/templates/blocks/DataTables.html16
2 files changed, 13 insertions, 4 deletions
diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html
index 652df14b3..add4f1d6c 100644
--- a/ishtar_common/templates/base.html
+++ b/ishtar_common/templates/base.html
@@ -44,6 +44,7 @@
var activate_own_search_msg = "{% trans 'Searches in the shortcut menu deal with only your items.' %}";
var search_pinned_msg = "{% trans 'Search pinned' %}";
var added_message = "{% trans " items added." %}";
+ var select_only_one_msg = {% trans "Select only one item." %};
var YES = "{% trans 'yes' %}";
var NO = "{% trans 'no' %}";
var autorefresh_message_start = "{% trans 'Autorefresh start. The form is disabled.' %}";
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html
index b5f669963..e1966787b 100644
--- a/ishtar_common/templates/blocks/DataTables.html
+++ b/ishtar_common/templates/blocks/DataTables.html
@@ -152,7 +152,7 @@ jQuery(document).ready(function(){
}
},
"select": {
- "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %}
+ "style": {% if multiple_select or quick_actions %}'multi'{% else %}'single'{% endif %}
},
{% if multiple_select or quick_actions %}"buttons": [
{% for url, title, icon, target in quick_actions %}
@@ -170,7 +170,7 @@ jQuery(document).ready(function(){
}
},
{% if not forloop.last %},{% endif %}
- {% endfor %}{% if multiple_select %}{% if quick_actions%},{% endif %}
+ {% endfor %}{% if quick_actions%},{% endif %}
{
extend: 'selectAll',
text: '<i class="fa fa-check-circle-o"></i>',
@@ -181,7 +181,6 @@ jQuery(document).ready(function(){
text: '<i class="fa fa-times"></i>',
titleAttr: "{% trans 'Deselect' %}"
}
- {% endif %}
],
"dom": 'lBtip',
{% else %}
@@ -192,7 +191,11 @@ jQuery(document).ready(function(){
{ "data": "link", "orderable": false },{% for col in extra_cols %}
{ "data": "{{col}}", "defaultContent": "-",
"render": $.fn.dataTable.render.ellipsis( 70, true ) }{% if not forloop.last %},{% endif %}{% endfor %}
- ]
+ ],
+ "initComplete": function(settings, json) {
+ var api = new $.fn.dataTable.Api(settings);
+ dt_single_enable_disable_submit_button(null, api);
+ }
};
if (!debug) $.fn.dataTable.ext.errMode = 'none';
@@ -201,6 +204,11 @@ jQuery(document).ready(function(){
if (datatables_i18n) datatable_options['language'] = datatables_i18n;
datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options);
+ {% if not multiple_select %}
+ datatable_{{sname}}.on('select', dt_single_enable_disable_submit_button);
+ datatable_{{sname}}.on('deselect', dt_single_enable_disable_submit_button);
+ {% endif %}
+
{% if multiple %}
jQuery("#add_button_{{name}}").click(function (){
var mygrid = jQuery("#grid_{{name}}");