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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move modal out of dropdown markup, ensure index matches slug #3291

Merged
merged 2 commits into from Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions warehouse/templates/manage/manage_base.html
Expand Up @@ -99,12 +99,3 @@ <h3 class="modal__title">{{ title }} {{ confirm_string }}?</h3>
</a>
{{ confirm_modal(title, confirm_name, confirm_string, slug, index=None, extra_fields=extra_fields, action=action) }}
{% endmacro %}

{% macro confirm_dropdown(title, confirm_name, confirm_string, index=None, extra_fields=None, action=None) %}
{% set slug = title.lower().replace(' ', '-') + '-modal' + ('-{}'.format(index) if index else '') %}
<a href="#{{ slug }}" class="dropdown__link">
<i class="fa fa-trash" aria-hidden="true"></i>
Delete
</a>
{{ confirm_modal(title, confirm_name, confirm_string, slug, index=index, extra_fields=extra_fields, action=action) }}
{% endmacro %}
8 changes: 7 additions & 1 deletion warehouse/templates/manage/release.html
Expand Up @@ -74,12 +74,18 @@ <h2 class="heading-wsubtitle__heading">Release Version {{ release.version }}</h2
<i class="fa fa-hashtag" aria-hidden="true"></i>
View Hashes
</a>
{% set title = "Delete File" %}
{% set slug = title.lower().replace(' ', '-') + '-modal-{}'.format(loop.index) %}
<a href="#{{ slug }}" class="dropdown__link">
<i class="fa fa-trash" aria-hidden="true"></i>
Delete
</a>
{% set extra_fields %}
<input name="file_id" type="hidden" value="{{ file.id }}">
{% endset %}
{{ confirm_dropdown("Delete File", "Filename", file.filename, index=loop.index, extra_fields=extra_fields) }}
</div>
</div>
{{ confirm_modal(title, "Filename", file.filename, slug, index=loop.index, extra_fields=extra_fields) }}
</td>
</tr>
{% endfor %}
Expand Down
10 changes: 8 additions & 2 deletions warehouse/templates/manage/releases.html
Expand Up @@ -61,10 +61,16 @@ <h2>Releases ({{ project.releases|length }})</h2>
<i class="fa fa-eye" aria-hidden="true"></i>
View
</a>
{% set action = request.route_path('manage.project.release', project_name=project.name, version=release.version) %}
{{ confirm_dropdown("Delete Release", "Version", release.version, index=loop.index, action=action) }}
{% set title = "Delete Release" %}
{% set slug = title.lower().replace(' ', '-') + '-modal-{}'.format(loop.index) %}
<a href="#{{ slug }}" class="dropdown__link">
<i class="fa fa-trash" aria-hidden="true"></i>
Delete
</a>
</div>
</div>
{% set action = request.route_path('manage.project.release', project_name=project.name, version=release.version) %}
{{ confirm_modal(title, "Version", release.version, slug, index=loop.index, action=action) }}
</td>
</tr>
{% endfor %}
Expand Down