Lines 5-10
Link Here
|
5 |
<title>Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %])[% ELSE %]Add MARC record[% END %]</title> |
5 |
<title>Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %])[% ELSE %]Add MARC record[% END %]</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
7 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
|
|
8 |
<script> |
9 |
var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]"; |
10 |
</script> |
8 |
[% Asset.js("js/cataloging.js") | $raw %] |
11 |
[% Asset.js("js/cataloging.js") | $raw %] |
9 |
[% INCLUDE 'strings.inc' %] |
12 |
[% INCLUDE 'strings.inc' %] |
10 |
[% Asset.js("js/browser.js") | $raw %] |
13 |
[% Asset.js("js/browser.js") | $raw %] |
Lines 483-557
Link Here
|
483 |
[% Asset.css("css/addbiblio.css") | $raw %] |
486 |
[% Asset.css("css/addbiblio.css") | $raw %] |
484 |
|
487 |
|
485 |
[% INCLUDE 'select2.inc' %] |
488 |
[% INCLUDE 'select2.inc' %] |
486 |
<script> |
|
|
487 |
$(document).ready(function() { |
488 |
$('.subfield_line select[data-category=""]').select2(); // branches, itemtypes and cn_source |
489 |
|
490 |
[% UNLESS CAN_user_parameters_manage_auth_values %] |
491 |
$('.subfield_line select[data-category!=""]').select2(); |
492 |
[% ELSE %] |
493 |
var current_select2; |
494 |
$('.subfield_line select[data-category!=""]').select2({ |
495 |
tags: true, |
496 |
createTag: function (tag) { |
497 |
return { |
498 |
id: tag.term, |
499 |
text: tag.term, |
500 |
newTag: true |
501 |
}; |
502 |
}, |
503 |
templateResult: function(state) { |
504 |
if (state.newTag) { |
505 |
return state.text + " " + "(select to create)"; |
506 |
} |
507 |
return state.text; |
508 |
} |
509 |
}).on("select2:select", function(e) { |
510 |
if(e.params.data.newTag){ |
511 |
|
512 |
var category = $(this).data("category"); |
513 |
$("#avCreate #new_av_category").html(category); |
514 |
$("#avCreate input[name='category']").val(category); |
515 |
$("#avCreate input[name='value']").val(e.params.data.text); |
516 |
$("#avCreate input[name='description']").val(e.params.data.text); |
517 |
$('#avCreate').modal({show:true}); |
518 |
|
519 |
$(current_select2).val($(current_select2).find("option:first").val()).trigger('change'); |
520 |
|
521 |
current_select2 = this; |
522 |
|
523 |
} |
524 |
}); |
525 |
|
526 |
$("#avCreate").on('hide.bs.modal', function(e){ |
527 |
}); |
528 |
|
529 |
$("#add_new_av").on("submit", function(){ |
530 |
var data = { |
531 |
category: $(this).find('input[name="category"]').val(), |
532 |
value: $(this).find('input[name="value"]').val(), |
533 |
description: $(this).find('input[name="description"]').val(), |
534 |
opac_description: $(this).find('input[name="opac_description"]').val(), |
535 |
}; |
536 |
$.ajax({ |
537 |
type: "POST", |
538 |
url: "/api/v1/authorised_values", |
539 |
data:JSON.stringify(data), |
540 |
success: function(response) { |
541 |
$('#avCreate').modal('hide'); |
542 |
|
543 |
$(current_select2).append('<option selected value="'+data['value']+'">'+data['description']+'</option>'); |
544 |
}, |
545 |
error: function(err) { |
546 |
$("#avCreate .error").html(_("Something went wrong, maybe the value already exists?")) |
547 |
} |
548 |
}); |
549 |
return false; |
550 |
}); |
551 |
[% END %] |
552 |
}); |
553 |
</script> |
554 |
|
555 |
</head> |
489 |
</head> |
556 |
<body id="cat_addbiblio" class="cat"> |
490 |
<body id="cat_addbiblio" class="cat"> |
557 |
|
491 |
|
Lines 961-1007
Link Here
|
961 |
[%# End of fields for fast cataloging %] |
895 |
[%# End of fields for fast cataloging %] |
962 |
</form> <!-- /name=f --> |
896 |
</form> <!-- /name=f --> |
963 |
|
897 |
|
964 |
<div id="avCreate" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="avCreateLabel" aria-hidden="true"> |
898 |
[% INCLUDE 'modals/cataloguing_create_av.inc' %] |
965 |
<div class="modal-dialog"> |
|
|
966 |
<div class="modal-content"> |
967 |
<div class="modal-header"> |
968 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
969 |
<h3 id="avCreateLabel">Create a new authorised value</h3> |
970 |
</div> |
971 |
<form id="add_new_av" method="post"> |
972 |
<div class="modal-body"> |
973 |
<div class="error"></div> |
974 |
<fieldset class="rows"> |
975 |
<ol> |
976 |
<li> |
977 |
<span class="label">Category:</span> |
978 |
<input type="hidden" name="category" value="" /> |
979 |
<span id="new_av_category"></span> |
980 |
</li> |
981 |
<li> |
982 |
<span class="label" for="value">Authorised value:</span> |
983 |
<input type="text" id="value" name="value" /> |
984 |
</li> |
985 |
<li> |
986 |
<span class="label" for="description">Description:</span> |
987 |
<input type="text" id="description" name="description" /> |
988 |
</li> |
989 |
<li> |
990 |
<span class="label" for="opac_description">Description (OPAC):</span> |
991 |
<input type="text" id="opac_description" name="opac_description" /> |
992 |
</li> |
993 |
</ol> |
994 |
</fieldset> |
995 |
</div> |
996 |
<div class="modal-footer"> |
997 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
998 |
<input type="hidden" name="select2" value="" /> |
999 |
<input type="submit" class="btn btn-primary" value="Save"> |
1000 |
</div> |
1001 |
</form> |
1002 |
</div> <!-- /.modal-content --> |
1003 |
</div> <!-- /.modal-dialog --> |
1004 |
</div> <!-- /#avCreate --> |
1005 |
|
899 |
|
1006 |
</div> <!-- /.col-md-10.col-md-offset-1 --> |
900 |
</div> <!-- /.col-md-10.col-md-offset-1 --> |
1007 |
</div> <!-- /.row --> |
901 |
</div> <!-- /.row --> |