Implemented Survey Jump-to combo box (#9202)
You will need to manually import survey_rfe_9202 until this branch is merged back into trunk.
This commit is contained in:
parent
7a42b4b241
commit
4fe81a69f6
4 changed files with 18 additions and 3 deletions
|
|
@ -456,6 +456,11 @@ sub www_loadSurvey {
|
|||
elsif ( $var->{type} eq 'answer' ) {
|
||||
$editHtml = $self->processTemplate( $var, $self->get("answerEditTemplateId") );
|
||||
}
|
||||
|
||||
# Generate the list of valid goto targets
|
||||
my @section_vars = map {$_->{variable}} @{$self->survey->sections};
|
||||
my @question_vars = map {$_->{variable}} @{$self->survey->questions};
|
||||
my @gotoTargets = grep {$_ ne ''} (@section_vars, @question_vars);
|
||||
|
||||
my %buttons;
|
||||
$buttons{question} = $$address[0];
|
||||
|
|
@ -509,7 +514,8 @@ sub www_loadSurvey {
|
|||
#type is the object type
|
||||
my $return = {
|
||||
"address", $address, "buttons", \%buttons, "edithtml", $editHtml,
|
||||
"ddhtml", $html, "ids", \@ids, "type", $var->{type}
|
||||
"ddhtml", $html, "ids", \@ids, "type", $var->{type},
|
||||
gotoTargets => \@gotoTargets,
|
||||
};
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return to_json($return);
|
||||
|
|
|
|||
BIN
survey_rfe_9202.wgpkg
Normal file
BIN
survey_rfe_9202.wgpkg
Normal file
Binary file not shown.
|
|
@ -77,11 +77,17 @@ YAHOO.log('adding handler for '+ d.ids[x]);
|
|||
// }
|
||||
if(d.buttons['answer']){
|
||||
var button = new YAHOO.widget.Button({ label:"Add Answer", id:"addanswer", container:"addAnswer" });
|
||||
button.on("click", this.addAnswer,d.buttons['answer']);
|
||||
button.on("click", this.addAnswer,d.buttons['answer']);
|
||||
}
|
||||
|
||||
if(showEdit == 1){
|
||||
this.loadObjectEdit(d.edithtml,d.type);
|
||||
|
||||
// build the goto auto-complete widget
|
||||
if (d.gotoTargets && document.getElementById('goto')) {
|
||||
var ds = new YAHOO.util.LocalDataSource(d.gotoTargets);
|
||||
var ac = new YAHOO.widget.AutoComplete('goto', 'goto-yui-ac-container', ds);
|
||||
}
|
||||
}else{
|
||||
document.getElementById('edit').innerHTML = "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,7 @@ li.newAnswer {
|
|||
padding-left:50px;
|
||||
# cursor: move;
|
||||
}
|
||||
|
||||
#goto-yui-ac {
|
||||
width:15em;
|
||||
margin-top:0.5em;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue