adding a ExpandField feature to MARC editor : all subfields that are empty and not mandatory are hidden by default. a click on the tag title expand all of them. This is better imho than the previous minimizer, because :

Note that the minimize/expand by default behaviour could be changed to use the hidden property. Il let LibLime guys say what they think of this proposal, and discuss another behaviour.
Anyway, it proves that the new editor is better than the previous one as it can evolve easily ;-)

Signed-off-by: Chris Cormack <crc@liblime.com>
This commit is contained in:
Paul POULAIN 2007-08-08 17:39:46 +02:00 committed by Chris Cormack
parent e1f5681bbf
commit 3f9017b349
3 changed files with 22 additions and 11 deletions

View file

@ -302,8 +302,9 @@ sub create_input {
}
$subfield_data{visibility} = "display:none;"
unless ( ( $tagslib->{$tag}->{$subfield}->{hidden} % 2 == 0 )
or $value ne '' ); #check parity
if ( ($tagslib->{$tag}->{$subfield}->{hidden} % 2 == 1) and $value ne ''
or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory})
);
# it's an authorised field
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {

View file

@ -111,9 +111,8 @@
<!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
<!-- TMPL_VAR NAME="tag_lib" -->
<a onClick="ExpandField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'-->')"><!-- TMPL_VAR NAME="tag_lib" --></a>
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF name="repeatable" -->
<span class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'-->')">+</span>
<!-- /TMPL_IF -->
@ -324,6 +323,21 @@ function openAuth(tagid,authtype,X) {
newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&tagid="+Y, "value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
}
function ExpandField(index) {
var original = document.getElementById(index); //original <div>
var divs = original.getElementsByTagName('div');
for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield
if (divs[i].style.display == 'block') {
divs[i].style.display = 'none';
} else {
divs[i].style.display = 'block';
}
}
}
}
/**
* To clone a field or a subfield by clickink on '+' button
*/

View file

@ -489,7 +489,7 @@ legend {
#tabs {
margin-top:35px;
margin-bottom:20px;
margin-bottom:10px;
}
/* styles for the 11 content blocks */
@ -560,13 +560,12 @@ a.info:hover span {
/* the style of tag description */
div.tag_title {
font-weight:bold;
cursor:pointer;
}
div.tag_title span {
display:inline;
letter-spacing:5px;
font-size:1.2em;
text-transform: capitalize;
font-size:1em;
color : #027ac6;
}
@ -574,9 +573,6 @@ div.tag_title a:hover{
text-decoration:none;
}
div.tag {
margin-bottom:1.8em;
}
.subfield_line{
margin-left:1.1em;