Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Apr 12, 2018

Conversation

miketaylr
Copy link
Member

Copy link
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

@@ -350,7 +350,7 @@ def contributors():

@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.

@@ -5,59 +5,59 @@
</a>
</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 class="link-text" href="/contributors/report-bug">
Working with bugs <span class="nested-sub"></span>
</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
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
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 class="link-text" href="/contributors/report-bug">
Working with bugs <span class="nested-sub"></span>
</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.

@@ -5,59 +5,59 @@
</a>
</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.

@@ -16,8 +16,7 @@
About
</a>
</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.

@@ -40,33 +39,33 @@
</ul>

<!-- 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.

<a class="footer-item-link" href="/contributors/site-outreach">Site Outreach</a>
</li>
</ul>
{% endif %}

<!-- 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
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
Member Author

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

@karlcow
Copy link
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