View | Details | Raw Unified | Return to bug 23351
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt (-24 / +61 lines)
Lines 4-40 Link Here
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Localization</title>
5
<title>Koha &rsaquo; Localization</title>
6
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
6
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
7
<style>#localization { margin-top: 1em; }</style>
7
</head>
8
</head>
8
9
9
<body id="admin_localization" class="admin">
10
<body id="admin_localization" class="admin">
10
<div id="main">
11
    <div class="container-fluid">
12
        <div class="row">
13
            <div class="col-sm-12">
11
<form id="add_translation" method="post">
14
<form id="add_translation" method="post">
12
    <input type="hidden" name="entity" value="[% entity | html %]" />
15
    <input type="hidden" name="entity" value="[% entity | html %]" />
13
    <input type="hidden" name="code" value="[% code | html %]" />
16
    <input type="hidden" name="code" value="[% code | html %]" />
14
    Lang: <select name="lang">
17
    <input type="hidden" name="interface" value="[% interface_side | html %]" />
15
        [% FOR language IN languages %]
18
    <fieldset class="rows clearfix">
16
            [% FOR sublanguage IN language.sublanguages_loop %]
19
        <ol>
17
                [% IF language.plural %]
20
            <li>
18
                    <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
21
                <span class="label">Authorized value:</span>
19
                [% ELSE %]
22
                [% code | html %]
20
                    <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
23
            </li>
21
                [% END %]
24
            <li>
22
            [% END %]
25
                <label for="lang">Language:</label>
23
        [% END %]
26
                <select name="lang" id="lang">
24
    </select>
27
                    [% FOR language IN languages %]
25
    Translation: <input type="text" name="translation" />
28
                        [% FOR sublanguage IN language.sublanguages_loop %]
26
    <input type="submit" value="Add" />
29
                            [% IF language.plural %]
30
                                <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
31
                            [% ELSE %]
32
                                <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
33
                            [% END %]
34
                        [% END %]
35
                    [% END %]
36
                </select>
37
            </li>
38
            <li>
39
                <label for="translation">Translation:</label>
40
                <input type="text" size="40" name="translation" id="translation" />
41
            </li>
42
            <li>
43
                <span class="label">&nbsp;</span>
44
                <input type="submit" value="Add" />
45
            </li>
46
        </ol>
47
    </fieldset>
27
</form>
48
</form>
49
            </div> <!-- /.col-sm-12 -->
50
        </div> <!-- /.row -->
51
52
        <div class="row">
53
            <div class="col-sm-12">
28
<div id="messages"></div>
54
<div id="messages"></div>
55
            </div> <!-- /.col-sm-12 -->
56
        </div> <!-- /.row -->
57
58
        <div class="row">
59
            <div class="col-sm-12">
29
<table id="localization">
60
<table id="localization">
30
    <thead>
61
    <thead>
31
        <tr>
62
        <tr>
32
            <th>Id</th>
63
            <th>Id</th>
33
            <th>Entity</th>
64
            <th>Entity</th>
34
            <th>Code</th>
65
            <th>Code</th>
35
            <th>Lang</th>
66
            <th>Language</th>
36
            <th>Translation</th>
67
            <th>Translation</th>
37
            <th></th>
68
            <th class="NoSort">&nbsp;</th>
38
        </tr>
69
        </tr>
39
    </thead>
70
    </thead>
40
    <tbody>
71
    <tbody>
Lines 50-56 Link Here
50
        [% END %]
81
        [% END %]
51
    </tbody>
82
    </tbody>
52
</table>
83
</table>
53
</div>
84
            </div> <!-- /.col-sm-12 -->
85
        </div> <!-- /.row -->
86
    </div> <!-- /.container-fluid -->
54
87
55
[% MACRO jsinclude BLOCK %]
88
[% MACRO jsinclude BLOCK %]
56
    [% INCLUDE 'datatables.inc' %]
89
    [% INCLUDE 'datatables.inc' %]
Lines 117-123 Link Here
117
                    }
150
                    }
118
                },
151
                },
119
                error: function (data) {
152
                error: function (data) {
120
                    $(cell).css('background-color', '#FF0000');
153
                    $(cell).css('background-color', '#FF9090');
121
                    if ( $(cell).hasClass('lang') ) {
154
                    if ( $(cell).hasClass('lang') ) {
122
                        $(cell).text(data.lang)
155
                        $(cell).text(data.lang)
123
                    } else if ( $(cell).hasClass('translation') ) {
156
                    } else if ( $(cell).hasClass('translation') ) {
Lines 137-143 Link Here
137
                    show_message({ type: 'success_on_delete', data: data });
170
                    show_message({ type: 'success_on_delete', data: data });
138
                },
171
                },
139
                error: function (data) {
172
                error: function (data) {
140
                    $(cell).css('background-color', '#FF0000');
173
                    $(cell).css('background-color', '#FF9090');
141
                    show_message({ type: 'error_on_delete', data: data });
174
                    show_message({ type: 'error_on_delete', data: data });
142
                },
175
                },
143
            });
176
            });
Lines 147-156 Link Here
147
            $(".dialog").hide();
180
            $(".dialog").hide();
148
181
149
            var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
182
            var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
183
                "dom": 't',
184
                "columnDefs": [
185
                    { 'sortable': false, 'targets': [ 'NoSort' ] }
186
                ],
150
                'bPaginate': false,
187
                'bPaginate': false,
188
                'autoWidth': false,
151
            }));
189
            }));
152
190
153
            var languages_select = $('<select name="lang"></select>');
191
            var languages_select = $('<select name="lang" id="lang"></select>');
154
            [% FOR language IN languages %]
192
            [% FOR language IN languages %]
155
                [% FOR sublanguage IN language.sublanguages_loop %]
193
                [% FOR sublanguage IN language.sublanguages_loop %]
156
                    var option;
194
                    var option;
Lines 197-203 Link Here
197
                send_update_request( data, this );
235
                send_update_request( data, this );
198
            });
236
            });
199
237
200
            $("a.delete").on('click', function(e){
238
            $("body").on("click", "a.delete", function(e){
201
                e.preventDefault();
239
                e.preventDefault();
202
                if ( confirm(_("Are you sure you want to delete this translation?")) ) {
240
                if ( confirm(_("Are you sure you want to delete this translation?")) ) {
203
                    var td = $(this).parent();
241
                    var td = $(this).parent();
Lines 222-229 Link Here
222
                        if ( data.error ) {
260
                        if ( data.error ) {
223
                            show_message({ type: 'error_on_insert', data: data });
261
                            show_message({ type: 'error_on_insert', data: data });
224
                        } else {
262
                        } else {
225
                            // FIXME Should append the delete link
263
                            var new_row = table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "<a href=\"#\" class=\"delete\"><i class=\"fa fa-trash\"></i> Delete</a>" ] ).draw().node();
226
                            table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "" ] ).draw();
264
                            $( new_row ).attr("id", "row_id_" + data.id ).data("id", data.id );
227
                            show_message({ type: 'success_on_insert', data: data });
265
                            show_message({ type: 'success_on_insert', data: data });
228
                        }
266
                        }
229
                    },
267
                    },
230
- 

Return to bug 23351