Keyword

Frontend Edit in modal from menu

More
9 years 3 months ago #144830 by Ella
Frontend Edit in modal from menu was created by Ella
When I create a new menu item for adding items via the front end (K2 > Item Edit Form) the menu link opens in a new "window without navigation" instead of in a modal box.
The problem with this is that there is a JS error in my dev console because the k2.js thinks that the form is in a modal:
Uncaught TypeError: Cannot read property 'removeEvents' of null (k2.js line 464)

This JS error is causing the Close button on the form to not work.

If I use add an item from a category page ("Add new item in this category") the form opens in a modal and all is well.

How can I get an add item form opened from a menu item to appear in a modal in the same way?

Thanks!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #144843 by Krikor Boghossian
Replied by Krikor Boghossian on topic Frontend Edit in modal from menu
Hello,

There are a couple of solutions.
a) Install the dev version from here: getk2.org/assets/get/
b) Use a mod_k2_user module which has the same link in a modal.
You can publish this module with a registered access level so only logged in users can see it.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 months ago #144855 by Ella
Replied by Ella on topic Frontend Edit in modal from menu
Thanks,
It works from the user module!

I needed a bit more flexibility in terms of menus though, so (in case this helps anyone else) I ended up overriding the default_component.php template file in mod_menu to make sure the itemform link opens in a modal instead of a new window.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #144867 by Krikor Boghossian
Replied by Krikor Boghossian on topic Frontend Edit in modal from menu
You can either install the dev version or look at this file: github.com/joomlaworks/k2/blob/master/media/k2/assets/js/k2.js

Copy the contents of this file over the file on the same location on your site (media/k2/assets/js/k2.js).

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum