update list course description - refs #2681
parent
4a45d14e4c
commit
fb7a2b9799
@ -1,105 +1,43 @@ |
||||
{{javascript}} |
||||
|
||||
<script> |
||||
{% if is_allowed_to_edit %} |
||||
var sec_token = '{{sec_token}}'; |
||||
{% endif %} |
||||
|
||||
function delete_entry(name, btn){ |
||||
if(!confirm("{{'ConfirmYourChoice'|get_lang}}")){ |
||||
return false; |
||||
} |
||||
|
||||
var item = $('#'+name); |
||||
var id = item.attr('data-id'); |
||||
var c_id = item.attr('data-c_id'); |
||||
|
||||
var f = function(data){ |
||||
if(data.success){ |
||||
item.remove(); |
||||
} |
||||
message.update(data); |
||||
$(btn).removeClass("loading"); |
||||
}; |
||||
CourseDescription.del(c_id, id, f); |
||||
$(btn).addClass("loading"); |
||||
} |
||||
|
||||
function delete_all(){ |
||||
if(!confirm("{{'ConfirmYourChoice'|get_lang}}")){ |
||||
return false; |
||||
} |
||||
|
||||
var f = function(data){ |
||||
if(data.success){ |
||||
var item = $('.course_descriptions'); |
||||
item.remove(); |
||||
} |
||||
message.update(data); |
||||
}; |
||||
CourseDescription.delete_by_course({{c_id}}, {{session_id}}, f); |
||||
} |
||||
</script> |
||||
|
||||
{% for message in messages %} |
||||
{{ message }} |
||||
{% endfor %} |
||||
|
||||
{% if is_allowed_to_edit %} |
||||
<div class="btn-toolbar actions-bar"> |
||||
<div class="btn-group edit new"> |
||||
{% for type in types %} |
||||
<a href="{{root}}&action=add&description_type={{type.id}}" class="btn btn-default"> |
||||
<img title="{{type.title}}" alt="{{type.title}}" src="{{type.icon|icon(32)}} " width="32" height="32"> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="btn-group edit"> |
||||
<a href="{{root}}&action=import_csv" class="btn btn-default" title="{{'ImportCSV'|get_lang}}"> |
||||
<em class="size-32 icon-import-csv"></em> |
||||
</a> |
||||
<a href="{{root}}&action=export_csv" class="btn btn-default" title="{{'ExportAsCSV'|get_lang}}"> |
||||
<em class="size-32 icon-export-csv"></em> |
||||
</a> |
||||
<a href="javascript:void(0)" onclick="delete_all();return false;" class="btn btn-default" title="{{'DeleteAll'|get_lang}}"> |
||||
<em class="size-32 icon-delete-all"></em> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<ul style="list-style: none; margin-left:0;" class="course_descriptions"> |
||||
{% for description in descriptions %} |
||||
<li id="description_{{description.id}}" class="course_description" data-id="{{description.id}}" data-c_id="{{description.c_id}}" data-type="course_description"> |
||||
<div class="title sectiontitle"> |
||||
{% if is_allowed_to_edit %} |
||||
<div class="pull-right element-actions"> |
||||
{% if session_id == description.session_id %} |
||||
<a href="{{root}}&action=delete&id={{description.id}}" |
||||
onclick="delete_entry('description_{{description.id}}', this); return false;" |
||||
title="{{'Delete'|get_lang}}"> |
||||
<em class="size-22 icon-delete"></em> |
||||
</a> |
||||
|
||||
<a href="{{root}}&action=edit&id={{description.id}}" |
||||
title="{{'Edit'|get_lang}}"> |
||||
<em class="size-22 icon-edit"></em> |
||||
</a> |
||||
{% else %} |
||||
<img title="{{'EditionNotAvailableFromSession'|get_lang}}" |
||||
alt="{{'EditionNotAvailableFromSession'|get_lang}}" |
||||
src="{{'edit_na.png'|icon(22)}}" width="22" height="22" |
||||
style="vertical-align:middle;"> |
||||
{% endif %} |
||||
{% block content %} |
||||
{% autoescape false %} |
||||
{% for message in messages %} |
||||
{{ message }} |
||||
{% endfor %} |
||||
{% for description in listing.descriptions %} |
||||
{% if not description is empty %} |
||||
<div id="description_{{ description.description_type }}" class="card" |
||||
data-id="{{ description.id }}" data-c_id="{{ description.c_id }}" data-type="course_description"> |
||||
|
||||
<div class="card-body"> |
||||
<h5 class="card-title"> |
||||
{% if is_allowed_to_edit %} |
||||
<div class="float-right"> |
||||
<div class="btn-group btn-group-sm" role="group"> |
||||
{% if session_id == description.session_id %} |
||||
<a class="btn btn-outline-secondary" href="{{ _p.web_self }}?action=edit&id={{ description.id }}&{{ _p.web_cid_query }}" |
||||
title="{{ 'Edit'|get_lang }}"> |
||||
<i class="fas fa-pencil-alt"></i> |
||||
</a> |
||||
<a class="btn btn-outline-secondary" href="{{ _p.web_self }}?action=delete&id={{ description.id }}&{{ _p.web_cid_query }}" |
||||
onclick="javascript:return confirmation('{{ description.title_js }}');" |
||||
title="{{ 'Delete'|get_lang }}"> |
||||
<i class="far fa-trash-alt"></i> |
||||
</a> |
||||
{% else %} |
||||
<a class="btn btn-outline-secondary disabled" href="#" |
||||
title="{{ 'EditionNotAvailableFromSession'|get_lang }}"> |
||||
<i class="fas fa-pencil-alt"></i> |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{{ description.title }} |
||||
</h5> |
||||
{{ description.content }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<img title="{{description.type.title}}" alt="{{description.type.title}}" src="{{description.type.icon|icon(32)}}" class="icon"> |
||||
{{description.title}} |
||||
</div> |
||||
<div class="sectioncomment"> |
||||
{{description.content}} |
||||
</div> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
{% endautoescape %} |
||||
{% endblock %} |
Loading…
Reference in new issue