source: adhocracy/templates/selection/tiles.html @ 871:9dfeea390bd7

Revision 871:9dfeea390bd7, 6.1 KB checked in by fl, 3 years ago (diff)

[svn r1217] unify variant html snippet

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                                            %if can.page.variant_edit(selection.page, tile.selected):
55                                                &middot; <a href="${h.entity_url(tile.selected_text, member='edit')}?proposal=${selection.proposal.id}">${_("edit")}</a>
56                                        %endif
57                                        </div>
58                                %endif
59                                <br/>
60                                ${diff.norm_texts_history_compare(tile.selected_text, selection.page.head)|n}
61                        %endif
62                </div>
63               
64                %if tile.selected:
65                <div class="expand_area area_hidden" id="comments_${selection.id}">
66                        ${tiles.comment.list(selection.page, variant=tile.selected, ret_url=h.entity_url(selection.proposal, member='implementation'))}
67                        <br/>
68                </div>
69                %endif
70               
71                <div class="expand_area area_hidden" id="variants_${selection.id}">
72                        ${self.variants(tile, selection)}
73                </div>
74               
75               
76                <div class="top_actions aside">
77                        %if tile.show_new_variant_link:
78                                <a class="button add" href="${h.entity_url(selection.page, member='%20/edit')}?proposal=${selection.proposal.id}">${_("new variant")}</a>
79                        %else:
80                                <a class="button edit" href="${h.entity_url(selection.page)}">${_("see norm")}</a>
81                        %endif
82                        ##<a class="button add otip" title="${_('Select a variant text to become a part of this proposal.')}"
83                        ##       href="${h.entity_url(selection)}">${_("select variants")}</a>
84                        %if tile.selected_text:
85                                <a class="button edit otip" title="${_('Compare this variant text to others.')}"
86                                   href="${h.entity_url(tile.selected_text)}">${_("comparison view")}</a>
87                        %endif
88                        %if can.selection.delete(selection):
89                                <a class="button delete" href="${h.entity_url(selection, member='ask_delete')}">${_("exclude")}</a>
90                        %endif
91                </div>
92                <br/><br/>
93        </div>
94        <br/>
95</%def>
96
97
98
99<%def name="variants(tile, selection)">
100        <ol class="variants" id="vs_${selection.id}">
101        %for row in tile.variant_rows():
102                <%
103                if not row.show:
104                        break
105                %>
106                <li id="poll_c${row.poll.id}"
107                                class="${h.poll_position_css(row.poll)} ${'selected' if row.selected else ''}
108                                       ${'head' if row.text.is_head else ''}">
109                        <div class="logo rate">
110                                %if can.poll.vote(row.poll):
111                                        <a class="up icon otip" title="${_("Support this variant")}"
112                                                 href="${h.entity_url(row.poll, member='rate')}?position=1&${h.url_token()}"
113                                                 onclick="return rate('#poll_c${row.poll.id}', ${row.poll.id}, 1);">
114                                                &nbsp;
115                                        </a>
116                                        <a href="${h.entity_url(row.poll, member='votes')}"
117                                                class="score">${row.poll.tally.score}</a>
118                                        <a class="down icon ttip" title="${_("Oppose this variant")}"
119                                                 href="${h.entity_url(row.poll, member='rate')}?position=-1&${h.url_token()}"
120                                                 onclick="return rate('#poll_c${row.poll.id}', ${row.poll.id}, -1);">
121                                                &nbsp;
122                                        </a>
123                                %else:
124                                        <a class="up icon inactive">&nbsp;</a>
125                                        <a href="${h.entity_url(row.poll, member='votes')}"
126                                                class="score">${row.poll.tally.score}</a>
127                                        <a class="down icon inactive">&nbsp;</a>
128                                %endif
129                        </div>
130                        <div class="variant_header expand_tab" title="text_${row.text.id}@vs_${selection.id}">
131                                <div class="variant_innerheader">                               
132                                <b>${row.text.variant_html|n}</b>
133                                %if row.text.is_head:
134                                        ${_("(this proposal should not change this norm)")}
135                                %elif row.selected and not row.text.is_head and not tile.frozen:
136                                        &middot; ${_("Currently selected for inclusion in this proposal")}
137                                %endif
138                                <br/>
139                                ${ungettext("%s comment", "%s comments", row.num_comments) % row.num_comments}
140                                &middot; <a href="${h.entity_url(row.text)}">${_("view")}</a>
141                                %if row.can_edit:
142                                        &middot; <a href="${h.entity_url(row.text, member='edit')}?proposal=${selection.proposal.id}">${_("edit")}</a>
143                                %endif
144                                %if can.page.variant_purge(selection.page, row.text.variant):
145                                        &middot; <a href="${h.entity_url(row.text, member='ask_purge')}">${_("purge variant")}</a>
146                                %endif
147                                %if tile.selected_text and row.text.id != tile.selected_text.id:
148                                        &middot; <a href="/page/diff?left=${row.text.id}&right=${tile.selected_text.id}">${_("compare")}</a>
149                                %endif
150                        </div></div>
151                        <div id="text_${row.text.id}"
152                                class="tile expand_area ${'area_hidden' if not row.selected else ''}">
153                       
154                                %if row.text.has_text:
155                                        %if tile.selected_text:
156                                                %if row.selected:
157                                                    ${diff.norm_texts_history_compare(row.text, selection.page.head)|n}
158                                                %else:
159                                                    ${diff.norm_texts_history_compare(row.text, tile.selected_text)|n}
160                                                %endif
161                                        %else:
162                                                ${row.text.render()|n}
163                                        %endif
164                                %else:
165                                        <div class="infobox">
166                                                ${_("This variant has no text.")}
167                                        </div>
168                                %endif
169                        </div>
170                </li>
171        %endfor
172        </ol>
173</%def>
174
175
Note: See TracBrowser for help on using the repository browser.