summaryrefslogtreecommitdiff
path: root/app/views/admin/participants/list.html.haml
blob: 32a3aaf83014c1a9a5ea0c137aea4651b7a139b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
-#
  Copyright (C) 2007, 2013 Heiko Bernloehr (FreeIT.de).

  This file is part of ECS.

  ECS is free software: you can redistribute it and/or modify it
  under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of
  the License, or (at your option) any later version.

  ECS is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public
  License along with ECS. If not, see <http://www.gnu.org/licenses/>.


%h1.box1 Listing Participants (#{@list_participants_count.to_s})

.text-link= link_to 'New participant', new_admin_participant_path
- if @list_participants_anonymous_count > 0
  - if @list_anonymous
    .text-link= link_to "Hide anonymous (#{@list_participants_anonymous_count})", admin_participants_path(:anonymous => "false")
  - else
    .text-link= link_to "Show anonymous (#{@list_participants_anonymous_count})", admin_participants_path(:anonymous => "true")

%p
  %table.list
    %tr.table-resource-label
      %th.box2 &uarr; OrgAbrev:
      %th.box2 ID:
      %th.box2 &uarr; Name:
      %th.box2 Description (optional):
      %th.box2 Self-<br/>routing:
      %th.box2 Events:
      %th.box2(align="center")= "Links, Actions (#{link_to_actions_toggle_on_off(@list_anonymous, @action_buttons)})".html_safe
    %tr

    - @participants.group_by(&:organization_id).sort{|x,y| Organization.find(x[0]).abrev.downcase <=> Organization.find(y[0]).abrev.downcase}.each do |orgid,participants|
      - org_printed= false
      - participants.sort{|x,y| x.name.downcase <=> y.name.downcase}.each do |participant|
        %tr{:class => [cycle('list-line-odd', 'list-line-even')]}
          - if org_printed
            %td.center "
          - else
            %td= Organization.find(orgid).abrev
          %td.center= participant.id
          %td= h participant.name
          %td= truncate(participant.description, :length => 80)
          %td.center= check_box_tag "participant[community_selfrouting]",1,participant.community_selfrouting, :disabled => true
          %td.center= check_box_tag "participant[events_]",1,participant.events_, :disabled => true
          %td
            %table
              %tr
                %td
                  = link_to 'Show', admin_participant_path(:id => participant)
                  = link_to 'Edit', edit_admin_participant_path(:id => participant)
                  &nbsp;&nbsp;
                  %td
                    = button_to_reset(participant, @list_anonymous, @action_buttons)
                  %td
                    = button_to_delete(participant, @list_anonymous, @action_buttons)
          - org_printed= true