Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forced use of mootool by calling JHTMLbehavior::modal on all items views #21

Closed
nonnenmacher opened this issue Sep 9, 2013 · 7 comments

Comments

@nonnenmacher
Copy link

I'm trying to remove all links to mootools in a 2.5 version of a site.

Succeeded so far until I get into those lines in K2 Plug-in on the AfterRoute method

if ( !$user->guest || (JRequest::getCmd('option') == 'com_k2' && JRequest::getCmd('view') == 'item') || defined('K2_JOOMLA_MODAL_REQUIRED') ){
JHTML::_('behavior.modal');
}

I don't understand why, you'd force use of this mootool modal, for example on people that use other modals (NoNumber modal come to mind).

Could there be a better way to use this K2 constant K2_JOOMLA_MODAL_REQUIRED ?

In front of this if statement an create a more meaningful logic shortcut along something like 👍
if ( defined('K2_JOOMLA_MODAL_REQUIRED') && ....

note : this kinda duplicate of tickets 68 and 582 on google issues.

@kavadas
Copy link
Contributor

kavadas commented Sep 10, 2013

Hi. Unfortunately the Joomla! modal is required for front-end editing. The check that is there checks three things:

  1. If user is logged in modal is loaded since it is required for front-end editing.
  2. If we are on an item page, modal is loaded in order to open the item image in modal.
  3. If there is an extra field in page that requires the Joomla! modal ( extra fields of type link which open in lightbox for example ).

If none of the above is true, then you should not get the modal loaded in your page.

@nonnenmacher
Copy link
Author

I don't think that this logic is proper :

1- test if the user is not a guest is not sufficient, for example on a
site, where you have 'registered' user and no front-end editing. So the
test 'a user is not a guest' => it should be able to edit, is not correct
in all cases

2- if a K2 site, use bootstrap modal, or any other modal mechanism (e.g
NoNumber), then modal is handled outside. So decision to include
Behavior.modal, should be made at the template override level.

or controlled by this define flag of yours.

3- same for any lightbox image

In my case, I was able to inject bootstrap and jQuery, long before Joomla
3, but when I'm trying to get ride of mootool in the front-end, this is
quite the last remaining place where this is injected by force in this code.

I don't think that I'm alone trying this I'm the Joomla 2.5 path.

On Tue, Sep 10, 2013 at 3:29 PM, Lefteris Kavadas
notifications@github.comwrote:

Hi. Unfortunately the Joomla! modal is required for front-end editing. The
check that is there checks three things:

  1. If user is logged in modal is loaded since it is required for
    front-end editing.
  2. If we are on an item page, modal is loaded in order to open the
    item image in modal.
  3. If there is an extra field in page that requires the Joomla! modal
    ( extra fields of type link which open in lightbox for example ).

If none of the above is true, then you should not get the modal loaded in
your page.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-24159250
.

@kavadas
Copy link
Contributor

kavadas commented Sep 10, 2013

I don't disagree in total with you but there are somethings to consider:

  1. Removing the modal from the item view will make images open in the current tab. This will confuse most of the users who will come back here to post an issue. This will also happen for extra fields of type links.
  2. Not all users are familiar with JavaScript so they can add their own lightbox.

To summarize i do agree with you that we need to cut off mootools completely, but doing this now will generate a lot of confusion to the users and will make current sites look broken.

@nonnenmacher
Copy link
Author

I understand that very well
(same reason as raising the issue instead of patching the code directly and
monitor on every commit and upgrades).

Could it be possible to introduce a new constant and a logic shortcut, that
will get over this if statement for people that use explicitly this new
constant (or define) so existing code will continue to work unmodified and
people could choose to set it by any means (perhaps not even need to
escalate it to a configuration seen in the component options).

A first though the already referred constant was about that, and it is not
very documented, adding an other one… ;-)

Regards

On Tue, Sep 10, 2013 at 5:34 PM, Lefteris Kavadas
notifications@github.comwrote:

I don't disagree in total with you but there are somethings to consider:

Removing the modal from the item view will make images open in the
current tab. This will confuse most of the users who will come back here to
post an issue. This will also happen for extra fields of type links.
2.

Not all users are familiar with JavaScript so they can add their own
lightbox.

To summarize i do agree with you that we need to cut off mootools
completely, but doing this now will generate a lot of confusion to the
users and will make current sites look broken.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-24170308
.

@kavadas
Copy link
Contributor

kavadas commented Sep 11, 2013

An option in K2 paramaters is a possible solution, but this is something i cannot decide on my own. I need to talk with the rest members of the team.

@fevangelou
Copy link
Member

The Joomla modal will be removed for non editing features in K2 2.7.0 thus resolving this issue.

@nonnenmacher
Copy link
Author

would be perfect !!!!

Thanks in advance.

This issue was closed.
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

No branches or pull requests

3 participants