Skip to content

Commit

Permalink
Fix: #31 show the descriptions of the presets when selected to give m…
Browse files Browse the repository at this point in the history
…ore information about the use of the preset
  • Loading branch information
hepabolu committed Mar 17, 2024
1 parent 893a071 commit 5b52ec2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ <h2 class="accordion-header">
<div class="accordion-body">
<div id="preset-btn-group" class="row" role="group" aria-label="Preset group">
</div>
<div id="presetDescription"
class="row mt-2 p-1 border border-primary-subtle bg-primary-subtle rounded-2"></div>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/web/presetcontroller.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class PresetController {

// Tell the SettingsController to update
const config = this.#model.getPreset().config();
const description = this.#model.getPreset().description();
this.#view.displayDescription(description);
this.#settingsController.updateSettings(config);
};
}
Expand Down
18 changes: 18 additions & 0 deletions src/web/presetview.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ class PresetView {
*/
#presetHeader;

/**
* @private presetDescription - reference to the HTML div that will contain
* the description of the current preset
*/
#presetDescription;

/**
* @constructor
*/
constructor() {
this.#presetGroup = $('#preset-btn-group');
this.#presetHeader = $('#currentPreset');
this.#presetDescription = $('#presetDescription');

this.#presetDescription.hide();
log.trace('PresetView constructor executed');
};

Expand All @@ -47,6 +55,16 @@ class PresetView {
this.#presetGroup.append(button);
});
};

/**
* This function shows the description of the currently selected preset
*
* @param {string} description - the description of the preset
*/
displayDescription(description) {
this.#presetDescription.html(description).show();
}

/**
* This is the function that is called
* when one of the preset buttons is clicked
Expand Down

0 comments on commit 5b52ec2

Please sign in to comment.