Skip to content

Commit

Permalink
NEW: Automatically Populate Comment Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
aljawaid committed Feb 25, 2023
1 parent 61d6919 commit b1df3b8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Assets/css/template-manager.css
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ span.example-detail code, .example-steps code {
}

.quick-templates-title .fa-clipboard {
font-size: 20px;
font-size: 1.1em;
vertical-align: middle;
color: var(--pp-light-grey);
}
Expand Down Expand Up @@ -666,7 +666,7 @@ span.example-detail code, .example-steps code {

.quick-template-content .tooltip .fa-info-circle, .template-row .tooltip .fa-info-circle {
color: rgba(5, 93, 32, .8);
font-size: 1.3em !important;
font-size: 1.312em !important;
vertical-align: middle !important;
}

Expand All @@ -678,7 +678,7 @@ span.example-detail code, .example-steps code {
.template-topic {
font-size: .8em;
text-transform: uppercase;
width: 80%;
width: 65%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand All @@ -693,6 +693,10 @@ span.example-detail code, .example-steps code {
float: right;
}

#PasteDescTemplate {
margin-right: 10px;
}

.templates-menu-count {
margin-left: 5px;
font-size: .8em;
Expand Down
13 changes: 13 additions & 0 deletions Assets/icons/text-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Assets/js/template-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ KB.onClick('.js-template-title', function (e) {

_KB.controllers.Dropdown.close();
});

KB.onClick('.js-template-comment', function (e) {
var template = KB.dom(e.target).data('template');
var target = KB.dom(e.target).data('templateTarget');
var targetField = KB.find(target);

if (targetField) {
targetField.build().value = template;
}

});
1 change: 1 addition & 0 deletions Locale/translations-starter-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,5 @@
'Send by email' => '',
'Add a comment' => '',
'Comment Templates' => '',
'Paste to Text Editor' => '',
);
15 changes: 15 additions & 0 deletions Template/task_comments/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@
</g>
</svg>
</a>
<a id="PasteDescTemplate" href="#" class="icon-btn js-template-comment" data-template-target="textarea[name=comment]" data-template="<?= htmlspecialchars($commentTemplate['description']) ?>" title="<?= t('Paste to Text Editor') ?>">
<svg fill="currentColor" class="text-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="21px" height="21px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<g stroke-width="0"/>
<g stroke-linecap="round" stroke-linejoin="round"/>
<g>
<path d="M256,0C114.609,0,0,114.609,0,256s114.609,256,256,256s256-114.609,256-256S397.391,0,256,0z M256,472 c-119.297,0-216-96.703-216-216S136.703,40,256,40s216,96.703,216,216S375.297,472,256,472z"/>
<g>
<rect fill="#055D20" x="144" y="336" width="224" height="32"/>
<rect fill="#055D20" x="176" y="272" width="160" height="32"/>
<rect fill="#055D20" x="176" y="208" width="160" height="32"/>
<rect fill="#055D20" x="144" y="144" width="224" height="32"/>
</g>
</g>
</svg>
</a>
</div>
</div>
<?php endforeach ?>
Expand Down

0 comments on commit b1df3b8

Please sign in to comment.