From 478423e687a34fec2562ded88c4987d4ad3bdb06 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 12 May 2015 15:27:34 -0500 Subject: [PATCH] thread: Fix misplaced attachments in thread Few UI tweaks and Team::getLocalName --- css/thread.css | 2 +- include/class.team.php | 3 + include/staff/templates/thread-entry.tmpl.php | 44 ++++---- scp/css/scp.css | 100 ++++++++---------- 4 files changed, 70 insertions(+), 79 deletions(-) diff --git a/css/thread.css b/css/thread.css index 233f28315..4ac661570 100644 --- a/css/thread.css +++ b/css/thread.css @@ -30,7 +30,7 @@ color: #333333; background-color: #ffffff; margin: 0; - padding: 0.5em; + padding: 0.9em; } .thread-body a:focus { outline: thin dotted; diff --git a/include/class.team.php b/include/class.team.php index 04427634a..f172f1ede 100644 --- a/include/class.team.php +++ b/include/class.team.php @@ -62,6 +62,9 @@ implements TemplateVariable { function getName() { return $this->name; } + function getLocalName() { + return $this->getLocal('name'); + } function getNumMembers() { return $this->members->count(); diff --git a/include/staff/templates/thread-entry.tmpl.php b/include/staff/templates/thread-entry.tmpl.php index b20f00e11..f06b376ef 100644 --- a/include/staff/templates/thread-entry.tmpl.php +++ b/include/staff/templates/thread-entry.tmpl.php @@ -2,6 +2,7 @@ $entryTypes = array('M'=>'message', 'R'=>'response', 'N'=>'note'); $user = $entry->getUser() ?: $entry->getStaff(); $name = $user ? $user->getName() : $entry->poster; +$avatar = ''; if ($user && ($url = $user->get_gravatar(48))) $avatar = "<img class=\"avatar\" src=\"{$url}\"> "; ?> @@ -54,30 +55,31 @@ if ($user && ($url = $user->get_gravatar(48))) echo $entry->title; ?></span> </span> </div> - <div class="thread-body" id="thread-id-<?php - echo $entry->getId(); ?>"><div><?php - echo $entry->getBody()->toHtml(); ?></div> - </div> - <?php - $urls = null; - if ($entry->has_attachments - && ($urls = $entry->getAttachmentUrls())) { ?> - <div><?php - foreach ($entry->attachments as $A) { - if ($A->inline) continue; - $size = ''; - if ($A->file->size) - $size = sprintf('<em>(%s)</em>', - Format::file_size($A->file->size)); + <div class="thread-body" id="thread-id-<?php echo $entry->getId(); ?>"> + <div><?php echo $entry->getBody()->toHtml(); ?></div> +<?php + if ($entry->has_attachments) { ?> + <div class="attachments"><?php + foreach ($entry->attachments as $A) { + if ($A->inline) + continue; + $size = ''; + if ($A->file->size) + $size = sprintf('<small class="filesize faded">%s</small>', Format::file_size($A->file->size)); ?> - <a class="Icon file no-pjax" href="<?php echo $A->file->getDownloadUrl(); + <span class="attachment-info"> + <i class="icon-paperclip icon-flip-horizontal"></i> + <a class="no-pjax truncate filename" href="<?php echo $A->file->getDownloadUrl(); ?>" download="<?php echo Format::htmlchars($A->file->name); ?>" target="_blank"><?php echo Format::htmlchars($A->file->name); - ?></a><?php echo $size;?> -<?php } ?> - </div> <?php - } - if ($urls) { ?> + ?></a><?php echo $size;?> + </span> +<?php } ?> + </div> +<?php } ?> + </div> +<?php + if ($urls = $entry->getAttachmentUrls()) { ?> <script type="text/javascript"> $('#thread-id-<?php echo $entry->getId(); ?>') .data('urls', <?php diff --git a/scp/css/scp.css b/scp/css/scp.css index 0eeaad43d..b5e9e7a31 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -842,54 +842,6 @@ h2 .reload { border-bottom:none; margin:0; } - -#toggle_ticket_thread { - background:url(../images/icons/open.gif) 10px 50% no-repeat; -} - -#toggle_notes { - background:url(../images/icons/note.gif) 10px 50% no-repeat; -} - -table.thread-entry { - margin-top:10px; - border:1px solid #aaa; -} - -#ticket_notes table { - margin-top:10px; - border:1px solid #ddd; - border-bottom:2px solid #ddd; -} - -table.thread-entry th, #ticket_notes table th { - text-align:left; - border-bottom:1px solid #aaa; - font-size:10pt; - padding:5px; -} - -#ticket_notes table th { - text-align:left; - border-bottom:1px solid #ddd; - font-size:10pt; - padding:5px; - background:#F4FAFF; -} - -#ticket_notes table th em { - font-weight:normal; - font-size:10pt; - color:#666; -} - -#ticket_notes .date { - font-weight:normal; - font-size:10pt; - color:#888; - text-align:right; -} - .thread-entry { margin-top: 15px; } @@ -915,7 +867,7 @@ img.avatar { border-radius: inherit; } .thread-entry .header { - padding: 8px; + padding: 8px 0.9em; border: 1px solid #ccc; border-color: rgba(0,0,0,0.2); border-radius: 5px 5px 0 0; @@ -927,18 +879,18 @@ img.avatar { content: ''; border-top: 9px solid transparent; border-bottom: 9px solid transparent; - border-left: 9px solid #CCC; - border-left-color: rgba(0,0,0,0.3); + border-left: 9px solid #9cadcc; display: inline-block; } .thread-entry.avatar .header:after { position: absolute; top: 7px; - right: -8px; + right: -9px; content: ''; - border-top: 9px solid transparent; - border-bottom: 9px solid transparent; + border-top: 8px solid transparent; + border-bottom: 8px solid transparent; display: inline-block; + margin-top: 1px; } .thread-entry.avatar .header { @@ -949,7 +901,8 @@ img.avatar { background:#C3D9FF; } .thread-entry.avatar.message .header:after { - border-left:9px solid #C3D9FF; + border-left: 9px solid #C3D9FF; + margin-right: 1px; } .thread-entry.response .header { @@ -962,15 +915,25 @@ img.avatar { right: initial; border-left: none; border-right: 9px solid #CCC; - border-right-color: rgba(0,0,0,0.2); +} +.thread-entry.note:not(.avatar) .header { + background-color: #f4f4f4; + background-color: rgba(0,0,0,0.05); +} +.thread-entry.avatar.response .header:before { + border-right-color: #ccb3af; +} +.thread-entry.avatar.note .header:before { + border-right-color: #ccccb0; } .thread-entry.avatar.response .header:after, .thread-entry.avatar.note .header:after { top: 7px; - left: -8px; + left: -9px; right: initial; border-left: none; border-right: 9px solid #FFE0B3; + margin-left: 1px; } .thread-entry.note .header { @@ -992,6 +955,28 @@ img.avatar { border-bottom:2px solid #aaa; border-radius: 0 0 5px 5px; } +.thread-body .attachments { + background-color: #f4faff; + margin: 0 -0.9em; + position: relative; + top: 0.9em; + padding: 0.3em 0.9em; + border-top: 1px dotted #ccc; + border-top-color: rgba(0,0,0,0.2); + border-radius: 0 0 6px 6px; +} +.thread-body .attachments .filesize { + margin-left: 0.5em; +} +.thread-body .attachment-info { + margin-right: 10px; + display: inline-block; + width: 48%; +} +.thread-body .attachment-info .filename { + max-width: 80%; + max-width: calc(100% - 70px); +} #ticket_notes table td { padding:5px; @@ -2245,6 +2230,7 @@ button a:hover { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + vertical-align: bottom; } td.indented { padding-left: 20px; -- GitLab