Skip to content

JFormFieldUser broken since 3.5.0#9659

Merged
rdeutz merged 2 commits intojoomla:stagingfrom
dgrammatiko:UserField
Apr 12, 2016
Merged

JFormFieldUser broken since 3.5.0#9659
rdeutz merged 2 commits intojoomla:stagingfrom
dgrammatiko:UserField

Conversation

@dgrammatiko
Copy link
Copy Markdown
Contributor

Pull Request for Issue #9593 .

Summary of Changes

mootools modal needs the field id

Testing Instructions

Switch to the Hathor template. I know it's out of date and never updated, but it serves this point for now. Go to Content > Articles > Add New Article. Click on the User icon next to the Created By field. The Modal window shows up (it should be based on MooTools). Click on any user in there and nothing happens.
Apply patch redo. Also check that isis still works as expected

Kudos to @OctavianC for finding and proposing the solution

@RonakParmar
Copy link
Copy Markdown

I have followed above steps and not able to reproduce this issue.
Here is my system information:

Joomla! Version: Joomla! 3.4.8 Stable [ Ember ] 24-December-2015 19:30 GMT
Joomla! Platform Version: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
PHP Version: 5.4.45-3+deb.sury.org~precise+1
System Linux desktop


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

@OctavianC
Copy link
Copy Markdown
Contributor

I appreciate you for stepping in @DGT41 :)
However, since the fielduser.js file only injects the click event when the Bootstrap Modal is loaded, there's also a need to modify administrator/components/com_users/views/users/tmpl/modal.php and add:

onclick="if (window.parent && window.parent.jSelectUser) window.parent.jSelectUser(this);"

Wherever the following is encountered:

data-user-field="<?php echo $this->escape($field);?>"

This makes setValue() somehow redundant:

// set the value
$.fieldUser.prototype.setValue = function(value, name) {
    this.$input.val(value).trigger('change');
    this.$inputName.val(name || value).trigger('change');
};

... since the onclick HTML attribute will trigger as well. I can see an isolated issue where jModalClose() is not defined and would make jSelectUser() throw an error. Perhaps changing this:

// handle value select
content.on('click', '.button-select', function(){
    self.setValue($(this).data('user-value'), $(this).data('user-name'));
    self.modalClose();
    $('body').removeClass('modal-open');
});

... to also remove the HTML attribute would solve it when using Bootstrap Modals?

$(this).removeAttr('onclick');

@mikeveeckmans
Copy link
Copy Markdown

I have tested this item ✅ successfully on 0fe32ce

TEST OK

but please never make me use Hathor again :-P


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

@brianteeman
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 0fe32ce


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

@brianteeman
Copy link
Copy Markdown
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 31, 2016
@brianteeman brianteeman added this to the Joomla 3.5.2 milestone Mar 31, 2016
@OctavianC
Copy link
Copy Markdown
Contributor

hathor has template overrides for administrator/components/com_users/views/users/tmpl/modal.php (here: https://github.com/joomla/joomla-cms/blob/staging/administrator/templates/hathor/html/com_users/users/modal.php#L66) which calls if (window.parent) window.parent.jSelectUser(this);. If you use any other template, the Modal will fail even after applying this patch.

@brianteeman
Copy link
Copy Markdown
Contributor

I thought about that when I was testing and was able to select the user in
com_content before and after the patch when using isis

On 31 March 2016 at 09:54, Octavian Cinciu notifications@github.com wrote:

hathor has template overrides for
administrator/components/com_users/views/users/tmpl/modal.php (here:
https://github.com/joomla/joomla-cms/blob/staging/administrator/templates/hathor/html/com_users/users/modal.php#L66)
which calls if (window.parent) window.parent.jSelectUser(this);. If you
use any other template, the Modal will fail even after applying this patch.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#9659 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@OctavianC
Copy link
Copy Markdown
Contributor

Isis has layout overrides - fielduser.js takes into account only Bootstrap 2 Modals. Any other Modals (MooTools) and the onclick event won't be triggered. If you'll be using another administrator template (unlikely, but why are we supporting templates if they don't work then?) without a template override for modal.php clicking on a user won't do anything.

Without my proposed changes above this won't be fixed entirely, it will only be fixed for hathor.

@brianteeman
Copy link
Copy Markdown
Contributor

Removed RTC


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

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 31, 2016
@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @brianteeman, @mikeveeckmans


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

@brianteeman brianteeman changed the title Fix for issue #9593 JFormFieldUser broken since 3.5.0 Apr 2, 2016
@mikeveeckmans
Copy link
Copy Markdown

I have tested this item ✅ successfully on d6a8353

TEST OK


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

@OctavianC
Copy link
Copy Markdown
Contributor

Tested successfully:

@brianteeman
Copy link
Copy Markdown
Contributor

Set back to RTc - thanks everyone


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 4, 2016
@rdeutz rdeutz merged commit c8c2d20 into joomla:staging Apr 12, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 12, 2016
@rdeutz rdeutz modified the milestones: Joomla 3.5.2, Joomla! 3.6.0 May 1, 2016
@dgrammatiko dgrammatiko deleted the UserField branch May 4, 2016 16:22
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.

7 participants