? ? Pending

User tests: Successful: Unsuccessful:

avatar NunoLopes96
NunoLopes96
14 Apr 2017

Summary of Changes

Replace the JS alert() for the Joomla alerts in standart buttons where are no boxes checked

Testing Instructions

Go Components -> Banners -> Banners

Without any box checked, hit publish item

Expected result

screenshot from 2017-04-14 22-40-40

Also, I think the close button is white because the class is not completed, here is where the class is called:
https://github.com/joomla/joomla-cms/blob/4.0-dev/media/system/js/core.js#L333

Actual result

screenshot from 2017-04-14 22-43-52

Documentation Changes Required

none

avatar NunoLopes96 NunoLopes96 - open - 14 Apr 2017
avatar NunoLopes96 NunoLopes96 - change - 14 Apr 2017
Status New Pending
avatar NunoLopes96 NunoLopes96 - edited - 14 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 14 Apr 2017
Category Libraries
avatar zero-24
zero-24 - comment - 14 Apr 2017
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/cms/pagination/JPaginationTest.php:749
5) JToolbarButtonTest::testRender
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
 '
-<button onclick="if (document.adminForm.boxchecked.value == 0) { alert(Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')); } else { Joomla.submitbutton(''); }" class="btn btn-sm btn-outline-primary">
+<button onclick="if (document.adminForm.boxchecked.value == 0) { Joomla.renderMessages({'warning': ['JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST', '<h4>Warning</h4>']}) } else { Joomla.submitbutton(''); }" class="btn btn-sm btn-outline-primary">
 	<span class="icon-test"></span>
 	</button>
 '

https://travis-ci.org/joomla/joomla-cms/jobs/222232149

Looks good to me ? and is working well. Can you fix the travis error above. The other ones are not realted to your PR. I'm going to open a new issue for that.

avatar NunoLopes96 NunoLopes96 - change - 14 Apr 2017
Title
replace js alerts for joomla alerts
[4.0] Replace js alerts for joomla alerts
Labels Added: ?
avatar C-Lodder
C-Lodder - comment - 15 Apr 2017

@NunoLopes96 - that last commit you just made in incorrect. This is PHP, not JS ;)

avatar zero-24
zero-24 - comment - 15 Apr 2017

@NunoLopes96 in Order to fix the test you need to edit the test itself your code was correct before the last commit ;)

avatar NunoLopes96
NunoLopes96 - comment - 15 Apr 2017

Ok I'm sorry never used travis before I need to research first a little bit, any tip?

avatar zero-24
zero-24 - comment - 15 Apr 2017

@NunoLopes96 please check this file + line in your branch: https://github.com/NunoLopes96/joomla-cms/blob/replaceJSalerts/tests/unit/suites/libraries/cms/toolbar/JToolbarButtonTest.php#L126

There is the expeced value stored. So this value needs to be changed as we want to change the output.

avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2017
Category Libraries Libraries Unit Tests
avatar NunoLopes96 NunoLopes96 - change - 15 Apr 2017
Labels Added: ?
avatar NunoLopes96
NunoLopes96 - comment - 15 Apr 2017

@zero-24 I just changed that, that error no longer appears on travis, thank you for the help

avatar jreys jreys - test_item - 15 Apr 2017 - Tested successfully
avatar jreys
jreys - comment - 15 Apr 2017

I have tested this item successfully on 746f8d1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15315.

avatar rjcf18 rjcf18 - test_item - 15 Apr 2017 - Tested successfully
avatar rjcf18
rjcf18 - comment - 15 Apr 2017

I have tested this item successfully on 746f8d1

The Joomla alert appears normally after clicking publish item with no item selected after the patch.

Before patch:

deepinscreenshot20170415025640

After patch:

deepinscreenshot20170415025216


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15315.
avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Apr 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Apr 2017

RTC after two successful tests.

avatar joomdonation
joomdonation - comment - 15 Apr 2017

Please remove RTC label. You cannot simply change JText::script to JText::_ as look like JText::script has some code to deal with special character in string

For example, with this change, you can edit the file , change administrator\language\en-GB\en-GB.lib_joomla.ini, change the language item

JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST="Please first ' make a selection from the list."

To:

JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST="Please first ' make a selection from the list."

You will get javascript error. Note that the original code works well with this special character in language string

avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Apr 2017
Status Ready to Commit Pending
avatar dgt41
dgt41 - comment - 15 Apr 2017

I am against this.
There should not be any inline scripts in J4 in order to satisfy CSP requirements.
So we have to create a toolbar.js file with the logic needed and then pass form the PHP side the config options, e.g. JFactory->getDocument()->addScriptOptions('Toolbar', $optionsArray).

Please DO NO MERGE this!
It's not the right approach!

avatar brianteeman
brianteeman - comment - 15 Apr 2017

CSP?

On 15 Apr 2017 11:06 a.m., "Dimitri Grammatikogianni" <
notifications@github.com> wrote:

I am against this.
There should not be any inline scripts in J4 in order to satisfy CSP
requirements.
So we have to create a toolbar.js file with the logic needed and then pass
form the PHP side the config options, e.g.
JFactory->getDocument()->addScriptOptions('Toolbar',
$optionsArray).

Please DO NO MERGE this!
It's not the right approach!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#15315 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8W1W4nie8QvQ5Ds6PfUC2CeddN1Tks5rwJa9gaJpZM4M-JnG
.

avatar brianteeman
brianteeman - comment - 15 Apr 2017

Thanks. I understand exactly your comment now. However you can have a CSP
that allows inline scripts.

On 15 Apr 2017 12:57 p.m., "Dimitri Grammatikogianni" <
notifications@github.com> wrote:

CSP: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#15315 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8XURxb3k_eU8vsjknQhSYWEeMwo-ks5rwLDCgaJpZM4M-JnG
.

avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2017
Category Libraries Unit Tests Administration Language & Strings Libraries Unit Tests
avatar NunoLopes96
NunoLopes96 - comment - 15 Apr 2017

Replace the JText::_ for JText::script and while doing that found that when adding the JText::script('WARNING'); appeared 2x Warning, so I removed the text with <h4> tags and now the title is higher:

Actual:
screenshot from 2017-04-15 14-01-19

Before:
screenshot from 2017-04-14 22-14-55

avatar NunoLopes96 NunoLopes96 - change - 15 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2017
Category Libraries Unit Tests Administration Language & Strings Libraries Unit Tests
avatar NunoLopes96
NunoLopes96 - comment - 15 Apr 2017

Sorry, done

avatar wilsonge wilsonge - change - 15 Apr 2017
Labels Removed: ?
avatar wilsonge wilsonge - change - 15 Apr 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-04-15 20:26:00
Closed_By wilsonge
avatar wilsonge wilsonge - close - 15 Apr 2017
avatar wilsonge wilsonge - merge - 15 Apr 2017
avatar wilsonge
wilsonge - comment - 15 Apr 2017

Merged - thanks :)

Add a Comment

Login with GitHub to post a comment