Merge branch 'dev' of https://code.grnet.gr/git/astakos into dev
[astakos] / snf-astakos-app / astakos / im / templates / im / astakosgroup_list.html
1 {% extends "im/account_base.html" %}
2
3 {% load filters %}
4
5 {% block page.body %}
6 <div class="maincol {% block innerpage.class %}{% endblock %}">
7     <div class="projects">
8             <h2>GROUPS</h2>
9             {% if form %}
10             <p>You can search for a group by name</p>
11             <form action="{% url group_search %}" method="post" class="withlabels signup">{% csrf_token %}
12                     {% include "im/form_render.html" %}
13                     <div class="form-row submit">
14                         <input type="submit" class="submit altcol" value="SEARCH" />
15                     </div>
16             </form>
17              
18             <form action="{% url group_all %}" method="post" class="link-like alone">{% csrf_token %}
19                 <div class="form-row submit">
20                     <input type="submit" class="submit altcol" value="Show all groups" />
21                 </div>
22             </form>
23             {% else %}
24     
25                 <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <br>You can <a href="{% url group_create_list %}">create a new group</a> or <a href="{% url group_search %}">join</a> to an existing one.</p>
26                 <div class="widjets"> 
27                         <a href="#" class="widjet-x" title="remove boxes">X</a>
28                         <ul class="clearfix">   
29                                 <li>
30                                         <div>
31                                                 <p>WELCOME!<br>Connect with a world of people who share your passions.<br>With millions of groups at your fingertips, it's easy to find the group that's best for you -- no matter your interest.</p>
32                                                 <p class="btn"><a href="{% url group_create_list %}" class="submit">CREATE</a></p>
33                                         </div>
34                                 </li>
35                                 <li>
36                                         <div>
37                                                 <p>LOOKING FOR A GROUP?</p><p>Well, this is the place to start!<br>sdofuisd ofuaofi usdiof uiofu osifuaoi ufisdfiousf oiusd<br><img alt="THINK ABOUT IT" src="/static/medialibrary/2012/06/behind_okeanos.png"></p>
38                                                 <p class="btn"><a href="{% url group_search %}" class="submit">JOIN</a></p>
39                                         </div>
40                                 </li>
41                         </ul>
42                 </div>
43         
44     {% endif %}
45     {% with page_obj.object_list as object_list %}
46     <!-- Search group -->
47     {% if object_list %}
48         <div class="full-dotted">
49                 <form method="GET" class="minimal" action=""> 
50                                 <div class="form-row">
51                                         <select name="sorting" onchange="this.form.submit();">
52                                             <option value="">Sort by</option>
53                                             <option value="groupname" {% if sorting == 'groupname' %}selected{% endif %}>Name</option>
54                                     <option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>                    
55                                     <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Issue date</option>                  
56                                     <option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
57                                     <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Participants</option> 
58                                         </select>
59                                         <input type="hidden" name="q" value="{{q}}"/>
60                                 </div>
61                         </form>
62             <table class="alt-style complex">
63                 <caption>
64                     SEARCH RESULTS
65                 </caption>
66                 <thead>
67                   <tr>
68                     <th>Name</th>
69                     <th>Type</th>
70                     <th>Issued</th>
71                     <th>Expires</th>
72                      
73                     <th>Enrolled</th>
74                    
75                      
76                     <th>Enrollment status</th>
77                     <th>&nbsp;</th>
78                   
79                   </tr>
80                 </thead>
81                 <tbody>
82                   {% for o in object_list %}
83                     <tr class="{% cycle 'tr1' 'tr2' %}">
84                     <td><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/"}}</a></td>
85                     <td>{{o.kindname|capfirst}}</td>
86                     <td>{{o.issue_date|date:"d/m/Y"}}</td>
87                     <td>{{o.expiration_date|date:"d/m/Y"}}</td>
88                     <td>{{o.approved_members_num}}</td>
89                     
90                     <td>
91                     {% if o.is_member %}
92                         {% if o.membership_approval_date %}
93     
94                         Registered
95                         {% if not o.is_owner %}
96                             <form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
97                                  <input type="submit"  value="LEAVE GROUP" />
98                             </form>
99                         {% endif %}
100                         
101                             
102
103                         {% else %}
104                             Pending
105                         {% endif %}
106                     {% else %}
107                             Not member 
108                                 <form action="{% url group_join o.id %}" method="post" class="link-like">{% csrf_token %}
109                                     <input type="submit"   value="JOIN GROUP" />
110                                 </form>
111                             
112                     {% endif %}
113                     </td>
114                     <td><a href="#" class="more-info" title="more info">&nbsp;</a></td>
115                   </tr>
116                   <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
117                     <td colspan="7" class="info-td">
118                         <div>
119                             <p>{{o.desc}}</p>
120                             <p>{% if o.homepage%}
121                                 Group's home page: <a target="_blank" href="{{ o.homepage }}">{{ o.homepage }}</a>
122                             
123                             {% endif %}
124                             </p>
125                         </div>  
126                     </td>
127                   </tr>
128                   {% endfor %}
129                 </tbody>
130             </table>
131            
132         </div>
133         
134      
135     <div class="pagination">
136                 <p class="next-prev">
137                 {% if page_obj.has_previous %}
138                 <a href="?page={{ page_obj.previous_page_number }}{% if q %}&q={{q}}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">previous</a>
139             {% endif %}
140             {% if page_obj.has_next %}
141                 <a href="?page={{ page_obj.next_page_number }}{% if q %}&q={{q}}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">next</a>
142             {% endif %}
143         </p>
144                 <p class="nums">
145                         <span class="current">
146                 Page {{ page_obj.number }} of {{ paginator.num_pages }}
147             </span>
148                 </p>
149    </div>
150       <!-- Group listing -->
151         {% else %}
152             {% if mine %}
153             {% with own_page|concat:own_sorting as args %}
154             {% with mine|paginate:args as mine %}
155                     <div class="full-dotted">
156                                         <form method="GET" class="minimal" action="">
157                                                 <div class="form-row">
158                                                     <select name="own_sorting" onchange="this.form.submit();">
159                                                             <option value="">Sort by</option>
160                                                             <option value="groupname" {% if own_sorting == 'groupname' %}selected{% endif %}>Name</option>
161                                                     <option value="kindname" {% if own_sorting == 'kindname' %}selected{% endif %}>Type</option>                        
162                                                     <option value="issue_date" {% if own_sorting == 'issue_date' %}selected{% endif %}>Issue date</option>                      
163                                                     <option value="expiration_date" {% if own_sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
164                                                     <option value="approved_members_num" {% if own_sorting == 'approved_members_num' %}selected{% endif %}>Participants</option>
165                                                     <option value="is_enabled" {% if own_sorting == 'is_enabled' %}selected{% endif %}>Status</option>
166                                                     <option value="moderation_enabled" {% if own_sorting == 'moderation_enabled' %}selected{% endif %}>Moderation</option>              
167                                                         </select>
168                                                 </div>
169                                         </form>
170                                         <table class="alt-style complex">
171                                     <caption>MY GROUPS</caption>
172                                     <thead>
173                                       <tr>
174                                         <th>Name</th>
175                                         <th>Type</th>
176                                         <th>Issued</th>
177                                         <th>Expires</th>
178                                         <th>Enrolled</th>
179                                         <th>Status</th>
180                                         <th>Moderated</th>
181                                         <th>&nbsp;</th>
182                                         
183                                       </tr>
184                                     </thead>
185                                     <tbody>
186                                       {% for o in mine.object_list %}
187                                       <tr class="{% cycle 'tr1' 'tr2' %}">
188                                         <td><a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/" }}</a></td>
189                                         <td>{{o.kindname|capfirst}}</td>
190                                         <td>{{o.issue_date|date:"d/m/Y"}}</td>
191                                         <td>{{o.expiration_date|date:"d/m/Y"}}</td>
192                                         <td>{{ o.approved_members_num }}</td>
193                                         <td>{% if o.is_enabled %}Active{% else %}Pending{% endif %}</td>
194                                         <td>{% if o.moderation_enabled%}Yes{% else %}No{% endif %}</td>
195                                         <td><a href="#" class="more-info" title="more info">&nbsp;</a></td>
196                                       </tr>
197                                       <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
198                                         <td colspan="8" class="info-td">
199                                                 <div>
200                                                         <p>{{o.desc}}</p>
201                                                         <p>{% if o.homepage%}
202                                                                                 Group's home page: <a href="{{ o.homepage }}">{{ o.homepage }}</a>
203                                                                         {% endif %}
204                                                                         </p>
205                                                 </div>  
206                                         </td>
207                                       </tr>
208                                       {% endfor %}
209                                     </tbody>
210                                 </table>
211                                 </div>
212                                 <div class="pagination">
213                                         <p class="next-prev">
214                                         {% if mine.has_previous %}
215                             <a href="?own_page={{ mine.previous_page_number }}{% if own_sorting %}&own_sorting={{ own_sorting }}{% endif%}{% if other_sorting %}&other_sorting={{ other_sorting }}{% endif%}">previous</a>
216                         {% endif %}
217                                     {% if mine.has_next %}
218                             <a href="?own_page={{ mine.next_page_number }}{% if own_sorting %}&own_sorting={{ own_sorting }}{% endif%}{% if other_sorting %}&other_sorting={{ other_sorting }}{% endif%}">next</a>
219                         {% endif %}
220                                 </p>
221                                         <p class="nums">
222                                                 <span class="current">
223                             Page {{ mine.number }} of {{ mine.paginator.num_pages }}
224                         </span>
225                                         </p>
226                            </div>
227                         
228                 {% endwith %}
229             {% endwith %}
230                 {% endif %}
231                 
232                 {% if other %}
233             {% with other_page|concat:other_sorting as args %}
234             {% with other|paginate:args as other %}
235                         <div class="full-dotted">
236                                 <form method="GET" class="minimal" action="">
237                                                 <div class="form-row">
238                                                         <select name="other_sorting" onchange="this.form.submit();">
239                                                             <option value="">Sort by</option>
240                                                             <option value="groupname" {% if other_sorting == 'groupname' %}selected{% endif %}>Name</option>
241                                                     <option value="kindname" {% if other_sorting == 'kindname' %}selected{% endif %}>Type</option>                      
242                                                     <option value="issue_date" {% if other_sorting == 'issue_date' %}selected{% endif %}>Issue date</option>                    
243                                                     <option value="expiration_date" {% if other_sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
244                                                     <option value="approved_members_num" {% if other_sorting == 'approved_members_num' %}selected{% endif %}>Participants</option>
245                                                     <option value="membership_status" {% if other_sorting == 'membership_status' %}selected{% endif %}>Enrollment Status</option>
246                                                      
247                                                         </select>
248                                                 </div>
249                                         </form>
250                                         <table class="alt-style complex">
251                                     <caption>
252                                         I PARTICIPATE IN
253                                     </caption>
254                                     <thead>
255                                       <tr>
256                                         <th>Name</th>
257                                         <th>Type</th>
258                                         <th>Issued</th>
259                                         <th>Expires</th>
260
261                                          
262                                         <th>Enrolled</th>
263                                        
264                                          
265                                         <th>Enrollment status</th>
266                                         <th>&nbsp;</th>
267                                       
268                                       </tr>
269                                     </thead>
270                                     <tbody>
271                                       {% for o in other.object_list %}
272                                       <tr class="{% cycle 'tr1' 'tr2' %}">
273                                         <td><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/"}}</a></td>
274                                         <td>{{o.kindname|capfirst}}</td>
275                                         <td>{{o.issue_date|date:"d/m/Y"}}</td>
276                                         <td>{{o.expiration_date|date:"d/m/Y"}}</td>
277                                         
278                                         <td>{{ o.approved_members_num }}</td>
279                                         
280                                         <td>
281                                         {% if o.membership_status %}
282                                             Registered
283                                         <form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
284                                              <input type="submit"  value="LEAVE GROUP" />
285                                         </form> 
286                                             
287                                         {% else %}
288                                             Pending
289                                         {% endif %}
290                                         </td>
291                                         <td><a href="#" class="more-info" title="more info">&nbsp;</a></td>
292                                       </tr>
293                                       <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
294                                         <td colspan="7" class="info-td">
295                                                 <div>
296                                                         <p>{{o.desc}}</p>
297                                                         <p>{% if o.homepage%}
298                                                                                 Visit it group's home page: <a href="{{ o.homepage }}">{{ o.homepage }}</a>
299                                                                         {% else %}
300                                                                                 There is no homepage for this group yet.
301                                                                         {% endif %}
302                                                                         </p>
303                                                 </div>  
304                                         </td>
305                                       </tr>
306                                       {% endfor %}
307                                     </tbody>
308                                 </table>
309                                
310                                 </div>
311                                 <div class="pagination">
312                                         <p class="next-prev">
313                                         {% if other.has_previous %}
314                             <a href="?other_page={{ other.previous_page_number }}{% if own_sorting %}&own_sorting={{ own_sorting }}{% endif%}{% if other_sorting %}&other_sorting={{ other_sorting }}{% endif%}">previous</a>
315                         {% endif %}
316                                     {% if other.has_next %}
317                             <a href="?other_page={{ other.next_page_number }}{% if own_sorting %}&own_sorting={{ own_sorting }}{% endif%}{% if other_sorting %}&other_sorting={{ other_sorting }}{% endif%}">next</a>
318                         {% endif %}
319                                 </p>
320                                         <p class="nums">
321                                                 <span class="current">
322                             Page {{ other.number }} of {{ other.paginator.num_pages }}
323                         </span>
324                                         </p>
325                            </div>
326                     
327                         {% endwith %}
328             {% endwith %}
329                         {% endif %}
330                 
331             {% if q %}
332                 <h2>No groups found!</h2>
333             {% endif %}
334       {% endif %}
335     {% endwith %}
336 </div>
337 </div>
338 {% endblock %}