From d9254bf3e865d83365a77c77e2c4d3002dae70a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sun, 7 Mar 2021 18:27:17 +0100 Subject: [PATCH 01/85] Change site logo Issue #116 --- assets/css/common.css | 14 ++++++++------ assets/images/logo.svg | 2 +- assets/public/icon.png | Bin 6626 -> 5613 bytes 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/assets/css/common.css b/assets/css/common.css index 4c411807..0648c6d1 100644 --- a/assets/css/common.css +++ b/assets/css/common.css @@ -103,8 +103,8 @@ a:active { .site-header { background-color: rgba(255,255,255, 0.6); box-shadow: 0 0 5px rgba(0,0,0, 0.2); - padding-top: 0.6em; - padding-bottom: 0.6em; + padding-top: 0.7em; + padding-bottom: 0.7em; } .site-header.develop { background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='a' viewBox='0 0 8 8' width='24' height='24' patternUnits='userSpaceOnUse'%3E%3Cpath fill='rgba%28255%2C0%2C0%2C0.06%29' d='M0 0h4L0 4zm0 8l8-8v4L4 8z'/%3E%3C/pattern%3E%3C/defs%3E%3Cpath fill='url%28%23a%29' d='M0 0h24v24H0z'/%3E%3C/svg%3E"); @@ -117,10 +117,10 @@ a:active { .site-header .site-logo { background: url('../images/logo.svg') no-repeat; - background-size: 238px auto; - background-position: 4px 4px; + background-size: contain; + background-position: center; width: 245px; - height: 62px; + height: 56px; display: block; text-indent: -9999px; @@ -131,6 +131,8 @@ a:active { { .site-header .site-logo { width: 72px; + background-size: auto 100%; + background-position: left; flex-grow: 0; flex-shrink: 0; } @@ -170,7 +172,7 @@ a:active { color: #EE6D00; } .site-navigation .user-menu { - margin: 0.55em 0 0.6em; + margin: 0.35em 0 0.6em; font-size: 0.8em; color: #8E8E8E; } diff --git a/assets/images/logo.svg b/assets/images/logo.svg index a0b486d7..87f65f0a 100644 --- a/assets/images/logo.svg +++ b/assets/images/logo.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/assets/public/icon.png b/assets/public/icon.png index d0b866e05ec6d861eb9366c7023f219d158ab9b2..205184dd3ecfd837ce3f68fa80f774384c62d832 100644 GIT binary patch literal 5613 zcmZ{oc{o&m^vB1Nt&j{8Vi;l&%KlBZVXS2tB4jCBYNEm@W6hEo`<5iTvab_{v1c!P zLX1ITWGva&@tc0n^ZWC6p67G#=bq1V&i&_}_dVx@F*DI;XX9rB008WU2D%8^{pjCf zVWM55D7NYV0MBPbU2V&kKPl~@G#?-&=d>79O#g5D|Jb``Tu9uiLF2QCk&AIM9*yXN z$+HUBTcDes+@#R-gQa&1(bjNI8XnhSSd4pMCe%k6Qe}m8E34PH{KWB9uYf z(YN)FUH#q*3-7Bn)(Lq~(P*g=jj#{d3Gk&jMbuEj&k^E`?iVoJyd+?r%C}6YNwO1L zpr&EJjTxG!%p3cj_PudM%9@A@L>HaeU9Gk|eCny05DCKOQSSfnvFzXTut8c!zXKPe zfZK&5o7(1|+uv3-XgsKQU_2?3et|PEPkB}>zm`#>t`tkT!nO9R{OMQXb09A^@8p@) zv^GzjyErlpYnJ`!YGOlVhn9Itdl$EUswf)HPtf2ZC-6)gcru6Un5U>q58z)cvKb;L zu-5~>JH=-h?CP7Rlntrgz`IbCqb>(pUF|1n?P{B+{1IR~?n}1rcFSd{a!9SVw{S&Y zKcr>I{-IlkBM%x!HyDJ!DKe^TDVD~n$PfNjs4LY)_Vz>kK$6%6<_7sQVjokPnDT1r zOpxk7k4I!~gzQ~6Z{>dvd?M`HWY&yhLvx^}W$9;A-gHm=pV>(!Q#N-#5Ut>@eX$<9fG>?!@@1!693c)h5Pn1?tMer?A7C*7t^vN1K zAJ5wcT1q(|^V>M;I+a9p1Q}i=`gwCne&O0pNh1tQc`Rnhbx^%hulY$>01QmjW^P&3 z>?h`300sS5d6GX3YYs?3Pyb|i=VoU;?yh{*r{-gWD59=jJTdT1 z)WL{l_mcWnm`Kz)Otl?`mmuE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i?JE7oMn?qnE9MECK5S|W=A_wjm!t_unqDsrKnL-DRw5jDqYUO0*j1C_1Gn{xP) zoLjGdOB@?3a(893h&(Fu4P+S2KqSmjnS(*H?4Q_DY@N_Zkyo2Y(5BBNQcp_#axo24VDS~G8y$Z@TpQbOE~R3C<6s0DK5^9@ZV@@}1= zBf~I;XM>E}I}~@9il?cf*t8&s0hzek@CWEe(9E0}z~eeBJD9o-Bv3?o~5B|k9|_rTc9mb-JvFmNy*J1xnL zX3xCl1IRE8JaiqgzNdH8v_g$2^~-|{!@%X|$xgP4&u4AVz)V%VtF7zJFq(*PLH>Y> z?{$WOTV0>X-IXSC!)Q`;U9k?$3{{fb>gQ)a4X*2kVW_8D=({_g`X?mT*WVi< Date: Thu, 29 Apr 2021 23:45:53 +0200 Subject: [PATCH 02/85] Forms: make item layout vertical, implement item help Issue #116 Fixes #103 --- assets/css/common.css | 52 ++++++----------- assets/css/radio-table-settings.css | 16 +++--- assets/css/user-login-register.css | 14 ----- assets/js/src/RadioTableColumnsUI.js | 3 +- templates/common/form/custom_types.html.twig | 20 +++++-- .../common/form/overwritten_types.html.twig | 57 ++++++++++++++----- 6 files changed, 83 insertions(+), 79 deletions(-) diff --git a/assets/css/common.css b/assets/css/common.css index 0648c6d1..19577bbd 100644 --- a/assets/css/common.css +++ b/assets/css/common.css @@ -575,49 +575,31 @@ input.color[style] { /* form items lists */ .form-item { - width: 100%; -} - -.form-item.form-regular { - display: flex; - margin: 0.7em 0; -} -.form-item.form-regular > *:first-child { - width: 40%; + margin: 20px 0; } -.form-item.form-regular > *:last-child { - flex: 1; +.form-item label { + display: block; + margin-bottom: 7px; } -.form-item.form-checkbox { - margin: 0.9em 0; - +.form-item-checkbox { /* needed for inputs and fake checkboxes with position absolute */ position: relative; } - -.form-item label { - display: block; -} -.form-item.form-regular label { - margin-top: 5px; +.form-item-checkbox label { + margin-bottom: 0; } -@media (max-width: 800px) -{ - .form-item.form-regular { - flex-direction: column; - } - .form-item.form-regular > *:first-child { - width: auto; - } - .form-item.form-regular label { - margin-bottom: 0.5em; - } - - .form-item.form-checkbox { - margin: 1.3em 0; - } +.form-error-message { + color: #ff0000; + margin: 7px 0 0; + font-weight: bold; +} +.form-help-message { + font-size: 0.9em; + font-style: italic; + margin: 7px 0 0; + opacity: 0.8; } diff --git a/assets/css/radio-table-settings.css b/assets/css/radio-table-settings.css index 746b7796..3c49d404 100644 --- a/assets/css/radio-table-settings.css +++ b/assets/css/radio-table-settings.css @@ -7,7 +7,6 @@ /* columns UI */ .JS .radio-table-columns { - width: 80%; margin: 1.2em auto; } .JS .radio-table-columns .form-item { @@ -16,13 +15,15 @@ border: 1px solid #C2C2C2; padding: 0.5em 1em; box-sizing: border-box; + display: flex; align-items: center; } .JS .radio-table-columns .form-item label { - margin-top: 0; + margin: 0; } .JS .radio-table-columns .form-item > :last-child { text-align: right; + flex: 1; } .JS .radio-table-columns .form-item.hidden-column { background: #FBFBFB; @@ -47,23 +48,20 @@ @media (max-width: 800px) { - .JS .radio-table-columns { - width: auto; - } - .JS .radio-table-columns .form-item.form-regular { + .JS .radio-table-columns .form-item { flex-direction: row; } - .JS .radio-table-columns .form-item.form-regular label { + .JS .radio-table-columns .form-item label { margin-bottom: 0; } } @media (max-width: 700px) { - .JS .radio-table-columns .form-item.form-regular { + .JS .radio-table-columns .form-item { flex-direction: column; } - .JS .radio-table-columns .form-item.form-regular label { + .JS .radio-table-columns .form-item label { margin-bottom: 0.7em; } .JS .radio-table-columns .form-item > :last-child { diff --git a/assets/css/user-login-register.css b/assets/css/user-login-register.css index 4287ce21..4768c97f 100644 --- a/assets/css/user-login-register.css +++ b/assets/css/user-login-register.css @@ -2,17 +2,3 @@ max-width: 400px; margin: 2.5em auto; } - -/* keep these styles in sync with mobile form item list */ -.user-login-screen .form-item.form-regular { - flex-direction: column; -} -.user-login-screen .form-item.form-regular > *:first-child { - width: auto; -} -.user-login-screen .form-item.form-regular label { - margin-bottom: 0.5em; -} -.user-login-screen .form-item.form-checkbox { - margin: 1.3em 0; -} diff --git a/assets/js/src/RadioTableColumnsUI.js b/assets/js/src/RadioTableColumnsUI.js index bb17f235..fba9f4d1 100644 --- a/assets/js/src/RadioTableColumnsUI.js +++ b/assets/js/src/RadioTableColumnsUI.js @@ -45,7 +45,8 @@ export class RadioTableColumnsUI item.buttonToggle.disabled = true; } - let buttonsContainer = item.block.lastElementChild; + let buttonsContainer = document.createElement('div'); + item.block.appendChild(buttonsContainer) buttonsContainer.appendChild(item.buttonToggle); buttonsContainer.appendChild(item.buttonMoveUp); buttonsContainer.appendChild(item.buttonMoveDown); diff --git a/templates/common/form/custom_types.html.twig b/templates/common/form/custom_types.html.twig index 48554f9e..21ec72a1 100644 --- a/templates/common/form/custom_types.html.twig +++ b/templates/common/form/custom_types.html.twig @@ -1,7 +1,13 @@ {% block integer_unit_widget %} + {% set unit_label_id = id ~ '_unit' %} + {% set attr = attr|merge({'aria-describedby': (attr['aria-describedby'] ?? '') ~ ' ' ~ unit_label_id}) %} + {{ block('integer_widget') }} - {{ unit_label }} -{% endblock integer_unit_widget %} + + + {{ unit_label }} + +{% endblock %} {% block decimal_unit_widget %} {% set attr = attr|merge({ @@ -9,22 +15,24 @@ 'step': step, 'min': step, }) %} + {{ block('integer_unit_widget') }} -{% endblock decimal_unit_widget %} +{% endblock %} {% block radio_table_columns_row %} {# Do not render label for radio table columns widget. #} {{ block('form_rows') }} -{% endblock radio_table_columns_row %} +{% endblock %} {% block text_hints_widget %} {% set hints_list_id = id ~ '_hints' %} + {% set attr = attr|merge({'list': hints_list_id}) %} + {% for hint in hints %} {% endfor %} - {% set attr = attr|merge({'list': hints_list_id}) %} {{ block('form_widget') }} -{% endblock text_hints_widget %} +{% endblock %} diff --git a/templates/common/form/overwritten_types.html.twig b/templates/common/form/overwritten_types.html.twig index 9825e41d..1144b6a5 100644 --- a/templates/common/form/overwritten_types.html.twig +++ b/templates/common/form/overwritten_types.html.twig @@ -1,30 +1,59 @@ {% block form_row %} -
-
{{ form_label(form) }}
-
{{ form_widget(form) }}
+ {%- set aria_describedby = (attr['aria-describedby'] ?? '') ~ (errors|length > 0 ? ' ' ~ id ~ '_error') ~ (help ? ' ' ~ id ~ '_help') -%} + +
+ {{ form_label(form) }} + {{ form_widget(form, {attr: {'aria-describedby': aria_describedby|trim}}) }} + {{ form_errors(form) }} + {{ form_help(form) }}
-{% endblock form_row %} +{% endblock %} {% block checkbox_row %} -
- {{ form_widget(form) }} - {{ form_label(form) }} + {%- set aria_describedby = (attr['aria-describedby'] ?? '') ~ (errors|length > 0 ? ' ' ~ id ~ '_error') ~ (help ? ' ' ~ id ~ '_help') -%} + +
+
+ {{ form_widget(form, {attr: {'aria-describedby': aria_describedby|trim}}) }} + {{ form_label(form) }} +
+ + {{ form_errors(form) }} + {{ form_help(form) }}
-{% endblock checkbox_row %} +{% endblock %} -{% block radio_row %} - {{ block('checkbox_row') }} -{% endblock radio_row %} +{% block form_errors %} + {%- if errors|length > 0 -%} +

+ {{ (errors|first).message }} +

+ {%- endif -%} +{% endblock %} + +{% block form_help %} + {%- if help -%} +

+ {{ help_html ? field_help(form)|raw : field_help(form) }} +

+ {%- endif -%} +{% endblock %} {% block choice_row %} {% if expanded %} -
+ {%- set aria_describedby = (attr['aria-describedby'] ?? '') ~ (errors|length > 0 ? ' ' ~ id ~ '_error') ~ (help ? ' ' ~ id ~ '_help') -%} + +
{{ form_label(form)|striptags }} + {% for child in form %} - {{ form_row(child) }} + {{ form_row(child, {attr: {'aria-describedby': aria_describedby|trim}}) }} {% endfor %} + + {{ form_errors(form) }} + {{ form_help(form) }}
{% else %} {{ form_row(form) }} {% endif %} -{% endblock choice_row %} +{% endblock %} From c1c6ca201bb35bbde83108a0122599acdb0e6f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 00:12:10 +0100 Subject: [PATCH 03/85] Get rid of tabbed UI Issue #116 --- assets/css/part/tabbed-ui.css | 107 ---------------------------- assets/js/my-account-settings.js | 3 - assets/js/radio-station-edit-add.js | 4 -- assets/js/radio-table-create.js | 3 - assets/js/radio-table-remove.js | 4 -- assets/js/radio-table-settings.js | 2 - assets/js/src/TabbedUI.js | 102 -------------------------- 7 files changed, 225 deletions(-) delete mode 100644 assets/css/part/tabbed-ui.css delete mode 100644 assets/js/src/TabbedUI.js diff --git a/assets/css/part/tabbed-ui.css b/assets/css/part/tabbed-ui.css deleted file mode 100644 index 7bbc3175..00000000 --- a/assets/css/part/tabbed-ui.css +++ /dev/null @@ -1,107 +0,0 @@ -.JS .tabbed-ui > div { - background: #FAFFF8; - padding: 0.5em 1.2em 0.8em; - border: 1px solid #D2D2D2; -} -.JS .tabbed-ui > div:not(.tabbed-ui-current) { - display: none; -} - -.tabbed-ui-navigator { - padding-left: 0; - list-style-type: none; - margin: 0 0 -1px; - - vertical-align: bottom; -} -@supports (-webkit-nbsp-mode: initial) -{ - .tabbed-ui-navigator { - /* needed for WebKit, not Blink */ - margin-bottom: 0; - } -} -.tabbed-ui-navigator li { - display: inline; -} -.tabbed-ui-navigator button { - margin-right: 0.4em; - padding: 0.2em 0.9em; - background: #FAFFF8; - border: 1px solid #D2D2D2; - opacity: 0.63; - - white-space: nowrap; - display: inline-block; - outline-style: none; - box-shadow: none; - color: inherit; - transition-property: opacity; - width: auto; - font-weight: normal; - margin-top: 0; -} -.tabbed-ui-navigator button:hover { - background: #fff; - color: inherit; -} -.tabbed-ui-navigator button:focus:not(:hover):not(:active) { - opacity: 1; - outline-style: dashed; -} -.tabbed-ui-navigator button.tabbed-ui-current { - opacity: 1; - border-bottom-color: #FAFFF8; - padding-top: 0.6em; - background: #FAFFF8; -} - -@media (max-width: 800px) -{ - .tabbed-ui-navigator { - margin-bottom: 0.4em; - } - - .tabbed-ui-navigator button { - margin-bottom: 0.5em; - } - .tabbed-ui-navigator button, .tabbed-ui-navigator button.tabbed-ui-current { - padding: 0.2em 0.9em; - border: 1px solid #D2D2D2; - } - .tabbed-ui-navigator li:last-child button { - margin-right: 0; - } - .tabbed-ui-navigator button.tabbed-ui-current { - font-weight: bold; - border-color: #aaa; - } -} - - -/* information paragraph in tabbed UI */ - -.JS .tabbed-ui .information { - box-shadow: none; - padding-top: 1.5em; - padding-bottom: 1.5em; -} - -@media (max-width: 800px) -{ - .JS .tabbed-ui .information { - padding-top: 0.9em; - padding-bottom: 0.9em; - } -} - - -/* button in tabbed UI */ - -.JS .tabbed-ui > div > form > button { - margin-top: 1.5em; - margin-bottom: 0.7em; -} -.JS .tabbed-ui + button { - margin-top: 1.3em; -} diff --git a/assets/js/my-account-settings.js b/assets/js/my-account-settings.js index cc7d7f3b..9d6d40cd 100644 --- a/assets/js/my-account-settings.js +++ b/assets/js/my-account-settings.js @@ -1,7 +1,4 @@ import '../css/my-account-settings.css'; -import { TabbedUI } from './src/TabbedUI.js'; - document.addEventListener('DOMContentLoaded', () => { - new TabbedUI(document.querySelector('.tabbed-ui')); }); diff --git a/assets/js/radio-station-edit-add.js b/assets/js/radio-station-edit-add.js index bc8a709c..5d27057b 100644 --- a/assets/js/radio-station-edit-add.js +++ b/assets/js/radio-station-edit-add.js @@ -1,7 +1,5 @@ import '../css/radio-station-edit-add.css'; -import { TabbedUI } from './src/TabbedUI.js'; - function setupFrequencyWithDabChannelSync() { let dabChannelInput = document.querySelector('.dab-channel-input'); @@ -19,7 +17,5 @@ function setupFrequencyWithDabChannelSync() } document.addEventListener('DOMContentLoaded', () => { - new TabbedUI(document.querySelector('.tabbed-ui')); - setupFrequencyWithDabChannelSync(); }); diff --git a/assets/js/radio-table-create.js b/assets/js/radio-table-create.js index a542dde7..1b21677b 100644 --- a/assets/js/radio-table-create.js +++ b/assets/js/radio-table-create.js @@ -1,7 +1,4 @@ import '../css/radio-table-create.css'; -import { TabbedUI } from './src/TabbedUI.js'; - document.addEventListener('DOMContentLoaded', () => { - new TabbedUI(document.querySelector('.tabbed-ui')); }); diff --git a/assets/js/radio-table-remove.js b/assets/js/radio-table-remove.js index 65827a00..2cd9e1cb 100644 --- a/assets/js/radio-table-remove.js +++ b/assets/js/radio-table-remove.js @@ -1,7 +1,5 @@ import '../css/radio-table-remove.css'; -import { TabbedUI } from './src/TabbedUI.js'; - function setupRemoveConfirmDialog() { let input = document.querySelector('.radio-table-remove-confirm'); @@ -19,7 +17,5 @@ function setupRemoveConfirmDialog() } document.addEventListener('DOMContentLoaded', () => { - new TabbedUI(document.querySelector('.tabbed-ui')); - setupRemoveConfirmDialog(); }); diff --git a/assets/js/radio-table-settings.js b/assets/js/radio-table-settings.js index d4f7a7fc..02e63ae6 100644 --- a/assets/js/radio-table-settings.js +++ b/assets/js/radio-table-settings.js @@ -1,6 +1,5 @@ import '../css/radio-table-settings.css'; -import { TabbedUI } from './src/TabbedUI.js'; import { RadioTableColumnsUI } from './src/RadioTableColumnsUI.js'; import Huebee from 'huebee'; @@ -50,7 +49,6 @@ function setupCustomWidthInput() } document.addEventListener('DOMContentLoaded', () => { - new TabbedUI(document.querySelector('.tabbed-ui')); new RadioTableColumnsUI(document.querySelector('.radio-table-columns')); setupColorInputs(); diff --git a/assets/js/src/TabbedUI.js b/assets/js/src/TabbedUI.js deleted file mode 100644 index 459370d1..00000000 --- a/assets/js/src/TabbedUI.js +++ /dev/null @@ -1,102 +0,0 @@ -import '../../css/part/tabbed-ui.css'; - -export class TabbedUI -{ - constructor(container) - { - this.container = container; - this.panels = [...container.children]; - this.navigator = null; - this.buttons = []; - - this.setupNavigator(); - this.setupPanels(); - } - - get LAST_PANEL_SESSION_KEY() - { - return 'tabbed-ui__' + location.pathname; - } - - setupNavigator() - { - this.navigator = document.createElement('ul'); - this.navigator.classList.add('tabbed-ui-navigator'); - this.navigator.setAttribute('role', 'tablist'); - - this.panels.forEach((panel, i) => { - let title = panel.querySelector('h2').innerHTML; - let item = document.createElement('li'); - let button = document.createElement('button'); - - button.innerHTML = title; - button.dataset.panelNumber = i; - button.type = 'button'; - button.addEventListener('click', this.onNavigatorButtonClick.bind(this)); - button.setAttribute('role', 'tab'); - - this.buttons[i] = button; - - item.appendChild(button); - this.navigator.appendChild(item); - }); - - this.container.insertBefore(this.navigator, this.panels[0]); - } - - setupPanels() - { - let defaultPanelNumber = 0; - - let currentHash = location.hash.replace('#', ''); - let savedPanelNumber = sessionStorage.getItem(this.LAST_PANEL_SESSION_KEY); - - if (null != savedPanelNumber) { - defaultPanelNumber = savedPanelNumber; - } - - this.panels.forEach((panel, i) => { - panel.setAttribute('role', 'tabpanel'); - - if (currentHash && panel.id == currentHash) { - defaultPanelNumber = i; - - // If default panel was determined by URL hash, scroll to - // the top of the page to prevent default browser behavior. - let scrollToTop = () => { - window.scroll(0, 0); - window.removeEventListener('scroll', scrollToTop); - }; - window.addEventListener('scroll', scrollToTop); - } - }); - - this.changePanel(defaultPanelNumber); - } - - changePanel(panelNumber) - { - this.panels.forEach((panel, i) => { - panel.classList.remove('tabbed-ui-current'); - this.buttons[i].classList.remove('tabbed-ui-current'); - - if (i == panelNumber) { - panel.classList.add('tabbed-ui-current'); - this.buttons[i].classList.add('tabbed-ui-current'); - } - }); - } - - onNavigatorButtonClick(event) - { - event.preventDefault(); - - let button = event.target; - let panelNumber = button.dataset.panelNumber; - - button.blur(); - - this.changePanel(panelNumber); - sessionStorage.setItem(this.LAST_PANEL_SESSION_KEY, panelNumber); - } -} From 20759292612886985a055e708e50cf6f577204e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 01:34:58 +0100 Subject: [PATCH 04/85] Use from item help where it makes sense Issue #116 --- assets/css/part/radio-table-status.css | 5 ++++- src/Form/RadioTableCreateType.php | 13 ++++++++++- src/Form/UserSettingsType.php | 6 ++++- templates/radio_table/create.html.twig | 4 ---- templates/user/my_account_settings.html.twig | 10 +-------- translations/messages.en.yaml | 21 +++++++++--------- translations/messages.pl.yaml | 23 ++++++++++---------- 7 files changed, 43 insertions(+), 39 deletions(-) diff --git a/assets/css/part/radio-table-status.css b/assets/css/part/radio-table-status.css index d14ad57b..37e90485 100644 --- a/assets/css/part/radio-table-status.css +++ b/assets/css/part/radio-table-status.css @@ -1,8 +1,11 @@ /* radio table status chooser */ .radio-table-status .form-item { - padding: 1.2em 0 1.1em 78px; + padding-left: 78px; + padding-top: 3px; + min-height: 50px; box-sizing: border-box; + background-repeat: no-repeat; background-position: left 2px center; background-size: 50px; diff --git a/src/Form/RadioTableCreateType.php b/src/Form/RadioTableCreateType.php index 84b16292..3ef96183 100644 --- a/src/Form/RadioTableCreateType.php +++ b/src/Form/RadioTableCreateType.php @@ -7,6 +7,8 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; class RadioTableCreateType extends AbstractType @@ -14,7 +16,9 @@ class RadioTableCreateType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('name') + ->add('name', null, [ + 'help' => 'radio_table.settings.form.name.help', + ]) ->add('frequencyUnit', ChoiceType::class, [ 'choices' => [ 'MHz' => RadioTable::FREQUENCY_MHZ, @@ -40,6 +44,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ; } + public function finishView(FormView $view, FormInterface $form, array $options): void + { + foreach ($view['status'] as $children) { + $children->vars['help'] = 'radio_table.settings.form.status.choice.'.$children->vars['value'].'.help'; + } + } + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php index 02116f54..c0793a17 100644 --- a/src/Form/UserSettingsType.php +++ b/src/Form/UserSettingsType.php @@ -21,10 +21,14 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'required' => false, 'sanitize_html' => true, ]) - ->add('publicProfile') + ->add('publicProfile', null, [ + 'required' => false, + 'help' => 'user.settings.form.publicProfile.help', + ]) ->add('currentPassword', PasswordType::class, [ 'mapped' => false, 'required' => false, + 'help' => 'user.settings.form.currentPassword.help', 'constraints' => [ new SecurityAssert\UserPassword([ 'groups' => 'ChangingPasswordTab', diff --git a/templates/radio_table/create.html.twig b/templates/radio_table/create.html.twig index b72e4b8a..9f51f3ec 100644 --- a/templates/radio_table/create.html.twig +++ b/templates/radio_table/create.html.twig @@ -18,10 +18,6 @@

{{ 'radio_table.settings.heading.general'|trans }}

-

- {{ 'radio_table.create.information.local_desc'|trans }} -

- {{ form_row(form.name) }} {{ form_row(form.frequencyUnit) }} {{ form_row(form.description) }} diff --git a/templates/user/my_account_settings.html.twig b/templates/user/my_account_settings.html.twig index 836efce7..ad57e941 100644 --- a/templates/user/my_account_settings.html.twig +++ b/templates/user/my_account_settings.html.twig @@ -48,20 +48,12 @@

{{ 'user.settings.heading.public_profile'|trans }}

-

- {{ 'user.settings.information.public_profile'|trans }} -

- - {{ form_row(form.aboutMe) }} {{ form_row(form.publicProfile) }} + {{ form_row(form.aboutMe) }}

{{ 'user.settings.heading.change_password'|trans }}

-

- {{ 'user.settings.information.change_password'|trans }} -

- {{ form_row(form.currentPassword) }} {{ form_row(form.plainPassword) }}
diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index bce98b50..01669b63 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -56,9 +56,6 @@ radio_table: notification: created: 'List has been created.' - information: - local_desc: "It's usually good idea to include additional information about your location into list title and description. They\u00A0are used for searching. You can change them later." - settings: title: 'List settings' @@ -71,14 +68,18 @@ radio_table: form: name: 'List name' + name.help: 'Place information about location here to make finding your list easier.' frequencyUnit: 'Frequency unit' maxSignalLevelUnit: 'Signal level unit' description: 'List description' status: 'List visibility' status.choice: - '1': 'Public — your list is available for everyone' - '0': 'Unlisted — your list is available only for visitors who receive the link' - '-1': 'Private — your list is available only for you' + '1': 'Public' + '1.help': 'Your list is available for everyone.' + '0': 'Unlisted' + '0.help': 'Your list is available only for visitors who receive the link.' + '-1': 'Private' + '-1.help': 'Your list is available only for you.' sorting: 'Default sorting' appearanceBackgroundColor: 'Background color' appearanceColor: 'Text color' @@ -232,19 +233,17 @@ user: change_password: 'Password change' form: - aboutMe: 'About me' + aboutMe: 'Something about you' publicProfile: 'Enable public profile' + publicProfile.help: "Public profile shows your lists and information about you. If it's disabled, your lists are anonymous." currentPassword: 'Current password' + currentPassword.help: "Keep it empty if you don't want to change the password." plainPassword.first: 'New password' plainPassword.second: 'New password again' notification: changed_password: 'New password has been saved.' - information: - public_profile: 'Public profile page shows index with your lists and information about you. With public profile enabled your username will be shown publicly and linked under your lists.' - change_password: "Keep these fields empty if you don't want to change the password." - register: title: 'Register' diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index 71ccaaa9..383d10f9 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -56,9 +56,6 @@ radio_table: notification: created: 'Wykaz został utworzony.' - information: - local_desc: "W nazwie i opisie wykazu warto umieścić lokalizację (np.\u00A0miejscowość lub województwo). Te\u00A0informacje są\u00A0używane przy\u00A0przeszukiwaniu wykazów. Można je później zmienić." - settings: title: 'Ustawienia wykazu' @@ -71,14 +68,18 @@ radio_table: form: name: 'Nazwa wykazu' + name.help: 'Umieść tutaj lokalizację (np. miejscowość lub województwo), aby ułatwić odnalezienie twojego wykazu.' frequencyUnit: 'Jednostka częstotliwości' maxSignalLevelUnit: 'Jednostka poziomu sygnału' description: 'Opis wykazu' status: 'Widoczność wykazu' status.choice: - '1': 'Publiczny — wykaz może zobaczyć każdy' - '0': 'Niepubliczny — wykaz mogą zobaczyć jedynie osoby, które otrzymają odnośnik' - '-1': 'Prywatny — wykaz możesz zobaczyć tylko ty' + '1': 'Publiczny' + '1.help': 'Wykaz może zobaczyć każdy.' + '0': 'Niepubliczny' + '0.help': 'Wykaz mogą zobaczyć jedynie osoby, które otrzymają odnośnik.' + '-1': 'Prywatny' + '-1.help': 'Wykaz możesz zobaczyć tylko ty.' sorting: 'Domyślne sortowanie' appearanceBackgroundColor: 'Kolor tła' appearanceColor: 'Kolor tekstu' @@ -232,19 +233,17 @@ user: change_password: 'Zmiana hasła' form: - aboutMe: 'Kilka słów o mnie' - publicProfile: 'Włącz profil publiczny i stronę profilową' + aboutMe: 'Kilka słów o tobie' + publicProfile: 'Włącz profil publiczny' + publicProfile.help: 'Profil publiczny zawiera listę twoich wykazów i informacje o tobie. Jeśli jest wyłączony, twoje wykazy są anonimowe.' currentPassword: 'Obecne hasło' + currentPassword.help: 'Pozostaw puste, jeżeli nie chcesz zmieniać hasła.' plainPassword.first: 'Nowe hasło' plainPassword.second: 'Nowe hasło ponownie' notification: changed_password: 'Nowe hasło zostało zapisane.' - information: - public_profile: "Publiczna strona profilowa zawiera spis twoich wykazów oraz poniższy opis. Włączenie publicznej strony profilowej ujawni twoją nazwę użytkownika i\u00A0spowoduje umieszczenie odnośnika do twojego profilu pod każdym twoim wykazem." - change_password: 'Jeżeli nie chcesz zmieniać hasła, pozostaw pola puste.' - register: title: 'Zarejestruj się' From 79b62dbc8f52b45c0be1486e7120621b30ca18ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 01:35:23 +0100 Subject: [PATCH 05/85] User settings: remove unneeded account details Issue #116 --- templates/user/my_account_settings.html.twig | 30 -------------------- translations/messages.en.yaml | 7 ----- translations/messages.pl.yaml | 7 ----- 3 files changed, 44 deletions(-) diff --git a/templates/user/my_account_settings.html.twig b/templates/user/my_account_settings.html.twig index ad57e941..9ea09a9c 100644 --- a/templates/user/my_account_settings.html.twig +++ b/templates/user/my_account_settings.html.twig @@ -15,36 +15,6 @@ {{ form_start(form) }}
-
-

{{ 'user.settings.heading.my_account'|trans }}

- - -

{{ 'user.settings.heading.public_profile'|trans }}

diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 01669b63..a57de640 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -214,21 +214,14 @@ radio_station: user: detail: - name: 'Username' last_activity_date: 'Last activity date' register_date: 'Registration date' - public_profile: 'Public profile state' - public_profile.state: - '': 'disabled' - '1': 'enabled' - radio_tables_count: 'Number of lists' settings: title: 'My account' title_long: 'Account settings' heading: - my_account: 'My account' public_profile: 'Public profile' change_password: 'Password change' diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index 383d10f9..484a51fd 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -214,21 +214,14 @@ radio_station: user: detail: - name: 'Nazwa użytkownika' last_activity_date: 'Data ostatniej aktywności' register_date: 'Data założenia konta' - public_profile: 'Stan profilu publicznego' - public_profile.state: - '': 'wyłączony' - '1': 'włączony' - radio_tables_count: 'Liczba utworzonych wykazów' settings: title: 'Moje konto' title_long: 'Ustawienia konta' heading: - my_account: 'Moje konto' public_profile: 'Profil publiczny' change_password: 'Zmiana hasła' From 21348793738e61633c970df15ae4740c38fc684d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 01:49:59 +0100 Subject: [PATCH 06/85] Simplify radio table create screen - Remove frequency unit and description. Keep them in settings, although. - Redirect to newly created list instead of user lists index. Issue #116 --- assets/css/radio-table-create.css | 1 - src/Controller/RadioTableController.php | 2 +- src/Form/RadioTableCreateType.php | 12 ------------ src/Form/RadioTableSettingsType.php | 12 ++++++++++++ templates/radio_table/create.html.twig | 2 -- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/assets/css/radio-table-create.css b/assets/css/radio-table-create.css index 2a115aa2..380e4b40 100644 --- a/assets/css/radio-table-create.css +++ b/assets/css/radio-table-create.css @@ -1,2 +1 @@ @import './part/radio-table-status.css'; -@import './part/ckeditor.css'; diff --git a/src/Controller/RadioTableController.php b/src/Controller/RadioTableController.php index 0add499a..947b13b2 100644 --- a/src/Controller/RadioTableController.php +++ b/src/Controller/RadioTableController.php @@ -53,7 +53,7 @@ public function create(Request $request, EntityManagerInterface $entityManager): $entityManager->flush(); $this->addFlash('notice', 'radio_table.create.notification.created'); - return $this->redirectToRoute('user.my_radio_tables'); + return $this->redirectToRoute('radio_table.show', ['id' => $radioTable->getId()]); } return $this->render('radio_table/create.html.twig', [ diff --git a/src/Form/RadioTableCreateType.php b/src/Form/RadioTableCreateType.php index 3ef96183..2ac95111 100644 --- a/src/Form/RadioTableCreateType.php +++ b/src/Form/RadioTableCreateType.php @@ -3,7 +3,6 @@ namespace App\Form; use App\Entity\RadioTable; -use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -19,17 +18,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('name', null, [ 'help' => 'radio_table.settings.form.name.help', ]) - ->add('frequencyUnit', ChoiceType::class, [ - 'choices' => [ - 'MHz' => RadioTable::FREQUENCY_MHZ, - 'kHz' => RadioTable::FREQUENCY_KHZ, - ], - 'choice_translation_domain' => false, - ]) - ->add('description', CKEditorType::class, [ - 'required' => false, - 'sanitize_html' => true, - ]) ->add('status', ChoiceType::class, [ 'expanded' => true, 'choices' => [ diff --git a/src/Form/RadioTableSettingsType.php b/src/Form/RadioTableSettingsType.php index a8a7d074..6847143d 100644 --- a/src/Form/RadioTableSettingsType.php +++ b/src/Form/RadioTableSettingsType.php @@ -6,6 +6,7 @@ use App\Entity\RadioTable; use App\Form\Type\IntegerUnitType; use App\Form\Type\RadioTableColumnsType; +use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -19,6 +20,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void parent::buildForm($builder, $options); $builder + ->add('description', CKEditorType::class, [ + 'required' => false, + 'sanitize_html' => true, + ]) + ->add('frequencyUnit', ChoiceType::class, [ + 'choices' => [ + 'MHz' => RadioTable::FREQUENCY_MHZ, + 'kHz' => RadioTable::FREQUENCY_KHZ, + ], + 'choice_translation_domain' => false, + ]) ->add('maxSignalLevelUnit', ChoiceType::class, [ 'choices' => [ 'dB' => RadioTable::MAX_SIGNAL_LEVEL_DB, diff --git a/templates/radio_table/create.html.twig b/templates/radio_table/create.html.twig index 9f51f3ec..f757740e 100644 --- a/templates/radio_table/create.html.twig +++ b/templates/radio_table/create.html.twig @@ -19,8 +19,6 @@

{{ 'radio_table.settings.heading.general'|trans }}

{{ form_row(form.name) }} - {{ form_row(form.frequencyUnit) }} - {{ form_row(form.description) }}
From 6b816f32bdce913521cb45b393e33f498bea0310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 20:31:53 +0100 Subject: [PATCH 07/85] Forms: make validation error messages inline, simplify maintenance Issue #116 --- src/Entity/Embeddable/RadioStation/Rds.php | 4 +- .../Embeddable/RadioTable/Appearance.php | 8 +-- src/Entity/RadioStation.php | 34 +++++----- src/Entity/RadioTable.php | 9 ++- src/Entity/User.php | 17 ++--- .../ValidationFlashErrorExtension.php | 14 +--- src/Validator/DabChannel.php | 2 +- src/Validator/HexColor.php | 2 +- src/Validator/YearMonthDate.php | 1 + translations/messages.en.yaml | 2 +- translations/messages.pl.yaml | 2 +- translations/validators.en.yaml | 67 +++---------------- translations/validators.pl.yaml | 67 +++---------------- 13 files changed, 58 insertions(+), 171 deletions(-) diff --git a/src/Entity/Embeddable/RadioStation/Rds.php b/src/Entity/Embeddable/RadioStation/Rds.php index 38521dec..fbf18821 100644 --- a/src/Entity/Embeddable/RadioStation/Rds.php +++ b/src/Entity/Embeddable/RadioStation/Rds.php @@ -33,7 +33,7 @@ class Rds * Programme Type * @ORM\Column(type="string", length=25, nullable=true) - * @Assert\Length(max=25, maxMessage="radio_station.rds_pty.max_length") + * @Assert\Length(max=25) */ private $pty; @@ -41,7 +41,7 @@ class Rds * Programme Identification * * @ORM\Column(type="string", length=4, nullable=true) - * @Assert\Length(max=4, maxMessage="radio_station.rds_pi.max_length") + * @Assert\Length(max=4) */ private $pi; diff --git a/src/Entity/Embeddable/RadioTable/Appearance.php b/src/Entity/Embeddable/RadioTable/Appearance.php index dfb4df85..5587c4d5 100644 --- a/src/Entity/Embeddable/RadioTable/Appearance.php +++ b/src/Entity/Embeddable/RadioTable/Appearance.php @@ -18,13 +18,13 @@ class Appearance /** * @ORM\Column(type="string", length=10, nullable=true) - * @HexColor(message="radio_table.appearance.fg_invalid") + * @HexColor() */ private $textColor; /** * @ORM\Column(type="string", length=10, nullable=true) - * @HexColor(message="radio_table.appearance.bg_invalid") + * @HexColor() */ private $backgroundColor; @@ -36,11 +36,11 @@ class Appearance /** * @ORM\Column(type="integer", nullable=true) - * @Assert\GreaterThanOrEqual(900, message="radio_table.appearance.width_min_value") + * @Assert\GreaterThanOrEqual(900, message="radio_table.appearance_width_min_value") * @Assert\Expression( * "value || this.getWidthType() !== width_custom", * values={"width_custom": Appearance::WIDTH_CUSTOM}, - * message="radio_table.appearance.width_required" + * message="This value should not be blank." * ) */ private $customWidth; diff --git a/src/Entity/RadioStation.php b/src/Entity/RadioStation.php index 216941b3..6246cdf8 100644 --- a/src/Entity/RadioStation.php +++ b/src/Entity/RadioStation.php @@ -58,47 +58,47 @@ class RadioStation /** * @ORM\Column(type="string", length=100) - * @Assert\NotBlank(message="radio_station.name.not_blank") - * @Assert\Length(max=100, maxMessage="radio_station.name.max_length") + * @Assert\NotBlank() + * @Assert\Length(max=100) */ private $name; /** * @ORM\Column(type="string", length=50, nullable=true) - * @Assert\Length(max=50, maxMessage="radio_station.radio_group.max_length") + * @Assert\Length(max=50) */ private $radioGroup; /** * @ORM\Column(type="string", length=50, nullable=true) - * @Assert\Length(max=50, maxMessage="radio_station.country.max_length") + * @Assert\Length(max=50) */ private $country; /** * @ORM\Column(type="string", length=100, nullable=true) - * @Assert\Length(max=50, maxMessage="radio_station.region.max_length") + * @Assert\Length(max=50) */ private $region; /** * @ORM\Column(type="decimal", precision=8, scale=3) - * @Assert\NotBlank(message="radio_station.frequency.not_blank") + * @Assert\NotBlank() * @Assert\Type("numeric") - * @Assert\GreaterThan(0, message="radio_station.frequency.greater_than_zero") + * @Assert\GreaterThan(0) */ private $frequency; /** * @ORM\Column(type="string", length=100, nullable=true) - * @Assert\Length(max=100, maxMessage="radio_station.location.max_length") + * @Assert\Length(max=100) */ private $location; /** * @ORM\Column(type="decimal", precision=8, scale=3, nullable=true) * @Assert\Type("numeric") - * @Assert\GreaterThan(0, message="radio_station.power.greater_than_zero") + * @Assert\GreaterThan(0) */ private $power; @@ -110,19 +110,19 @@ class RadioStation /** * @ORM\Column(type="string", length=50, nullable=true) - * @Assert\Length(max=100, maxMessage="radio_station.multiplex.max_length") + * @Assert\Length(max=100) */ private $multiplex; /** * @ORM\Column(type="string", length=5, nullable=true) - * @DabChannel(message="radio_station.dab_channel.invalid_for_frequency") + * @DabChannel() */ private $dabChannel; /** * @ORM\Column(type="integer", nullable=true) - * @Assert\GreaterThan(0, message="radio_station.distance.greater_than_zero") + * @Assert\GreaterThan(0) */ private $distance; @@ -140,13 +140,13 @@ class RadioStation /** * @ORM\Column(type="integer", nullable=true) * @Assert\Type("int") - * @Assert\GreaterThan(0, message="radio_station.private_number.greater_than_zero") + * @Assert\GreaterThan(0) */ private $privateNumber; /** * @ORM\Column(type="string", length=10, nullable=true) - * @YearMonthDate(message="radio_station.first_log_date.invalid_format") + * @YearMonthDate() */ private $firstLogDate; @@ -170,14 +170,14 @@ class RadioStation /** * @ORM\Column(type="string", length=500, nullable=true) - * @Assert\Length(max=500, maxMessage="radio_station.comment.max_length") + * @Assert\Length(max=500) */ private $comment; /** * @ORM\Column(type="string", length=300, nullable=true) - * @Assert\Length(max=500, maxMessage="radio_station.external_anchor.max_length") - * @Assert\Url(message="radio_station.external_anchor.invalid_format") + * @Assert\Length(max=500) + * @Assert\Url() */ private $externalAnchor; diff --git a/src/Entity/RadioTable.php b/src/Entity/RadioTable.php index 68fd6efd..f22fe12c 100644 --- a/src/Entity/RadioTable.php +++ b/src/Entity/RadioTable.php @@ -73,8 +73,8 @@ class RadioTable /** * @ORM\Column(type="string", length=100) - * @Assert\NotBlank(message="radio_table.name.not_blank") - * @Assert\Length(max=100, maxMessage="radio_table.name.max_length") + * @Assert\NotBlank() + * @Assert\Length(max=100) */ private $name; @@ -89,8 +89,7 @@ class RadioTable * @ClassConstantsChoice(class=RadioTable::class, prefix="COLUMN_", multiple=true) * @Assert\Expression( * "frequency in value && name in value", - * values={"frequency"=RadioTable::COLUMN_FREQUENCY, "name"=RadioTable::COLUMN_NAME}, - * message="radio_table.columns.frequency_and_name_required" + * values={"frequency"=RadioTable::COLUMN_FREQUENCY, "name"=RadioTable::COLUMN_NAME} * ) */ private $columns = [ @@ -112,7 +111,7 @@ class RadioTable /** * @ORM\Column(type="string", length=2000, nullable=true) - * @Assert\Length(max=2000, maxMessage="radio_table.description.max_length") + * @Assert\Length(max=2000) */ private $description; diff --git a/src/Entity/User.php b/src/Entity/User.php index dba2673e..bf8c3f86 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -12,7 +12,7 @@ /** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\EntityListeners({"App\Doctrine\EntityListener\UserListener"}) - * @UniqueEntity("name", groups={"Default", "RedefinePassword"}, message="user.name.not_unique") + * @UniqueEntity("name", groups={"Default", "RedefinePassword"}, message="user.name_not_unique") * @ORM\Cache("NONSTRICT_READ_WRITE") */ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface, PasswordAuthenticatedUserInterface @@ -26,11 +26,11 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface, P /** * @ORM\Column(type="string", length=50, unique=true) - * @Assert\NotBlank(groups={"Default", "RedefinePassword"}, message="user.name.not_blank") - * @Assert\Length(max=50, groups={"Default", "RedefinePassword"}, maxMessage="user.name.max_length") + * @Assert\NotBlank(groups={"Default", "RedefinePassword"}) + * @Assert\Length(max=50, groups={"Default", "RedefinePassword"}) * @Assert\Regex( * "/^[a-zA-Z0-9_\.\-]*$/", groups={"Default", "RedefinePassword"}, - * message="user.name.invalid_chars" + * message="user.name_invalid_chars" * ) */ private $name; @@ -42,11 +42,8 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface, P private $password; /** - * @Assert\NotBlank(groups={"RedefinePassword"}, message="user.password.not_blank") - * @Assert\Length( - * max=100, groups={"RedefinePassword"}, - * maxMessage="user.password.max_length" - * ) + * @Assert\NotBlank(groups={"RedefinePassword"}) + * @Assert\Length(max=100, groups={"RedefinePassword"}) */ private $plainPassword; @@ -62,7 +59,7 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface, P /** * @ORM\Column(type="string", length=2000, nullable=true) - * @Assert\Length(max=2000, groups={"Default", "RedefinePassword"}, maxMessage="user.about_me.max_length") + * @Assert\Length(max=2000, groups={"Default", "RedefinePassword"}) */ private $aboutMe; diff --git a/src/Form/Extension/ValidationFlashErrorExtension.php b/src/Form/Extension/ValidationFlashErrorExtension.php index 96d3d8cc..ef2e4137 100644 --- a/src/Form/Extension/ValidationFlashErrorExtension.php +++ b/src/Form/Extension/ValidationFlashErrorExtension.php @@ -27,19 +27,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void /** @var Session */ $session = $this->requestStack->getCurrentRequest()->getSession(); - $error = $form->getErrors(true)[0]; - $template = $error->getMessageTemplate(); - - // Set generic error message if current text isn't specified by this application. - if ( - false !== stripos($template, 'this') || - (false !== stripos($template, 'value') && false === stripos($template, 'value }}')) - ) { - $session->getFlashBag()->add('error', 'common.notification.invalid_form'); - } - else { - $session->getFlashBag()->add('validation_error', $error->getMessage()); - } + $session->getFlashBag()->add('error', 'common.notification.invalid_form'); } }); } diff --git a/src/Validator/DabChannel.php b/src/Validator/DabChannel.php index 96517c80..73a65f6a 100644 --- a/src/Validator/DabChannel.php +++ b/src/Validator/DabChannel.php @@ -9,5 +9,5 @@ */ class DabChannel extends Constraint { - public $message = 'The value "{{ value }}" is not valid.'; + public $message = 'radio_station.dab_channel_invalid_for_frequency'; } diff --git a/src/Validator/HexColor.php b/src/Validator/HexColor.php index f469ebd4..3a7dc4c0 100644 --- a/src/Validator/HexColor.php +++ b/src/Validator/HexColor.php @@ -9,5 +9,5 @@ */ class HexColor extends Constraint { - public $message = 'The value "{{ value }}" is not valid.'; + public $message = 'radio_table.color_invalid_format'; } diff --git a/src/Validator/YearMonthDate.php b/src/Validator/YearMonthDate.php index d704f299..441887e4 100644 --- a/src/Validator/YearMonthDate.php +++ b/src/Validator/YearMonthDate.php @@ -9,4 +9,5 @@ */ class YearMonthDate extends Date { + public $message = 'radio_station.first_log_date_invalid_format'; } diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index a57de640..cb19e43f 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -19,7 +19,7 @@ common: notification: saved_changes: 'Changes have been saved.' - invalid_form: 'The form has been filled out incorrectly.' + invalid_form: 'There is a problem in the form below.' radio_table: detail: diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index 484a51fd..a6e56882 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -19,7 +19,7 @@ common: notification: saved_changes: 'Zmiany zostały zapisane.' - invalid_form: 'Formularz został wypełniony niepoprawnie.' + invalid_form: 'Wystąpił błąd w formularzu poniżej.' radio_table: detail: diff --git a/translations/validators.en.yaml b/translations/validators.en.yaml index 8cfe9b38..3a30643f 100644 --- a/translations/validators.en.yaml +++ b/translations/validators.en.yaml @@ -1,66 +1,17 @@ radio_table: - name: - not_blank: 'List name cannot be empty.' - max_length: 'List title can be up to {{ limit }} characters.' - columns: - frequency_and_name_required: 'Frequency and name columns must be visible.' - description: - max_length: 'List description can be up to {{ limit }} characters.' - appearance: - bg_invalid: 'Background color is incorrect.' - fg_invalid: 'Text color is incorrect.' - width_min_value: 'Custom width must be at least {{ compared_value }} pixels.' - width_required: 'Custom width cannot be empty.' + appearance_width_min_value: 'Width must be at least {{ compared_value }} pixels.' radio_station: - name: - not_blank: 'Station name cannot be empty.' - max_length: 'Station name can be up to {{ limit }} characters.' - radio_group: - max_length: 'Media group can be up to {{ limit }} characters.' - country: - max_length: 'Country can be up to {{ limit }} characters.' - region: - max_length: 'Region can be up to {{ limit }} characters.' - frequency: - not_blank: 'Frequency cannot be empty.' - greater_than_zero: 'Frequency must be greater than zero.' - location: - max_length: 'Location can be up to {{ limit }} characters.' - power: - greater_than_zero: 'Power must be greater than zero.' - multiplex: - max_length: 'Multiplex can be up to {{ limit }} characters.' - dab_channel: - invalid_for_frequency: 'DAB channel does not match the frequency.' - distance: - greater_than_zero: 'Distance from the transmitter must be greater than zero' - private_number: - greater_than_zero: 'Number in the receiver must be greater than zero' - first_log_date: - invalid_format: 'First log date is incorrect.' - rds_pty: - max_length: 'RDS PTY can be up to {{ limit }} characters.' - rds_pi: - max_length: 'RDS PI can be up to {{ limit }} characters.' - comment: - max_length: 'Comment can be up to {{ limit }} characters.' - external_anchor: - max_length: 'External reference URL can be up to {{ limit }} characters.' - invalid_format: 'External reference URL is incorrect.' + dab_channel_invalid_for_frequency: 'DAB channel does not match the frequency.' + first_log_date_invalid_format: 'Date format is incorrect.' + color_invalid_format: 'Color in HEX form is incorrect.' user: - name: - not_blank: 'Username cannot be empty.' - max_length: 'Username can be up to {{ limit }} characters.' - invalid_chars: 'Username contains disallowed characters.' - not_unique: 'This username is already used.' - password: - not_blank: 'Password cannot be empty.' - max_length: 'Password can be up to {{ limit }} characters.' - about_me: - max_length: 'Text about you can be up to {{ limit }} characters.' - + name_invalid_chars: 'Username contains disallowed characters.' + name_not_unique: 'This username is already used.' service_terms_required: 'You must accept terms of service.' incorrect_password: 'Your current password is incorrect.' passwords_dont_match: 'Passwords do not match.' + +'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.': 'Here you can enter up to {{ limit }} characters.' +'This value should not be blank.': 'This field cannot be empty.' diff --git a/translations/validators.pl.yaml b/translations/validators.pl.yaml index 68c8d7a5..96f6c44d 100644 --- a/translations/validators.pl.yaml +++ b/translations/validators.pl.yaml @@ -1,66 +1,17 @@ radio_table: - name: - not_blank: 'Nazwa wykazu nie może być pusta.' - max_length: 'Nazwa wykazu może mieć maksymalnie {{ limit }} znaków.' - columns: - frequency_and_name_required: 'Kolumny częstotliwości i nazwy muszą być widoczne.' - description: - max_length: 'Opis wykazu może mieć maksymalnie {{ limit }} znaków.' - appearance: - bg_invalid: 'Kolor tła jest niepoprawny.' - fg_invalid: 'Kolor tekstu jest niepoprawny.' - width_min_value: 'Niestandardowa szerokość musi mieć minimum {{ compared_value }} pikseli.' - width_required: 'Niestandardowa szerokość nie może być pusta.' + appearance_width_min_value: 'Szerokość musi mieć minimum {{ compared_value }} pikseli.' radio_station: - name: - not_blank: 'Nazwa stacji nie może być pusta.' - max_length: 'Nazwa stacji może mieć maksymalnie {{ limit }} znaków.' - radio_group: - max_length: 'Grupa może mieć maksymalnie {{ limit }} znaków.' - country: - max_length: 'Kraj może mieć maksymalnie {{ limit }} znaków.' - region: - max_length: 'Region może mieć maksymalnie {{ limit }} znaków.' - frequency: - not_blank: 'Częstotliwość stacji nie może być pusta.' - greater_than_zero: 'Częstotliwość musi być większa niż zero.' - location: - max_length: 'Lokalizacja może mieć maksymalnie {{ limit }} znaków.' - power: - greater_than_zero: 'Moc musi być większa niż zero.' - multiplex: - max_length: 'Multipleks może mieć maksymalnie {{ limit }} znaków.' - dab_channel: - invalid_for_frequency: 'Kanał DAB nie zgadza się z częstotliwością.' - distance: - greater_than_zero: 'Odległość od nadajnika musi być większa niż zero.' - private_number: - greater_than_zero: 'Numer w odbiorniku musi być większy niż zero.' - first_log_date: - invalid_format: 'Data pierwszego odbioru jest niepoprawna.' - rds_pty: - max_length: 'Kod RDS PTY może mieć maksymalnie {{ limit }} znaków.' - rds_pi: - max_length: 'Kod RDS PI może mieć maksymalnie {{ limit }} znaki.' - comment: - max_length: 'Komentarz może mieć maksymalnie {{ limit }} znaków.' - external_anchor: - max_length: 'Odnośnik zewnętrzny może mieć maksymalnie {{ limit }} znaków.' - invalid_format: 'Odnośnik zewnętrzny jest niepoprawny.' + dab_channel_invalid_for_frequency: 'Kanał DAB nie zgadza się z częstotliwością.' + first_log_date_invalid_format: 'Format daty jest niepoprawny.' + color_invalid_format: 'Kolor w zapisie HEX jest niepoprawny.' user: - name: - not_blank: 'Nazwa użytkownika nie może być pusta.' - max_length: 'Nazwa użytkownika może mieć maksymalnie {{ limit }} znaków.' - invalid_chars: 'Nazwa użytkownika zawiera niedozwolone znaki.' - not_unique: 'Wybrana nazwa użytkownika jest już zajęta.' - password: - not_blank: 'Hasło nie może być puste.' - max_length: 'Hasło może mieć maksymalnie {{ limit }} znaków.' - about_me: - max_length: 'Twój opis może mieć maksymalnie {{ limit }} znaków.' - + name_invalid_chars: 'Nazwa użytkownika zawiera niedozwolone znaki.' + name_not_unique: 'Wybrana nazwa użytkownika jest już zajęta.' service_terms_required: 'Akceptacja regulaminu serwisu jest wymagana.' incorrect_password: 'Podane aktualne hasło jest niepoprawne.' passwords_dont_match: 'Podane hasła nie są identyczne.' + +'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.': 'Tutaj można wpisać maksymalnie {{ limit }} znaków.' +'This value should not be blank.': 'To pole nie może być puste.' From 8d29e8ecb1569e4329ece1f89a1f7783cfbb7744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 21:03:30 +0100 Subject: [PATCH 08/85] RadioStationController: remove unused `remove` action --- src/Controller/RadioStationController.php | 18 ------------------ tests/Functional/BasicApplicationTest.php | 1 - tests/Functional/SecurityPermissionTest.php | 1 - translations/messages.en.yaml | 1 - translations/messages.pl.yaml | 1 - 5 files changed, 22 deletions(-) diff --git a/src/Controller/RadioStationController.php b/src/Controller/RadioStationController.php index bbbb9f90..9a3509aa 100644 --- a/src/Controller/RadioStationController.php +++ b/src/Controller/RadioStationController.php @@ -96,22 +96,4 @@ public function copy(RadioStation $radioStation): Response 'template' => $template, ]); } - - /** - * @Route( - * {"pl": "/wykaz/{radioTableId}/usun-stacje/{id}", "en": "/list/{radioTableId}/delete-station/{id}"}, - * name="radio_station.remove" - * ) - * @IsGranted("IS_AUTHENTICATED_REMEMBERED") - * @IsGranted("RADIO_TABLE_MODIFY", subject="radioStation", statusCode=404) - */ - public function remove(RadioStation $radioStation): Response - { - $this->addFlash('notice', 'radio_station.remove.notification.chosen_to_be_removed'); - - return $this->forward(RadioTableController::class . '::remove', [ - 'id' => $radioStation->getRadioTable()->getId(), - 'radioStationToRemove' => $radioStation, - ]); - } } diff --git a/tests/Functional/BasicApplicationTest.php b/tests/Functional/BasicApplicationTest.php index c3e3a196..9bffe3d8 100644 --- a/tests/Functional/BasicApplicationTest.php +++ b/tests/Functional/BasicApplicationTest.php @@ -56,7 +56,6 @@ public function authenticatedUrlsProvider(): iterable ['/wykaz/1/dodaj-stacje'], ['/wykaz/1/edytuj-stacje/1'], ['/wykaz/1/kopiuj-stacje/1'], - ['/wykaz/1/usun-stacje/1'], ['/wykaz/1/ustawienia'], ['/wykaz/1/eksport', '/wykaz/1/ustawienia#export'], ['/wykaz/1/usun'], diff --git a/tests/Functional/SecurityPermissionTest.php b/tests/Functional/SecurityPermissionTest.php index cc0810cf..e0dc258e 100644 --- a/tests/Functional/SecurityPermissionTest.php +++ b/tests/Functional/SecurityPermissionTest.php @@ -34,7 +34,6 @@ public function ownedByTestUserUrlProvider(): iterable '/wykaz/1/dodaj-stacje', '/wykaz/1/edytuj-stacje/1', '/wykaz/1/kopiuj-stacje/1', - '/wykaz/1/usun-stacje/1', '/wykaz/1/ustawienia', '/wykaz/1/eksport/html', '/wykaz/1/eksport/csv', diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index cb19e43f..2f8cd0a2 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -209,7 +209,6 @@ radio_station: chosenToRemove: 'Choose stations to be deleted' notification: - chosen_to_be_removed: 'Stations have been chosen to be deleted.' bulk_removed: 'Chosen stations have been deleted.' user: diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index a6e56882..b9adda2f 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -209,7 +209,6 @@ radio_station: chosenToRemove: 'Wskaż stacje do usunięcia' notification: - chosen_to_be_removed: 'Stacja została zaznaczona do usunięcia.' bulk_removed: 'Wybrane stacje zostały usunięte.' user: From b34be0b506dd605766550358d233450735dd9111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 21:57:41 +0100 Subject: [PATCH 09/85] Separate radio table remove and radio station bulk remove screens Issue #116 --- assets/css/radio-station-bulk-remove.css | 13 ++++ assets/css/radio-table-remove.css | 15 ----- src/Controller/RadioStationController.php | 35 +++++++++++ src/Controller/RadioTableController.php | 45 ++------------ ...ype.php => RadioStationBulkRemoveType.php} | 4 +- templates/radio_station/bulk_remove.html.twig | 62 +++++++++++++++++++ templates/radio_table/remove.html.twig | 33 ++-------- templates/radio_table/settings.html.twig | 5 ++ .../Controller/RadioStationControllerTest.php | 9 +-- tests/Form/FormsCompilationTest.php | 4 +- translations/messages.en.yaml | 19 +++--- translations/messages.pl.yaml | 19 +++--- webpack.config.js | 1 + 13 files changed, 159 insertions(+), 105 deletions(-) create mode 100644 assets/css/radio-station-bulk-remove.css rename src/Form/{RadioStationRemoveType.php => RadioStationBulkRemoveType.php} (94%) create mode 100644 templates/radio_station/bulk_remove.html.twig diff --git a/assets/css/radio-station-bulk-remove.css b/assets/css/radio-station-bulk-remove.css new file mode 100644 index 00000000..95366459 --- /dev/null +++ b/assets/css/radio-station-bulk-remove.css @@ -0,0 +1,13 @@ +/* radio station list */ + +.radio-stations-remove { + max-height: 430px; + overflow-y: auto; + box-sizing: border-box; + padding: 0.05em 1em; + background: #F9FCF9; + border: 1px solid #D6EAD0; +} +.radio-stations-remove fieldset { + margin: 0; +} diff --git a/assets/css/radio-table-remove.css b/assets/css/radio-table-remove.css index 9fb7aa8a..f4af4576 100644 --- a/assets/css/radio-table-remove.css +++ b/assets/css/radio-table-remove.css @@ -1,18 +1,3 @@ -/* radio station list */ - -.radio-stations-remove { - max-height: 430px; - overflow-y: auto; - box-sizing: border-box; - padding: 0.05em 1em; - background: #F9FCF9; - border: 1px solid #D6EAD0; -} -.radio-stations-remove fieldset { - margin: 0; -} - - /* radio table warning */ .radio-table-remove-confirm { diff --git a/src/Controller/RadioStationController.php b/src/Controller/RadioStationController.php index 9a3509aa..7677fa4c 100644 --- a/src/Controller/RadioStationController.php +++ b/src/Controller/RadioStationController.php @@ -5,6 +5,7 @@ use App\Entity\RadioStation; use App\Entity\RadioTable; use App\Form\RadioStationEditType; +use App\Form\RadioStationBulkRemoveType; use Doctrine\ORM\EntityManagerInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -96,4 +97,38 @@ public function copy(RadioStation $radioStation): Response 'template' => $template, ]); } + + /** + * @Route({"pl": "/wykaz/{id}/usun-stacje", "en": "/list/{id}/delete-stations"}, name="radio_station.bulk_remove") + * @IsGranted("IS_AUTHENTICATED_REMEMBERED") + * @IsGranted("RADIO_TABLE_MODIFY", subject="radioTable", statusCode=404) + */ + public function bulkRemove(RadioTable $radioTable, Request $request, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(RadioStationBulkRemoveType::class, null, ['radio_table' => $radioTable]); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $chosenToRemove = $form->getData()['chosenToRemove']; + + if (count($chosenToRemove) > 0) { + foreach ($chosenToRemove as $radioStation) { + $entityManager->remove($radioStation); + } + $entityManager->flush(); + + $this->addFlash('notice', 'radio_station.bulk_remove.notification.bulk_removed'); + + // Form needs to be reloaded to not display removed radio stations. + return $this->redirectToRoute('radio_station.bulk_remove', [ + 'id' => $radioTable->getId(), + ]); + } + } + + return $this->render('radio_station/bulk_remove.html.twig', [ + 'form' => $form->createView(), + 'radio_table' => $radioTable, + ]); + } } diff --git a/src/Controller/RadioTableController.php b/src/Controller/RadioTableController.php index 947b13b2..c87b4900 100644 --- a/src/Controller/RadioTableController.php +++ b/src/Controller/RadioTableController.php @@ -2,17 +2,14 @@ namespace App\Controller; -use App\Entity\RadioStation; use App\Entity\RadioTable; use App\Export\RadioTableExporterProvider; -use App\Form\RadioStationRemoveType; use App\Form\RadioTableCreateType; use App\Form\RadioTableRemoveType; use App\Form\RadioTableSettingsType; use App\Repository\RadioStationRepository; use Doctrine\ORM\EntityManagerInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -125,27 +122,17 @@ public function export(RadioTable $radioTable): Response } /** - * This action handles both radio table removing and radio station removing. - * * @Route({"pl": "/wykaz/{id}/usun", "en": "/list/{id}/delete"}, name="radio_table.remove") - * @ParamConverter("radioStationToRemove", class="stdClass") * @IsGranted("IS_AUTHENTICATED_REMEMBERED") * @IsGranted("RADIO_TABLE_MODIFY", subject="radioTable", statusCode=404) */ - public function remove(RadioTable $radioTable, Request $request, EntityManagerInterface $entityManager, - RadioStation $radioStationToRemove = null): Response + public function remove(RadioTable $radioTable, Request $request, EntityManagerInterface $entityManager): Response { - $form_RadioTable = $this->createForm(RadioTableRemoveType::class); - $form_RadioTable->handleRequest($request); - - $form_RadioStation = $this->createForm(RadioStationRemoveType::class, - $radioStationToRemove ? ['chosenToRemove' => [$radioStationToRemove]] : null, - ['radio_table' => $radioTable] - ); - $form_RadioStation->handleRequest($request); + $form = $this->createForm(RadioTableRemoveType::class); + $form->handleRequest($request); - if ($form_RadioTable->isSubmitted() && $form_RadioTable->isValid()) { - $confirmed = (true === $form_RadioTable->getData()['confirm']); + if ($form->isSubmitted() && $form->isValid()) { + $confirmed = (true === $form->getData()['confirm']); if ($confirmed) { $entityManager->remove($radioTable); @@ -158,29 +145,9 @@ public function remove(RadioTable $radioTable, Request $request, EntityManagerIn $this->addFlash('error', 'radio_table.remove.notification.not_yet'); } } - elseif ($form_RadioStation->isSubmitted() && $form_RadioStation->isValid()) { - $chosenToRemove = $form_RadioStation->getData()['chosenToRemove']; - - if (count($chosenToRemove) > 0) { - foreach ($chosenToRemove as $radioStation) { - $entityManager->remove($radioStation); - } - $entityManager->flush(); - - $this->addFlash('notice', 'radio_station.remove.notification.bulk_removed'); - - // Redirect to after successful radio stations removing. - // * Form needs to be reloaded to not display removed radio stations. - // * URL needs to be changed to avoid 404 error if page was forwarded from RadioStationController. - return $this->redirectToRoute('radio_table.remove', [ - 'id' => $radioTable->getId(), - ]); - } - } return $this->render('radio_table/remove.html.twig', [ - 'form_radio_table' => $form_RadioTable->createView(), - 'form_radio_station' => $form_RadioStation->createView(), + 'form' => $form->createView(), 'radio_table' => $radioTable, ]); } diff --git a/src/Form/RadioStationRemoveType.php b/src/Form/RadioStationBulkRemoveType.php similarity index 94% rename from src/Form/RadioStationRemoveType.php rename to src/Form/RadioStationBulkRemoveType.php index dd8f1ac4..cb4df921 100644 --- a/src/Form/RadioStationRemoveType.php +++ b/src/Form/RadioStationBulkRemoveType.php @@ -12,7 +12,7 @@ use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; -class RadioStationRemoveType extends AbstractType +class RadioStationBulkRemoveType extends AbstractType { private $radioStationRepository; @@ -53,7 +53,7 @@ public function configureOptions(OptionsResolver $resolver): void $resolver->setRequired(['radio_table']); $resolver->setAllowedTypes('radio_table', RadioTable::class); $resolver->setDefaults([ - 'label_format' => 'radio_station.remove.form.%name%', + 'label_format' => 'radio_station.bulk_remove.form.%name%', ]); } } diff --git a/templates/radio_station/bulk_remove.html.twig b/templates/radio_station/bulk_remove.html.twig new file mode 100644 index 00000000..7d8dfde9 --- /dev/null +++ b/templates/radio_station/bulk_remove.html.twig @@ -0,0 +1,62 @@ +{% extends 'layout.html.twig' %} + +{% block page_title %}{{ 'radio_station.bulk_remove.title'|trans }}{% endblock %} + +{% block head_closing %} + {{ encore_entry_link_tags('radio-station-bulk-remove') }} +{% endblock %} + +{% block context_menu %} + +{% endblock %} + +{% form_theme form _self %} +{% block _radio_station_bulk_remove_chosenToRemove_entry_label %} + {% set label = '%s (%s %s)'|format(label, frequency|format_number({min_fraction_digit: 2, grouping_used: false}), get_frequency_label(frequency_unit)) %} + {{ block('form_label') }} +{% endblock %} + +{% block page_content %} +
+

+ {{ 'radio_station.bulk_remove.title'|trans }} + + {{ 'radio_station.edit.text.for_radio_table_a11y_subheading'|trans }} + {{ radio_table.name }} + +

+
+ +
+
+

{{ 'radio_station.bulk_remove.heading.remove_radio_station'|trans }}

+ + {% if radio_table.radioStationsCount > 0 %} + {{ form_start(form) }} + +
+ {{ form_row(form.chosenToRemove) }} +
+ + + + {{ form_end(form) }} + {% else %} +

+ {{ 'radio_station.bulk_remove.information.empty_cannot_remove_radio_station'|trans }} +

+ {% endif %} +
+
+{% endblock %} diff --git a/templates/radio_table/remove.html.twig b/templates/radio_table/remove.html.twig index b22ab68a..25007a09 100644 --- a/templates/radio_table/remove.html.twig +++ b/templates/radio_table/remove.html.twig @@ -27,12 +27,6 @@ {% endblock %} -{% form_theme form_radio_station _self %} -{% block _radio_station_remove_chosenToRemove_entry_label %} - {% set label = '%s (%s %s)'|format(label, frequency|format_number({min_fraction_digit: 2, grouping_used: false}), get_frequency_label(frequency_unit)) %} - {{ block('form_label') }} -{% endblock %} - {% block page_content %}

@@ -42,25 +36,6 @@

-
-

{{ 'radio_table.remove.heading.remove_radio_station'|trans }}

- - {% if radio_table.radioStationsCount > 0 %} - {{ form_start(form_radio_station) }} - -
- {{ form_row(form_radio_station.chosenToRemove) }} -
- - - - {{ form_end(form_radio_station) }} - {% else %} -

- {{ 'radio_table.remove.information.empty_cannot_remove_radio_station'|trans }} -

- {% endif %} -

{{ 'radio_table.remove.heading.remove_radio_table'|trans }}

@@ -68,9 +43,9 @@ {{ 'radio_table.remove.information.cannot_be_undone'|trans }}

- {{ form_start(form_radio_table) }} + {{ form_start(form) }} - {{ form_row(form_radio_table.confirm, { + {{ form_row(form.confirm, { label_translation_parameters: { '%name%': radio_table.name }, attr: { 'class': 'radio-table-remove-confirm', @@ -78,9 +53,9 @@ }, }) }} - + - {{ form_end(form_radio_table) }} + {{ form_end(form) }}
{% endblock %} diff --git a/templates/radio_table/settings.html.twig b/templates/radio_table/settings.html.twig index 25b45cc1..6ba9afab 100644 --- a/templates/radio_table/settings.html.twig +++ b/templates/radio_table/settings.html.twig @@ -19,6 +19,11 @@ {{ 'radio_station.add.title'|trans }} +
  • + + {{ 'radio_station.bulk_remove.title'|trans }} + +
  • {{ 'radio_table.remove.title'|trans }} diff --git a/tests/Controller/RadioStationControllerTest.php b/tests/Controller/RadioStationControllerTest.php index 61a1ab6c..eeb7f3ae 100644 --- a/tests/Controller/RadioStationControllerTest.php +++ b/tests/Controller/RadioStationControllerTest.php @@ -58,11 +58,12 @@ public function testCopyRadioStation(): void $this->assertStringContainsString('COPIED_RADIO_STATION_NAME', $content); } - public function testRemoveRadioStation(): void + public function testBulkRemoveRadioStation(): void { - $crawler = $this->client->request('GET', '/wykaz/1/usun-stacje/1'); - $form = $crawler->filter('form[name="radio_station_remove"]')->form(); - $this->client->submit($form); // Radiostation is selected automatically. + $crawler = $this->client->request('GET', '/wykaz/1/usun-stacje'); + $form = $crawler->filter('form[name="radio_station_bulk_remove"]')->form(); + $form['radio_station_bulk_remove[chosenToRemove][1]']->tick(); // Checkbox is chosen by order, not by input value. + $this->client->submit($form); $this->client->request('GET', '/wykaz/1'); $content = $this->client->getResponse()->getContent(); diff --git a/tests/Form/FormsCompilationTest.php b/tests/Form/FormsCompilationTest.php index 3361cb6a..7bc7bcbd 100644 --- a/tests/Form/FormsCompilationTest.php +++ b/tests/Form/FormsCompilationTest.php @@ -6,7 +6,7 @@ use App\Entity\RadioTable; use App\Entity\User; use App\Form\RadioStationEditType; -use App\Form\RadioStationRemoveType; +use App\Form\RadioStationBulkRemoveType; use App\Form\RadioTableCreateType; use App\Form\RadioTableRemoveType; use App\Form\RadioTableSearchType; @@ -40,7 +40,7 @@ public function formTypeAndEntityProvider(): iterable self::ensureKernelShutdown(); yield 'RadioStationEditType' => [RadioStationEditType::class, $radioStation]; - yield 'RadioStationRemoveType' => [RadioStationRemoveType::class, null, ['radio_table' => $radioTable]]; + yield 'RadioStationBulkRemoveType' => [RadioStationBulkRemoveType::class, null, ['radio_table' => $radioTable]]; yield 'RadioTableCreateType' => [RadioTableCreateType::class, $radioTable]; yield 'RadioTableRemoveType' => [RadioTableRemoveType::class]; yield 'RadioTableSearchType' => [RadioTableSearchType::class]; diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 2f8cd0a2..08ef6536 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -118,15 +118,12 @@ radio_table: about_ods: 'ODS — spreadsheet document for LibreOffice and Apache OpenOffice' remove: - title: 'Delete station or list' + title: 'Delete list' action: export: 'Export list' - selected_radio_stations: 'Delete chosen stations' - radio_table: 'Delete list' heading: - remove_radio_station: 'Delete stations' remove_radio_table: 'Delete list' form: @@ -137,7 +134,6 @@ radio_table: not_yet: "Let's try again. Nothing happened." information: - empty_cannot_remove_radio_station: 'This is is empty. There is nothing to delete…' cannot_be_undone: 'Deleted list cannot be restored. Please remember that you can still export your list into HTML, PDF or CSV file and download it to your computer.' text: @@ -202,8 +198,14 @@ radio_station: for_radio_table_a11y_subheading: 'in list' disabled_radio_table_column: 'This column is currently not visible in the list.' - remove: - title: 'Delete station' + bulk_remove: + title: 'Delete more stations' + + action: + bulk_remove: 'Delete chosen stations' + + heading: + remove_radio_station: 'Delete stations' form: chosenToRemove: 'Choose stations to be deleted' @@ -211,6 +213,9 @@ radio_station: notification: bulk_removed: 'Chosen stations have been deleted.' + information: + empty_cannot_remove_radio_station: 'This is is empty. There is nothing to delete…' + user: detail: last_activity_date: 'Last activity date' diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index b9adda2f..91a89d45 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -118,15 +118,12 @@ radio_table: about_ods: "ODS — arkusz kalkulacyjny pakietów LibreOffice oraz Apache\u00A0OpenOffice" remove: - title: 'Usuń stacje lub wykaz' + title: 'Usuń wykaz' action: export: 'Eksport wykazu' - selected_radio_stations: 'Usuń zaznaczone stacje' - radio_table: 'Usuń wykaz' heading: - remove_radio_station: 'Usuwanie stacji' remove_radio_table: 'Usuwanie wykazu' form: @@ -137,7 +134,6 @@ radio_table: not_yet: 'Pamiętaj: jeśli jesteś na samym dnie, głowa do góry, może być już tylko lepiej!' information: - empty_cannot_remove_radio_station: 'Ten wykaz jest pusty. Nie ma czego usuwać…' cannot_be_undone: "Usunięcie wykazu jest nieodwracalne. Pamiętaj, że przed usunięciem możesz wyeksportować wykaz do\u00A0pliku HTML, PDF lub CSV, aby pobrać go na komputer." text: @@ -202,8 +198,14 @@ radio_station: for_radio_table_a11y_subheading: 'w wykazie' disabled_radio_table_column: 'Ta kolumna jest niewidoczna w wykazie.' - remove: - title: 'Usuń stację' + bulk_remove: + title: 'Usuń wiele stacji' + + action: + bulk_remove: 'Usuń zaznaczone stacje' + + heading: + remove_radio_station: 'Usuwanie stacji' form: chosenToRemove: 'Wskaż stacje do usunięcia' @@ -211,6 +213,9 @@ radio_station: notification: bulk_removed: 'Wybrane stacje zostały usunięte.' + information: + empty_cannot_remove_radio_station: 'Ten wykaz jest pusty. Nie ma czego usuwać…' + user: detail: last_activity_date: 'Data ostatniej aktywności' diff --git a/webpack.config.js b/webpack.config.js index 28860c4c..b7f99715 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,6 +31,7 @@ Encore .addStyleEntry('homepage', './assets/css/homepage.css') .addStyleEntry('user-login-register', './assets/css/user-login-register.css') .addStyleEntry('user-public-profile', './assets/css/user-public-profile.css') + .addStyleEntry('radio-station-bulk-remove', './assets/css/radio-station-bulk-remove.css') .addStyleEntry('all-radio-tables', './assets/css/all-radio-tables.css') .addStyleEntry('static-page', './assets/css/static-page.css') .addStyleEntry('dark-error', './assets/css/dark-error.css') From 09b46ddb6cc7904937f25bc05c8e9153cb55759b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sun, 27 Feb 2022 00:50:03 +0100 Subject: [PATCH 10/85] Split export section from radio table settings screen Issue #116 --- assets/css/radio-table-export.css | 23 +++++++ assets/css/radio-table-settings.css | 25 -------- src/Controller/RadioTableController.php | 5 +- templates/radio_table/export.html.twig | 81 ++++++++++++++++++++++++ templates/radio_table/remove.html.twig | 2 +- templates/radio_table/settings.html.twig | 52 ++------------- translations/messages.en.yaml | 42 ++++++------ translations/messages.pl.yaml | 42 ++++++------ webpack.config.js | 1 + 9 files changed, 159 insertions(+), 114 deletions(-) create mode 100644 assets/css/radio-table-export.css create mode 100644 templates/radio_table/export.html.twig diff --git a/assets/css/radio-table-export.css b/assets/css/radio-table-export.css new file mode 100644 index 00000000..630a007d --- /dev/null +++ b/assets/css/radio-table-export.css @@ -0,0 +1,23 @@ +/* export list */ + +.radio-table-export-list { + list-style: none; + padding-left: 0; +} +.radio-table-export-list li { + margin-top: 0.8em; +} +.radio-table-export-list a { + margin-right: 0.7em; + width: 250px; + vertical-align: baseline; +} + +@media (max-width: 800px) +{ + .radio-table-export-list a.button { + margin: 0.23em 0 0.7em 0; + width: 100%; + max-width: 100%; + } +} diff --git a/assets/css/radio-table-settings.css b/assets/css/radio-table-settings.css index 3c49d404..f809dc3b 100644 --- a/assets/css/radio-table-settings.css +++ b/assets/css/radio-table-settings.css @@ -79,28 +79,3 @@ padding-bottom: 0.6em; } } - - -/* export list */ - -.radio-table-export-list { - list-style: none; - padding-left: 0; -} -.radio-table-export-list li { - margin-top: 0.8em; -} -.radio-table-export-list a { - margin-right: 0.7em; - width: 250px; - vertical-align: baseline; -} - -@media (max-width: 800px) -{ - .radio-table-export-list a.button { - margin: 0.23em 0 0.7em 0; - width: 100%; - max-width: 100%; - } -} diff --git a/src/Controller/RadioTableController.php b/src/Controller/RadioTableController.php index c87b4900..42f14005 100644 --- a/src/Controller/RadioTableController.php +++ b/src/Controller/RadioTableController.php @@ -115,9 +115,8 @@ public function download(RadioTable $radioTable, string $_format, */ public function export(RadioTable $radioTable): Response { - return $this->redirectToRoute('radio_table.settings', [ - 'id' => $radioTable->getId(), - '_fragment' => 'export', + return $this->render('radio_table/export.html.twig', [ + 'radio_table' => $radioTable, ]); } diff --git a/templates/radio_table/export.html.twig b/templates/radio_table/export.html.twig new file mode 100644 index 00000000..dbe48cc2 --- /dev/null +++ b/templates/radio_table/export.html.twig @@ -0,0 +1,81 @@ +{% extends 'layout.html.twig' %} + +{% block page_title %}{{ 'radio_table.export.title'|trans }}{% endblock %} + +{% block head_closing %} + {{ encore_entry_link_tags('radio-table-export') }} + {{ encore_entry_script_tags('radio-table-export') }} +{% endblock %} + +{% block context_menu %} + +{% endblock %} + +{% block page_content %} +
    +

    + {{ 'radio_table.export.title'|trans }} + {{ radio_table.name }} +

    +
    + +
    +
    +

    {{ 'radio_table.export.heading.export'|trans }}

    + + {% if radio_table.radioStationsCount > 0 %} +

    + {{ 'radio_table.export.information.export'|trans }} +

    + + + {% else %} +

    + {{ 'radio_table.export.information.export_cannot_empty'|trans }} +

    + {% endif %} +
    +
    +{% endblock %} diff --git a/templates/radio_table/remove.html.twig b/templates/radio_table/remove.html.twig index 25007a09..e63d14e2 100644 --- a/templates/radio_table/remove.html.twig +++ b/templates/radio_table/remove.html.twig @@ -16,7 +16,7 @@
  • - {{ 'radio_table.remove.action.export'|trans }} + {{ 'radio_table.export.title'|trans }}
  • diff --git a/templates/radio_table/settings.html.twig b/templates/radio_table/settings.html.twig index 6ba9afab..62f29f64 100644 --- a/templates/radio_table/settings.html.twig +++ b/templates/radio_table/settings.html.twig @@ -19,6 +19,11 @@ {{ 'radio_station.add.title'|trans }}
  • +
  • + + {{ 'radio_table.export.title'|trans }} + +
  • {{ 'radio_station.bulk_remove.title'|trans }} @@ -106,53 +111,6 @@ {{ form_row(form.appearanceCollapsedComments) }}
  • - -
    -

    {{ 'radio_table.settings.heading.export'|trans }}

    - - {% if radio_table.radioStationsCount > 0 %} -

    - {{ 'radio_table.settings.information.export'|trans }} -

    - -
    - {% else %} -

    - {{ 'radio_table.settings.information.export_cannot_empty'|trans }} -

    - {% endif %} -
    diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 08ef6536..139134b8 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -64,7 +64,6 @@ radio_table: visibility: 'Visibility' columns: 'Columns' appearance: 'Appearance' - export: 'Export' form: name: 'List name' @@ -93,8 +92,6 @@ radio_table: information: columns: 'Order of list columns can be changed through numbers. Change number to move column up or down. Use negative number to hide column. Please enable JavaScript in your browser for easy to use graphical interface.' - export: 'Choose preferred export format to download the whole list to your computer. List will be exported with current sorting and with enabled columns only. Extra RDS information is not included.' - export_cannot_empty: 'You cannot export empty list.' columns_ui: action: @@ -103,25 +100,32 @@ radio_table: move_up: 'Move up' move_down: 'Move down' - export: - action: - download_pdf: 'Download PDF document' - download_csv: 'Download CSV sheet' - download_html: 'Download HTML page' - download_xlsx: 'Download XLSX sheet' - download_ods: 'Download ODS sheet' - text: - about_pdf: 'PDF — standard document for reading and printing' - about_csv: 'CSV — dataset for importing into spreadsheet' - about_html: 'HTML — web page file for internet browsers' - about_xlsx: 'XLSX — spreadsheet document for Microsoft Excel 2007' - about_ods: 'ODS — spreadsheet document for LibreOffice and Apache OpenOffice' + export: + title: 'Export list' - remove: - title: 'Delete list' + heading: + export: 'Export' action: - export: 'Export list' + download_pdf: 'Download PDF document' + download_csv: 'Download CSV sheet' + download_html: 'Download HTML page' + download_xlsx: 'Download XLSX sheet' + download_ods: 'Download ODS sheet' + + text: + about_pdf: 'PDF — standard document for reading and printing' + about_csv: 'CSV — dataset for importing into spreadsheet' + about_html: 'HTML — web page file for internet browsers' + about_xlsx: 'XLSX — spreadsheet document for Microsoft Excel 2007' + about_ods: 'ODS — spreadsheet document for LibreOffice and Apache OpenOffice' + + information: + export: 'Choose preferred export format to download the whole list to your computer. List will be exported with current sorting and with enabled columns only. Extra RDS information is not included.' + export_cannot_empty: 'You cannot export empty list.' + + remove: + title: 'Delete list' heading: remove_radio_table: 'Delete list' diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index 91a89d45..fbb07601 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -64,7 +64,6 @@ radio_table: visibility: 'Widoczność' columns: 'Kolumny' appearance: 'Wygląd' - export: 'Eksport' form: name: 'Nazwa wykazu' @@ -93,8 +92,6 @@ radio_table: information: columns: "Kolejność kolumn wykazu jest uzależniona od przypisanych do nich liczb. Aby przenieść kolumnę, zmień jej liczbę. Aby ukryć kolumnę, wpisz liczbę ujemną. Aby skorzystać z\u00A0wygodnego graficznego edytora kolumn, włącz JavaScript w\u00A0przeglądarce." - export: "Wybierz pożądany format eksportu, aby pobrać cały wykaz w\u00A0formie pliku na swój komputer. Wykaz\u00A0eksportowany jest z\u00A0aktualnie ustawionym sortowaniem i\u00A0aktualnie widocznymi kolumnami. Pomijane\u00A0są\u00A0szczegółowe informacje o\u00A0RDS." - export_cannot_empty: 'Ten wykaz jest pusty. Nie można go wyeksportować.' columns_ui: action: @@ -103,25 +100,32 @@ radio_table: move_up: 'Do góry' move_down: 'W dół' - export: - action: - download_pdf: 'Pobierz dokument PDF' - download_csv: 'Pobierz arkusz CSV' - download_html: 'Pobierz stronę HTML' - download_xlsx: 'Pobierz arkusz XLSX' - download_ods: 'Pobierz arkusz ODS' - text: - about_pdf: "PDF — dokument elektroniczny do przeglądania i\u00A0druku" - about_csv: "CSV — zestaw danych do zaimportowania i\u00A0edycji w\u00A0arkuszu kalkulacyjnym" - about_html: "HTML — plik strony internetowej otwierany w\u00A0przeglądarce" - about_xlsx: "XLSX — arkusz kalkulacyjny programu Microsoft Excel\u00A02007" - about_ods: "ODS — arkusz kalkulacyjny pakietów LibreOffice oraz Apache\u00A0OpenOffice" + export: + title: 'Eksportuj wykaz' - remove: - title: 'Usuń wykaz' + heading: + export: 'Eksport' action: - export: 'Eksport wykazu' + download_pdf: 'Pobierz dokument PDF' + download_csv: 'Pobierz arkusz CSV' + download_html: 'Pobierz stronę HTML' + download_xlsx: 'Pobierz arkusz XLSX' + download_ods: 'Pobierz arkusz ODS' + + text: + about_pdf: "PDF — dokument elektroniczny do przeglądania i\u00A0druku" + about_csv: "CSV — zestaw danych do zaimportowania i\u00A0edycji w\u00A0arkuszu kalkulacyjnym" + about_html: "HTML — plik strony internetowej otwierany w\u00A0przeglądarce" + about_xlsx: "XLSX — arkusz kalkulacyjny programu Microsoft Excel\u00A02007" + about_ods: "ODS — arkusz kalkulacyjny pakietów LibreOffice oraz Apache\u00A0OpenOffice" + + information: + export: "Wybierz pożądany format eksportu, aby pobrać cały wykaz w\u00A0formie pliku na swój komputer. Wykaz\u00A0eksportowany jest z\u00A0aktualnie ustawionym sortowaniem i\u00A0aktualnie widocznymi kolumnami. Pomijane\u00A0są\u00A0szczegółowe informacje o\u00A0RDS." + export_cannot_empty: 'Ten wykaz jest pusty. Nie można go wyeksportować.' + + remove: + title: 'Usuń wykaz' heading: remove_radio_table: 'Usuwanie wykazu' diff --git a/webpack.config.js b/webpack.config.js index b7f99715..7ab8063f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,6 +31,7 @@ Encore .addStyleEntry('homepage', './assets/css/homepage.css') .addStyleEntry('user-login-register', './assets/css/user-login-register.css') .addStyleEntry('user-public-profile', './assets/css/user-public-profile.css') + .addStyleEntry('radio-table-export', './assets/css/radio-table-export.css') .addStyleEntry('radio-station-bulk-remove', './assets/css/radio-station-bulk-remove.css') .addStyleEntry('all-radio-tables', './assets/css/all-radio-tables.css') .addStyleEntry('static-page', './assets/css/static-page.css') From 8b21b96f36a9da9df730d302386d7d129001f292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sun, 27 Feb 2022 01:25:01 +0100 Subject: [PATCH 11/85] Split columns section from radio table settings screen Issue #116 --- assets/css/radio-table-columns.css | 75 +++++++++++++++++++++++ assets/css/radio-table-settings.css | 77 ------------------------ assets/js/radio-table-columns.js | 7 +++ assets/js/radio-table-settings.js | 3 - src/Controller/RadioTableController.php | 24 ++++++++ src/Form/RadioTableColumnsType.php | 29 +++++++++ src/Form/RadioTableSettingsType.php | 5 -- templates/radio_table/columns.html.twig | 63 +++++++++++++++++++ templates/radio_table/settings.html.twig | 21 +------ translations/messages.en.yaml | 13 +++- translations/messages.pl.yaml | 14 ++++- webpack.config.js | 1 + 12 files changed, 225 insertions(+), 107 deletions(-) create mode 100644 assets/css/radio-table-columns.css create mode 100644 assets/js/radio-table-columns.js create mode 100644 src/Form/RadioTableColumnsType.php create mode 100644 templates/radio_table/columns.html.twig diff --git a/assets/css/radio-table-columns.css b/assets/css/radio-table-columns.css new file mode 100644 index 00000000..c05554dd --- /dev/null +++ b/assets/css/radio-table-columns.css @@ -0,0 +1,75 @@ +/* columns UI */ + +.JS .radio-table-columns { + margin: 1.2em auto; +} +.JS .radio-table-columns .form-item { + background: #F3F3F3; + box-shadow: inset 2px 2px 2px #DEDEDE; + border: 1px solid #C2C2C2; + padding: 0.5em 1em; + box-sizing: border-box; + display: flex; + align-items: center; +} +.JS .radio-table-columns .form-item label { + margin: 0; +} +.JS .radio-table-columns .form-item > :last-child { + text-align: right; + flex: 1; +} +.JS .radio-table-columns .form-item.hidden-column { + background: #FBFBFB; + box-shadow: inset 2px 2px 2px #efefef; + border-color: #dfdfdf; +} +.JS .radio-table-columns .form-item.hidden-column label { + text-decoration: line-through; + opacity: 0.5; +} +.JS .radio-table-columns .form-item button { + display: inline; + width: auto; + height: 2em; + min-width: 85px; + margin: 0 0 0 0.6em; + white-space: nowrap; +} +.JS .radio-table-columns .form-item button:first-of-type { + margin-left: 0; +} + +@media (max-width: 800px) +{ + .JS .radio-table-columns .form-item { + flex-direction: row; + } + .JS .radio-table-columns .form-item label { + margin-bottom: 0; + } +} + +@media (max-width: 700px) +{ + .JS .radio-table-columns .form-item { + flex-direction: column; + } + .JS .radio-table-columns .form-item label { + margin-bottom: 0.7em; + } + .JS .radio-table-columns .form-item > :last-child { + text-align: center; + white-space: nowrap; + } +} +@media (max-width: 440px) +{ + .JS .radio-table-columns .form-item button { + min-width: auto; + height: auto; + font-size: 0.8em; + padding-top: 0.6em; + padding-bottom: 0.6em; + } +} diff --git a/assets/css/radio-table-settings.css b/assets/css/radio-table-settings.css index f809dc3b..519314c3 100644 --- a/assets/css/radio-table-settings.css +++ b/assets/css/radio-table-settings.css @@ -2,80 +2,3 @@ @import './part/radio-table-status.css'; @import './part/ckeditor.css'; - - -/* columns UI */ - -.JS .radio-table-columns { - margin: 1.2em auto; -} -.JS .radio-table-columns .form-item { - background: #F3F3F3; - box-shadow: inset 2px 2px 2px #DEDEDE; - border: 1px solid #C2C2C2; - padding: 0.5em 1em; - box-sizing: border-box; - display: flex; - align-items: center; -} -.JS .radio-table-columns .form-item label { - margin: 0; -} -.JS .radio-table-columns .form-item > :last-child { - text-align: right; - flex: 1; -} -.JS .radio-table-columns .form-item.hidden-column { - background: #FBFBFB; - box-shadow: inset 2px 2px 2px #efefef; - border-color: #dfdfdf; -} -.JS .radio-table-columns .form-item.hidden-column label { - text-decoration: line-through; - opacity: 0.5; -} -.JS .radio-table-columns .form-item button { - display: inline; - width: auto; - height: 2em; - min-width: 85px; - margin: 0 0 0 0.6em; - white-space: nowrap; -} -.JS .radio-table-columns .form-item button:first-of-type { - margin-left: 0; -} - -@media (max-width: 800px) -{ - .JS .radio-table-columns .form-item { - flex-direction: row; - } - .JS .radio-table-columns .form-item label { - margin-bottom: 0; - } -} - -@media (max-width: 700px) -{ - .JS .radio-table-columns .form-item { - flex-direction: column; - } - .JS .radio-table-columns .form-item label { - margin-bottom: 0.7em; - } - .JS .radio-table-columns .form-item > :last-child { - text-align: center; - white-space: nowrap; - } -} -@media (max-width: 440px) -{ - .JS .radio-table-columns .form-item button { - min-width: auto; - height: auto; - font-size: 0.8em; - padding-top: 0.6em; - padding-bottom: 0.6em; - } -} diff --git a/assets/js/radio-table-columns.js b/assets/js/radio-table-columns.js new file mode 100644 index 00000000..6623c722 --- /dev/null +++ b/assets/js/radio-table-columns.js @@ -0,0 +1,7 @@ +import '../css/radio-table-columns.css'; + +import { RadioTableColumnsUI } from './src/RadioTableColumnsUI.js'; + +document.addEventListener('DOMContentLoaded', () => { + new RadioTableColumnsUI(document.querySelector('.radio-table-columns')); +}); diff --git a/assets/js/radio-table-settings.js b/assets/js/radio-table-settings.js index 02e63ae6..565cd1e5 100644 --- a/assets/js/radio-table-settings.js +++ b/assets/js/radio-table-settings.js @@ -1,6 +1,5 @@ import '../css/radio-table-settings.css'; -import { RadioTableColumnsUI } from './src/RadioTableColumnsUI.js'; import Huebee from 'huebee'; function setupColorInputs() @@ -49,8 +48,6 @@ function setupCustomWidthInput() } document.addEventListener('DOMContentLoaded', () => { - new RadioTableColumnsUI(document.querySelector('.radio-table-columns')); - setupColorInputs(); setupCustomWidthInput(); }); diff --git a/src/Controller/RadioTableController.php b/src/Controller/RadioTableController.php index 42f14005..d4664ea3 100644 --- a/src/Controller/RadioTableController.php +++ b/src/Controller/RadioTableController.php @@ -4,6 +4,7 @@ use App\Entity\RadioTable; use App\Export\RadioTableExporterProvider; +use App\Form\RadioTableColumnsType; use App\Form\RadioTableCreateType; use App\Form\RadioTableRemoveType; use App\Form\RadioTableSettingsType; @@ -81,6 +82,29 @@ public function settings(RadioTable $radioTable, Request $request, ]); } + /** + * @Route({"pl": "/wykaz/{id}/ustawienia/kolumny", "en": "/list/{id}/settings/columns"}, name="radio_table.columns") + * @IsGranted("IS_AUTHENTICATED_REMEMBERED") + * @IsGranted("RADIO_TABLE_MODIFY", subject="radioTable", statusCode=404) + */ + public function columns(RadioTable $radioTable, Request $request, + EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(RadioTableColumnsType::class, $radioTable); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + $this->addFlash('notice', 'common.notification.saved_changes'); + } + + return $this->render('radio_table/columns.html.twig', [ + 'form' => $form->createView(), + 'radio_table' => $radioTable, + ]); + } + /** * @Route( * {"pl": "/wykaz/{id}/eksport/{_format}", "en": "/list/{id}/export/{_format}"}, diff --git a/src/Form/RadioTableColumnsType.php b/src/Form/RadioTableColumnsType.php new file mode 100644 index 00000000..44c309eb --- /dev/null +++ b/src/Form/RadioTableColumnsType.php @@ -0,0 +1,29 @@ +add('columns', RadioTableColumnsUIType::class, [ + 'label_format' => 'column.%name%', + 'translation_domain' => 'radio_table', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => RadioTable::class, + ]); + } +} diff --git a/src/Form/RadioTableSettingsType.php b/src/Form/RadioTableSettingsType.php index 6847143d..87c3cef1 100644 --- a/src/Form/RadioTableSettingsType.php +++ b/src/Form/RadioTableSettingsType.php @@ -5,7 +5,6 @@ use App\Entity\Embeddable\RadioTable\Appearance; use App\Entity\RadioTable; use App\Form\Type\IntegerUnitType; -use App\Form\Type\RadioTableColumnsType; use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -51,10 +50,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void }, 'choice_translation_domain' => 'radio_table', ]) - ->add('columns', RadioTableColumnsType::class, [ - 'label_format' => 'column.%name%', - 'translation_domain' => 'radio_table', - ]) ->add('appearanceBackgroundColor', TextType::class, [ 'property_path' => 'appearance.backgroundColor', diff --git a/templates/radio_table/columns.html.twig b/templates/radio_table/columns.html.twig new file mode 100644 index 00000000..b7306a27 --- /dev/null +++ b/templates/radio_table/columns.html.twig @@ -0,0 +1,63 @@ +{% extends 'layout.html.twig' %} + +{% block page_title %}{{ 'radio_table.columns.title'|trans }}{% endblock %} + +{% block head_closing %} + {{ encore_entry_link_tags('radio-table-columns') }} + {{ encore_entry_script_tags('radio-table-columns') }} +{% endblock %} + +{% block context_menu %} + +{% endblock %} + +{% block page_content %} +
    +

    + {{ 'radio_table.columns.title'|trans }} + {{ radio_table.name }} +

    +
    + + {{ form_start(form) }} + +
    +
    +

    {{ 'radio_table.columns.information.no_javascript'|trans }}

    + + + +
    + {{ form_row(form.columns) }} + + +
    +
    +
    + + + + {{ form_end(form) }} +{% endblock %} diff --git a/templates/radio_table/settings.html.twig b/templates/radio_table/settings.html.twig index 62f29f64..30c89e1d 100644 --- a/templates/radio_table/settings.html.twig +++ b/templates/radio_table/settings.html.twig @@ -69,24 +69,9 @@

    {{ 'radio_table.settings.heading.columns'|trans }}

    - - -
    - {{ form_row(form.columns) }} - - -
    + + {{ 'radio_table.settings.action.set_custom_columns'|trans }} +
    diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 139134b8..96bab183 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -65,6 +65,9 @@ radio_table: columns: 'Columns' appearance: 'Appearance' + action: + set_custom_columns: 'Change columns layout' + form: name: 'List name' name.help: 'Place information about location here to make finding your list easier.' @@ -90,8 +93,11 @@ radio_table: appearanceCustomWidth: 'Custom width' appearanceCollapsedComments: 'Use icon instead of full content in comments column' - information: - columns: 'Order of list columns can be changed through numbers. Change number to move column up or down. Use negative number to hide column. Please enable JavaScript in your browser for easy to use graphical interface.' + columns: + title: 'List columns' + + heading: + columns: 'Columns' columns_ui: action: @@ -100,6 +106,9 @@ radio_table: move_up: 'Move up' move_down: 'Move down' + information: + no_javascript: 'Order of list columns can be changed through numbers. Change number to move column up or down. Use negative number to hide column. Please enable JavaScript in your browser for easy to use graphical interface.' + export: title: 'Export list' diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index fbb07601..1497305f 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -65,6 +65,9 @@ radio_table: columns: 'Kolumny' appearance: 'Wygląd' + action: + set_custom_columns: 'Zmień układ kolumn' + form: name: 'Nazwa wykazu' name.help: 'Umieść tutaj lokalizację (np. miejscowość lub województwo), aby ułatwić odnalezienie twojego wykazu.' @@ -90,8 +93,12 @@ radio_table: appearanceCustomWidth: 'Niestandardowa szerokość' appearanceCollapsedComments: 'Użyj ikony zamiast pełnej treści w kolumnie komentarzy' - information: - columns: "Kolejność kolumn wykazu jest uzależniona od przypisanych do nich liczb. Aby przenieść kolumnę, zmień jej liczbę. Aby ukryć kolumnę, wpisz liczbę ujemną. Aby skorzystać z\u00A0wygodnego graficznego edytora kolumn, włącz JavaScript w\u00A0przeglądarce." + + columns: + title: 'Ustawienia kolumn' + + heading: + columns: 'Kolumny' columns_ui: action: @@ -100,6 +107,9 @@ radio_table: move_up: 'Do góry' move_down: 'W dół' + information: + no_javascript: "Kolejność kolumn wykazu jest uzależniona od przypisanych do nich liczb. Aby przenieść kolumnę, zmień jej liczbę. Aby ukryć kolumnę, wpisz liczbę ujemną. Aby skorzystać z\u00A0wygodnego graficznego edytora kolumn, włącz JavaScript w\u00A0przeglądarce." + export: title: 'Eksportuj wykaz' diff --git a/webpack.config.js b/webpack.config.js index 7ab8063f..8f61a1a2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,6 +24,7 @@ Encore .addEntry('radio-table-create', './assets/js/radio-table-create.js') .addEntry('radio-table-show', './assets/js/radio-table-show.js') .addEntry('radio-table-settings', './assets/js/radio-table-settings.js') + .addEntry('radio-table-columns', './assets/js/radio-table-columns.js') .addEntry('radio-table-remove', './assets/js/radio-table-remove.js') .addEntry('radio-station-edit-add', './assets/js/radio-station-edit-add.js') .addEntry('my-account-settings', './assets/js/my-account-settings.js') From e00e82ccc6c849c27819c1528454a0ff350484b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sun, 27 Feb 2022 21:47:12 +0100 Subject: [PATCH 12/85] Update site general style: colors, shadows, forms Issue #116 --- assets/css/common.css | 176 ++++++++---------- assets/css/homepage.css | 6 +- assets/css/part/ckeditor.css | 42 +++-- assets/css/radio-station-bulk-remove.css | 8 +- assets/css/radio-table-columns.css | 17 +- assets/css/radio-table-show.css | 8 +- assets/css/static-page.css | 2 - templates/common/form/ckeditor.html.twig | 1 + .../common/form/overwritten_types.html.twig | 4 +- 9 files changed, 133 insertions(+), 131 deletions(-) diff --git a/assets/css/common.css b/assets/css/common.css index 19577bbd..d89a8419 100644 --- a/assets/css/common.css +++ b/assets/css/common.css @@ -29,7 +29,7 @@ body { font: 17px "LatoLatinWeb", "Liberation Sans", "Arial", sans-serif; color: #000; text-rendering: optimizeLegibility; - background: #F7FFF3; + background: #f7f6f5; cursor: default; overflow-y: scroll; @@ -55,6 +55,10 @@ a:hover { color: #0084FF; outline: none; } +a:focus-visible { + outline-offset: 3px; + outline: 2px solid rgb(240,127,31, 0.6); +} a:active { color: #64BE00; outline: none; @@ -382,20 +386,23 @@ a:active { /* form widgets */ input, textarea, select, button, a.button { - font-size: 0.88em; width: 100%; - padding: 5px 11px; - background: #F3F3F3; - box-shadow: inset 2px 2px 2px #DEDEDE; - border: 1px solid #C2C2C2; + padding: 6px 11px; + background: #f9f9f9; + border: 1px solid #cacaca; + border-radius: 7px; + + outline: 0 solid transparent; + transition: linear 0.1s background-color, linear 0.1s outline; - outline: none; font: inherit; color: inherit; box-sizing: border-box; } input:focus, textarea:focus, select:focus, button:focus, a.button:focus { - outline: 1px solid #F07F1F; + outline: 2px solid rgb(240,127,31, 0.6); + border-color: #F07F1F; + background-color: #fff; /* needed for WebKit/Blink */ outline-offset: 0px; @@ -404,6 +411,10 @@ input:disabled, textarea:disabled, select:disabled { opacity: 0.4; cursor: not-allowed; } +input::placeholder, textarea::placeholder { + color: inherit; + opacity: 0.3; +} textarea { resize: vertical; min-height: 130px; @@ -438,35 +449,33 @@ select { -webkit-appearance: none; appearance: none; - background-image: url("data:image/svg+xml,%3Csvg height='16px' width='35px' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon fill='%23999' points='23.303,-0.002 12.467,10.834 1.63,-0.002 -0.454,2.082 12.467,15.002 14.551,12.918 25.387,2.082'/%3E%3C/svg%3E"); + background-image: url("data:image/svg+xml,%3Csvg height='16px' width='45px' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon fill='%23999' points='23.303,-0.002 12.467,10.834 1.63,-0.002 -0.454,2.082 12.467,15.002 14.551,12.918 25.387,2.082'/%3E%3C/svg%3E"); background-position: center right; background-repeat: no-repeat; - - /* needed for WebKit */ - border-radius: 0; -} -@supports (-moz-user-select: none) -{ - /* smaller padding for Firefox */ - select { - padding: 4px 7px; - } + background-size: 30px; } button, a.button { - max-width: 40%; + display: block; margin: 1em auto 0; - background: #F8FFDF; - color: #F07F1F; + width: auto; + padding-left: 1.2em; + padding-right: 1.2em; + + background: #f8f8f8; + color: #D66200; font-weight: bold; - transition: linear 0.1s background-color; - border-color: #DDDDDD; - box-shadow: 0 0 2px rgba(0,0,0, 0.08); - display: block; + border-color: #ddd; + box-shadow: 0 0 2px rgba(0,0,0, 0.17); +} +button:hover:not(:disabled), a.button:hover { + background: #e9e9e9; +} +button:focus, a.button:focus { + background: #f8f8f8; } -button:hover:not(:disabled), button:focus, a.button:hover, a.button:focus { - background: #F07F1F; - color: #F2FFC6; +button:active, a.button:active { + opacity: 0.7; } button:disabled { opacity: 0.4; @@ -483,82 +492,50 @@ a.button { } fieldset { + margin: 0; padding: 0; border: none; padding: 0.3em 0; - - /* undo "magic" top margin from fieldset */ - margin: -0.9em 0 0; -} - -@media (max-width: 800px) -{ - button { - max-width: 70%; - } } /* form widgets — checkboxes + labels */ input[type="checkbox"], input[type="radio"] { - width: auto; - padding: 0; - margin: 0; - - /* hide real checkbox and keep it above fake checkbox */ - position: absolute; - z-index: 2; - opacity: 0; -} - -input[type="checkbox"] + label::before, input[type="radio"] + label::before { - content: " "; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; display: inline-block; - width: 17px; - height: 17px; + width: 19px; + height: 19px; padding: 0; + margin: 0 6px 0 0; + border-radius: 4px; + vertical-align: -3px; - position: absolute; - z-index: 1; - margin-top: 1px; - - /* negative label's padding-left */ - margin-left: calc(-1 * (17px + 0.7em)); - - /* copied from form widgets styles */ - background: #F3F3F3; - box-shadow: inset 2px 2px 2px #DEDEDE; - border: 1px solid #C2C2C2; -} -input[type="radio"] + label::before { - border-radius: 10px; - -moz-outline-radius: 10px; -} -input[type="checkbox"]:focus + label::before, input[type="radio"]:focus + label::before { - /* copied from form widgets styles */ - outline: 1px solid #F07F1F; -} -input[type="checkbox"]:checked + label::before, input[type="radio"]:checked + label::before { background-position: center; background-repeat: no-repeat; background-size: 9px 9px; } -input[type="checkbox"]:checked + label::before { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7' viewBox='0 0 1.852 1.852'%3E%3Cpath fill='%23FF7500' d='M0 0h1.852v1.852H0z'/%3E%3C/svg%3E"); +input[type="radio"] { + border-radius: 10px; +} +input[type="checkbox"]:checked { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7' viewBox='0 0 1 1'%3E%3Crect fill='%23FF7500' rx='0.25' x='0' y='0' width='1' height='1'/%3E%3C/svg%3E"); } -input[type="radio"]:checked + label::before { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7' viewBox='0 0 1.852 1.852'%3E%3Ccircle fill='%23FF7500' cx='19.798' cy='24.486' r='.926' transform='translate%28-18.872 -23.56%29'/%3E%3C/svg%3E"); +input[type="radio"]:checked { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7' viewBox='0 0 1 1'%3E%3Crect fill='%23FF7500' rx='1' x='0' y='0' width='1' height='1'/%3E%3C/svg%3E"); } input[type="checkbox"] + label, input[type="radio"] + label { - /* keep in sync with ::before's margin-left */ - padding-left: calc(17px + 0.7em); + border-radius: 3px; + outline: 0 solid transparent; + transition: linear 0.1s outline; } -input[type="checkbox"]:focus:not(:hover) + label, input[type="radio"]:focus:not(:hover) + label { - outline: 1px dotted #F6BD8D; +input[type="checkbox"]:focus-visible + label, input[type="radio"]:focus-visible + label { outline-offset: 3px; + outline: 2px solid rgb(240,127,31, 0.6); } @@ -578,14 +555,10 @@ input.color[style] { margin: 20px 0; } .form-item label { - display: block; + display: inline-block; margin-bottom: 7px; } -.form-item-checkbox { - /* needed for inputs and fake checkboxes with position absolute */ - position: relative; -} .form-item-checkbox label { margin-bottom: 0; } @@ -606,18 +579,30 @@ input.color[style] { /* radio tables list */ .radio-tables-list-item { - background: #FAFFF8; - border: 1px solid #D2D2D2; + background: #fff; + border: 1px solid #dfdfdf; + border-radius: 7px; + box-shadow: 0 0 6px rgba(0,0,0, 0.09); padding: 1em 1.4em; margin: 1.2em 0; + + outline: 0 solid transparent; + transition: linear 0.1s outline; +} +.radio-tables-list-item:hover { + background: #fcfcfc; + border-color: #e6d1be; +} +.radio-tables-list-item:focus-within { + outline: 2px solid rgb(240,127,31, 0.6); + border-color: #F07F1F; } .radio-tables-list-item dd { margin-left: 0; } - -.radio-tables-list-item:focus-within:not(:hover) { - background: rgba(255,255,255, 1); - border-color: #BABABA; +.radio-tables-list-item a { + /* make outline visible with overflow */ + outline-offset: -1px; } .radio-tables-list-title a, .radio-tables-list-details dl { @@ -630,10 +615,6 @@ input.color[style] { display: block; font-size: 1.6em; } -.radio-tables-list-title a:focus { - /* make outline visible with overflow */ - outline-offset: -1px; -} .radio-tables-list-details dl { margin: 0.4em 0 0.1em; @@ -689,5 +670,4 @@ input.color[style] { .search-form button { margin: 0; margin-left: 0.6em; - width: 80px; } diff --git a/assets/css/homepage.css b/assets/css/homepage.css index cb3549b9..e93329a7 100644 --- a/assets/css/homepage.css +++ b/assets/css/homepage.css @@ -12,8 +12,10 @@ } .homepage section { - background: rgba(255,255,255, 0.4); - box-shadow: 0 0 2px rgba(0,0,0, 0.15); + background: #fff; + border: 1px solid #dfdfdf; + border-radius: 7px; + box-shadow: 0 4px 22px rgba(0,0,0, 0.09); padding: 0.2em 1.3em 0.4em; } .homepage section h2 { diff --git a/assets/css/part/ckeditor.css b/assets/css/part/ckeditor.css index 0c8573b2..5e90be25 100644 --- a/assets/css/part/ckeditor.css +++ b/assets/css/part/ckeditor.css @@ -1,36 +1,48 @@ +textarea.ckeditor { + height: 268px; +} + .cke_chrome { + border-radius: 7px !important; + border: 1px solid #cacaca !important; + background: #f7f7f7 !important; + outline: 0 solid transparent !important; + transition: linear 0.1s outline !important; + box-shadow: none !important; - border: none !important; } -.cke_chrome.cke_focus { - outline: 1px solid #F07F1F !important; +.cke_chrome:focus-within { + outline: 2px solid rgb(240,127,31, 0.6) !important; + border-color: #F07F1F !important; } .cke_reset_all, .cke_reset_all *, .cke_reset_all a { font-family: inherit !important; } .cke_toolgroup { - background-image: linear-gradient(to bottom,#fff,#efefef) !important; + background: #fff !important; +} +.cke_toolgroup .cke_button:hover, .cke_toolgroup .cke_button:focus { + background: #eaeaea !important; +} +.cke_toolgroup .cke_button_on { + background: #cdcdcd !important; + + box-shadow: none !important; } .cke_chrome .cke_inner { - background: rgba(224,224,224, 0.3) !important; + background: transparent !important; } .cke_chrome .cke_wysiwyg_div { padding: 2px 11px !important; - background: #F3F3F3 !important; - border: 1px solid #C2C2C2 !important; - box-shadow: inset 2px 2px 2px #DEDEDE !important; + background: #fff !important; + border-top: 1px solid #cacaca !important; + border-bottom: 1px solid #cacaca !important; } .cke_chrome span.cke_top, .cke_chrome span.cke_bottom { box-shadow: none !important; - border: 1px solid #C2C2C2 !important; background: none !important; -} -.cke_chrome span.cke_top { - border-bottom: none !important; -} -.cke_chrome span.cke_bottom { - border-top: none !important; + border: none !important; } .cke_chrome .cke_wordcount { text-transform: lowercase; diff --git a/assets/css/radio-station-bulk-remove.css b/assets/css/radio-station-bulk-remove.css index 95366459..56834a33 100644 --- a/assets/css/radio-station-bulk-remove.css +++ b/assets/css/radio-station-bulk-remove.css @@ -4,9 +4,11 @@ max-height: 430px; overflow-y: auto; box-sizing: border-box; - padding: 0.05em 1em; - background: #F9FCF9; - border: 1px solid #D6EAD0; + padding: 0 1.4em; + background: #fff; + border: 1px solid #dfdfdf; + border-radius: 7px; + box-shadow: 0 0 6px rgba(0,0,0, 0.09); } .radio-stations-remove fieldset { margin: 0; diff --git a/assets/css/radio-table-columns.css b/assets/css/radio-table-columns.css index c05554dd..1ef8b425 100644 --- a/assets/css/radio-table-columns.css +++ b/assets/css/radio-table-columns.css @@ -2,11 +2,14 @@ .JS .radio-table-columns { margin: 1.2em auto; + max-width: 800px; } .JS .radio-table-columns .form-item { - background: #F3F3F3; - box-shadow: inset 2px 2px 2px #DEDEDE; - border: 1px solid #C2C2C2; + border-radius: 7px; + background: #fff; + border: 1px solid #dfdfdf; + box-shadow: 0 0 6px rgba(0,0,0, 0.09); + padding: 0.5em 1em; box-sizing: border-box; display: flex; @@ -20,9 +23,9 @@ flex: 1; } .JS .radio-table-columns .form-item.hidden-column { - background: #FBFBFB; - box-shadow: inset 2px 2px 2px #efefef; - border-color: #dfdfdf; + background: #fafafa; + box-shadow: inset 1px 1px 2px #efefef; + border-color: #e9e9e9; } .JS .radio-table-columns .form-item.hidden-column label { text-decoration: line-through; @@ -32,7 +35,7 @@ display: inline; width: auto; height: 2em; - min-width: 85px; + min-width: 100px; margin: 0 0 0 0.6em; white-space: nowrap; } diff --git a/assets/css/radio-table-show.css b/assets/css/radio-table-show.css index 95c635ac..3946fd76 100644 --- a/assets/css/radio-table-show.css +++ b/assets/css/radio-table-show.css @@ -269,8 +269,10 @@ .rds-popup { background: #fff; color: #000; - border: 1px solid #eee; - box-shadow: 0 0 3px rgba(0,0,0, 0.4); + border: 1px solid #cacaca; + border-radius: 7px; + overflow: hidden; + box-shadow: 0 0 10px rgba(0,0,0, 0.14); width: 430px; animation-name: rds_popup_show; @@ -286,7 +288,7 @@ font-size: 0.9em; text-transform: uppercase; text-align: center; - padding: 0.1em 0; + padding: 0.3em 0; margin: 0; } diff --git a/assets/css/static-page.css b/assets/css/static-page.css index edbf1ef3..2aa7b9bf 100644 --- a/assets/css/static-page.css +++ b/assets/css/static-page.css @@ -52,7 +52,5 @@ } .plain-text-page a.button { max-width: none; - padding-left: 1.4em; - padding-right: 1.4em; margin-bottom: -1px; } diff --git a/templates/common/form/ckeditor.html.twig b/templates/common/form/ckeditor.html.twig index 47542486..e4a092da 100644 --- a/templates/common/form/ckeditor.html.twig +++ b/templates/common/form/ckeditor.html.twig @@ -1,6 +1,7 @@ {% use '@FOSCKEditor/Form/ckeditor_widget.html.twig' %} {% block ckeditor_widget %} + {% set attr = attr|merge({ class: 'ckeditor' }) %} {{ parent() }}