From 215d541d7c037effe427c3769f61eaf75feffbd9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 19 Jul 2019 14:06:59 +0000 Subject: [PATCH] Bug 23351: Clean up localization template This patch modifies the template used for translation of item type descriptions. It is updated with more consistent Bootstrap grid markup and improved handling of adding and removing rows from the DataTable. To test you should have more than one translation installed. - Apply the patch and go to Administration -> Item types. - Edit an item type. - Click the translate link. - Add a new translation. The table of translations should be updated with your new translation. - Test the "Delete" link corresponding to your new entry. It should work correctly. --- .../prog/en/modules/admin/localization.tt | 84 ++++++++++++++++------ 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt index 6952ba0..95d2810 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt @@ -4,37 +4,68 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Localization [% INCLUDE 'doc-head-close.inc' popup => 1 %] + -
+
+
+
- Lang: - Translation: - + +
+
    +
  1. + Authorized value: + [% code | html %] +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
  7. +   + +
  8. +
+
+
+
+ +
+
+
+
+ +
+
- + - + @@ -50,7 +81,9 @@ [% END %]
Id Entity CodeLangLanguage Translation 
-
+
+
+
[% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] @@ -117,7 +150,7 @@ } }, error: function (data) { - $(cell).css('background-color', '#FF0000'); + $(cell).css('background-color', '#FF9090'); if ( $(cell).hasClass('lang') ) { $(cell).text(data.lang) } else if ( $(cell).hasClass('translation') ) { @@ -137,7 +170,7 @@ show_message({ type: 'success_on_delete', data: data }); }, error: function (data) { - $(cell).css('background-color', '#FF0000'); + $(cell).css('background-color', '#FF9090'); show_message({ type: 'error_on_delete', data: data }); }, }); @@ -147,10 +180,15 @@ $(".dialog").hide(); var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, { + "dom": 't', + "columnDefs": [ + { 'sortable': false, 'targets': [ 'NoSort' ] } + ], 'bPaginate': false, + 'autoWidth': false, })); - var languages_select = $(''); + var languages_select = $(''); [% FOR language IN languages %] [% FOR sublanguage IN language.sublanguages_loop %] var option; @@ -197,7 +235,7 @@ send_update_request( data, this ); }); - $("a.delete").on('click', function(e){ + $("body").on("click", "a.delete", function(e){ e.preventDefault(); if ( confirm(_("Are you sure you want to delete this translation?")) ) { var td = $(this).parent(); @@ -222,8 +260,8 @@ if ( data.error ) { show_message({ type: 'error_on_insert', data: data }); } else { - // FIXME Should append the delete link - table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "" ] ).draw(); + var new_row = table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, " Delete" ] ).draw().node(); + $( new_row ).attr("id", "row_id_" + data.id ).data("id", data.id ); show_message({ type: 'success_on_insert', data: data }); } }, -- 2.1.4