Add icon, fix pagination, fix video preview

pull/3064/head
Julio Montoya 5 years ago
parent 6dd786dd40
commit 268a9190f0
  1. 12
      config/services.yaml
  2. 17
      src/CoreBundle/Controller/ResourceController.php
  3. 38
      src/ThemeBundle/Resources/views/Resource/grid_theme.html.twig
  4. 36
      src/ThemeBundle/Resources/views/Resource/index.html.twig

@ -156,12 +156,12 @@ apy_data_grid:
# actions_columns_size: -1
# actions_columns_title: "Actions"
# actions_columns_separator: "<br />"
# pagerfanta:
# enable: false
# view_class: "Pagerfanta\View\DefaultView"
# options:
# prev_message: "«"
# next_message: "»"
pagerfanta:
enable: true
view_class: 'Pagerfanta\View\TwitterBootstrap4View'
options:
prev_message: "«"
next_message: "»"
# Course settings
chamilo_course:

@ -121,6 +121,19 @@ class ResourceController extends AbstractResourceController implements CourseCon
$source->initQueryBuilder($qb);
$grid->setSource($source);
$grid->setRouteUrl(
$this->generateUrl(
'chamilo_core_resource_list',
[
'tool' => $tool,
'type' => $type,
'cidReq' => $this->getCourse()->getCode(),
'id_session' => $this->getSessionId(),
'id' => $request->get('id'),
]
)
);
$title = $grid->getColumn('title');
$title->setSafe(false);
@ -180,7 +193,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
);
return '
<video width="640" height="320" controls id="video'.$id.'" style="display:none;">
<video width="640" height="320" controls id="video'.$id.'" controls preload="metadata" style="display:none;">
<source src="'.$url.'" type="video/mp4">
Your browser doesn\'t support HTML5 video tag.
</video>
@ -232,7 +245,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
'chamilo_core_resource_show',
false,
'_self',
['class' => 'btn btn-secondary']
['class' => 'btn btn-secondary', 'icon' => 'fa-info-circle']
);
$setNodeParameters = function (RowAction $action, Row $row) use ($routeParams) {

@ -63,7 +63,11 @@
target="{{ action.target }}" {% if action.confirm %} onclick="return confirm('{{ action.confirmMessage }}')"{% endif %}
{% for name, value in action.attributes %} {{ name }}="{{ value }}" {% endfor %}
>
{{ action.title|trans }}
{% if action.attributes.icon is defined and action.attributes.icon %}
<i class="fas {{ action.attributes.icon }} "></i>
{% else %}
{{ action.title|trans }}
{% endif %}
</a>
{% endif %}
{% endfor %}
@ -168,21 +172,21 @@
{# ---------------------------------------------------- grid_pager_selectpage -------------------------------------------------- #}
{% block grid_pager_selectpage %}
{{ 'Page'|trans }}
{% spaceless %}
<input type="button" class="btn btn-secondary prev" {% if grid.page <= 0 %}disabled="disabled"{% endif %} value="<" onclick="return {{ grid.hash }}_previousPage();"/>
<input type="text" class="current" value="{{ grid.page + 1 }}" size="2" onkeypress="return {{ grid.hash }}_enterPage(event, parseInt(this.value)-1);"/>
<input type="button" value=">" class="btn btn-secondary next" {% if grid.page >= grid.pageCount-1 %}disabled="disabled"{% endif %} onclick="return {{ grid.hash }}_nextPage();"/> {{ 'of %count%'|trans({ '%count%' : grid.pageCount }) }}
{% endspaceless %}
{% endblock grid_pager_selectpage %}
{#{% block grid_pager_selectpage %}#}
{# {{ 'Page'|trans }}#}
{# {% spaceless %}#}
{# <input type="button" class="btn btn-secondary prev" {% if grid.page <= 0 %}disabled="disabled"{% endif %} value="<" onclick="return {{ grid.hash }}_previousPage();"/>#}
{# <input type="text" class="form-control current" value="{{ grid.page + 1 }}" size="2" onkeypress="return {{ grid.hash }}_enterPage(event, parseInt(this.value)-1);"/>#}
{# <input type="button" value=">" class="btn btn-secondary next" {% if grid.page >= grid.pageCount-1 %}disabled="disabled"{% endif %} onclick="return {{ grid.hash }}_nextPage();"/> {{ 'of %count%'|trans({ '%count%' : grid.pageCount }) }}#}
{# {% endspaceless %}#}
{#{% endblock grid_pager_selectpage %}#}
{# ---------------------------------------------------- grid_pager_results_perpage -------------------------------------------------- #}
{% block grid_pager_results_perpage %}
{{ ', Display'|trans }}
<select onchange="return {{ grid.hash }}_resultsPerPage(this.value);">
{% for key, value in grid.limits %}
<option value="{{ key }}"{% if (key == grid.limit) %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select> {{ 'Items per page'|trans }}
{% endblock grid_pager_results_perpage %}
{#{% block grid_pager_results_perpage %}#}
{# {{ ', Display'|trans }}#}
{# <select onchange="return {{ grid.hash }}_resultsPerPage(this.value);">#}
{# {% for key, value in grid.limits %}#}
{# <option value="{{ key }}"{% if (key == grid.limit) %} selected="selected"{% endif %}>{{ value }}</option>#}
{# {% endfor %}#}
{# </select> {{ 'Items per page'|trans }}#}
{#{% endblock grid_pager_results_perpage %}#}

@ -17,22 +17,26 @@
</a>
</div>
{% endif %}
<script>
$(function () {
$('[data-fancybox="gallery"]').fancybox({
toolbar: "true",
buttons: [
"zoom",
//"share",
"slideShow",
//"fullScreen",
"download",
"thumbs",
"close"
],
});
});
</script>
<script>
$(function () {
$('[data-fancybox="gallery"]').fancybox({
toolbar: "true",
buttons: [
"zoom",
//"share",
"slideShow",
//"fullScreen",
"download",
"thumbs",
"close"
],
video: {
autoStart: false
}
});
});
</script>
{% include '@ChamiloTheme/Resource/grid.html.twig' %}
{% endblock %}

Loading…
Cancel
Save