update list course description - refs #2681

pull/2818/head
Alex Aragón 6 years ago
parent 4a45d14e4c
commit fb7a2b9799
  1. 3
      assets/css/scss/_base.scss
  2. 5
      main/course_description/course_description_controller.php
  3. 2
      main/course_description/edit.php
  4. 116
      main/template/default/course_description/index.html.twig

@ -455,7 +455,6 @@ footer {
text-align: center; text-align: center;
border: 1px solid rgba(0, 0, 0, 0.125) ; border: 1px solid rgba(0, 0, 0, 0.125) ;
border-radius: 50%; border-radius: 50%;
background-color: #def5ff;
img{ img{
transition: transform .2s ease-in; transition: transform .2s ease-in;
padding-top: 10px; padding-top: 10px;
@ -757,7 +756,7 @@ footer {
line-height: 20px; line-height: 20px;
position: absolute; position: absolute;
top: 18px; top: 18px;
right: 25px; right: 10px;
content: "\f107"; content: "\f107";
color: #808080; color: #808080;
} }

@ -120,8 +120,11 @@ class CourseDescriptionController
$tpl->assign('actions', $actions); $tpl->assign('actions', $actions);
$tpl->assign('session_id', $session_id); $tpl->assign('session_id', $session_id);
$tpl->assign('c_id', api_get_course_int_id()); $tpl->assign('c_id', api_get_course_int_id());
$templateName = $tpl->get_template('course_description/index.tpl'); $templateName = $tpl->get_template('course_description/index.html.twig');
$content = $tpl->fetch($templateName); $content = $tpl->fetch($templateName);
$tpl->assign('content', $content); $tpl->assign('content', $content);
$tpl->display_one_col_template(); $tpl->display_one_col_template();
} }

@ -98,7 +98,7 @@ $form->addHtmlEditor(
true, true,
false, false,
[ [
'ToolbarSet' => 'Basic', 'ToolbarSet' => 'Work',
'Width' => '100%', 'Width' => '100%',
'Height' => '200', 'Height' => '200',
] ]

@ -1,105 +1,43 @@
{{javascript}} {% block content %}
{% autoescape false %}
<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 %} {% for message in messages %}
{{ message }} {{ message }}
{% endfor %} {% 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 %} {% if is_allowed_to_edit %}
<div class="btn-toolbar actions-bar"> <div class="float-right">
<div class="btn-group edit new"> <div class="btn-group btn-group-sm" role="group">
{% for type in types %}
<a href="{{root}}&amp;action=add&amp;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}}&amp;action=import_csv" class="btn btn-default" title="{{'ImportCSV'|get_lang}}">
<em class="size-32 icon-import-csv"></em>
</a>
<a href="{{root}}&amp;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 %} {% if session_id == description.session_id %}
<a href="{{root}}&amp;action=delete&amp;id={{description.id}}" <a class="btn btn-outline-secondary" href="{{ _p.web_self }}?action=edit&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
onclick="delete_entry('description_{{description.id}}', this); return false;"
title="{{'Delete'|get_lang}}">
<em class="size-22 icon-delete"></em>
</a>
<a href="{{root}}&amp;action=edit&amp;id={{description.id}}"
title="{{ 'Edit'|get_lang }}"> title="{{ 'Edit'|get_lang }}">
<em class="size-22 icon-edit"></em> <i class="fas fa-pencil-alt"></i>
</a>
<a class="btn btn-outline-secondary" href="{{ _p.web_self }}?action=delete&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
onclick="javascript:return confirmation('{{ description.title_js }}');"
title="{{ 'Delete'|get_lang }}">
<i class="far fa-trash-alt"></i>
</a> </a>
{% else %} {% else %}
<img title="{{'EditionNotAvailableFromSession'|get_lang}}" <a class="btn btn-outline-secondary disabled" href="#"
alt="{{'EditionNotAvailableFromSession'|get_lang}}" title="{{ 'EditionNotAvailableFromSession'|get_lang }}">
src="{{'edit_na.png'|icon(22)}}" width="22" height="22" <i class="fas fa-pencil-alt"></i>
style="vertical-align:middle;"> </a>
{% endif %} {% endif %}
</div> </div>
</div>
{% endif %} {% endif %}
<img title="{{description.type.title}}" alt="{{description.type.title}}" src="{{description.type.icon|icon(32)}}" class="icon">
{{ description.title }} {{ description.title }}
</div> </h5>
<div class="sectioncomment">
{{ description.content }} {{ description.content }}
</div> </div>
</li> </div>
{% endif %}
{% endfor %} {% endfor %}
</ul> {% endautoescape %}
{% endblock %}
Loading…
Cancel
Save