odoo/addons/survey/views/survey_templates.xml

420 lines
24 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- List of all the surveys -->
<template id="list" name="Survey List">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<h1>Open surveys</h1>
<div class="table-responsive">
<table class="table table-hover">
<tr><th>Title</th><th>Category</th></tr>
<t t-foreach="surveys" t-as="survey">
<tr>
<td><a t-att-href="survey.public_url"><span t-field="survey.title" /></a></td>
<td><span t-field="survey.category"/></td>
</tr>
</t>
</table>
</div>
</div>
</div>
</t>
</template>
<!-- Thank you message when the survey is completed -->
<template id="finished" name="Survey Finished">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron">
<h1>Thank you!</h1>
<div t-field="survey.thank_you_message" />
</div>
</div>
</div>
</t>
</template>
<!-- Message when the survey is not open -->
<template id="notopen" name="Survey not open">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron">
<h1>Not open</h1>
<p>This survey is not open. Thank you for your interest!</p>
</div>
</div>
</div>
</t>
</template>
<!-- A survey -->
<template id="survey" name="Survey">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/survey/static/src/js/survey.js" />
</t>
<div class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<t t-if="pagination['current'] == -1">
<div class='jumbotron'>
<h1><span t-field='survey.title'/></h1>
<div t-field='survey.description' />
<form role="form" method="post" t-att-name="survey.id.__str__() + '_-1'" t-att-action="'/survey/fill/%s/%s' % (survey.id, token)" target="">
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
<input type="submit" class="btn btn-primary btn-lg active" value="Take survey"/>
</form>
</div>
</t>
<t t-if="pagination['current'] != -1">
<t t-set='page' t-value="survey.page_ids[pagination['current']]" />
<t t-call="survey.page" />
</t>
</div>
</div>
</div>
</div>
</t>
</template>
<!-- Navigation & Submission -->
<template id="navsub" name="Footer for navigation and submission">
<div class="text-center">
<t t-if="pagination['current'] != -1 and survey.users_can_go_back"><input type="button" class="btn active survey-btn" value="Previous page"/></t>
<t t-if="pagination['current'] != -1 and pagination['next'] != 'finished'"><input type="submit" class="btn btn-primary active survey-btn" value="Next page"/></t>
<t t-if="pagination['next'] == 'finished'"><input type="submit" class="btn btn-success active survey-btn" value="Submit survey"/></t>
</div>
</template>
<!-- A page -->
<template id="page" name="Page">
<div class="page-header">
<h1><span t-field='page.title' /></h1>
<div t-field='page.description'/>
<progress t-att-value="pagination['current']+1" t-att-max="len(survey.page_ids)"><t t-raw='"Page %s on %s" % (pagination["current"]+1, len(survey.page_ids))' /></progress>
</div>
<form role="form" method="post" class="js_surveyform" t-att-name="survey.id.__str__() + '_' + pagination['current'].__str__()" t-att-action="'/survey/fill/' + survey.id.__str__()" t-att-data-prefill="'/survey/prefill/' + survey.id.__str__()" t-att-data-validate="'/survey/validate/' + survey.id.__str__()" t-att-data-submit="'/survey/submit/' + survey.id.__str__()">
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
<t t-foreach='page.question_ids' t-as='question'>
<t t-set="prefix" t-value="'%s_%s_%s' % (survey.id, pagination['current'], question.id)" />
<t t-call='survey.question'/>
</t>
<t t-call='survey.navsub' />
</form>
</template>
<!-- A question -->
<template id='question' name='Question'>
<div class="js_question-wrapper" t-att-id="prefix">
<t t-if="question.type in ['free_text']"><t t-call="survey.free_text"/></t>
<t t-if="question.type in ['textbox']"><t t-call="survey.textbox"/></t>
<t t-if="question.type in ['numerical_box']"><t t-call="survey.numerical_box"/></t>
<t t-if="question.type in ['datetime']"><t t-call="survey.datetime"/></t>
<t t-if="question.type in ['simple_choice']"><t t-call="survey.simple_choice"/></t>
<t t-if="question.type in ['multiple_choice']"><t t-call="survey.multiple_choice"/></t>
<t t-if="question.type in ['matrix']"><t t-call="survey.matrix"/></t>
<div class="js_errzone alert alert-danger" style="display:none;"></div>
</div>
</template>
<!-- Question widgets -->
<template id="free_text" name="Free text box">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<textarea class="form-control" rows="3" t-att-name="prefix"></textarea>
</template>
<template id="textbox" name="Text box">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<input type="text" class="form-control" t-att-name="prefix"/>
</template>
<template id="numerical_box" name="Numerical box">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<input type="number" step=".1" class="form-control" t-att-name="prefix"/>
</template>
<template id="datetime" name="Numerical box">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<input type="datetime-local" class="form-control" t-att-name="prefix" placeholder="jj-mm-aaaa hh:mm" />
</template>
<template id="simple_choice" name="Simple choice">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<t t-if="question.simple_choice_display == 'dropdown'">
<div class="js_drop row">
<div class="col-md-6">
<select class="form-control" t-att-name="prefix">
<option disabled="1" selected="1">Choose...</option>
<t t-foreach='question.labels_ids' t-as='label'>
<option><t t-esc='label.value'/></option>
</t>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<option class="js_other_option"><span t-esc="question.children_ids[0].question" /></option>
</t>
</select>
</div>
<div class="col-md-6">
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<input type="text" class="form-control" t-att-name="prefix+'_other'" data-oe-survey-othert="1"/>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div>
<span t-field="question.children_ids[0].question" />
<input type="text" class="form-control" t-att-name="prefix+'_comments'"/>
</div>
</t>
</div>
</div>
</t>
<t t-if="question.simple_choice_display == 'horizontal'">
<div class="js_radio">
<t t-foreach='question.labels_ids' t-as='label'>
<label class="radio-inline">
<input type="radio" t-att-name="prefix" t-att-value='label.id' />
<span t-field='label.value'/>
</label>
</t>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm js_comments">
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/><span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div>
<span t-field="question.children_ids[0].question" />
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</t>
<t t-if="question.simple_choice_display == '1col'">
<div class="js_radio">
<t t-foreach='question.labels_ids' t-as='label'>
<div class="radio">
<label>
<input type="radio" t-att-name="prefix" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm js_comments">
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/><span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div>
<span t-field="question.children_ids[0].question" />
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</t>
<t t-if="question.simple_choice_display == '2col'">
<div class="js_radio">
<div class="row">
<t t-foreach='question.labels_ids' t-as='label'>
<div class="radio col-md-6">
<label>
<input type="radio" t-att-name="prefix" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
</div>
<div class="row">
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm js_comments col-md-6">
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/><span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="col-md-6">
<span t-field="question.children_ids[0].question" />
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
<t t-if="question.simple_choice_display == '3col'">
<div class="js_radio">
<div class="row">
<t t-foreach='question.labels_ids' t-as='label'>
<div class="radio col-md-4">
<label>
<input type="radio" t-att-name="prefix" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
</div>
<div class="row">
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm js_comments col-md-4">
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/><span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="col-md-4">
<span t-field="question.children_ids[0].question" />
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
</template>
<template id="multiple_choice" name="Multiple choice">
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
<t t-if="question.simple_choice_display == 'horizontal'">
<div>
<t t-foreach='question.labels_ids' t-as='label'>
<label class="checkbox-inline">
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</t>
<div>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm col-md-4 js_ck_comments">
<span class="input-group-addon"><input type="checkbox" t-att-name="prefix + '_other'" /> <span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix + '_' + question.children_ids[0].id.__str__()"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="row">
<span t-field="question.children_ids[0].question" class="col-md-4"/>
<input type="text" class="form-control col-md-4" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
<t t-if="question.simple_choice_display == '1col'">
<div>
<t t-foreach='question.labels_ids' t-as='label'>
<div class="checkbox">
<label>
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
<div>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm js_ck_comments">
<span class="input-group-addon"><input type="checkbox" t-att-name="prefix + '_other'" /> <span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix + '_' + question.children_ids[0].id.__str__()"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="row">
<span t-field="question.children_ids[0].question" class="col-md-4"/>
<input type="text" class="form-control col-md-4" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
<t t-if="question.simple_choice_display == '2col'">
<div class="row">
<t t-foreach='question.labels_ids' t-as='label'>
<div class="checkbox col-md-6">
<label>
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
<div>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm col-md-6 js_ck_comments">
<span class="input-group-addon"><input type="checkbox" t-att-name="prefix + '_other'" /> <span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix + '_' + question.children_ids[0].id.__str__()"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="row">
<span t-field="question.children_ids[0].question" class="col-md-4"/>
<input type="text" class="form-control col-md-4" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
<t t-if="question.simple_choice_display == '3col'">
<div class="row">
<t t-foreach='question.labels_ids' t-as='label'>
<div class="checkbox col-md-4">
<label>
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
<span t-field='label.value'/>
</label>
</div>
</t>
<div>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<div class="input-group input-group-sm col-md-4 js_ck_comments">
<span class="input-group-addon"><input type="checkbox" t-att-name="prefix + '_other'" /> <span t-field="question.children_ids[0].question" /></span>
<input type="text" class="form-control" t-att-name="prefix + '_' + question.children_ids[0].id.__str__()"/>
</div>
</t>
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
<div class="row">
<span t-field="question.children_ids[0].question" class="col-md-4"/>
<input type="text" class="form-control col-md-4" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
</div>
</t>
</div>
</div>
</t>
</template>
<!-- Printable view of a survey (all pages) -->
<template id="survey_print" name="Survey">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="row">
<div class='jumbotron'>
<h1><span t-field='survey.title'/></h1>
<t t-if="survey.description is not False"><p><span t-field='survey.description'/></p></t>
</div>
<t t-foreach="survey.page_ids" t-as="page">
<t t-call="survey.page" />
<hr/>
</t>
</div>
</div>
</div>
</t>
</template>
</data>
</openerp>