Skip to content

Commit

Permalink
Rename sublabel to option
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Apr 26, 2019
1 parent 85b0103 commit 7592c8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions funnel/templates/labels.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
{% if label.has_options %}
<h3 class="mui--text-title mui--text-bold label-box__heading">{% if label.icon_emoji %}{{ label.icon_emoji }}{% endif %} {{ label.title }}</h3>
<div class="sublabel-wrapper">
{%- for sublabel in label.options %}
<span class="mui--text-subhead mui--text-light label-box__subheading">{% if sublabel.icon_emoji %}{{ sublabel.icon_emoji }} {% endif %}{{ sublabel.title }}</span>
{%- for option in label.options %}
<span class="mui--text-subhead mui--text-light label-box__subheading">{% if option.icon_emoji %}{{ option.icon_emoji }} {% endif %}{{ option.title }}</span>
{% else %}
<span class="mui--text-subhead mui--text-light"><em>{% trans %}(No labels){% endtrans %}</em></span>
{%- endfor %}
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/labels_form.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{% endfor %}
{% endif %}
</div>
<div><button class="mui-btn mui-btn--raised mui-btn--accent" id="add-sublabel-form"><i class="material-icons mui--align-middle mui--text-subhead">add</i> Add Sublabel</button></div>
<div><button class="mui-btn mui-btn--raised mui-btn--accent" id="add-sublabel-form"><i class="material-icons mui--align-middle mui--text-subhead">add</i> Add option</button></div>
{%- if subforms|length > 0 %}
{{ renderfield(form.required) }}
{%- else -%}
Expand Down
10 changes: 5 additions & 5 deletions funnel/views/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand Down Expand Up @@ -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]
Expand All @@ -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)
Expand Down

0 comments on commit 7592c8f

Please sign in to comment.