Display status when the user send a report
This commit is contained in:
parent
d23f4a66da
commit
ed96ddac98
5 changed files with 34 additions and 16 deletions
|
|
@ -83,16 +83,30 @@ app.views.Base = Backbone.View.extend({
|
|||
|
||||
report: function(evt) {
|
||||
if(evt) { evt.preventDefault(); }
|
||||
var msg = prompt(Diaspora.I18n.t('report_prompt'), Diaspora.I18n.t('report_prompt_default'));
|
||||
if (msg !== null) {
|
||||
var report = new app.models.Report();
|
||||
var id = this.model.id;
|
||||
var type = $(evt.currentTarget).data("type");
|
||||
report.fetch({
|
||||
data: { id: id, type: type, text: msg },
|
||||
type: 'POST'
|
||||
});
|
||||
}
|
||||
var msg = prompt(Diaspora.I18n.t('report.prompt'), Diaspora.I18n.t('report.prompt_default'));
|
||||
if (msg == null) return;
|
||||
var report = new app.models.Report();
|
||||
var id = this.model.id;
|
||||
var type = $(evt.currentTarget).data("type");
|
||||
|
||||
report.fetch({
|
||||
data: { id: id, type: type, text: msg },
|
||||
type: 'POST',
|
||||
statusCode: {
|
||||
200: function(xhr) {
|
||||
Diaspora.page.flashMessages.render({
|
||||
success: true,
|
||||
notice: Diaspora.I18n.t('report.status.created')
|
||||
});
|
||||
},
|
||||
400: function(xhr) {
|
||||
Diaspora.page.flashMessages.render({
|
||||
success: false,
|
||||
notice: Diaspora.I18n.t('report.status.exists')
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
destroyModel: function(evt) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div alt="Deletelabel" class="icons-deletelabel" />
|
||||
<a/>
|
||||
{{else}}
|
||||
<a href="#" data-type="comment" class="comment_report" title="{{t "report"}}">
|
||||
<a href="#" data-type="comment" class="comment_report" title="{{t "report.name"}}">
|
||||
<div class="icons-report control_icon"/>
|
||||
</a>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<a href="#" rel="auth-required" data-type="post" class="post_report" title="{{t "report"}}">
|
||||
<a href="#" rel="auth-required" data-type="post" class="post_report" title="{{t "report.name"}}">
|
||||
<i class="entypo report gray large"/>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
{{#if loggedIn}}
|
||||
<div class="controls">
|
||||
{{#unless authorIsCurrentUser}}
|
||||
<a href="#" rel="nofollow" data-type="post" class="post_report" title="{{t "report"}}">
|
||||
<a href="#" rel="nofollow" data-type="post" class="post_report" title="{{t "report.name"}}">
|
||||
<div class="icons-report control_icon"/>
|
||||
</a>
|
||||
<a href="#" rel="nofollow" class="block_user" title="{{t "ignore"}}">
|
||||
|
|
|
|||
|
|
@ -6,11 +6,15 @@
|
|||
en:
|
||||
javascripts:
|
||||
confirm_dialog: "Are you sure?"
|
||||
report_prompt: "Please enter a reason:"
|
||||
report_prompt_default: "offensive content"
|
||||
delete: "Delete"
|
||||
ignore: "Ignore"
|
||||
report: "Report"
|
||||
report:
|
||||
prompt: "Please enter a reason:"
|
||||
prompt_default: "offensive content"
|
||||
name: "Report"
|
||||
status:
|
||||
created: "The report was successfully created"
|
||||
exists: "The report already exists"
|
||||
ignore_user: "Ignore this user?"
|
||||
and: "and"
|
||||
comma: ","
|
||||
|
|
|
|||
Loading…
Reference in a new issue