Projet

Général

Profil

0001-backoffice-use-native-gadjo-style-for-variables-tabl.patch

Frédéric Péters, 08 avril 2020 10:30

Télécharger (4,86 ko)

Voir les différences:

Subject: [PATCH 1/2] backoffice: use native gadjo style for variables table
 (#41316)

 wcs/admin/workflows.py              |  1 -
 wcs/qommon/admin/emails.py          |  8 ++------
 wcs/qommon/admin/texts.py           |  6 ++----
 wcs/qommon/static/css/dc2/admin.css |  9 +++------
 wcs/qommon/substitution.py          | 11 +++++++++--
 5 files changed, 16 insertions(+), 19 deletions(-)
wcs/admin/workflows.py
288 288
            r += htmltext('<h2>%s</h2>') % _(self.item.description)
289 289
            r += form.render()
290 290
            if self.item.support_substitution_variables:
291
                r += htmltext('<h3>%s</h3>') % _('Variables')
292 291
                r += get_publisher().substitutions.get_substitution_html_table()
293 292
            return r.getvalue()
294 293
        else:
wcs/qommon/admin/emails.py
223 223
        r = TemplateIO(html=True)
224 224
        r += htmltext('<h2>%s - %s</h2>') % (_('Email'), email_label)
225 225
        r += form.render()
226

  
227
        r += htmltext('<h3>%s</h3>') % _('Substitution Variables')
228
        r += htmltext('<p>')
229
        r += _('The email subject and body can reference variables from the table below:')
230
        r += htmltext('</p>')
231
        r += get_publisher().substitutions.get_substitution_html_table()
226
        r += get_publisher().substitutions.get_substitution_html_table(
227
                intro=_('The email subject and body can reference variables from the table below:'))
232 228
        return r.getvalue()
233 229

  
234 230
    def email_submit(self, form, email_key, check_template = None):
wcs/qommon/admin/texts.py
146 146
        r = TemplateIO(html=True)
147 147
        r += htmltext('<h2>%s - %s</h2>') % (_('Text'), text_label)
148 148
        r += form.render()
149

  
150
        r += htmltext('<h3>%s</h3>') % _('Substitution Variables')
151
        r += htmltext('<p>%s</p>') % _('The text can reference variables from the table below:')
152
        r += htmltext(get_publisher().substitutions.get_substitution_html_table())
149
        r += get_publisher().substitutions.get_substitution_html_table(
150
                intro=_('The text can reference variables from the table below:'))
153 151
        return r.getvalue()
154 152

  
155 153
    def text_submit(self, form, text_key, check_template = None):
wcs/qommon/static/css/dc2/admin.css
829 829
	border-bottom: 1px solid #bcbcbc;
830 830
}
831 831

  
832
table.franceconnect-attrs,
833
table#substvars {
832
table.franceconnect-attrs {
834 833
	border-bottom: 1px solid #eee;
835 834
	border-collapse: collapse;
836 835
	margin: 1em 0;
837 836
}
838 837

  
839
table.franceconnect-attrs th,
840
table#substvars th {
838
table.franceconnect-attrs th {
841 839
	background: #eee;
842 840
	border: 1px solid #eee;
843 841
	border-style: solid solid none;
......
845 843
	padding: 0 1em;
846 844
}
847 845

  
848
table.franceconnect-attrs td,
849
table#substvars td {
846
table.franceconnect-attrs td {
850 847
	border: 1px solid #eee;
851 848
	padding: 0 1em;
852 849
	border-style: none solid;
wcs/qommon/substitution.py
125 125
        return d
126 126

  
127 127
    @classmethod
128
    def get_substitution_html_table(cls):
128
    def get_substitution_html_table(cls, intro=None):
129 129
        from . import _
130 130
        r = TemplateIO(html=True)
131
        r += htmltext('<table id="substvars">')
131
        r += htmltext('<div class="section">')
132
        r += htmltext('<h3>%s</h3>') % _('Variables')
133
        r += htmltext('<div>')
134
        if intro:
135
            r += htmltext('<p>%s</p>') % intro
136
        r += htmltext('<table id="substvars" class="main">')
132 137
        r += htmltext('<thead><tr><th>%s</th><th>%s</th><th>%s</th></tr></thead>' % (
133 138
                        _('Category'), _('Variable'), _('Comment')))
134 139
        r += htmltext('<tbody>')
......
142 147
                category, '{{ %s }}' % variable, comment))
143 148
        r += htmltext('</tbody>')
144 149
        r += htmltext('</table>')
150
        r += htmltext('</div>')
151
        r += htmltext('</div>')
145 152
        return r.getvalue()
146 153

  
147 154

  
148
-