Skip to content

Fixes #2337: Refactor contributor routes for simpler nav/sub-nav templates.#2387

Merged
karlcow merged 2 commits intomasterfrom
issues/2337/1
Apr 12, 2018
Merged

Fixes #2337: Refactor contributor routes for simpler nav/sub-nav templates.#2387
karlcow merged 2 commits intomasterfrom
issues/2337/1

Conversation

@miketaylr
Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miketaylr Thanks.

My bad for NOT (edited) noticing this before. Aka the templates contained these rules with endpoint before, while we could have used rule. But we have an opportunity to change that. So I'm sending this with a weak request changes. Your PR is working as-is. but we probably don't have to change views.py

Comment thread webcompat/views.py
@app.route('/contributors/report-bug')
@cache_policy(private=True, uri_max_age=0, must_revalidate=True)
def contributors_report_bug():
def contributors_bug_report():

This comment was marked as abuse.

</li>

<li class="sub-nav-item {% if request.url_rule.endpoint in ['contributors_report_bug', 'contributors_reproduce_bug', 'contributors_diagnose_bug', 'contributors_site_outreach'] %} active {% endif %}">
<li class="sub-nav-item {% if 'contributors_bug_' in request.url_rule.endpoint %} active {% endif %}">

This comment was marked as abuse.

This comment was marked as abuse.

</a>
<ol class="nested-sub-nav">
<li class="nested-sub-nav-item {% if request.url_rule.endpoint == 'contributors_report_bug' %} sub-nav-active{% endif %}">
<li class="nested-sub-nav-item {% if request.url_rule.endpoint == 'contributors_bug_report' %} sub-nav-active{% endif %}">

This comment was marked as abuse.

This comment was marked as abuse.

@@ -5,59 +5,59 @@
</a>

This comment was marked as abuse.

@miketaylr
Copy link
Copy Markdown
Member Author

miketaylr commented Apr 12, 2018

Aka the templates contained these rules with endpoint before, while we could have used rule. But we have an opportunity to change that. So I'm sending this with a weak request changes.

Yep, makes sense! Happy to make the changes.

edit: looking at this more, I think it's a little nicer to use endpoint rather than rule. But if you feel strongly, we can re-do this. It just means the template is a little more verbose than my proposal.

Copy link
Copy Markdown
Member Author

@miketaylr miketaylr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(oops, left my comments as part of a Review)

</a>
<ol class="nested-sub-nav">
<li class="nested-sub-nav-item {% if request.url_rule.endpoint == 'contributors_report_bug' %} sub-nav-active{% endif %}">
<li class="nested-sub-nav-item {% if request.url_rule.endpoint == 'contributors_bug_report' %} sub-nav-active{% endif %}">

This comment was marked as abuse.

</li>

<li class="sub-nav-item {% if request.url_rule.endpoint in ['contributors_report_bug', 'contributors_reproduce_bug', 'contributors_diagnose_bug', 'contributors_site_outreach'] %} active {% endif %}">
<li class="sub-nav-item {% if 'contributors_bug_' in request.url_rule.endpoint %} active {% endif %}">

This comment was marked as abuse.

</li>
<li class="footer-item{% if request.url_rule.endpoint in
['contributors_build_tools', 'contributors_web_platform_research', 'contributors_organize_webcompat_events', 'contributors', 'contributors_report_bug', 'contributors_reproduce_bug', 'contributors_diagnose_bug', 'contributors_site_outreach'] %} active{% endif %}">
<li class="footer-item{% if 'contributors' in request.url_rule.endpoint %} active{% endif %}">

This comment was marked as abuse.


<!-- sub nav for contribute > working with bugs -->
{% if request.url_rule.endpoint in ['contributors_report_bug', 'contributors_reproduce_bug', 'contributors_diagnose_bug', 'contributors_site_outreach'] %}
{% if 'contributors_bug_' in request.url_rule.endpoint %}

This comment was marked as abuse.


<!-- sub nav for contribute > other contributions -->
{% if request.url_rule.endpoint in ['contributors_build_tools', 'contributors_web_platform_research', 'contributors_organize_webcompat_events'] %}
{% if 'contributors_other_' in request.url_rule.endpoint %}

This comment was marked as abuse.

Copy link
Copy Markdown
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok understood! Indeed it makes sense.

@miketaylr Thanks for the explanations. Super useful.

@karlcow karlcow merged commit e205f37 into master Apr 12, 2018
@miketaylr miketaylr deleted the issues/2337/1 branch April 12, 2018 22:02
@miketaylr
Copy link
Copy Markdown
Member Author

Thanks @karlcow for your review, I didn't know about request.url_rule.rule. 🎈

@karlcow
Copy link
Copy Markdown
Member

karlcow commented Apr 12, 2018

As a kind of followup on this #2391

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants