aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/admin/participants_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/admin/participants_helper.rb')
-rw-r--r--app/helpers/admin/participants_helper.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/helpers/admin/participants_helper.rb b/app/helpers/admin/participants_helper.rb
index d6245e7..6d90ed5 100644
--- a/app/helpers/admin/participants_helper.rb
+++ b/app/helpers/admin/participants_helper.rb
@@ -18,6 +18,8 @@
module Admin::ParticipantsHelper
+ @queryparams = [[:list_anonymous,:anonymous], [:action_buttons, :actionbuttons]]
+
# adds an empty identity object to the p.identities collection. This object
# ist still not saved. This collection is reused in the form.fields_for method.
# (form.fields_for :identities ...)
@@ -28,4 +30,51 @@ module Admin::ParticipantsHelper
end
end
+ def button_to_reset(participant, list_anonymous, action_buttons)
+ button_to_reset = "button_to 'Reset', reset_admin_participant_path(:id => participant,#{(list_anonymous)?":anonymous => true":":anonymous => false"}"
+ button_to_reset += ", #{(action_buttons)?":actionbuttons => true":":actionbuttons => false"})"
+ button_to_reset += ", :title => 'All messages and events of \"#{h participant.name}\" participant will be deleted. #{(ECS_CONFIG["admin"]["confirm_actions"])?"":"There will be no confirmation !"}'"
+ button_to_reset += ", #{(action_buttons)?":disabled => false":":disabled => true"}"
+ button_to_reset += ", :confirm => 'Are you sure?'" if ECS_CONFIG["admin"]["confirm_actions"]
+ eval button_to_reset
+ end
+
+ def button_to_delete(participant, list_anonymous, action_buttons)
+ button_to_delete = "button_to 'Delete', admin_participant_path(:id => participant,#{(list_anonymous)?":anonymous => true":":anonymous => false"}"
+ button_to_delete += ", #{(action_buttons)?":actionbuttons => true":":actionbuttons => false"})"
+ button_to_delete +=", :method => :delete"
+ button_to_delete +=", :title => 'The \"#{h participant.name}\" participant will be deleted. #{(ECS_CONFIG["admin"]["confirm_actions"])?"":"There will be no confirmation !"}'"
+ button_to_delete += ", #{(action_buttons)?":disabled => false":":disabled => true"}"
+ button_to_delete += ", :confirm => 'Are you sure?'" if ECS_CONFIG["admin"]["confirm_actions"]
+ eval button_to_delete
+ end
+
+ def link_to_actions_toggle_on_off(list_anonymous, action_buttons)
+ Rails.logger.info "Admin::ParticipantsHelper#link_to_actions_toggle_on_off actionbuttons = #{action_buttons}"
+ link = "link_to #{(action_buttons)?'\'off\'':'\'on\''}, admin_participants_path(#{(list_anonymous)?":anonymous => true":":anonymous => false"}"
+ link +=", #{(action_buttons)?":actionbuttons => false":":actionbuttons => true"})"
+ unless action_buttons
+ session[:link_to_actions_toggle_on_off] = false
+ end
+ if not session[:link_to_actions_toggle_on_off] and action_buttons
+ session[:link_to_actions_toggle_on_off] = true
+ unless ECS_CONFIG["admin"]["confirm_actions"]
+ flash.now[:notice] = "Action buttons operate in NON CONFIRMATION mode, .i.e. pressing a delete or reset button just do its job without any confirmation. You have been warned ! To change this behaviour, just set \"admin->confirm_actions\" to \"true\" in \"config/ecs_config.yml\"."
+ end
+ end
+ eval link
+ end
+
+ def link_to_anonymous_toggle_on_off(list_anonymous, action_buttons)
+ end
+
+ def toggle_query_param(queryparam)
+ end
+
+ def link_to_toggle_on_off(ontext, offtext, list_anonymous, action_buttons)
+ #link = "link_to #{(action_buttons)?\'offtext\':\'ontext\'}, admin_participants_path(#{(list_anonymous)?":anonymous => true":":anonymous => false"}"
+ #link +=", #{(action_buttons)?":actionbuttons => false":":actionbuttons => true"})"
+ #eval link
+ end
+
end