Refactored delete action for HopObject, Site and Comment
This commit is contained in:
parent
b6693b0e83
commit
5688cabffa
4 changed files with 33 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
||||||
<% #delete %>
|
<% #delete %>
|
||||||
<% if <% comment.creator %> is <% membership.user.name %> then ''
|
<% if <% comment.creator %> is <% membership.user.name %> then ''
|
||||||
else <% if <% comment.related.size %> is null then ''
|
else <% if <% comment.related.size %> is null then ''
|
||||||
else <% comment.skin #deleteOptions %> %> %>
|
else <% comment.skin #deleteOptions %> %> %>
|
||||||
|
|
||||||
<% #deleteOptions %>
|
<% #deleteOptions %>
|
||||||
|
@ -22,14 +22,13 @@ $(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<div>
|
<div class='uk-alert uk-alert-warning'>
|
||||||
<input type="checkbox" id="mode" name="mode" value="user" />
|
<input type="checkbox" id="mode" name="mode" value="user" />
|
||||||
<label for="mode"><% gettext "Erase all comments of user {0}"
|
<label for="mode"><% gettext "Erase all comments of user {0}"
|
||||||
<% comment.creator %> %></label>
|
<% comment.creator %> %></label>
|
||||||
|
<div id="confirmation">
|
||||||
|
<input type="checkbox" id="confirm" name="confirm" value="1" />
|
||||||
|
<label for="confirm"><% ngettext "Yes, really erase {0} comment"
|
||||||
|
"Yes, really erase {0} comments" <% comment.related.size %> %></label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="confirmation">
|
|
||||||
<input type="checkbox" id="confirm" name="confirm" value="1" />
|
|
||||||
<label for="confirm"><% ngettext "Yes, really erase {0} comment"
|
|
||||||
"Yes, really erase {0} comments" <% comment.related.size %> %></label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
<% #confirm %>
|
<% #confirm %>
|
||||||
|
<h1><% gettext Warning! %></h1>
|
||||||
|
<p class='uk-text-bold'><% param.text %></p>
|
||||||
|
<p>
|
||||||
|
<% gettext 'Please be aware of the fact that there is no “undo”, so if you click “Proceed” below the changes will be applied irreversibly.' %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<% gettext 'Click “Cancel” now if you are not really sure you want to proceed.' %>
|
||||||
|
</p>
|
||||||
<form action="<% response.action %>" method="post">
|
<form action="<% response.action %>" method="post">
|
||||||
<p class="storyTitle"><% gettext Warning! %></p>
|
|
||||||
<p><% param.text %></p>
|
|
||||||
<p><% gettext 'Please be aware of the fact that there is no “undo”, so if you
|
|
||||||
click “Proceed” below the changes will be applied irreversibly.' %></p>
|
|
||||||
<p><% gettext 'Click “Cancel” now if you are not really sure you want to
|
|
||||||
proceed.' %></p>
|
|
||||||
<% this.skin <% this.type prefix=$ suffix=#delete %> %>
|
<% this.skin <% this.type prefix=$ suffix=#delete %> %>
|
||||||
<p><button type="submit" name="proceed" value="1"><% gettext Proceed %></button>
|
<p>
|
||||||
<a href="" class="cancel"><strong><% gettext Cancel %></strong></a></p>
|
<button class='uk-button uk-button-danger' name="proceed" value="1"><% gettext Proceed %></button>
|
||||||
|
<a href="" class="uk-button uk-button-link cancel"><% gettext Cancel %></a>
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% #notify_create %>
|
<% #notify_create %>
|
||||||
|
|
|
@ -169,8 +169,7 @@ HopObject.prototype.delete_action = function() {
|
||||||
if (req.postParams.proceed) {
|
if (req.postParams.proceed) {
|
||||||
try {
|
try {
|
||||||
var parent = this._parent;
|
var parent = this._parent;
|
||||||
var url = this.constructor.remove.call(this, req.postParams) ||
|
var url = this.constructor.remove.call(this, req.postParams) || parent.href();
|
||||||
parent.href();
|
|
||||||
res.message = gettext('{0} was successfully deleted.', gettext(this._prototype));
|
res.message = gettext('{0} was successfully deleted.', gettext(this._prototype));
|
||||||
res.redirect(User.getLocation() || url);
|
res.redirect(User.getLocation() || url);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
|
|
|
@ -293,7 +293,7 @@ referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<a name='admin' id='admin'></a>
|
||||||
<fieldset class='uk-margin-large-top'>
|
<fieldset class='uk-margin-large-top'>
|
||||||
<legend><% gettext Admin %></legend>
|
<legend><% gettext Admin %></legend>
|
||||||
<div class='uk-form-row'>
|
<div class='uk-form-row'>
|
||||||
|
@ -320,7 +320,6 @@ referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class='uk-margin-large-top'>
|
<div class='uk-margin-large-top'>
|
||||||
<button class='uk-button uk-button-primary' type="submit" id="submit" name="save" value="1">
|
<button class='uk-button uk-button-primary' type="submit" id="submit" name="save" value="1">
|
||||||
<% gettext Save %>
|
<% gettext Save %>
|
||||||
|
@ -337,6 +336,17 @@ $(function() {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<% #delete %>
|
||||||
|
<div class='uk-alert uk-alert-danger'>
|
||||||
|
<% gettext 'You are about to delete the whole site which currently contains {0}, {1}, {2}, {3} and {4}.'
|
||||||
|
<% ngettext '{0} story' '{0} stories' <% count <% site.self stories %> %> %>
|
||||||
|
<% ngettext '{0} comment' '{0} comments' <% count <% site.self comments %> %> %>
|
||||||
|
<% ngettext '{0} image' '{0} images' <% count <% site.self images %> %> %>
|
||||||
|
<% ngettext '{0} file' '{0} files' <% count <% site.self files %> %> %>
|
||||||
|
<% ngettext '{0} poll' '{0} polls' <% count <% site.self polls %> %> %> %>
|
||||||
|
<strong><% gettext 'All of this will be deleted irreversibly.' %></strong>
|
||||||
|
<% gettext 'Are you sure you want to proceed?' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% #notify_block %>
|
<% #notify_block %>
|
||||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue