aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/widget_helper.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-04-14 15:29:37 +0100
committerLouise Crow <louise.crow@gmail.com>2015-04-28 09:07:25 +0100
commitca66d9b22bca71f4c0a62121e6bff7c7da93d20d (patch)
treeec4970007438cc240ec0ce248780eb8c911e28da /app/helpers/widget_helper.rb
parentf77d5f9f70f4a0755a9772436357fc315124e92c (diff)
Use a helper to generate the status text.
This has length constraints, so we don't want to directly use InfoRequest.get_status_description (which also adds a full stop), but we want statuses that more closely correspond to get_status_description than those in the template, which are used in AskTheEU.
Diffstat (limited to 'app/helpers/widget_helper.rb')
-rw-r--r--app/helpers/widget_helper.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/app/helpers/widget_helper.rb b/app/helpers/widget_helper.rb
new file mode 100644
index 000000000..f188f6b08
--- /dev/null
+++ b/app/helpers/widget_helper.rb
@@ -0,0 +1,47 @@
+module WidgetHelper
+ def status_description(info_request)
+ status = info_request.calculate_status
+ case status
+ when 'waiting_classification'
+ _('Awaiting classification')
+ when 'waiting_response'
+ _('Awaiting response')
+ when 'waiting_response_overdue'
+ _('Delayed')
+ when 'waiting_response_very_overdue'
+ _('Long overdue')
+ when 'not_held'
+ _('Not held')
+ when 'rejected'
+ _('Rejected')
+ when 'successful'
+ _('Successful')
+ when 'partially_successful'
+ _('Partial success')
+ when 'waiting_clarification'
+ _('Awaiting clarification')
+ when 'gone_postal'
+ _('Handled by post')
+ when 'internal_review'
+ _('Internal review')
+ when 'error_message'
+ _('Delivery error')
+ when 'requires_admin'
+ _('Unusual response')
+ when 'user_withdrawn'
+ _('Withdrawn')
+ when 'attention_requested'
+ _('Needs admin attention')
+ when 'vexatious'
+ _('Vexatious')
+ when 'not_foi'
+ _('Not an FOI request')
+ else
+ if info_request.respond_to?(:theme_display_status)
+ info_request.theme_display_status(status)
+ else
+ _('Unknown')
+ end
+ end
+ end
+end \ No newline at end of file