Skip to content

Commit

Permalink
Add modal to prompt for delete of version (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ewoutvans authored and progwml6 committed Mar 26, 2018
1 parent 43dd31c commit 66b8767
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
39 changes: 31 additions & 8 deletions app/views/projects/versions/view.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,9 @@ <h1 class="pull-left">@v.v.versionString</h1>
<i class="fa fa-trash"></i> @messages("general.delete")
</a>
} else {
@form(action = versionRoutes.delete(
v.p.project.ownerName, v.p.project.slug, v.v.versionString),
'class -> "form-inline") {
@CSRF.formField
<button type="submit" class="btn btn-danger">
<i class="fa fa-trash"></i> @messages("general.delete")
</button>
}
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#modal-delete">
<i class="fa fa-trash"></i> @messages("general.delete")
</button>
}
}

Expand Down Expand Up @@ -205,4 +200,32 @@ <h3 class="panel-title">Dependencies</h3>
</div>
</div>

@if(sp.perms(EditVersions) && v.p.versions != 1) {
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="label-delete">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Cancel">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="label-delete">@messages("version.delete.title")</h4>
</div>
@form(action = versionRoutes.delete(v.p.project.ownerName, v.p.project.slug, v.v.versionString), 'class -> "form-inline") {
<div class="modal-body">
@messages("version.delete.info")
</div>
<div class="modal-footer">
<div class="form-inline">
@CSRF.formField
<button type="button" class="btn btn-default" data-dismiss="modal">
@messages("channel.edit.close")
</button>
<input type="submit" name="delete" value="@messages("general.delete")" class="btn btn-danger">
</div>
</div>
}
</div>
</div>
</div>
}
}
2 changes: 2 additions & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ version.approved = Approved
version.approved.info = <strong>{0}</strong> approved this version on <strong>{1}</strong>
version.releaseBulletin = Release Bulletin
version.releaseBulletin.info = What''s new in this release?
version.delete.info = Are you sure you want to delete this version?
version.delete.title = Delete version

version.download.confirm = Notice | {0}/{1} {2}
version.download.confirm.body = <p>This version has not been reviewed by our moderation staff and may not be safe for download.</p> <p><i>Disclaimer: We disclaim all responsibility for any harm to your server or system should you choose not to heed this warning.</i></p>
Expand Down

0 comments on commit 66b8767

Please sign in to comment.