? ? Pending

User tests: Successful: Unsuccessful:

avatar dgt41
dgt41
23 Apr 2017

Pull Request for Issue #15251

Summary of Changes

Minor changes to the calendar script that allow reinitialising the calendar

Testing Instructions

Apply this patch
Go to Administrator and edit an existing article.
Open the browser inspector and inspect the button of the Start Publishing field.
Then change data-show-others="1" to "0"
Then run this in the browser's console:

JoomlaCalendar.init(document.querySelector('.field-calendar'));

the cal should reinitialise, to confirm open it again you should see the table without the days for prev/next month

Alternative test method (only js, also a hint how to do this client side):
Apply this patch
Go to Administrator and edit an existing article.
Open the browser console and copy/paste the following commands

document.getElementById('jform_publish_up_btn').setAttribute('data-show-others', 0);
JoomlaCalendar.init(document.querySelector('.field-calendar'));

the cal should reinitialise, to confirm open it again you should see the table without the days for prev/next month

Expected result

Actual result

Documentation Changes Required

avatar dgt41 dgt41 - open - 23 Apr 2017
avatar dgt41 dgt41 - change - 23 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Apr 2017
Category JavaScript
avatar zero-24 zero-24 - change - 23 Apr 2017
The description was changed
avatar zero-24 zero-24 - edited - 23 Apr 2017
avatar dgt41 dgt41 - change - 23 Apr 2017
The description was changed
avatar dgt41 dgt41 - edited - 23 Apr 2017
avatar zero-24
zero-24 - comment - 23 Apr 2017

The drone error has nothing to do with this change I'm going to send a new PR for this. Thanks @dgt41

avatar zero-24 zero-24 - change - 23 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Apr 2017
Category JavaScript JavaScript Unit Tests
avatar chmst
chmst - comment - 23 Apr 2017

I've tested this patch following the instruction above. And it works as decribed.
But as much as I see, it does not resolve the issue. The calendars in our programs are not reinizialised. So please let me know what we have to change in our programs.

avatar chmst
chmst - comment - 23 Apr 2017

After changing the code, the calendar is initialised. But ina format which is not expected.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15487.
avatar dgt41
dgt41 - comment - 23 Apr 2017

@chmst let's say that ajax success returns a date, all you have to do is set the appropriate attribute and initialise the calendar again. A dummy code (using jQuery):

/** For value we target the input **/
var newDate = "2010-01-01 00:00:00"; /** This comes from AJAX request **/

/** For calendar attributes we target the input id + `_btn` **/
jQuery('#'jform_publish_up_btn').attr('data-show-others', 0);

/** The field node **/
$field = jQuery('#jform_publish_up');
/** The calendar node **/
$calElement = $field.parent('.field-calendar');

/** Resetting attributes **/
$field.val(newDate);
$field.data('alt-value', newDate);

/** Reinitialise **/
JoomlaCalendar.init($calElement[0]); /** $calElement[0] will return the vanilla node!!! **/

Is this any helpful? If something still unclear let me know

avatar richard67
richard67 - comment - 23 Apr 2017

Since the original issue #15251 had the release blocker label, shouldn't this PR also have that?

avatar dgt41
dgt41 - comment - 23 Apr 2017

@chmst what properties/values are you resetting with your code?

avatar bembelimen
bembelimen - comment - 23 Apr 2017

The test case is still very easy:

Ajax request => call: #15251 (comment)

In 3.6 the calender works, in 3.7 not...

avatar dgt41
dgt41 - comment - 23 Apr 2017
avatar bembelimen
bembelimen - comment - 23 Apr 2017

It's still not B/C, wrong date format etc.

avatar rdeutz
rdeutz - comment - 23 Apr 2017

To be crystal clear here, I am happy if we find a way to handle the problem but I will not delay the release for this problem.

avatar chmst
chmst - comment - 23 Apr 2017

You are the boss ;) It works for me after I've adapted my programs for setting attributes in JHtml and replacing the calendar setup in js.
So for me the patch is successfull but the issue (b/c break) is a fact.

avatar rdeutz rdeutz - change - 23 Apr 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-04-23 14:33:16
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 23 Apr 2017
avatar rdeutz rdeutz - merge - 23 Apr 2017
avatar rdeutz
rdeutz - comment - 23 Apr 2017

@chmst good that you found a way to solve the issue. :-)

avatar zero-24
zero-24 - comment - 23 Apr 2017

I'm going to create a FAQ page based on the infos above when i'm back at home. Thanks for the work here!

avatar chmst
chmst - comment - 23 Apr 2017

Thanks to all - I am saved :)

avatar bembelimen
bembelimen - comment - 23 Apr 2017

So will the original issue reopened again? Because the b/c is still not fixed...

avatar dgt41
dgt41 - comment - 23 Apr 2017

@bembelimen don't worry, I'm creating a PR that will cover the B/C break here, gimme 5 mins

avatar dgt41
dgt41 - comment - 23 Apr 2017

@bembelimen please test #15489

Add a Comment

Login with GitHub to post a comment