From 39e3ee9fbf98aa5bf894b79a63b168be462effdd Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Mon, 22 Jun 2015 21:17:24 +0000 Subject: [PATCH] FreetextWidget render styling Credit: Jared --- assets/default/css/theme.css | 19 +++++++++++++++++++ include/class.forms.php | 12 +++++++----- .../client/templates/dynamic-form.tmpl.php | 2 +- scp/css/scp.css | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css index 266801765..50ffe968a 100644 --- a/assets/default/css/theme.css +++ b/assets/default/css/theme.css @@ -1259,3 +1259,22 @@ img.avatar { border-bottom: 2px solid #ddd; border-bottom-color: rgba(0,0,0,0.1); } + +.freetext-files { + padding: 10px; + margin-top: 10px; + border: 1px dotted #ddd; + border-radius: 4px; + background-color: #f5f5f5; +} +.freetext-files .file { + margin-right: 10px; + display: inline-block; + width: 48%; + padding-top: 0.2em; +} +.freetext-files .title { + font-weight: bold; + margin-bottom: 0.3em; + font-size: 1.1em; +} diff --git a/include/class.forms.php b/include/class.forms.php index 5112c0aef..bfbe4f12e 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -3193,6 +3193,7 @@ class FreeTextField extends FormField { )), 'attachments' => new FileUploadField(array( 'id'=>'attach', + 'label' => __('Attachments'), 'name'=>'files', 'configuration' => array('extensions'=>'') )), @@ -3248,7 +3249,7 @@ class FreeTextField extends FormField { class FreeTextWidget extends Widget { function render($options=array()) { $config = $this->field->getConfiguration(); - ?><div class=""><?php + ?><div class="thread-body" style="padding:0"><?php if ($label = $this->field->getLocal('label')) { ?> <h3><?php echo Format::htmlchars($label); @@ -3264,12 +3265,13 @@ class FreeTextWidget extends Widget { </div> <?php if (($attachments=$this->field->getFiles())) { ?> - <br/> - <section> + <section class="freetext-files"> + <div class="title"><?php echo __('Related Resources'); ?></div> <?php foreach ($attachments as $attach) { ?> - <div> + <div class="file"> <a href="<?php echo $attach->file->getDownloadUrl(); ?>" - target="_blank" class="no-pjax"> + target="_blank" download="<?php echo $attach->file->getDownloadUrl(); + ?>" class="truncate no-pjax"> <i class="icon-file"></i> <?php echo Format::htmlchars($attach->getFilename()); ?> </a> diff --git a/include/client/templates/dynamic-form.tmpl.php b/include/client/templates/dynamic-form.tmpl.php index bcfc9ada2..7a23a4546 100644 --- a/include/client/templates/dynamic-form.tmpl.php +++ b/include/client/templates/dynamic-form.tmpl.php @@ -18,7 +18,7 @@ continue; ?> <tr> - <td colspan="2" style="padding-top:8px;"> + <td colspan="2" style="padding-top:10px;"> <?php if (!$field->isBlockLevel()) { ?> <label for="<?php echo $field->getFormName(); ?>"><span class="<?php if ($field->isRequiredForUsers()) echo 'required'; ?>"> diff --git a/scp/css/scp.css b/scp/css/scp.css index c965cb7a9..cb29126b6 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -2430,3 +2430,22 @@ td.indented { width: calc(100% - 95px); line-height: 1.4em; } + +.freetext-files { + padding: 10px; + margin-top: 10px; + border: 1px dotted #ddd; + border-radius: 4px; + background-color: #f5f5f5; +} +.freetext-files .file { + margin-right: 10px; + display: inline-block; + width: 48%; + padding-top: 0.2em; +} +.freetext-files .title { + font-weight: bold; + margin-bottom: 0.3em; + font-size: 1.1em; +} -- GitLab