mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-10-31 17:13:08 +00:00 
			
		
		
		
	Improve pedagogy permissions
This commit is contained in:
		| @@ -19,7 +19,7 @@ | ||||
| {% endblock head %} | ||||
|  | ||||
| {% block content %} | ||||
|   {% if can_create_uv %} | ||||
|   {% if user.has_perm("pedagogy.add_uv") %} | ||||
|     <div class="action-bar"> | ||||
|       <p> | ||||
|         <a href="{{ url('pedagogy:uv_create') }}">{% trans %}Create UV{% endtrans %}</a> | ||||
| @@ -94,8 +94,10 @@ | ||||
|           <td>{% trans %}Credit type{% endtrans %}</td> | ||||
|           <td><i class="fa fa-leaf"></i></td> | ||||
|           <td><i class="fa-regular fa-sun"></i></td> | ||||
|           {% if can_create_uv %} | ||||
|           {%- if user.has_perm("pedagogy.change_uv") -%} | ||||
|             <td>{% trans %}Edit{% endtrans %}</td> | ||||
|           {%- endif -%} | ||||
|           {%- if user.has_perm("pedagogy.delete_uv") -%} | ||||
|             <td>{% trans %}Delete{% endtrans %}</td> | ||||
|           {% endif %} | ||||
|         </tr> | ||||
| @@ -109,8 +111,10 @@ | ||||
|             <td x-text="uv.credit_type"></td> | ||||
|             <td><i :class="uv.semester.includes('AUTUMN') && 'fa fa-leaf'"></i></td> | ||||
|             <td><i :class="uv.semester.includes('SPRING') && 'fa-regular fa-sun'"></i></td> | ||||
|             {% if can_create_uv -%} | ||||
|             {%- if user.has_perm("pedagogy.change_uv") -%} | ||||
|               <td><a :href="`/pedagogy/uv/${uv.id}/edit`">{% trans %}Edit{% endtrans %}</a></td> | ||||
|             {%- endif -%} | ||||
|             {%- if user.has_perm("pedagogy.delete_uv") -%} | ||||
|               <td><a :href="`/pedagogy/uv/${uv.id}/delete`">{% trans %}Delete{% endtrans %}</a></td> | ||||
|             {%- endif -%} | ||||
|           </tr> | ||||
|   | ||||
| @@ -89,7 +89,7 @@ | ||||
|         <div id="leave_comment_not_allowed"> | ||||
|           <p>{% trans %}You already posted a comment on this UV. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p> | ||||
|         </div> | ||||
|       {% else %} | ||||
|       {% elif user.has_perm("pedagogy.add_uvcomment") %} | ||||
|         <div id="leave_comment"> | ||||
|           <h2>{% trans %}Leave comment{% endtrans %}</h2> | ||||
|           <div> | ||||
| @@ -146,9 +146,9 @@ | ||||
|       {% endif %} | ||||
|       <br> | ||||
|  | ||||
|       {% if object.comments.exists() %} | ||||
|       {% if comments %} | ||||
|         <h2>{% trans %}Comments{% endtrans %}</h2> | ||||
|         {% for comment in object.comments.order_by("-publish_date").all() %} | ||||
|         {% for comment in comments %} | ||||
|           <div id="{{ comment.id }}" class="comment-container"> | ||||
|  | ||||
|             <div class="grade-block"> | ||||
| @@ -183,16 +183,28 @@ | ||||
|                 </p> | ||||
|               {% endif %} | ||||
|  | ||||
|               {% if user.is_owner(comment) %} | ||||
|               {% if comment.author_id == user.id or user.has_perm("pedagogy.change_comment") %} | ||||
|                 <p class="actions"> | ||||
|                   <a href="{{ url('pedagogy:comment_update', comment_id=comment.id) }}">{% trans %}Edit{% endtrans %}</a> | ||||
|                   <a href="{{ url('pedagogy:comment_delete', comment_id=comment.id) }}">{% trans %}Delete{% endtrans %}</a> | ||||
|                   <a href="{{ url('pedagogy:comment_update', comment_id=comment.id) }}"> | ||||
|                     {% trans %}Edit{% endtrans %} | ||||
|                   </a> | ||||
|               {% endif %} | ||||
|               {% if comment.author_id == user.id or user.has_perm("pedagogy.delete_comment") %} | ||||
|                 <a href="{{ url('pedagogy:comment_delete', comment_id=comment.id) }}"> | ||||
|                   {% trans %}Delete{% endtrans %} | ||||
|                 </a> | ||||
|                 </p> | ||||
|               {% endif %} | ||||
|             </div> | ||||
|  | ||||
|             <div class="comment-end-bar"> | ||||
|               <div class="report"><p><a href="{{ url('pedagogy:comment_report', comment_id=comment.id) }}">{% trans %}Report this comment{% endtrans %}</a></p></div> | ||||
|               <div class="report"> | ||||
|                 <p> | ||||
|                   <a href="{{ url('pedagogy:comment_report', comment_id=comment.id) }}"> | ||||
|                     {% trans %}Report this comment{% endtrans %} | ||||
|                   </a> | ||||
|                 </p> | ||||
|               </div> | ||||
|  | ||||
|               <div class="date"><p>{{ comment.publish_date.strftime('%d/%m/%Y') }}</p></div> | ||||
|  | ||||
| @@ -209,7 +221,7 @@ | ||||
|   <script type="text/javascript"> | ||||
|     $("#return_noscript").hide(); | ||||
|     $("#return_js").show(); | ||||
|     var icons = { | ||||
|     const icons = { | ||||
|       header: "fa fa-toggle-right", | ||||
|       activeHeader: "fa fa-toggle-down" | ||||
|     }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user