Display status when the user send a report

This commit is contained in:
Lukas Matt 2014-02-25 12:16:15 -05:00
parent d23f4a66da
commit ed96ddac98
5 changed files with 34 additions and 16 deletions

View file

@ -83,16 +83,30 @@ app.views.Base = Backbone.View.extend({
report: function(evt) { report: function(evt) {
if(evt) { evt.preventDefault(); } if(evt) { evt.preventDefault(); }
var msg = prompt(Diaspora.I18n.t('report_prompt'), Diaspora.I18n.t('report_prompt_default')); var msg = prompt(Diaspora.I18n.t('report.prompt'), Diaspora.I18n.t('report.prompt_default'));
if (msg !== null) { if (msg == null) return;
var report = new app.models.Report(); var report = new app.models.Report();
var id = this.model.id; var id = this.model.id;
var type = $(evt.currentTarget).data("type"); var type = $(evt.currentTarget).data("type");
report.fetch({
data: { id: id, type: type, text: msg }, report.fetch({
type: 'POST' 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) { destroyModel: function(evt) {

View file

@ -12,7 +12,7 @@
<div alt="Deletelabel" class="icons-deletelabel" /> <div alt="Deletelabel" class="icons-deletelabel" />
<a/> <a/>
{{else}} {{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"/> <div class="icons-report control_icon"/>
</a> </a>
{{/if}} {{/if}}

View file

@ -23,7 +23,7 @@
{{/if}} {{/if}}
{{/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"/> <i class="entypo report gray large"/>
</a> </a>
</div> </div>

View file

@ -10,7 +10,7 @@
{{#if loggedIn}} {{#if loggedIn}}
<div class="controls"> <div class="controls">
{{#unless authorIsCurrentUser}} {{#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"/> <div class="icons-report control_icon"/>
</a> </a>
<a href="#" rel="nofollow" class="block_user" title="{{t "ignore"}}"> <a href="#" rel="nofollow" class="block_user" title="{{t "ignore"}}">

View file

@ -6,11 +6,15 @@
en: en:
javascripts: javascripts:
confirm_dialog: "Are you sure?" confirm_dialog: "Are you sure?"
report_prompt: "Please enter a reason:"
report_prompt_default: "offensive content"
delete: "Delete" delete: "Delete"
ignore: "Ignore" 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?" ignore_user: "Ignore this user?"
and: "and" and: "and"
comma: "," comma: ","