Skip to content

Commit e0ff2b1

Browse files
committed
1.2.2-b1
1 parent 1c80f30 commit e0ff2b1

10 files changed

Lines changed: 198 additions & 183 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Extension for phpBB - Allows to define independent permissions for viewing stati
55

66
### Requirements
77
* phpBB 3.3.0 - 3.3.x
8-
* PHP 7.4.0 - 8.4.x
8+
* PHP 8.0.0 - 8.5.x
Lines changed: 85 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,133 @@
1-
/* GENERAL */
1+
/* GENERAL >>> */
22

33
.stats_permissions_footer {
44
margin-top: 1em;
55
text-align: center;
66
font-size: .75em;
77
}
88

9-
/* SETTINGS */
9+
/* <<< GENERAL */
1010

11-
[type=button][name*="stats_permissions_"],
12-
.submit-buttons input[type=submit],
13-
.submit-buttons input[type=button] {
11+
/* SETTINGS >>> */
12+
13+
/* [type=button][name^="stats_permissions_"], */
14+
/* .submit-buttons input[type=submit], */
15+
/* .submit-buttons input[type=button] { */
16+
/* padding: 3px 4px; */
17+
/* } */
18+
19+
input[type=button][name^="stats_permissions_"],
20+
.submit-buttons input:is([type="submit"], [type="reset"], [type="button"]) {
1421
padding: 3px 4px;
1522
}
1623

1724
legend {
18-
top: 0;
19-
margin-left: -11px;
20-
padding: 2px 10px;
21-
border-radius: 5px 5px 0 0;
25+
background: inherit;
26+
margin: 2px 0 0 -11px;
2227
border-top: inherit;
2328
border-left: inherit;
24-
background-color: inherit;
25-
}
29+
border-radius: 5px 5px 0 0;
30+
padding: 2px 10px;
31+
top: 0;
2632

27-
legend.legend_sub {
28-
border: 0;
29-
margin: 1em 0;
30-
padding: 0;
31-
display: flex;
32-
white-space: nowrap;
33-
}
33+
& + .legend_explain {
34+
width: 45%;
35+
}
3436

35-
legend.legend_sub:after {
36-
content: "";
37-
border-bottom: 1px solid #cccccc;
38-
width: 100%;
39-
margin: 0 0 0.5em 1em;
37+
&.legend_sub {
38+
border: 0;
39+
margin: 1em 0;
40+
padding: 0;
41+
display: flex;
42+
white-space: nowrap;
43+
44+
&:after {
45+
content: "";
46+
border-bottom: 1px solid #cccccc;
47+
width: 100%;
48+
margin: 0 0 0.5em 1em;
49+
}
50+
}
4051
}
4152

42-
fieldset dt label {
53+
fieldset :is(dt, dd) label {
4354
cursor: inherit;
4455
}
4556

4657
.simple_permissions dd {
4758
line-height: 2em;
4859
}
4960

50-
/*
51-
* phpBB ACP Toggles - A CSS class that makes it easy to display checkboxes as toggles.
52-
* Source : https://danklammer.com/articles/simple-css-toggle-switch/
53-
* Revision by: Kirk (customization and optimization), LukeWCS (optimization)
54-
*/
55-
5661
.toggle {
57-
-webkit-appearance: none;
58-
-moz-appearance: none;
62+
/* phpBB Kirk Toggles 2.0 - A CSS class that makes it easy to display checkboxes as toggles.
63+
Source : https://danklammer.com/articles/simple-css-toggle-switch/
64+
Revision by: Kirk (customization and optimization), LukeWCS (optimization) */
65+
66+
/* Kirk style: */
67+
/* --background-transition: ease 0.3s; */
68+
/* --background-color-off: #a00; */
69+
/* --background-color-on: #3fa651; */
70+
/* --slider-transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s; */
71+
5972
appearance: none;
73+
position: relative;
6074
width: 38px;
6175
height: 17px;
62-
position: relative;
6376
border-radius: 50px;
6477
cursor: pointer;
6578
font-family: FontAwesome;
66-
transition: background-color 0.2s;
67-
}
79+
transition: var(--background-transition, 0.2s);
80+
81+
&,
82+
&:hover,
83+
&:focus {
84+
background: var(--background-color-off, #ccc);
85+
border: none;
86+
color: #000;
87+
}
6888

69-
.toggle:before {
70-
position: absolute;
71-
width: 14px;
72-
height: 13px;
73-
background-color: #ffffff;
74-
top: 2px;
75-
border-radius: 50%;
76-
display: flex;
77-
justify-content: center;
78-
align-items: center;
79-
left: 22px;
80-
content: "\f00d";
81-
transition: 0.2s;
82-
}
89+
&:before {
90+
content: "\f00d";
91+
justify-content: center;
92+
position: absolute;
93+
top: 2px;
94+
left: 22px;
95+
width: 14px;
96+
height: 13px;
97+
background: #fff;
98+
border-radius: 50%;
99+
display: flex;
100+
align-items: center;
101+
transition: var(--slider-transition, 0.2s);
102+
}
83103

84-
.toggle,
85-
.toggle:hover,
86-
.toggle:focus {
87-
background-color: #cccccc;
88-
border: none;
89-
color: #000000;
90-
}
104+
&:checked {
105+
background: var(--background-color-on, #3b87ab);
91106

92-
.toggle:checked {
93-
background-color: #3b87ab;
107+
&:before {
108+
content: "\f00c";
109+
left: 2px;
110+
}
111+
}
94112
}
95113

96-
.toggle:checked:before {
97-
left: 2px;
98-
content: "\f00c";
99-
}
114+
/* <<< SETTINGS */
100115

101-
/* RESPONSIVE */
116+
/* RESPONSIVE >>> */
102117

103118
@media (max-width: 700px) {
104119
legend {
105120
margin-left: -6px;
106121
padding: 2px 5px;
122+
123+
& + .legend_explain {
124+
width: auto;
125+
}
107126
}
108127

109128
#stats_permissions_form dd {
110-
margin-top: .5em;
129+
margin: 0.5em 0 0 0;
111130
}
112131
}
132+
133+
/* <<< RESPONSIVE */

lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212

1313
{% INCLUDE 'overall_header.html' %}
1414

15-
{% set switch_type = TOGGLECTRL_TYPE ?? 'toggle' %}
16-
1715
<a id="maincontent"></a>
1816

1917
<h1>{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}</h1>
20-
<p>{{ lang('STATS_PERMISSIONS_CONFIG_DESC', STATS_PERMISSIONS_METADATA.EXT_NAME) }}</p>
18+
<p>{{ lang('STATS_PERMISSIONS_CONFIG_DESC', STATS_PERMISSIONS_METADATA.ext_name) }}</p>
2119

2220
{{ _self.notes(STATS_PERMISSIONS_NOTES) }}
2321

@@ -28,14 +26,14 @@ <h1>{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}</h1>
2826
<dl>
2927
<dt><label>{{ lang('STATS_PERMISSIONS_ADMIN_MODE') ~ lang('COLON') }}</label><br><span>{{ lang('STATS_PERMISSIONS_ADMIN_MODE_EXP') }}</span></dt>
3028
<dd>
31-
{{ _self.switch('stats_permissions_admin_mode', STATS_PERMISSIONS_ADMIN_MODE, switch_type) }}
29+
{{ _self.switch('stats_permissions_admin_mode', STATS_PERMISSIONS_ADMIN_MODE) }}
3230
</dd>
3331
</dl>
3432

3533
<dl>
3634
<dt><label>{{ lang('STATS_PERMISSIONS_USE_PERMISSIONS') ~ lang('COLON') }}</label><br><span>{{ lang('STATS_PERMISSIONS_USE_PERMISSIONS_EXP') }}</span></dt>
3735
<dd>
38-
{{ _self.switch('stats_permissions_use_permissions', STATS_PERMISSIONS_USE_PERMISSIONS, switch_type) }}
36+
{{ _self.switch('stats_permissions_use_permissions', STATS_PERMISSIONS_USE_PERMISSIONS) }}
3937
</dd>
4038
</dl>
4139

@@ -49,16 +47,16 @@ <h1>{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}</h1>
4947
<dl class="simple_permissions">
5048
<dt><label>{{ lang('STATS_PERMISSIONS_PERM_FOR_GUESTS') ~ lang('COLON') }}</label><br><span>{{ lang('STATS_PERMISSIONS_PERM_FOR_GUESTS_EXP') }}</span></dt>
5149
<dd>
52-
{{ _self.switch('stats_permissions_perm_for_guests_stats' , STATS_PERMISSIONS_PERM_FOR_GUESTS b-and 1, switch_type) }} {{ lang('STATS_PERMISSIONS_PERM_STATS') }}<br>
53-
{{ _self.switch('stats_permissions_perm_for_guests_newest' , STATS_PERMISSIONS_PERM_FOR_GUESTS b-and 2, switch_type) }} {{ lang('STATS_PERMISSIONS_PERM_NEWEST') }}<br>
50+
{{ _self.switch('stats_permissions_perm_for_guests_stats' , STATS_PERMISSIONS_PERM_FOR_GUESTS b-and 1) }} {{ lang('STATS_PERMISSIONS_PERM_STATS') }}<br>
51+
{{ _self.switch('stats_permissions_perm_for_guests_newest' , STATS_PERMISSIONS_PERM_FOR_GUESTS b-and 2) }} {{ lang('STATS_PERMISSIONS_PERM_NEWEST') }}<br>
5452
</dd>
5553
</dl>
5654

5755
<dl class="simple_permissions">
5856
<dt><label>{{ lang('STATS_PERMISSIONS_PERM_FOR_BOTS') ~ lang('COLON') }}</label><br><span>{{ lang('STATS_PERMISSIONS_PERM_FOR_BOTS_EXP') }}</span></dt>
5957
<dd>
60-
{{ _self.switch('stats_permissions_perm_for_bots_stats' , STATS_PERMISSIONS_PERM_FOR_BOTS b-and 1, switch_type) }} {{ lang('STATS_PERMISSIONS_PERM_STATS') }}<br>
61-
{{ _self.switch('stats_permissions_perm_for_bots_newest' , STATS_PERMISSIONS_PERM_FOR_BOTS b-and 2, switch_type) }} {{ lang('STATS_PERMISSIONS_PERM_NEWEST') }}<br>
58+
{{ _self.switch('stats_permissions_perm_for_bots_stats' , STATS_PERMISSIONS_PERM_FOR_BOTS b-and 1) }} {{ lang('STATS_PERMISSIONS_PERM_STATS') }}<br>
59+
{{ _self.switch('stats_permissions_perm_for_bots_newest' , STATS_PERMISSIONS_PERM_FOR_BOTS b-and 2) }} {{ lang('STATS_PERMISSIONS_PERM_NEWEST') }}<br>
6260

6361
</dd>
6462
</dl>
@@ -94,35 +92,38 @@ <h1>{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}</h1>
9492
{% INCLUDEJS '@lukewcs_statspermissions/acp_stats_permissions_settings.js' %}
9593
{% INCLUDECSS '@lukewcs_statspermissions/acp_stats_permissions_settings.css' %}
9694

97-
{% macro switch(name, checked = false, type = 'toggle') -%}
98-
{% if type == 'toggle' || type == 'checkbox' -%}
99-
<input type="checkbox"{{ type == 'toggle' ? ' class="toggle"' }} name="{{ name }}" value="1"{{ checked ? ' checked' }}>
95+
{% macro switch(name, checked = false, type = null) -%}
96+
{% set type = type ?? (TOGGLECTRL_TYPE in ['toggle', 'checkbox', 'radio'] ? TOGGLECTRL_TYPE : 'toggle') -%}
97+
{% if type in ['toggle', 'checkbox'] -%}
98+
<input type="checkbox" class="{{ type }}" name="{{ name }}" value="1"{{ checked ? ' checked' }}>
10099
{%- elseif type == 'radio' -%}
101100
<label><input type="radio" class="radio" name="{{ name }}" value="1"{{ checked ? ' checked' }}> {{ lang('YES') }}</label>
102101
<label><input type="radio" class="radio" name="{{ name }}" value="0"{{ !checked ? ' checked' }}> {{ lang('NO') }}</label>
103102
{%- endif %}
103+
{#- v1.3.1 #}
104104
{%- endmacro %}
105105

106106
{% macro js_button(name, lang_var) -%}
107107
<input type="button" class="button2" name="{{ name }}" value="{{ lang(lang_var) }}">
108108
{%- endmacro %}
109109

110110
{% macro notes(notes) %}
111+
{% set note_dot = notes|length > 1 ? '&bull; ' %}
111112
{% if notes|length %}
112113
<div class="successbox notice">
113114
{% for note in notes %}
114-
<p>{{ note }}</p>
115+
<p>{{ note_dot }}{{ note }}</p>
115116
{% endfor %}
116117
</div>
117118
{% endif %}
118119
{% endmacro %}
119120

120121
{% macro footer(metadata) %}
121-
<p class="{{ metadata.class }}">
122+
<p class="{{ metadata.class }}">
122123
{{ metadata.ext_name }} {{ metadata.ext_ver }} &copy; {{ metadata.ext_copyright }}
123124
{% if metadata.lang_ver is defined %}
124125
<br>
125-
{{ metadata.lang_desc|e('html') }} {{ metadata.lang_ver|e('html') }} &bull; {{ metadata.lang_author|e('html') }}
126+
{{ metadata.lang_desc|e('html') }} {{ metadata.lang_ver|e('html') }} &copy; {{ metadata.lang_author|e('html') }}
126127
{% endif %}
127128
</p>
128129
{% endmacro %}

0 commit comments

Comments
 (0)