Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWCS committed Jan 15, 2024
1 parent 971657d commit 59a9d56
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/version_check.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"stable": {
"3.3": {
"current": "1.0.1",
"current": "1.0.2",
"announcement": "https://github.com/LukeWCS/toggle-control/releases",
"eol": null,
"security": false
Expand Down
5 changes: 5 additions & 0 deletions lukewcs/togglectrl/adm/style/acp_togglectrl_settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ fieldset dt label {
cursor: inherit;
}

fieldset p.submit-buttons {
margin-top: 0;
padding: 0 4px 4px 4px;
}

/*
* phpBB ACP Toggles - A CSS class that makes it easy to display checkboxes as toggles.
* Source : https://danklammer.com/articles/simple-css-toggle-switch/
Expand Down
2 changes: 1 addition & 1 deletion lukewcs/togglectrl/adm/style/acp_togglectrl_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1>{{ lang('TOGGLECTRL_CONFIG_TITLE') }}</h1>

{{ _self.notes(TOGGLECTRL_NOTES) }}

<form id="togglectrl_form" method="post" action="{{ U_ACTION }}">
<form id="togglectrl_settings" method="post" action="{{ U_ACTION }}">
<fieldset>
<legend>{{ lang('TOGGLECTRL_SETTINGS_TITLE') }}</legend>

Expand Down
19 changes: 13 additions & 6 deletions lukewcs/togglectrl/adm/style/acp_togglectrl_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
*/

(function () { // IIFE start
(function ($) { // IIFE start

'use strict';

var constants = Object.freeze({
const constants = Object.freeze({
OpacityEnabled : '1.0',
OpacityDisabled : '0.35',
});
Expand All @@ -21,7 +21,7 @@ function setState() {
};

function dimOptionGroup(elememtName, dimCondition) {
var c = constants;
const c = constants;

$('[name="' + elememtName + '"]').parents('dl').css('opacity', dimCondition ? c.OpacityDisabled : c.OpacityEnabled);
}
Expand All @@ -32,11 +32,18 @@ function formReset() {
});
};

function disableEnter(e) {
if (e.key == 'Enter' && e.target.type != 'textarea') {
return false;
}
};

$(window).ready(function () {
setState();

$('[name="togglectrl_enabled"]') .on('change', setState);
$('#togglectrl_form') .on('reset' , formReset);
$('#togglectrl_settings') .on('keypress' , disableEnter);
$('#togglectrl_settings') .on('reset' , formReset);
$('[name="togglectrl_enabled"]') .on('change' , setState);
});

})(); // IIFE end
})(jQuery); // IIFE end
4 changes: 2 additions & 2 deletions lukewcs/togglectrl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "Makes it possible to decide centrally for all extensions which visual style should be used for yes/no switches, provided extensions support Toggle Control.",
"homepage": "https://github.com/LukeWCS/toggle-control",
"version": "1.0.1",
"time": "2023-12-14",
"version": "1.0.2",
"time": "2024-01-15",
"license": "GPL-2.0-only",
"authors": [
{
Expand Down
13 changes: 3 additions & 10 deletions lukewcs/togglectrl/controller/acp_togglectrl_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function module_settings(): void

$this->template->assign_vars([
'TOGGLECTRL_NOTES' => $notes,

'TOGGLECTRL_ENABLED' => $this->config['togglectrl_enabled'],
] + (!$this->config['togglectrl_enabled'] ? [
'TOGGLECTRL_TYPE' => $this->config['togglectrl_type'],
Expand All @@ -89,7 +88,7 @@ public function set_page_url(string $u_action): void
private function set_meta_template_vars(string $tpl_prefix): void
{
$this->template->assign_vars([
$tpl_prefix . '_METADATA' => [
$tpl_prefix . '_METADATA' => [
'EXT_NAME' => $this->metadata['extra']['display-name'],
'EXT_VER' => $this->language->lang($tpl_prefix . '_VERSION_STRING', $this->metadata['version']),
'LANG_DESC' => $this->language->lang($tpl_prefix . '_LANG_DESC'),
Expand All @@ -100,18 +99,12 @@ private function set_meta_template_vars(string $tpl_prefix): void
]);
}

// Determine the version of the language pack with fallback to 0.0.0
private function get_lang_ver(string $lang_ext_ver): string
{
preg_match('/^([0-9]+\.[0-9]+\.[0-9]+)/', $this->language->lang($lang_ext_ver), $matches);
return ($matches[1] ?? '0.0.0');
}

// Check the language pack version for the minimum version and generate notice if outdated
private function lang_ver_check_msg(string $lang_version_var, string $lang_outdated_var): string
{
$lang_outdated_msg = '';
$ext_lang_ver = $this->get_lang_ver($lang_version_var);
preg_match('/^([0-9]+\.[0-9]+\.[0-9]+)/', $this->language->lang($lang_version_var), $matches);
$ext_lang_ver = $matches[1] ?? '0.0.0';
$ext_lang_min_ver = $this->metadata['extra']['lang-min-ver'];

if (phpbb_version_compare($ext_lang_ver, $ext_lang_min_ver, '<'))
Expand Down
4 changes: 1 addition & 3 deletions lukewcs/togglectrl/event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public function generate_template_vars()
{
if ($this->config['togglectrl_enabled'])
{
$this->template->assign_vars([
'TOGGLECTRL_TYPE' => $this->config['togglectrl_type'],
]);
$this->template->assign_var('TOGGLECTRL_TYPE', $this->config['togglectrl_type']);
}
}
}
4 changes: 2 additions & 2 deletions lukewcs/togglectrl/migrations/v_1_0_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public static function depends_on()
public function update_data()
{
return [
['config.add', ['togglectrl_enabled', 1]],
['config.add', ['togglectrl_type', 'toggle']],
['config.add', ['togglectrl_enabled' , 1]],
['config.add', ['togglectrl_type' , 'toggle']],
['module.add', [
'acp',
'ACP_CAT_DOT_MODS',
Expand Down
12 changes: 11 additions & 1 deletion toggle-control_build_changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### 1.0.2
* Release (2024-01-15)
* PHP:
* Code Optimierung im Controller.
* JS:
* Im Settings Formular wird jetzt die Enter Taste deaktiviert.
* Im IIFE Konstrukt wird jetzt explizit das jQuery Objekt übergeben.
* CSS:
* In der Gruppe mit dem Absenden-Button den zu grossen Abstand zwischen Buttons und oberem Rand der Gruppe verkleinert.

### 1.0.1
* Release (2023-12-14)
* Fix: Im `switch()` Makro wurde bei der Einstellung `checkbox` keine CSS Klasse generiert, wodurch der Mauszeiger über einer Checkbox nicht zu einem Pointer-Cursor geändert wurde. Bei Checkboxen wird jetzt explizit die passende Klasse generiert, die auch im ACP CSS definiert ist.
Expand All @@ -6,7 +16,7 @@
* Release (2023-12-07)
* Versionsprüfung hinzugefügt.

### 1.0.0-b4
#### 1.0.0-b4
* Template:
* Bei allen Optionsgruppen die ID entfernt, die für die Abblenden-Funktion benötigt wurde.
* JS:
Expand Down
11 changes: 11 additions & 0 deletions toggle-control_changelog_de.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### 1.0.2
(2024-01-15)

* PHP:
* Code Optimierung im Controller.
* JS:
* Im Settings Formular wird jetzt die Enter Taste deaktiviert.
* Im IIFE Konstrukt wird jetzt explizit das jQuery Objekt übergeben.
* CSS:
* In der Gruppe mit dem Absenden-Button den zu grossen Abstand zwischen Buttons und oberem Rand der Gruppe verkleinert.

### 1.0.1
(2023-12-14)

Expand Down

0 comments on commit 59a9d56

Please sign in to comment.