Commit e4ad011b0c8eceb69a4f99497f646f7ca8788198
1 parent
9d0c2c87
Exists in
master
and in
3 other branches
Adjusting subjects presention in manage categories
Showing
1 changed file
with
112 additions
and
142 deletions
Show diff stats
categories/templates/categories/list.html
@@ -38,165 +38,135 @@ | @@ -38,165 +38,135 @@ | ||
38 | <div class="col-md-12 cards-content"> | 38 | <div class="col-md-12 cards-content"> |
39 | <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> | 39 | <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> |
40 | {% for category in categories %} | 40 | {% for category in categories %} |
41 | - {% if category.visible %} | ||
42 | - | ||
43 | - | ||
44 | - <div class="panel panel-info"> | ||
45 | - <div class="panel-heading"> | ||
46 | - <div class="row"> | ||
47 | - <div class="col-md-12 category-header"> | ||
48 | - <h4 class="panel-title"> | ||
49 | - <a class="category-course-link pull-left" data-parent="#accordion" data-toggle="collapse" href="#{{category.slug}}"> | ||
50 | - <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button> {{category.name}} | ||
51 | - </a> | ||
52 | - </h4> | ||
53 | - {% if user.is_staff or user in category.coordinators.all %} | ||
54 | - <div class=" divMoreActions"> | ||
55 | - <div class="btn-group"> | ||
56 | - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
57 | - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
58 | - </button> | ||
59 | - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | ||
60 | - {% if user.is_staff %} | ||
61 | - <li><a href="{% url 'categories:replicate' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li> | ||
62 | - {% endif %} | ||
63 | - <li><a href="{% url 'categories:update' category.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li> | ||
64 | - <li><a href="javascript:delete_course.get('{% url 'categories:delete' category.slug %}?view=index','#category','#modal_course')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans 'Remove' %}</a></li> | ||
65 | - </ul> | 41 | + {% if category.visible %} |
42 | + <div class="panel panel-info"> | ||
43 | + <div class="panel-heading"> | ||
44 | + <div class="row"> | ||
45 | + <div class="col-md-12 category-header"> | ||
46 | + <h4 class="panel-title"> | ||
47 | + <a class="category-course-link pull-left" data-parent="#accordion" data-toggle="collapse" href="#{{category.slug}}"> | ||
48 | + <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button> {{category.name}} | ||
49 | + </a> | ||
50 | + </h4> | ||
51 | + {% if user.is_staff or user in category.coordinators.all %} | ||
52 | + <div class=" divMoreActions"> | ||
53 | + <div class="btn-group"> | ||
54 | + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
55 | + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
56 | + </button> | ||
57 | + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | ||
58 | + {% if user.is_staff %} | ||
59 | + <li><a href="{% url 'categories:replicate' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li> | ||
60 | + {% endif %} | ||
61 | + <li><a href="{% url 'categories:update' category.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li> | ||
62 | + <li><a href="javascript:delete_course.get('{% url 'categories:delete' category.slug %}?view=index','#category','#modal_course')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans 'Remove' %}</a></li> | ||
63 | + </ul> | ||
64 | + </div> | ||
66 | </div> | 65 | </div> |
67 | - </div> | ||
68 | - {% else %} | ||
69 | - <div class=" divMoreActions"> | ||
70 | - </div> | ||
71 | - {% endif %} | ||
72 | - | 66 | + {% else %} |
67 | + <div class=" divMoreActions"> | ||
68 | + </div> | ||
69 | + {% endif %} | ||
70 | + | ||
73 | <div class="col-md-5 pull-right category-card-items"> | 71 | <div class="col-md-5 pull-right category-card-items"> |
74 | <a href="" ><i class="fa fa-list" aria-hidden="true"></i></a> | 72 | <a href="" ><i class="fa fa-list" aria-hidden="true"></i></a> |
75 | <a href=""><i class="fa fa-envelope-o" aria-hidden="true"></i></a> | 73 | <a href=""><i class="fa fa-envelope-o" aria-hidden="true"></i></a> |
76 | <a href=""><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a> | 74 | <a href=""><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a> |
77 | <a href=""><i class="fa fa-bar-chart" aria-hidden="true"></i></a> | 75 | <a href=""><i class="fa fa-bar-chart" aria-hidden="true"></i></a> |
78 | </div> | 76 | </div> |
79 | - | 77 | + </div> |
80 | </div> | 78 | </div> |
81 | </div> | 79 | </div> |
82 | - </div> | ||
83 | - <div id="{{category.slug}}" class="panel-collapse panel-body collapse category-panel-content"> | ||
84 | - <input type="hidden" class="log_url" value="{% url 'categories:view_log' category.id %}" /> | ||
85 | - <input type="hidden" class="log_id" value="" /> | ||
86 | - {% if category.coordinators.all|length > 0 %} | ||
87 | - <h4><b>{% trans "Coordinator(s) " %}: </b> | ||
88 | - {{ category.coordinators.all|join:', ' }} | ||
89 | - </h4> | ||
90 | - {% else %} | ||
91 | - <h4> {% trans "It doesn't possess coordinators" %} </h4> | ||
92 | - {% endif %} | ||
93 | - | ||
94 | - {{category.description|safe}} | ||
95 | - | ||
96 | - {% if user in category.coordinators.all %} | ||
97 | - <a href="{% url 'subjects:create' category.slug %}"><button class="create-subject-btn"> {% trans "Create new subject" %} </button></a> | ||
98 | - {% endif %} | ||
99 | - <div class="panel-group" id="subject-accordion" role="tablist" aria-multiselectable="true"> | ||
100 | - {% for subject in category.subjects %} | ||
101 | - {% include "subjects/subject_card.html" %} | ||
102 | - {% endfor %} | ||
103 | - </div> | ||
104 | - | ||
105 | - | ||
106 | - </div> | 80 | + <div id="{{category.slug}}" class="panel-collapse panel-body collapse category-panel-content"> |
81 | + <input type="hidden" class="log_url" value="{% url 'categories:view_log' category.id %}" /> | ||
82 | + <input type="hidden" class="log_id" value="" /> | ||
83 | + | ||
84 | + {% if category.coordinators.all|length > 0 %} | ||
85 | + <h4><b>{% trans "Coordinator(s) " %}: </b> | ||
86 | + {{ category.coordinators.all|join:', ' }} | ||
87 | + </h4> | ||
88 | + {% else %} | ||
89 | + <h4> {% trans "It doesn't possess coordinators" %} </h4> | ||
90 | + {% endif %} | ||
91 | + | ||
92 | + {{category.description|safe}} | ||
93 | + | ||
94 | + {% if user in category.coordinators.all %} | ||
95 | + <a href="{% url 'subjects:create' category.slug %}"><button class="create-subject-btn"> {% trans "Create new subject" %} </button></a> | ||
96 | + {% endif %} | ||
107 | 97 | ||
108 | - | ||
109 | - | ||
110 | - | ||
111 | - {% comment %} | ||
112 | - <div id="{{category.slug}}" class="panel-collapse collapse"> | ||
113 | - {% for subject in subjects %} | ||
114 | - {% include "categories/category_card.html" %} | ||
115 | - {% endfor %} | 98 | + <div class="panel-group" id="{{ category.slug }}-accordion" role="tablist" aria-multiselectable="true"> |
99 | + {% for subject in category.subject_category.all %} | ||
100 | + {% include "subjects/subject_card.html" %} | ||
101 | + {% endfor %} | ||
102 | + </div> | ||
116 | </div> | 103 | </div> |
117 | - {% endcomment %} | ||
118 | - </div> | ||
119 | - | 104 | + </div> |
120 | {% elif request.user in category.coordinators.all or request.user.is_staff %} | 105 | {% elif request.user in category.coordinators.all or request.user.is_staff %} |
121 | - | ||
122 | - | ||
123 | - | ||
124 | - <div class="panel panel-invisible"> | ||
125 | - <div class="panel-heading"> | ||
126 | - <div class="row"> | ||
127 | - <div class="col-md-12 category-header"> | ||
128 | - <h4 class="panel-title"> | ||
129 | - <a class="category-course-link pull-left" data-parent="#accordion" data-toggle="collapse" href="#{{category.slug}}"> | ||
130 | - <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button> {{category.name}} | ||
131 | - </a> | ||
132 | - </h4> | ||
133 | - {% if user.is_staff or user in category.coordinators.all %} | ||
134 | - <div class=" divMoreActions"> | ||
135 | - <div class="btn-group"> | ||
136 | - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
137 | - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
138 | - </button> | ||
139 | - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | ||
140 | - {% if user.is_staff %} | ||
141 | - <li><a href="{% url 'categories:replicate' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li> | ||
142 | - {% endif %} | ||
143 | - <li><a href="{% url 'categories:update' category.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li> | ||
144 | - <li><a href="javascript:delete_course.get('{% url 'categories:delete' category.slug %}?view=index','#category','#modal_course')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans 'Remove' %}</a></li> | ||
145 | - </ul> | 106 | + <div class="panel panel-invisible"> |
107 | + <div class="panel-heading"> | ||
108 | + <div class="row"> | ||
109 | + <div class="col-md-12 category-header"> | ||
110 | + <h4 class="panel-title"> | ||
111 | + <a class="category-course-link pull-left" data-parent="#accordion" data-toggle="collapse" href="#{{category.slug}}"> | ||
112 | + <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button> {{category.name}} | ||
113 | + </a> | ||
114 | + </h4> | ||
115 | + {% if user.is_staff or user in category.coordinators.all %} | ||
116 | + <div class=" divMoreActions"> | ||
117 | + <div class="btn-group"> | ||
118 | + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
119 | + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
120 | + </button> | ||
121 | + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | ||
122 | + {% if user.is_staff %} | ||
123 | + <li><a href="{% url 'categories:replicate' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li> | ||
124 | + {% endif %} | ||
125 | + <li><a href="{% url 'categories:update' category.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li> | ||
126 | + <li><a href="javascript:delete_course.get('{% url 'categories:delete' category.slug %}?view=index','#category','#modal_course')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans 'Remove' %}</a></li> | ||
127 | + </ul> | ||
128 | + </div> | ||
146 | </div> | 129 | </div> |
147 | - </div> | ||
148 | - {% else %} | ||
149 | - <div class=" divMoreActions"> | ||
150 | - </div> | ||
151 | - {% endif %} | ||
152 | - | ||
153 | - <div class="col-md-5 pull-right category-card-items"> | ||
154 | - <a href="" ><i class="fa fa-list" aria-hidden="true"></i></a> | ||
155 | - <a href=""><i class="fa fa-envelope-o" aria-hidden="true"></i></a> | ||
156 | - <a href=""><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a> | ||
157 | - <a href=""><i class="fa fa-bar-chart" aria-hidden="true"></i></a> | ||
158 | - </div> | ||
159 | - | 130 | + {% else %} |
131 | + <div class=" divMoreActions"> | ||
132 | + </div> | ||
133 | + {% endif %} | ||
134 | + | ||
135 | + <div class="col-md-5 pull-right category-card-items"> | ||
136 | + <a href="" ><i class="fa fa-list" aria-hidden="true"></i></a> | ||
137 | + <a href=""><i class="fa fa-envelope-o" aria-hidden="true"></i></a> | ||
138 | + <a href=""><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a> | ||
139 | + <a href=""><i class="fa fa-bar-chart" aria-hidden="true"></i></a> | ||
140 | + </div> | ||
141 | + | ||
142 | + </div> | ||
160 | </div> | 143 | </div> |
161 | </div> | 144 | </div> |
162 | - </div> | ||
163 | - <div id="{{category.slug}}" class="panel-collapse panel-body collapse category-panel-content"> | ||
164 | - <input type="hidden" class="log_url" value="{% url 'categories:view_log' category.id %}" /> | ||
165 | - <input type="hidden" class="log_id" value="" /> | ||
166 | - {% if category.coordinators.all|length > 0 %} | ||
167 | - <h4><b>{% trans "Coordinator(s) " %}: </b> | ||
168 | - {{ category.coordinators.all|join:', ' }} | ||
169 | - </h4> | ||
170 | - {% else %} | ||
171 | - <h4> {% trans "It doesn't possess coordinators" %} </h4> | ||
172 | - {% endif %} | ||
173 | - | ||
174 | - {{category.description|safe}} | ||
175 | - | ||
176 | - {% if user in category.coordinators.all %} | ||
177 | - <a href="{% url 'subjects:create' category.slug %}"><button class="create-subject-btn"> {% trans "Create new subject" %} </button></a> | ||
178 | - {% endif %} | ||
179 | - <div class="panel-group" id="subject-accordion" role="tablist" aria-multiselectable="true"> | ||
180 | - {% for subject in category.subjects %} | ||
181 | - {% include "subjects/subject_card.html" %} | ||
182 | - {% endfor %} | 145 | + <div id="{{category.slug}}" class="panel-collapse panel-body collapse category-panel-content"> |
146 | + <input type="hidden" class="log_url" value="{% url 'categories:view_log' category.id %}" /> | ||
147 | + <input type="hidden" class="log_id" value="" /> | ||
148 | + | ||
149 | + {% if category.coordinators.all|length > 0 %} | ||
150 | + <h4><b>{% trans "Coordinator(s) " %}: </b> | ||
151 | + {{ category.coordinators.all|join:', ' }} | ||
152 | + </h4> | ||
153 | + {% else %} | ||
154 | + <h4> {% trans "It doesn't possess coordinators" %} </h4> | ||
155 | + {% endif %} | ||
156 | + | ||
157 | + {{category.description|safe}} | ||
158 | + | ||
159 | + {% if user in category.coordinators.all %} | ||
160 | + <a href="{% url 'subjects:create' category.slug %}"><button class="create-subject-btn"> {% trans "Create new subject" %} </button></a> | ||
161 | + {% endif %} | ||
162 | + | ||
163 | + <div class="panel-group" id="{{ category.slug }}-accordion" role="tablist" aria-multiselectable="true"> | ||
164 | + {% for subject in category.subject_category.all %} | ||
165 | + {% include "subjects/subject_card.html" %} | ||
166 | + {% endfor %} | ||
167 | + </div> | ||
183 | </div> | 168 | </div> |
184 | - | ||
185 | - | ||
186 | </div> | 169 | </div> |
187 | - | ||
188 | - | ||
189 | - | ||
190 | - | ||
191 | - {% comment %} | ||
192 | - <div id="{{category.slug}}" class="panel-collapse collapse"> | ||
193 | - {% for subject in subjects %} | ||
194 | - {% include "categories/category_card.html" %} | ||
195 | - {% endfor %} | ||
196 | - </div> | ||
197 | - {% endcomment %} | ||
198 | - </div> | ||
199 | - | ||
200 | {% endif %} | 170 | {% endif %} |
201 | {% endfor %} | 171 | {% endfor %} |
202 | </div> | 172 | </div> |