From 7592c8faeae657ba7265dbb67ca0cb26eb33c128 Mon Sep 17 00:00:00 2001 From: Kiran Jonnalagadda Date: Fri, 26 Apr 2019 22:08:52 +0530 Subject: [PATCH] Rename sublabel to option --- funnel/templates/labels.html.jinja2 | 4 ++-- funnel/templates/labels_form.html.jinja2 | 2 +- funnel/views/label.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/funnel/templates/labels.html.jinja2 b/funnel/templates/labels.html.jinja2 index a2c2e7e0e..1cd06585f 100644 --- a/funnel/templates/labels.html.jinja2 +++ b/funnel/templates/labels.html.jinja2 @@ -26,8 +26,8 @@ {% if label.has_options %}

{% if label.icon_emoji %}{{ label.icon_emoji }}{% endif %} {{ label.title }}

- {%- for sublabel in label.options %} - {% if sublabel.icon_emoji %}{{ sublabel.icon_emoji }} {% endif %}{{ sublabel.title }} + {%- for option in label.options %} + {% if option.icon_emoji %}{{ option.icon_emoji }} {% endif %}{{ option.title }} {% else %} {% trans %}(No labels){% endtrans %} {%- endfor %} diff --git a/funnel/templates/labels_form.html.jinja2 b/funnel/templates/labels_form.html.jinja2 index a80d1392e..f52c2f080 100644 --- a/funnel/templates/labels_form.html.jinja2 +++ b/funnel/templates/labels_form.html.jinja2 @@ -54,7 +54,7 @@ {% endfor %} {% endif %}
-
+
{%- if subforms|length > 0 %} {{ renderfield(form.required) }} {%- else -%} diff --git a/funnel/views/label.py b/funnel/views/label.py index 58b01d12d..b0265eb48 100644 --- a/funnel/views/label.py +++ b/funnel/views/label.py @@ -41,9 +41,9 @@ def new_label(self): emptysubform = LabelOptionForm(MultiDict({})) if form.validate_on_submit(): # This form can send one or multiple values for title and icon_emoji. - # If the label doesn't have any sublabel, one value is sent for each list, + # If the label doesn't have any options, one value is sent for each list, # and those values are also available at `form.data`. - # But in case there are sublabels, the sublabel values are in the list + # But in case there are options, the option values are in the list # in the order they appeared on the create form. titlelist = request.values.getlist('title') emojilist = request.values.getlist('icon_emoji') @@ -64,7 +64,7 @@ def new_label(self): }), meta={'csrf': False}) # parent form has valid CSRF token if not subform.validate(): - flash(_("Error with a sublabel: {}").format(subform.errors.pop()), category='error') + flash(_("Error with a label option: {}").format(subform.errors.pop()), category='error') return dict(title="Add label", form=form, project=self.obj) else: subl = Label(project=self.obj) @@ -130,7 +130,7 @@ def edit(self): for idx, title in enumerate(titlelist): if namelist[idx]: - # existing sublabel + # existing option subl = Label.query.filter_by(project=self.obj.project, name=namelist[idx]).first() subl.title = titlelist[idx] subl.icon_emoji = emojilist[idx] @@ -141,7 +141,7 @@ def edit(self): }), meta={'csrf': False}) # parent form has valid CSRF token if not subform.validate(): - flash(_("Error with a sublabel: {}").format(subform.errors.pop()), category='error') + flash(_("Error with a label option: {}").format(subform.errors.pop()), category='error') return dict(title="Edit label", form=form, project=self.obj.project) else: subl = Label(project=self.obj.project)