From 5b6eb88465d97cacdc5614cd4f89aeb2b41f463a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Mon, 11 Mar 2019 17:42:43 -0500 Subject: [PATCH] fix template forum - refs #2681 --- assets/css/scss/_base.scss | 75 ++++++++---- main/dropbox/dropbox_init.inc.php | 2 +- main/forum/index.php | 8 +- main/template/default/forum/list.html.twig | 132 ++++++++++----------- 4 files changed, 128 insertions(+), 89 deletions(-) diff --git a/assets/css/scss/_base.scss b/assets/css/scss/_base.scss index 370d8fb737..f8d6305edd 100755 --- a/assets/css/scss/_base.scss +++ b/assets/css/scss/_base.scss @@ -2064,30 +2064,65 @@ hr { /****** FORUM CSS ******/ .forum{ - .number-post { - background-color: #F7F7F9; - border: 1px solid #E1E1E1; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - padding: 10px; - text-align: center; - p { - padding: 0; - margin: 0; + .card{ + margin-bottom: 0; + .card-header{ + padding: 0.25rem; + .btn{ + padding: 0; + margin: 0; + } + .float-actions{ + position: absolute; + right: 17px; + top: 10px; + } } } - .title { - margin: 0; - padding: 0; - font-size: 18px; - } - .description { - font-size: 14px; - color: #666666; + .list-forum{ + .card{ + border: none; + box-shadow: none; + &:hover{ + .toolbar{ + opacity: 1; + transition: opacity 1s; + } + } + .toolbar{ + opacity: 0; + margin-left: 5px; + img{ + border: 1px solid #cdcdcd; + background-color: #ffffff; + padding: 2px; + border-radius: 4px; + } + + } + } + .d-flex{ + border-bottom: 1px solid #dddddd; + } + .avatar{ + img{ + border: 1px solid #cdcdcd; + } + } + .forum-threads{ + font-size: 12px; + list-style: none; + margin: 0; + padding: 0; + color: #666666; + li{ + display: inline-block; + padding-left: 5px; + padding-right: 5px; + } + } } } - .forum-post { border-color: #dddddd !important; .title-username { diff --git a/main/dropbox/dropbox_init.inc.php b/main/dropbox/dropbox_init.inc.php index f2195cf66c..6e5759fbbb 100755 --- a/main/dropbox/dropbox_init.inc.php +++ b/main/dropbox/dropbox_init.inc.php @@ -180,7 +180,7 @@ if (empty($session_id)) { // only when it is needed. if ($action == 'add') { $dropbox_person = new Dropbox_Person( - $_user['user_id'], + $user_id, $is_courseAdmin, $is_courseTutor ); diff --git a/main/forum/index.php b/main/forum/index.php index 9c01c395c9..64b1185c3a 100755 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -307,6 +307,7 @@ if (is_array($forumCategories)) { if (!empty($forumsInCategory)) { $forumsDetailsList = []; // We display all the forums in this category. + foreach ($allCourseForums as $forum) { // Here we clean the whatnew_post_info array a little bit because to display the icon we // test if $whatsnew_post_info[$forum['forum_id']] is empty or not. @@ -347,7 +348,7 @@ if (is_array($forumCategories)) { ); } } - + //var_dump($forum); if ($show_forum) { $form_count++; $mywhatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) @@ -460,6 +461,9 @@ if (is_array($forumCategories)) { if (!empty($forum['last_poster_id'])) { $forumInfo['last_poster_date'] = api_convert_and_format_date($forum['last_post_date']); $forumInfo['last_poster_user'] = display_user_link($poster_id, $name, null, $username); + $forumInfo['avatar'] = UserManager::getUserPicture($poster_id); + } else { + $forumInfo['avatar'] = UserManager::getUserPicture($forum['insert_user_id']); } if (api_is_allowed_to_edit(false, true) @@ -539,5 +543,5 @@ $tpl->assign('introduction', $introduction); $tpl->assign('actions', $actions); $tpl->assign('data', $listForumCategory); $tpl->assign('form_content', $formContent); -$layout = $tpl->get_template('forum/list.tpl'); +$layout = $tpl->get_template('forum/list.html.twig'); $tpl->display($layout); diff --git a/main/template/default/forum/list.html.twig b/main/template/default/forum/list.html.twig index a41ebdeae5..045bc619b5 100644 --- a/main/template/default/forum/list.html.twig +++ b/main/template/default/forum/list.html.twig @@ -1,90 +1,90 @@ {% extends "@ChamiloTheme/Layout/layout_one_col.html.twig" %} +{% import '@ChamiloTheme/Macros/box.html.twig' as macro %} {% block content %} {% autoescape false %} -{{ introduction_section }} {{ form_content }} - +
{% if data is not empty %} {% for item in data %} -
-
- {{ item.tools }} -
-

- {{ 'forum_blue.png'|img(32) }} +
+
+
+ {{ item.tools }} +
+ + {{ 'forum_blue.png'|img(32) }} + {{ item.title }}{{ item.icon_session }} -
-
- {{ item.description }} -
-
- {% for subitem in item.forums %} -

+
+
+ +
+ {{ item.description }} +
+ {% for subitem in item.forums %} + {% set content %} +
+
+
+
-
-
-
- {{ subitem.tools }} -
-
-

- {{ 'forum_yellow.png'|img(32) }} - {{ subitem.title }} - {% if subitem.forum_of_group != 0 %} - - {{ "forum.png"|img(22) }} {{ "GoTo"|get_lang }} {{ subitem.forum_group_title }} - - {% endif %} - {{ subitem.icon_session }} -

- {% if subitem.last_poster_id is not empty %} -
- - {{ subitem.last_poster_date }} - {{ "By"|get_lang }} - {{ subitem.last_poster_user }} +
+

+ {{ subitem.title }} + {% if subitem.forum_of_group != 0 %} + + {{ "forum.png"|img(22) }} {{ "GoTo"|get_lang }} {{ subitem.forum_group_title }} + + {% endif %} + {{ subitem.icon_session }} +
+
+ {{ subitem.tools }} +
- {% endif %} -
- {{ subitem.description }} -
- {{ subitem.alert }} - {% if subitem.moderation is not empty %} - - {{ "PostsPendingModeration"|get_lang }}: {{ subitem.moderation }} - - {% endif %} +

+
    +
  • {{ 'ForumThreads'| get_lang }}: {{ subitem.number_threads }}
  • + {% if subitem.last_poster_id is not empty %} +
  • + + {{ subitem.last_poster_date }} + {{ "By"|get_lang }} + {{ subitem.last_poster_user }} +
  • + {% endif %} +
+
+ {{ subitem.description }} +
+ {{ subitem.alert }} + + {% if subitem.moderation is not empty %} + + {{ "PostsPendingModeration"|get_lang }}: {{ subitem.moderation }} + + {% endif %} + {% endset %} + {% set forum_id = 'forum-'~ subitem.id %} +
+ {{ macro.panel_box(forum_id,'', content ) }}
-
+ {% endfor %}
- {% endfor %} +
+
{% endfor %} {% else %}
{{ 'NoForumInThisCategory'|get_lang }}
{% endif %} +
{% endautoescape %} {% endblock %}