aboutsummaryrefslogtreecommitdiff
blob: 3f0507fc5e9508825cc981927a4d6a627e6df71a (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
66
67
68
69
70
71
72
<show-page>
  <append-content-body:>
    <div>
    <span class="one-button-form">
    <form if="&this.editable_by?(current_user, :agenda) and this.agenda.nil?">
      <input value="&Agenda.current.id" type="hidden" name="agenda_item[agenda_id]"/>
      <submit label="Add to current agenda"/>
    </form>
    </span>

    <span class="one-button-form">
    <form if="&this.editable_by?(current_user, :rejected)">
      <input value="&!this.rejected?" type="hidden" name="agenda_item[rejected]"/>
      <submit label="Reject" unless="&this.rejected"/>
      <submit label="Un-reject" if="&this.rejected"/>
    </form>
    </span>
    </div>

    <table if="&current_user.signed_up?">
      <tr>
        <repeat:voting_options>
          <th>
            <name/>
          </th>
        </repeat>
      </tr>
      <repeat with="&User.council_member_is(true)">
        <tr>
          <% user = this %>
          <repeat with="&@this.voting_options">
            <td if="& not(user.id == current_user.id)">
              <unless with="&Vote.user_is(user).voting_option_is(this).count.zero?">
                +
              </unless>
            </td>
          </repeat>
        </tr>
      </repeat>
      <form if="&current_user.council_member?" action="&update_poll_answers_path">
        <tr>
          <repeat with="&@this.voting_options">
            <td>
              <% name = "choice[#{this.id}]"
                 id = this.id %>
              <if with="&Vote.user_is(current_user).voting_option_is(this).count.zero?">
                <input type="checkbox" name="&name" value="&id"/>
              </if>
              <else>
                <input type="checkbox" name="&name" value="&this.id" checked/>
              </else>
            </td>
          </repeat>
          <td>
            <after-submit stay-here/>
            <input type="hidden" name="agenda_item_id" value="&this.id"/>
            <submit label="Update choice"/>
          </td>
        </tr>
      </form>
    </table>
  </append-content-body:>

  <after-collection:>
    <form if="&VotingOption.new.creatable_by?(current_user)" action="&create_voting_option_path">
      <input id="voting_option_description" name="voting_option[description]" type="text"/>
      <input id="voting_option_agenda_item_id" name="voting_option[agenda_item_id]" type="hidden" value="&this.id"/>
      <after-submit stay-here/>
      <submit label="Add a voting option"/>
    </form>
  </after-collection:>
</show-page>