From cff95bcb4f96c1f889d52ebdb16055fb9c51701f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20FRAN=C3=87OIS?= Date: Tue, 18 Aug 2020 17:05:25 +0200 Subject: [PATCH] [ADD] SCSS style custom on survey --- survey_input_template_custom/__manifest__.py | 1 + survey_input_template_custom/i18n/fr.po | 78 ++++++++++++++++++- .../i18n/survey_input_template_custom.pot | 52 ++++++++++++- .../models/survey_survey.py | 32 +++++++- .../templates/layout.xml | 10 +++ .../views/survey_survey.xml | 11 ++- 6 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 survey_input_template_custom/templates/layout.xml diff --git a/survey_input_template_custom/__manifest__.py b/survey_input_template_custom/__manifest__.py index ec2b8ff..98938a2 100644 --- a/survey_input_template_custom/__manifest__.py +++ b/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', diff --git a/survey_input_template_custom/i18n/fr.po b/survey_input_template_custom/i18n/fr.po index 63d1426..87afc43 100644 --- a/survey_input_template_custom/i18n/fr.po +++ b/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 "\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 "\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" diff --git a/survey_input_template_custom/i18n/survey_input_template_custom.pot b/survey_input_template_custom/i18n/survey_input_template_custom.pot index 9a1c118..7c07985 100644 --- a/survey_input_template_custom/i18n/survey_input_template_custom.pot +++ b/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 "\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" diff --git a/survey_input_template_custom/models/survey_survey.py b/survey_input_template_custom/models/survey_survey.py index 06c18eb..8b3d3fa 100644 --- a/survey_input_template_custom/models/survey_survey.py +++ b/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', diff --git a/survey_input_template_custom/templates/layout.xml b/survey_input_template_custom/templates/layout.xml new file mode 100644 index 0000000..a63a404 --- /dev/null +++ b/survey_input_template_custom/templates/layout.xml @@ -0,0 +1,10 @@ + + + +