Skip to content

Commit

Permalink
Merge pull request #559 from GhostManager/hotfix/small-adjustments
Browse files Browse the repository at this point in the history
Release v4.3.8
  • Loading branch information
chrismaddalena authored Dec 6, 2024
2 parents a25c770 + 53fb2a0 commit cd6413e
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 13 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [4.3.7] - 25 November 2024
## [4.3.8] - 6 December 2024

#### Fixed
### Added

* Added buttons to jump to a selected template from the report dashboard

### Changed

* Enabled pasting with formatting in the WYSIWYG editor
* This change allows you to paste formatted text from other sources (e.g., Word documents) into the editor
* This caused issues in the past when pasting from Word, some terminals, and some websites, but the reporting engine seems to handle the formatting well now
* **Note:** Pasting with formatting may not work as expected in all cases, so please check your pasted content in the editor before generating a report
* Increased the auto-complete list's maximum items from 10 to 20 to show more evidence files
* Using the "Upload Evidence" button in the editor now pushes a `ref` version of the auto-complete entry to the auto-complete list upon successful upload

### Fixed

* Fixed activity log filtering not working correctly when very large log entries were present (PR #558)

## [4.3.7] - 25 November 2024

### Fixed

* Fixed forms not accepting decimal values for extra fields (PR #554)
* Fixed cross-references not working when the reference name contained spaces (PR #556)
Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v4.3.7
25 November 2024
v4.3.8
6 December 2024
4 changes: 2 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# 3rd Party Libraries
import environ

__version__ = "4.3.7"
__version__ = "4.3.8"
VERSION = __version__
RELEASE_DATE = "25 November 2024"
RELEASE_DATE = "6 December 2024"

ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
APPS_DIR = ROOT_DIR / "ghostwriter"
Expand Down
23 changes: 23 additions & 0 deletions ghostwriter/commandcenter/migrations/0033_auto_20241204_1810.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.19 on 2024-12-04 18:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('commandcenter', '0032_reportconfiguration_figure_caption_location'),
]

operations = [
migrations.AlterField(
model_name='reportconfiguration',
name='prefix_figure',
field=models.CharField(default=' – ', help_text='Unicode characters to place between the label and your figure caption in Word reports (include any desired spaces before and after)', max_length=255, verbose_name='Character Before Figure Captions'),
),
migrations.AlterField(
model_name='reportconfiguration',
name='prefix_table',
field=models.CharField(default=' – ', help_text='Unicode characters to place between the label and your table caption in Word reports (include any desired spaces before and after)', max_length=255, verbose_name='Character Before Table Titles'),
),
]
4 changes: 2 additions & 2 deletions ghostwriter/commandcenter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ReportConfiguration(SingletonModel):
"Character Before Figure Captions",
max_length=255,
default=" \u2013 ",
help_text="Unicode character to place between the label and your figure caption in Word reports",
help_text="Unicode characters to place between the label and your figure caption in Word reports (include any desired spaces before and after)",
)
label_figure = models.CharField(
"Label Used for Figures",
Expand All @@ -106,7 +106,7 @@ class ReportConfiguration(SingletonModel):
"Character Before Table Titles",
max_length=255,
default=" \u2013 ",
help_text="Unicode character to place between the label and your table caption in Word reports",
help_text="Unicode characters to place between the label and your table caption in Word reports (include any desired spaces before and after)",
)
label_table = models.CharField(
"Label Used for Tables",
Expand Down
28 changes: 28 additions & 0 deletions ghostwriter/reporting/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,20 @@ def __init__(self, *args, **kwargs):
</a>
"""
),
HTML(
"""
<a
class="btn btn-default jump-btn js-jump-to-word-template"
type="button"
href="#"
data-toggle="tooltip"
data-placement="top"
title="Jump to Word template details"
target="_blank"
>
</a>
"""
),
),
css_class="col-md-4",
),
Expand Down Expand Up @@ -846,6 +860,20 @@ def __init__(self, *args, **kwargs):
</a>
"""
),
HTML(
"""
<a
class="btn btn-default jump-btn js-jump-to-pptx-template"
type="button"
href="#"
data-toggle="tooltip"
data-placement="top"
title="Jump to PowerPoint template details"
target="_blank"
>
</a>
"""
),
),
css_class="col-md-4",
),
Expand Down
12 changes: 12 additions & 0 deletions ghostwriter/reporting/templates/reporting/report_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,16 @@ <h3><i class="fas fa-cog fa-spin"></i> Generating your report...</h3>
localStorage.setItem('reportDefaultTab', hash);
}

// Manage the URLs for the template link buttons
let templateBaseUrl = '/reporting/templates/';
let selectedWordTemplate = document.getElementById('id_docx_template').value
let selectedPowerPointTemplate = document.getElementById('id_pptx_template').value
let $jumpWordBtn = $('.js-jump-to-word-template')
let $jumpPptxBtn = $('.js-jump-to-pptx-template')

$jumpWordBtn.attr('href', templateBaseUrl + selectedWordTemplate);
$jumpPptxBtn.attr('href', templateBaseUrl + selectedPowerPointTemplate);

// Display whatever tab was last selected or default – if null, default to the Findings tab
let defaultTab = (localStorage.getItem('reportDefaultTab') !== null ? localStorage.getItem('reportDefaultTab') : 'findings');
$('[href="' + defaultTab + '"]').tab('show');
Expand Down Expand Up @@ -617,6 +627,8 @@ <h3><i class="fas fa-cog fa-spin"></i> Generating your report...</h3>
delay: 10
});
}
$jumpWordBtn.attr('href', templateBaseUrl + docxTemplateId);
$jumpPptxBtn.attr('href', templateBaseUrl + pptxTemplateId);
}
});
});
Expand Down
16 changes: 16 additions & 0 deletions ghostwriter/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,22 @@ th.icon {
color: gray;
}

.jump-btn {
font-family: 'Font Awesome 5 Free';
display: inline-block;
vertical-align: middle;
font-weight: 600;
background-color: gray;
padding-top: 0;
padding-bottom: 0;
}

.jump-btn:before {
content: '\f064';
color: white;
font-size: 1.5em;
}

.report-spinner:before {
content: '\f1ce';
-webkit-animation: fa-spin 2s infinite linear;
Expand Down
18 changes: 13 additions & 5 deletions ghostwriter/static/js/tinymce/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
plugins: 'searchreplace autoresize visualchars visualblocks save preview lists image hr autosave advlist code wordcount codesample searchreplace paste link case table pagebreak',
toolbar: 'subscript superscript bold italic underline link blockquote case highlight | bullist numlist | richcode codeInline | table tablerowheader | evidenceUpload | searchreplace removeformat save | editorsHints',
contextmenu: 'table formats bold italic underline link removeformat',
paste_as_text: true,
// paste_as_text: true,
paste_data_images: false,
browser_spellcheck: true,
resize: true,
Expand Down Expand Up @@ -276,17 +276,24 @@
// submission is kicked back for name reuse
} else {
var evidence_placeholder = `\{\{.${value.friendly_name}\}\}`;
var ref_placeholder = `\{\{.ref ${value.friendly_name}\}\}`;
editor.insertContent(`\n<p>\{\{.${value.friendly_name}\}\}</p>`);
// A brief block to prevent users from jamming the close button immediately
_dialog.block('Uploading...');
setTimeout(() => {
_dialog.unblock();
}, 1000);
// Push the new evidence into the AutoComplete dict
evidenceFiles.push({
text: evidence_placeholder,
value: evidence_placeholder
})
evidenceFiles.push(
{
text: evidence_placeholder,
value: evidence_placeholder
},
{
text: ref_placeholder,
value: ref_placeholder
}
)
}
}
});
Expand All @@ -295,6 +302,7 @@
ch: '@',
minChars: 1,
columns: 1,
maxResults: 20,
fetch: function (pattern) {
var matchedChars = evidenceFiles.filter(function (quote) {
return quote.text.toLowerCase().includes(pattern.toLowerCase());
Expand Down

0 comments on commit cd6413e

Please sign in to comment.