User tests: Successful: Unsuccessful:
Pull Request for Issue #19943 .
Makes the "type" detection for the switcher more robust.
Currently, everything behind the class part "switcher-" becomes the "type" of the switcher. This PR changes it so only that class is taken into account and following additional classes are ignored.
Adjust a radio field with class "switcher", eg https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/config.xml#L22.
switcher-danger
making it class="switcher switcher-danger"
. Then test the appearance in the com_content option page.class="switcher btn-group"
and check again.First test should change the switcher to a red one instead of green.
Second test should change nothing (since no switcher-foo
is defined). Your switcher should stay green.
First test works as expected and switcher gets red.
Second test changes the switcher to use no color at all.
None
Status | New | ⇒ | Pending |
Category | ⇒ | Layout |
Title |
|
@Bakual Thank you.
I have tested this item
I tested the design in Joomla 4 not the functionality.
I did not apply any class attribute: I saw no swicher, but circels and the field works. I could change die active circles
<field
name="article_layout"
type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
menuitems="true"
extension="com_content"
view="article"
/>
With class=switcher-danger (without switcher) the switcher color is green. I expected a red color, but that is OK. I forgot to insert the switcher to the class list.
<field
name="show_title"
type="radio"
label="JGLOBAL_SHOW_TITLE_LABEL"
class="switcher-danger"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
With class=switcher switcher-danger the switcher color is green like expected.
<field
name="show_title"
type="radio"
label="JGLOBAL_SHOW_TITLE_LABEL"
class="switcher switcher-danger"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
With class=switcher switcher-primary the switcher color is blue like expected
<field
name="show_title"
type="radio"
label="JGLOBAL_SHOW_TITLE_LABEL"
class="switcher switcher-primary"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
Is there a documentation anywhere for this webcomponent?
@Bakual I believe that the 4 cookouts that are used in alerts (blue, green, yellow, red) cover 90% of the use cases but Charlie is against that.
Anyways whatever the decision on the number of colors supported by the switcher there is fine detail that needs to be taken into consideration: custom elements WILL be again 1 file so the idea of extending the css means also that people will have to override (totally doable right now) the js!
@wilsonge can you merge this?
@Bakual We currently use the following colour map for custom elements:
$theme-colors: map-merge((
primary: $blue,
secondary: $gray-600,
success: $green,
warning: $yellow,
danger: $red
), $theme-colors);
However I may unset secondary
and warning
for the switcher
@dgt41 I assume you mean, for example, the use of alert-blue
instead of alert-primary
?
Rebased to see if tests now pass
[c/s] Add space before and after +
?
Labels |
Added:
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-02 22:37:35 |
Closed_By | ⇒ | wilsonge |
Btw possible values as far as I know are
switcher-success
(default one),switcher-warning
andswitcher-danger
. Maybe there are additional ones (@dgt41 is that documented?)