Skip to content

Conversation

@dgrammatiko
Copy link
Contributor

@dgrammatiko dgrammatiko commented Jun 11, 2016

This fixes a B/C for form field user

Summary of Changes

Introduce an option that will provide the needed backwards compatibility.

Testing Instructions

Apply patch

  • Bootstrap mode
    Test creating a new article and ensure that the field for selecting a user still works.
  • Mixed mode
    Edit administrator/components/com_content/views/article/tmpl/edit.php
    and paste the code bellow after line 81 (just before ?>)
JHtml::_('behavior.modal');

$idTag = 'jform_name';

$test_control[] = '<input type="text" disabled id="' .$idTag . '_id" name="' . $idTag . '" value="" style="display: block"/>';

$test_control[] = '<a class="modal btn" title="XXXXX" href="index.php?option=com_users&amp;view=users&amp;layout=modal&amp;tmpl=component&amp;required=1&amp;field=jform_name"'
    . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">SELECT MOOTOOLS</a>';

echo implode('', $test_control);

Test again the previous scenario as well as the new button that will appear above the tabs (that's a mootools modal). The field should be filled with the user id selected in the pop up

  • Compatibility Mode (AKA Mootools)
    Keep the changes in edit.php
    Rename administrator/templates/isis/html/layouts/joomla/form/field/user.php to xxxuser.php
    Repeat the previous testing steps

@dgrammatiko dgrammatiko changed the title Bootstrap popup with motors compatibility #2 Bootstrap popup with mootools compatibility #2 Jun 11, 2016
@dgrammatiko
Copy link
Contributor Author

@Fedik can you review this one as well?

@Fedik
Copy link
Member

Fedik commented Jun 12, 2016

@DGT41 to be honest I am not very understand what is going on here 😄 but I try some test, maybe this evening

<td>
<a class="pointer button-select" href="#" data-user-value="<?php echo $item->id; ?>" data-user-name="<?php echo $this->escape($item->name); ?>"
data-user-field="<?php echo $this->escape($field);?>" onclick="if (window.parent) window.parent.jSelectUser(this);">
data-user-field="<?php echo $this->escape($field);?>" <?php if ($isMoo) : ?>onclick="<?php echo $onClick; ?>"<?php endif; ?>>
Copy link
Contributor Author

@dgrammatiko dgrammatiko Jun 12, 2016

Choose a reason for hiding this comment

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

@Fedik onclick event isn't required for bootstrapped version, using the trick to pass a parameter to signify that the modal is bootstrapped we bring B/C even if there are mootools and bootstraped versions of the field in the same page.
Fast forward when joomla will completely remove mootools this parameter even if it exists will be ignored, so also future proof 😉

@Fedik
Copy link
Member

Fedik commented Jun 12, 2016

I have tested this item ✅ successfully on 4953c0c


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

@cyrez
Copy link
Contributor

cyrez commented Jun 12, 2016

In compatibility mode (with override removed from Isis, and so in mootools modal) the no-user is broken (but it was a "not" visible issue before excepted when tested B/C after layout removal).
I fix this here : https://github.com/joomla/joomla-cms/pull/10772/files#diff-8369fe928ed3e29986d8f380ed245ef2R52 (missing window.parent.jSelectUser(this) on click for no user button)

Another issue (but was there before, so not due to your PR, but could be fixed in the same time) : in all testing cases, if you select no user, you will have the text "Select a user." as the field user name value, where it should be just a placeholder.
But this needs i think, to add this in fielduser.js to set placeholder, and set name as empty.

About your code, after tests all seems good! 👍

@joomla-cms-bot
Copy link

This PR has received new commits.

CC: @Fedik


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

@dgrammatiko
Copy link
Contributor Author

@JoomliC I've fixed the No-User button

@cyrez
Copy link
Contributor

cyrez commented Jun 13, 2016

@DGT41 Confirm that no user button is fixed. 👍
What about the field name value on "no user" click ? To have a placeholder instead ?

@joomla-cms-bot
Copy link

This PR has received new commits.

CC: @Fedik


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

@rahultailored
Copy link

I have tested this item ✅ successfully on a337e9b

Tested Successfully in Joomla! 3.6.0-rc.


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

@gautamtailored
Copy link

I have tested this item ✅ successfully on a337e9b

Successfully Tested.


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

@gunjanpatel
Copy link
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 1, 2016
@roland-d roland-d added this to the Joomla 3.6.1 milestone Jul 16, 2016
@roland-d roland-d merged commit 6629c44 into joomla:staging Jul 16, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 16, 2016
@dgrammatiko dgrammatiko deleted the userField branch October 11, 2016 11:34
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.

8 participants