Lines 1-5
Link Here
|
1 |
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX |
1 |
/* global KOHA to_highlight search_jumped MSG_NOTHING_TO_SAVE MSG_SAVING MSG_SAVED_PREFERENCE MSG_MODIFIED MSG_MADE_CHANGES MSG_FILTER_NOT_FOUND humanMsg */ |
2 |
|
2 |
|
|
|
3 |
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX |
3 |
KOHA.Preferences = { |
4 |
KOHA.Preferences = { |
4 |
Save: function ( form ) { |
5 |
Save: function ( form ) { |
5 |
modified_prefs = $( form ).find( '.modified' ); |
6 |
modified_prefs = $( form ).find( '.modified' ); |
Lines 11-17
KOHA.Preferences = {
Link Here
|
11 |
unserialized.push($(this)); |
12 |
unserialized.push($(this)); |
12 |
} |
13 |
} |
13 |
}); |
14 |
}); |
14 |
data = modified_prefs.serialize(); |
15 |
var data = modified_prefs.serialize(); |
15 |
$(unserialized).each(function(){ |
16 |
$(unserialized).each(function(){ |
16 |
data += '&' + $(this).attr('name') + '='; |
17 |
data += '&' + $(this).attr('name') + '='; |
17 |
}); |
18 |
}); |
Lines 23-30
KOHA.Preferences = {
Link Here
|
23 |
KOHA.AJAX.Submit( { |
24 |
KOHA.AJAX.Submit( { |
24 |
data: data, |
25 |
data: data, |
25 |
url: '/cgi-bin/koha/svc/config/systempreferences/', |
26 |
url: '/cgi-bin/koha/svc/config/systempreferences/', |
26 |
success: function ( data ) { KOHA.Preferences.Success( form ) }, |
27 |
success: function () { KOHA.Preferences.Success( form ); }, |
27 |
complete: function () { KOHA.AJAX.MarkDone( $( form ).find( '.save-all' ) ) } |
28 |
complete: function () { KOHA.AJAX.MarkDone( $( form ).find( '.save-all' ) ); } |
28 |
} ); |
29 |
} ); |
29 |
}, |
30 |
}, |
30 |
Success: function ( form ) { |
31 |
Success: function ( form ) { |
Lines 48-54
$( document ).ready( function () {
Link Here
|
48 |
function mark_modified() { |
49 |
function mark_modified() { |
49 |
$( this.form ).find( '.save-all' ).prop('disabled', false); |
50 |
$( this.form ).find( '.save-all' ).prop('disabled', false); |
50 |
$( this ).addClass( 'modified' ); |
51 |
$( this ).addClass( 'modified' ); |
51 |
var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' ); |
52 |
var name_cell = $( this ).parent(); |
52 |
if ( !name_cell.find( '.modified-warning' ).length ) |
53 |
if ( !name_cell.find( '.modified-warning' ).length ) |
53 |
name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' ); |
54 |
name_cell.append( '<em class="modified-warning">('+MSG_MODIFIED+')</em>' ); |
54 |
KOHA.Preferences.Modified = true; |
55 |
KOHA.Preferences.Modified = true; |
Lines 74-81
$( document ).ready( function () {
Link Here
|
74 |
return false; |
75 |
return false; |
75 |
}); |
76 |
}); |
76 |
|
77 |
|
77 |
$("dl.sortable").sortable(); |
78 |
$(".sortable").sortable(); |
78 |
$("dl.sortable").on( "sortchange", function( event, ui ) { |
79 |
$(".sortable").on( "sortchange", function( event, ui ) { |
79 |
// This is not exact but we just need to trigger a change |
80 |
// This is not exact but we just need to trigger a change |
80 |
$(ui.item.find('input:first')).change(); |
81 |
$(ui.item.find('input:first')).change(); |
81 |
} ); |
82 |
} ); |
Lines 84-92
$( document ).ready( function () {
Link Here
|
84 |
if ( KOHA.Preferences.Modified ) { |
85 |
if ( KOHA.Preferences.Modified ) { |
85 |
return MSG_MADE_CHANGES; |
86 |
return MSG_MADE_CHANGES; |
86 |
} |
87 |
} |
87 |
} |
88 |
}; |
88 |
|
89 |
|
89 |
$( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } ); |
90 |
$( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false; } ); |
90 |
|
91 |
|
91 |
$( '.prefs-tab .save-all' ).prop('disabled', true).click( function () { |
92 |
$( '.prefs-tab .save-all' ).prop('disabled', true).click( function () { |
92 |
KOHA.Preferences.Save( this.form ); |
93 |
KOHA.Preferences.Save( this.form ); |
Lines 118-125
$( document ).ready( function () {
Link Here
|
118 |
|
119 |
|
119 |
|
120 |
|
120 |
// Filtering by mark.js |
121 |
// Filtering by mark.js |
121 |
var keyword_filter = $("#keyword_filter"), |
122 |
var keyword_filter = $("#keyword_filter"); |
122 |
context = $(".name-row"); |
123 |
var context = $(".name-row"); |
123 |
$("#clear_filter").on("click", function(e){ |
124 |
$("#clear_filter").on("click", function(e){ |
124 |
e.preventDefault(); |
125 |
e.preventDefault(); |
125 |
keyword_filter.val("").trigger("input"); |
126 |
keyword_filter.val("").trigger("input"); |
Lines 136-142
$( document ).ready( function () {
Link Here
|
136 |
$("#filter_empty").remove(); |
137 |
$("#filter_empty").remove(); |
137 |
} |
138 |
} |
138 |
}, |
139 |
}, |
139 |
noMatch: function(term){ |
140 |
noMatch: function(){ |
140 |
if( $("#filter_empty").length < 1 ){ |
141 |
if( $("#filter_empty").length < 1 ){ |
141 |
$("main").prepend("<div id=\"filter_empty\" class=\"dialog alert\">" + MSG_FILTER_NOT_FOUND + "</div>"); |
142 |
$("main").prepend("<div id=\"filter_empty\" class=\"dialog alert\">" + MSG_FILTER_NOT_FOUND + "</div>"); |
142 |
} |
143 |
} |
143 |
- |
|
|