@ -157,7 +157,7 @@ define([
h ( 'span' , Messages . form _textType ) ,
typeSelect [ 0 ]
] ) ;
typeSelect . onChange . reg ( evOnSave . fire () );
typeSelect . onChange . reg ( evOnSave . fire );
}
setCursorGetter ( function ( ) {
@ -2176,7 +2176,8 @@ define([
} ;
var addResultsButton = function ( framework , content ) {
var $res = $ ( h ( 'button.cp-toolbar-appmenu.cp-toolbar-form-button' , [
var $container = $ ( '.cp-forms-results-participant' ) ;
var $res = $ ( h ( 'button.btn.btn-primary.cp-toolbar-form-button' , [
h ( 'i.fa.fa-bar-chart' ) ,
h ( 'span.cp-button-name' , Messages . form _results )
] ) ) ;
@ -2190,20 +2191,20 @@ define([
$ ( 'body' ) . addClass ( 'cp-app-form-results' ) ;
renderResults ( content , answers ) ;
$res . remove ( ) ;
var $editor = $ ( h ( 'button. cp-toolbar-appmenu ', [
var $editor = $ ( h ( 'button. btn.btn-primary ', [
h ( 'i.fa.fa-pencil' ) ,
h ( 'span.cp-button-name' , APP. isEditor ? Messages. form _editor : Messages . form _form )
h ( 'span.cp-button-name' , Messages. form _editor )
] ) ) ;
$editor . click ( function ( ) {
$ ( 'body' ) . removeClass ( 'cp-app-form-results' ) ;
$editor . remove ( ) ;
addResultsButton ( framework , content ) ;
} ) ;
framework. _ . toolbar . $bottomL . ap pend( $editor ) ;
$container. pre pend( $editor ) ;
} ) ;
} ) ;
framework. _ . toolbar . $bottomL . ap pend( $res ) ;
$container. pre pend( $res ) ;
} ;
Messages . form _alreadyAnswered = "You've responded to this form on {0}" ; // XXX
@ -2213,7 +2214,7 @@ define([
var $formContainer = $ ( 'div.cp-form-creator-content' ) . hide ( ) ;
var $container = $ ( 'div.cp-form-creator-answered' ) . empty ( ) . css ( 'display' , '' ) ;
var viewOnly = content . answers . cantEdit ;
var viewOnly = content . answers . cantEdit || APP . isClosed ;
var action = h ( 'button.btn.btn-primary' , [
viewOnly ? h ( 'i.fa.fa-bar-chart' ) : h ( 'i.fa.fa-pencil' ) ,
h ( 'span' , viewOnly ? Messages . form _viewAnswer : Messages . form _editAnswer )
@ -2238,7 +2239,10 @@ define([
// If responses are public, show button to view them
var responses ;
if ( content . answers . privateKey ) {
responses = h ( 'button.btn.btn-default' , Messages . form _results ) ;
responses = h ( 'button.btn.btn-default' , [
h ( 'i.fa.fa-bar-chart' ) ,
h ( 'span.cp-button-name' , Messages . form _results )
] ) ;
$ ( responses ) . click ( function ( ) {
var sframeChan = framework . _ . sfCommon . getSframeChannel ( ) ;
sframeChan . query ( "Q_FORM_FETCH_ANSWERS" , content . answers , function ( err , obj ) {
@ -2387,10 +2391,7 @@ define([
}
evOnChange . fire ( false , true ) ;
window . onbeforeunload = undefined ;
if ( ! update && content . answers . privateKey ) {
// Add results button
addResultsButton ( framework , content ) ;
}
$send . removeAttr ( 'disabled' ) ;
//UI.alert(Messages.form_sent); // XXX not needed anymore?
$send . text ( Messages . form _update ) ;
@ -2509,7 +2510,7 @@ define([
APP . formBlocks = [ ] ;
if ( APP . isClosed && content . answers . privateKey && ! APP . isEditor ) {
if ( APP . isClosed && content . answers . privateKey && ! APP . isEditor && ! APP . hasAnswered ) {
var sframeChan = framework . _ . sfCommon . getSframeChannel ( ) ;
sframeChan . query ( "Q_FORM_FETCH_ANSWERS" , content . answers , function ( err , obj ) {
var answers = obj && obj . results ;
@ -3073,10 +3074,11 @@ define([
var $toolbarContainer = $ ( '#cp-toolbar' ) ;
if ( APP . isEditor || priv . form _auditorKey ) {
var helpMenu = framework . _ . sfCommon . createHelpMenu ( [ 'text' , 'pad' ] ) ;
$toolbarContainer . after ( helpMenu . menu ) ;
framework . _ . toolbar . $drawer . append ( helpMenu . button ) ;
var helpMenu = framework . _ . sfCommon . createHelpMenu ( [ 'text' , 'pad' ] ) ;
$toolbarContainer . after ( helpMenu . menu ) ;
framework . _ . toolbar . $drawer . append ( helpMenu . button ) ;
if ( ! APP . isEditor && ! priv . form _auditorKey ) {
$ ( helpMenu . menu ) . hide ( ) ;
}
var offlineEl = h ( 'div.alert.alert-danger.cp-burn-after-reading' , Messages . disconnected ) ;
@ -3126,7 +3128,7 @@ define([
} ) ;
} ) ;
Messages . form _makePublicWarning = "Are you sure you want to make responses to this form public? Past and future responses will be visible by participants. This cannot be undone." // XXX existing key
Messages . form _makePublicWarning = "Are you sure you want to make responses to this form public? Past and future responses will be visible by participants. This cannot be undone." ; // XXX existing key
// Private / public status
var resultsType = h ( 'div.cp-form-results-type-container' ) ;
var $results = $ ( resultsType ) ;
@ -3618,9 +3620,6 @@ define([
// If we have a non-anon answer, we can't answer anonymously later
if ( answers [ curve1 ] ) { APP . cantAnon = true ; }
// Add results button
if ( myAnswers ) { addResultsButton ( framework , content ) ; }
updateForm ( framework , content , false , myAnswers ) ;
} ) ;
return ;
@ -3648,9 +3647,6 @@ define([
APP . hasAnswered = true ;
// If we have a non-anon answer, we can't answer anonymously later
if ( ! obj . _isAnon ) { APP . cantAnon = true ; }
// Add results button
if ( content . answers . privateKey ) { addResultsButton ( framework , content ) ; }
}
checkIntegrity ( false ) ;
updateForm ( framework , content , false , answers ) ;