Skip to content

[4.0] Custom events: support in showon, templates, switcher, color field, tinymce#18864

Merged
wilsonge merged 8 commits intojoomla:4.0-devfrom
Fedik:jevents1
Nov 28, 2017
Merged

[4.0] Custom events: support in showon, templates, switcher, color field, tinymce#18864
wilsonge merged 8 commits intojoomla:4.0-devfrom
Fedik:jevents1

Conversation

@Fedik
Copy link
Copy Markdown
Member

@Fedik Fedik commented Nov 25, 2017

Summary of Changes

As part of #16016
this pull add support of custom event joomla:updated to showon, templates, switcher, color field, tinymce

Testing Instructions

for testing can use next XML

<field name="subform" type="subform" multiple="true" label="subform">
	<form>
		<field type="text" name="text" label="text"/>

		<field type="radio" name="radio" label="radio" class="switcher" default="0">
			<option value="0">JNO</option>
			<option value="1">JYES</option>
		</field>

		<field name="color" type="color" label="color" control="simple"/>
		<field name="coloradv" type="color" label="color adv"/>

		<field name="type" type="list" default="0" label="Type" >
			<option value="0">Small</option>
			<option value="1">Medium</option>
			<option value="2">Large</option>
		</field>

		<field name="something"  type="text"
			   label="Show when Type=Large" showon="type:2" />

		<field name="editor" type="editor" label="editor" buttons="false"/>
	</form>
</field>

Expected result

All fields should work

Documentation Changes Required

nope

ping @DGT41 @wilsonge

@wilsonge
Copy link
Copy Markdown
Contributor

Can you fix conflicts please?

Conflicts:
	administrator/templates/atum/js/template.js
@Fedik
Copy link
Copy Markdown
Member Author

Fedik commented Nov 27, 2017

@wilsonge done

*/

(function() {
!(function(document) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the ! for here? or is this a bug?

Copy link
Copy Markdown
Member

@C-Lodder C-Lodder Nov 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as the function is already invoked. @Fedik aren't you thinking of ; (semicolon)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

! or ; is just a different "style",
@wilsonge no it not a bug, but it need to prevent a bugs, for case when file will be merged in single one.
Example file1js has:

function doStuff (blabla) {

}

and switcher.js:

(function() {
...
})();

after merging we get:

function doStuff (blabla) {

}
(function() {
... switcher code
})();

after merging while parsing the "switcher" function WILL execute doStuff method from previous file, and pass a null to blabla variable.

! or ; will prevent this:

function doStuff (blabla) {

}
!(function() {
... switcher code
})();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants