@@ -, +, @@
editor
- You can click on any part of the element to drag it, the move
icon to the left of the item is a good place to do it.
=> You can only change the order of fields of the same tag.
- Duplicate fields/subfields
- Remove fields/subfields
- Using the tag editor for control fields or to link authorities
- etc
- Empty subfields should appear after the ones with content.
---
cataloguing/addbiblio.pl | 2 +-
koha-tmpl/intranet-tmpl/prog/css/addbiblio.css | 51 ++++++++++++++++++--
.../prog/en/modules/authorities/authorities.tt | 28 +++++++----
.../authorities/blinddetail-biblio-search.tt | 6 +--
.../prog/en/modules/cataloguing/addbiblio.tt | 28 +++++++----
koha-tmpl/intranet-tmpl/prog/img/up.png | Bin 362 -> 0 bytes
koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 52 +++++++++------------
7 files changed, 108 insertions(+), 59 deletions(-)
delete mode 100644 koha-tmpl/intranet-tmpl/prog/img/up.png
--- a/cataloguing/addbiblio.pl
+++ a/cataloguing/addbiblio.pl
@@ -511,7 +511,7 @@ sub build_tabs {
for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
my @loop_data = (); #innerloop in the template.
my $i = 0;
- foreach my $tag (@tab_data) {
+ foreach my $tag (sort @tab_data) {
$i++;
next if ! $tag;
my ($indicator1, $indicator2);
--- a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css
+++ a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css
@@ -15,6 +15,49 @@ div#toolbar {
margin: .3em 0;
}
+ul.sortable_field, ul.sortable_subfield {
+ margin-bottom: 0;
+ padding-left: 0;
+}
+
+ul li.tag, ul li.tag li.subfield_line {
+ list-style-type: none;
+ position: relative;
+ padding-left: 30px;
+}
+
+ul li.tag:before, ul li.tag li.subfield_line:before {
+ position: absolute;
+ font-family: 'FontAwesome';
+ font-size: .8em;
+ top: 0;
+ left: 10px;
+ content: "\f047";
+}
+
+ul li.tag:before {
+ padding-top: 1.7em;
+}
+
+li.ui-sortable-helper {
+ background-color: #e0e0e0;
+ max-height: 150px;
+ padding: 2px;
+ border-radius: 4px;
+}
+
+li.ui-sortable-helper ul li {
+ display: none !important;
+}
+
+.sortable_subfield .ui-sortable-helper input.flat {
+ background-color: transparent;
+}
+
+ul li.tag li.subfield_line.ui-sortable-helper::before {
+ top: 5px;
+}
+
.buttonPlus {
font-weight : bold;
text-decoration : none;
@@ -44,14 +87,14 @@ a.expandfield {
padding: .7em 0;
}
-div.subfield_line {
+li.subfield_line {
padding-bottom: .3em;
float: left;
clear: left;
width: 100%;
}
-div.subfield_line label {
+li.subfield_line label {
font-size:89%;
float: left;
padding-right : .4em;
@@ -262,7 +305,7 @@ tbody tr.active td {
}
@media (min-width: 768px) {
- div.subfield_line label {
+ li.subfield_line label {
width: 20em;
}
@@ -276,7 +319,7 @@ tbody tr.active td {
}
@media (min-width: 1200px) {
- div.subfield_line label {
+ li.subfield_line label {
width: 25em;
}
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
@@ -12,7 +12,9 @@
});
var Sticky;
$(document).ready(function() {
- $('#authoritytabs').tabs();
+ var tabs = $('#authoritytabs').tabs();
+ $( "ul.sortable_field", tabs ).sortable();
+ $( "ul.sortable_subfield", tabs ).sortable();
Sticky = $("#toolbar");
Sticky.hcSticky({
stickTo: ".main",
@@ -235,9 +237,17 @@ function confirmnotdup(redirect){
[% FOREACH BIG_LOO IN BIG_LOOP %]
+ [% previous = "" %]
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.tag ) %]
-
+ [% IF innerloo.tag != previous %]
+ [% IF previous != "" %]
+
+ [% END %]
+ [% previous = innerloo.tag %]
+
+
+
[% END %]
+
[% END %]
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt
@@ -46,7 +46,7 @@
} catch(e) {
return;
}
- var field_start = whichfield.parentNode.parentNode;
+ var field_start = whichfield.parentNode.parentNode.parentNode;
// Sets the good number of form fields for the specified subfield
// Returns false if the cloning failed
@@ -58,7 +58,7 @@
// Find the subfield we want to clone
var re = new RegExp('^subfield' + subfield_name,'g');
- var subfields = $(field_start).children('div').filter( function() {
+ var subfields = $(field_start).children('ul').children('li').filter( function() {
return this.id.match(re);
});
@@ -89,7 +89,7 @@
// Find the subfields where we will add the new values
var re = new RegExp('^subfield' + subfield_name,'g');
- var subfields = $(field_start).children('div').filter( function() {
+ var subfields = $(field_start).children('ul').children('li').filter( function() {
return this.id.match(re);
});
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
@@ -23,9 +23,11 @@
$("#toolbar").hide();
[% END %]
- $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
+ var $tabs = $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
$("#"+ui.panel.id+" input:eq(0)").focus();
});
+ $( "ul.sortable_field", $tabs ).sortable();
+ $( "ul.sortable_subfield", $tabs ).sortable();
[% IF tab %]
link = $("a[href='#[% tab | html %]']");
@@ -659,9 +661,17 @@
[% IF ( BIG_LOOP.size > 1 ) %]
Section [% BIG_LOO.number | html %]
[% END %]
+ [% previous = "" %]
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.tag ) %]
-
+ [% IF innerloo.tag != previous %]
+ [% IF previous != "" %]
+
+ [% END %]
+ [% previous = innerloo.tag %]
+
+ [% END %]
+ -
+
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
-
+
[% END # /FOREACH subfield_loop %]
-
+
+
[% END %]
[% END # /FOREACH BIG_LOO.innerloop %]
+
[% END # /FOREACH BIG_LOOP %]
--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
@@ -56,20 +56,20 @@ function openAuth(tagsubfieldid,authtype,source) {
}
function ExpandField(index) {
- var original = document.getElementById(index); //original
- var divs = original.getElementsByTagName('div');
- for(var i=0,divslen = divs.length ; i
+ var lis = original.getElementsByTagName('li');
+ for(var i=0,lislen = lis.length ; i show all subfields
- divs[i].style.display = 'block';
- } else if (divs[i].style.display == 'none') {
+ lis[i].style.display = 'block';
+ } else if (lis[i].style.display == 'none') {
// show
- divs[i].style.display = 'block';
+ lis[i].style.display = 'block';
} else {
// hide
- divs[i].style.display = 'none';
+ lis[i].style.display = 'none';
}
}
}
@@ -101,16 +101,16 @@ var Select2Utils = {
* @param advancedMARCEditor '0' for false, '1' for true
*/
function CloneField(index, hideMarc, advancedMARCEditor) {
- var original = document.getElementById(index); //original
+ var original = document.getElementById(index); //original
Select2Utils.removeSelect2(original);
var clone = original.cloneNode(true);
var new_key = CreateKey();
var new_id = original.getAttribute('id')+new_key;
- clone.setAttribute('id',new_id); // setting a new id for the parent div
+ clone.setAttribute('id',new_id); // setting a new id for the parent li
- var divs = clone.getElementsByTagName('div');
+ var divs = Array.from(clone.getElementsByTagName('li')).concat(Array.from(clone.getElementsByTagName('div')));
// if hide_marc, indicators are hidden fields
// setting a new name for the new indicator
@@ -120,10 +120,10 @@ function CloneField(index, hideMarc, advancedMARCEditor) {
}
// settings all subfields
- for(var i=0,divslen = divs.length ; i