Browse Source

[ADD] SCSS style custom on survey

12.0
Rémi FRANÇOIS 4 years ago
parent
commit
cff95bcb4f
  1. 1
      survey_input_template_custom/__manifest__.py
  2. 78
      survey_input_template_custom/i18n/fr.po
  3. 52
      survey_input_template_custom/i18n/survey_input_template_custom.pot
  4. 32
      survey_input_template_custom/models/survey_survey.py
  5. 10
      survey_input_template_custom/templates/layout.xml
  6. 11
      survey_input_template_custom/views/survey_survey.xml

1
survey_input_template_custom/__manifest__.py

@ -15,6 +15,7 @@
'survey_description',
],
'data': [
'templates/layout.xml',
'templates/page.xml',
'templates/sfinished.xml',
'templates/survey_init.xml',

78
survey_input_template_custom/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-25 23:45+0000\n"
"PO-Revision-Date: 2020-03-25 23:45+0000\n"
"POT-Creation-Date: 2020-08-18 14:54+0000\n"
"PO-Revision-Date: 2020-08-18 14:54+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -15,6 +15,80 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: survey_input_template_custom
#: code:addons/survey_input_template_custom/models/survey_survey.py:9
#, python-format
msgid "/* Background (start and thank you) */\n"
"/* .jumbotron {\n"
" background-color: #e9ecef;\n"
"} */\n"
"\n"
"/* Titles (survey and pages) */\n"
"/* h1 {} */\n"
"/* Descriptions (survey and pages) */\n"
"/* p {} */\n"
"\n"
"/* Questions (title) */\n"
"/* h2 {} */\n"
"/* Responses labels */\n"
"/* label {} */\n"
"\n"
"/* Buttons (start, navigate and submit) */\n"
"/* .btn-primary {\n"
" color: #FFFFFF;\n"
" background-color: #00A09D;\n"
" border-color: #00A09D;\n"
"} */\n"
"/* .btn-primary:hover {\n"
" color: #FFFFFF;\n"
" background-color: #007a77;\n"
" border-color: #006d6b;\n"
"} */"
msgstr "/* Arrière-plan (début et fin) */\n"
"/* .jumbotron {\n"
" background-color: #e9ecef;\n"
"} */\n"
"\n"
"/* Titres (sondage et pages) */\n"
"/* h1 {} */\n"
"/* Descriptions (sondage et pages) */\n"
"/* p {} */\n"
"\n"
"/* Questions (titre) */\n"
"/* h2 {} */\n"
"/* Labels des réponses */\n"
"/* label {} */\n"
"\n"
"/* Boutons (début, navigation et soumission) */\n"
"/* .btn-primary {\n"
" color: #FFFFFF;\n"
" background-color: #00A09D;\n"
" border-color: #00A09D;\n"
"} */\n"
"/* .btn-primary:hover {\n"
" color: #FFFFFF;\n"
" background-color: #007a77;\n"
" border-color: #006d6b;\n"
"} */"
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "<i class=\"fa fa-exclamation-triangle text-warning\"/>\n"
" This SCSS stylesheet will be injected in the layout of user response to a survey. Be sure of what you do when you decide to modify this field."
msgstr "<i class=\"fa fa-exclamation-triangle text-warning\"/>\n"
" Cette feuille de style SCSS sera injectée dans la mise en forme des pages de réponse au sondage. Soyez sûr de ce que vous faites lorsque vous modifiez ce champ."
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "Page title"
msgstr "Titre de la page"
#. module: survey_input_template_custom
#: model:ir.model.fields,field_description:survey_input_template_custom.field_survey_survey__scss_style
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "SCSS style"
msgstr "Style SCSS"
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_init
msgid "Start Survey"

52
survey_input_template_custom/i18n/survey_input_template_custom.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-25 23:45+0000\n"
"PO-Revision-Date: 2020-03-25 23:45+0000\n"
"POT-Creation-Date: 2020-08-18 14:53+0000\n"
"PO-Revision-Date: 2020-08-18 14:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -15,6 +15,54 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: survey_input_template_custom
#: code:addons/survey_input_template_custom/models/survey_survey.py:9
#, python-format
msgid "/* Background (start and thank you) */\n"
"/* .jumbotron {\n"
" background-color: #e9ecef;\n"
"} */\n"
"\n"
"/* Titles (survey and pages) */\n"
"/* h1 {} */\n"
"/* Descriptions (survey and pages) */\n"
"/* p {} */\n"
"\n"
"/* Questions (title) */\n"
"/* h2 {} */\n"
"/* Responses labels */\n"
"/* label {} */\n"
"\n"
"/* Buttons (start, navigate and submit) */\n"
"/* .btn-primary {\n"
" color: #FFFFFF;\n"
" background-color: #00A09D;\n"
" border-color: #00A09D;\n"
"} */\n"
"/* .btn-primary:hover {\n"
" color: #FFFFFF;\n"
" background-color: #007a77;\n"
" border-color: #006d6b;\n"
"} */"
msgstr ""
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "<i class=\"fa fa-exclamation-triangle text-warning\"/>\n"
" This SCSS stylesheet will be injected in the layout of user response to a survey. Be sure of what you do when you decide to modify this field."
msgstr ""
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "Page title"
msgstr ""
#. module: survey_input_template_custom
#: model:ir.model.fields,field_description:survey_input_template_custom.field_survey_survey__scss_style
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_survey_form
msgid "SCSS style"
msgstr ""
#. module: survey_input_template_custom
#: model_terms:ir.ui.view,arch_db:survey_input_template_custom.survey_init
msgid "Start Survey"

32
survey_input_template_custom/models/survey_survey.py

@ -1,9 +1,39 @@
from odoo import models, fields
from odoo import models, fields, api, _
class SurveySurvey(models.Model):
_inherit = 'survey.survey'
@api.model
def _get_default_style(self):
return _("""/* Background (start and thank you) */
/* .jumbotron {
background-color: #e9ecef;
} */
/* Titles (survey and pages) */
/* h1 {} */
/* Descriptions (survey and pages) */
/* p {} */
/* Questions (title) */
/* h2 {} */
/* Responses labels */
/* label {} */
/* Buttons (start, navigate and submit) */
/* .btn-primary {
color: #FFFFFF;
background-color: #00A09D;
border-color: #00A09D;
} */
/* .btn-primary:hover {
color: #FFFFFF;
background-color: #007a77;
border-color: #006d6b;
} */""")
scss_style = fields.Text(string="SCSS style", default=_get_default_style)
start_btn_label = fields.Char(string="Start button label", translate=True, track_visibility='onchange',
help="This label will be used in the survey start button. If empty, the label will be \"Start survey\".")
submit_btn_label = fields.Char(string="Submit button label", translate=True, track_visibility='onchange',

10
survey_input_template_custom/templates/layout.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="layout" inherit_id="survey.layout">
<xpath expr="//main/*[1]" position="before">
<style t-if="survey.scss_style" t-raw="survey.scss_style"/>
</xpath>
</template>
</odoo>

11
survey_input_template_custom/views/survey_survey.xml

@ -8,7 +8,7 @@
<field name="priority">21</field>
<field name="arch" type="xml">
<field name="thank_you_message" position="before">
<field name="thank_you_title" string="Titre de la page"/>
<field name="thank_you_title" string="Page title"/>
</field>
<xpath expr="//notebook/page[descendant::field[@name='users_can_go_back']]" position="inside">
<group col="4">
@ -16,6 +16,15 @@
<field name="submit_btn_label"/>
</group>
</xpath>
<xpath expr="//notebook/page[last()]" position="after">
<page name="scss_style" string="SCSS style" groups="base.group_system">
<div class="text-muted mb16">
<i class="fa fa-exclamation-triangle text-warning"/>
This SCSS stylesheet will be injected in the layout of user response to a survey. Be sure of what you do when you decide to modify this field.
</div>
<field name="scss_style" widget="ace" options="{'mode': 'scss'}"/>
</page>
</xpath>
</field>
</record>

Loading…
Cancel
Save