source: adhocracy/templates/selection/tiles.html @ 846:681350daee5a

Revision 846:681350daee5a, 5.8 KB checked in by fl, 3 years ago (diff)

[svn r1192] code simplification, remove cruft

Line 
1
2<%def name="row(tile, selection)">
3        <div class="tile selection" id="selection_${selection.id}">
4                <h3 class="section">
5                        <!--a href="${h.entity_url(selection)}"-->
6                        <img class="cd" src="/img/icons/page_variant_16.png">
7                        ${selection.page.title}
8                        <!--/a-->
9                        %if tile.selected and tile.selected != 'HEAD':
10                                - <code>${tile.selected}</code>
11                        %endif
12                        <!--
13                        %if not selection.page.head.has_text:
14                                ${_("(initiative)")}
15                        %else:
16                                ${_("(change)")}
17                        %endif
18                        -->
19                        <a name="selection_${selection.id}"></a>
20                </h3>
21                <br/>
22                <div class="panel">
23                        <div class="menu">
24                                <ul>
25                                        <li><a class="expand_tab" title="text_${selection.id}@selection_${selection.id}">
26                                                ${_("Selected variant")}
27                                        </a></li>
28                                        %if tile.selected:
29                                                <li><a class="expand_tab" title="comments_${selection.id}@selection_${selection.id}">
30                                                        ${_("Discussion (%s)") % tile.selected_num_comments}
31                                                </a></li>
32                                        %endif
33                                        <li><a class="expand_tab" title="variants_${selection.id}@selection_${selection.id}">
34                                                ${_("Variant selection (%s)") % max(0, len(selection.page.variants)-1)}
35                                        </a></li>
36                                </ul>
37                        </div>
38                </div>
39               
40                <div class="expand_area language selected" id="text_${selection.id}">
41                        %if tile.selected is None:
42                                <div class="infobox">
43                                        ${_("There is a tie between variants, thus none is included at the moment.")}
44                                </div>
45                       
46                        %else:
47                            %if tile.selected_text.is_head:
48                                <div class="infobox">
49                                        ${_("Status quo has the most votes, resulting in no proposed change to this norm.")}
50                                </div>
51                            %else:
52                                    <div class="variant_header">
53                                            ${_("Selected variant: <b>%s</b>") % ("<a href='%s'>%s</a>" % (h.entity_url(tile.selected_text), escape(tile.selected)))|n}
54                                        </div>
55                                %endif
56                                <br/>
57                                ${diff.norm_texts_history_compare(tile.selected_text, selection.page.head)|n}
58                        %endif
59                </div>
60               
61                %if tile.selected:
62                <div class="expand_area area_hidden" id="comments_${selection.id}">
63                        ${tiles.comment.list(selection.page, variant=tile.selected, ret_url=h.entity_url(selection.proposal, member='implementation'))}
64                        <br/>
65                </div>
66                %endif
67               
68                <div class="expand_area area_hidden" id="variants_${selection.id}">
69                        ${self.variants(tile, selection)}
70                </div>
71               
72               
73                <div class="top_actions aside">
74                        %if tile.show_new_variant_link:
75                                <a class="button add" href="${h.entity_url(selection.page, member='%20/edit')}?proposal=${selection.proposal.id}">${_("new variant")}</a>
76                        %else:
77                                <a class="button edit" href="${h.entity_url(selection.page)}">${_("see norm")}</a>
78                        %endif
79                        ##<a class="button add otip" title="${_('Select a variant text to become a part of this proposal.')}"
80                        ##       href="${h.entity_url(selection)}">${_("select variants")}</a>
81                        %if tile.selected_text:
82                                <a class="button edit otip" title="${_('Compare this variant text to others.')}"
83                                   href="${h.entity_url(tile.selected_text)}">${_("comparison view")}</a>
84                        %endif
85                        %if can.selection.delete(selection):
86                                <a class="button delete" href="${h.entity_url(selection, member='ask_delete')}">${_("delete")}</a>
87                        %endif
88                </div>
89                <br/><br/>
90        </div>
91        <br/>
92</%def>
93
94
95
96<%def name="variants(tile, selection)">
97        <ol class="variants" id="vs_${selection.id}">
98        %for row in tile.variant_rows():
99                <%
100                if not row.show:
101                        break
102                %>
103                <li id="poll_c${row.poll.id}"
104                                class="${h.poll_position_css(row.poll)} ${'selected' if row.selected else ''}
105                                       ${'head' if row.text.is_head else ''}">
106                        <div class="logo rate">
107                                %if can.poll.vote(row.poll):
108                                        <a class="up icon otip" title="${_("Support this variant")}"
109                                                 href="${h.entity_url(row.poll, member='rate')}?position=1&${h.url_token()}"
110                                                 onclick="return rate('#poll_c${row.poll.id}', ${row.poll.id}, 1);">
111                                                &nbsp;
112                                        </a>
113                                        <a href="${h.entity_url(row.poll, member='votes')}"
114                                                class="score">${row.poll.tally.score}</a>
115                                        <a class="down icon ttip" title="${_("Oppose this variant")}"
116                                                 href="${h.entity_url(row.poll, member='rate')}?position=-1&${h.url_token()}"
117                                                 onclick="return rate('#poll_c${row.poll.id}', ${row.poll.id}, -1);">
118                                                &nbsp;
119                                        </a>
120                                %else:
121                                        <a class="up icon inactive">&nbsp;</a>
122                                        <a href="${h.entity_url(row.poll, member='votes')}"
123                                                class="score">${row.poll.tally.score}</a>
124                                        <a class="down icon inactive">&nbsp;</a>
125                                %endif
126                        </div>
127                        <div class="variant_header expand_tab" title="text_${row.text.id}@vs_${selection.id}">
128                                <div class="variant_innerheader">                               
129                                %if row.text.is_head:
130                                        <b><a href="${h.entity_url(row.text)}">${_("Status quo")}</a></b>
131                                        ${_("(this proposal should not change this norm)")}
132                                %else:
133                                        <b><a href="${h.entity_url(row.text)}">${row.variant}</a></b>
134                                        %if row.selected and not row.text.is_head and not tile.frozen:
135                                                &middot; ${_("Currently selected for inclusion in this proposal")}
136                                        %endif
137                                %endif
138                                <br/>
139                                ${ungettext("%s comment", "%s comments", row.num_comments) % row.num_comments}
140                                %if row.can_edit:
141                                        &middot; <a href="${h.entity_url(row.text, member='edit')}?proposal=${selection.proposal.id}">${_("edit")}</a>
142                                %endif
143                                %if tile.selected_text and row.text.id != tile.selected_text.id:
144                                        &middot; <a href="/page/diff?right=${row.text.id}&left=${tile.selected_text.id}">${_("compare")}</a>
145                                %endif
146                        </div></div>
147                        <div id="text_${row.text.id}"
148                                class="tile expand_area ${'area_hidden' if not row.selected else ''}">
149                       
150                                %if row.text.has_text:
151                                        %if tile.selected_text:
152                                                %if row.selected:
153                                                    ${diff.norm_texts_history_compare(row.text, selection.page.head)|n}
154                                                %else:
155                                                    ${diff.norm_texts_history_compare(row.text, tile.selected_text)|n}
156                                                %endif
157                                        %else:
158                                                ${row.text.render()|n}
159                                        %endif
160                                %else:
161                                        <div class="infobox">
162                                                ${_("This variant has no text.")}
163                                        </div>
164                                %endif
165                        </div>
166                </li>
167        %endfor
168        </ol>
169</%def>
170
171
Note: See TracBrowser for help on using the repository browser.