Skip to content

Commit

Permalink
Fix my publications UI see BT#17508
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Jul 8, 2020
1 parent 7a2629e commit a098c38
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 38 deletions.
63 changes: 38 additions & 25 deletions main/template/default/layout/main.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,43 +63,56 @@ $(function() {
globalModal.find('.modal-header').hide();
}

var contentUrl = this.href;
var loadModalContent = $.get(contentUrl);
var self = $(this);

var blockDiv = $(this).attr('data-block-closing');
if (blockDiv != '') {
/*globalModal.on('hidden.bs.modal', function () {
$('#' + blockDiv + ' :input').attr('disabled', 'true');
});*/
globalModal.attr('data-backdrop', 'static');
globalModal.attr('data-keyboard', 'false');
}
var contentUrl = this.href;
var self = $(this);

if (contentUrl == 'javascript:void(0);') {
var
modalSize = self.data('size'),
modalWidth = self.data('width'),
modalTitle = self.data('title');
modalContent = self.data('content');
$.when(loadModalContent).done(function(modalContent) {
var modalDialog = globalModal.find('.modal-dialog'),
globalModal.find('.modal-title').text(modalTitle);
globalModal.find('.modal-body').html(modalContent);
globalModal.modal('show');
return true;
}

if (contentUrl) {
var loadModalContent = $.get(contentUrl);
$.when(loadModalContent).done(function (modalContent) {
var modalDialog = globalModal.find('.modal-dialog'),
modalSize = self.data('size') || get_url_params(contentUrl, 'modal_size'),
modalWidth = self.data('width') || get_url_params(contentUrl, 'width'),
modalTitle = self.data('title') || ' ';
modalDialog.removeClass('modal-lg modal-sm').css('width', '');
if (modalSize && modalSize.length != 0) {
switch (modalSize) {
case 'lg':
modalDialog.addClass('modal-lg');
break;
case 'sm':
modalDialog.addClass('modal-sm');
break;
modalDialog.removeClass('modal-lg modal-sm').css('width', '');
if (modalSize && modalSize.length != 0) {
switch (modalSize) {
case 'lg':
modalDialog.addClass('modal-lg');
break;
case 'sm':
modalDialog.addClass('modal-sm');
break;
}
} else if (modalWidth) {
modalDialog.css('width', modalWidth + 'px');
}
} else if (modalWidth) {
modalDialog.css('width', modalWidth + 'px');
}

globalModal.find('.modal-title').text(modalTitle);
globalModal.find('.modal-body').html(modalContent);
globalModal.modal('show');
});
globalModal.find('.modal-title').text(modalTitle);
globalModal.find('.modal-body').html(modalContent);
globalModal.modal('show');
});
}
});

// Expands an image modal
Expand Down
18 changes: 11 additions & 7 deletions main/template/default/work/publications.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{% extends 'layout/layout_1_col.tpl'|get_template %}
{% import 'default/macro/macro.tpl' as display %}

{% block content %}
{{ introduction_message }}
<a
href="javascript:void(0);"
class="ajax"
data-title="{{ intro_title | escape}}"
data-content="{{ intro_content | escape }}"
>
<h4>{{ intro_title }}</h4>
</a>

<h3>{{ 'PendingStudentPublications' | get_lang }}</h3>
{{ display.collapse('PendingStudentPublications', 'PendingStudentPublications' | get_lang, table, false, true) }}

{{ table }}

<h3>{{ 'StudentPublicationsSent' | get_lang }}</h3>

{{ table_with_results }}
{{ display.collapse('StudentPublicationsSent', 'StudentPublicationsSent' | get_lang, table_with_results, false, false) }}
{% endblock %}
3 changes: 2 additions & 1 deletion main/work/publications.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

$tpl = new Template(get_lang('StudentPublications'));

$tpl->assign('introduction_message', Display::return_message(get_lang('StudentPublicationsIntro')));
$tpl->assign('intro_title', get_lang('MyStudentPublicationsTitle'));
$tpl->assign('intro_content', Display::return_message(get_lang('MyStudentPublicationsExplanation')));
$tpl->assign('table', showStudentAllWorkGrid(0));
$tpl->assign('table_with_results', showStudentAllWorkGrid(1));

Expand Down
22 changes: 17 additions & 5 deletions main/work/work.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,26 @@ function showStudentAllWorkGrid($withResults = 1)
}

$columnModel = [
['name' => 'type', 'index' => 'type', 'width' => '30', 'align' => 'center', 'sortable' => 'false'],
['name' => 'title', 'index' => 'title', 'width' => '250', 'align' => 'left'],
['name' => 'expires_on', 'index' => 'expires_on', 'width' => '80', 'align' => 'center', 'sortable' => 'false'],
['name' => 'type', 'index' => 'type', 'width' => '50', 'align' => 'center', 'sortable' => 'false'],
['name' => 'title', 'index' => 'title', 'width' => '600', 'align' => 'left'],
['name' => 'expires_on', 'index' => 'expires_on', 'width' => '125', 'align' => 'center', 'sortable' => 'false'],
];

if ($withResults) {
$columnModel[] = ['name' => 'feedback', 'index' => 'feedback', 'width' => '80', 'align' => 'center', 'sortable' => 'false'];
$columnModel[] = ['name' => 'last_upload', 'index' => 'feedback', 'width' => '125', 'align' => 'center', 'sortable' => 'false'];
$columnModel[] = [
'name' => 'feedback',
'index' => 'feedback',
'width' => '150',
'align' => 'center',
'sortable' => 'false',
];
$columnModel[] = [
'name' => 'last_upload',
'index' => 'last_upload',
'width' => '150',
'align' => 'center',
'sortable' => 'false',
];
}

$params = [
Expand Down

0 comments on commit a098c38

Please sign in to comment.