? ? Success

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
22 Oct 2016

Pull Request for Issue #12331.

Summary of Changes

Move the voting integration for com_content to be completely within the plugin

  • Parameters for the component config, article editor, and menu item views are all moved to the plugin and added via onContentPrepareForm
  • The controller and model tasks to save the vote are moved into the plugin to be used with com_ajax

Testing Instructions

  • With the voting plugin enabled, you should see voting parameters in all appropriate com_content screens; when disabled the parameters should be absent
  • When voting is allowed, you should be able to vote on the item as before
  • Voting responses are handled by AJAX

Documentation Changes Required

Document the removed methods from the component

TODO Items

  • Remove join for voting data from models (I started to do this and move it to onContentPrepare but this breaks the existing onContentBeforeDisplay event)
  • Wire in the AJAX submission part of this (the PHP code is done, just need to write the JavaScript to handle it)
avatar mbabker mbabker - open - 22 Oct 2016
avatar mbabker mbabker - change - 22 Oct 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Oct 2016
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 22 Oct 2016
Category Administration Components Language & Strings Front End Plugins
avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

interresting i was trying to do somewhat the same thing for a new hits plugin andrepereiradasilva#94 (not completed and not working just a PoC)

I discovered that we also need:
1. ability to add optiions to select list fields dinamycly (i made a PR for this #12392). because of the ordering select and other.
2. A way to inject columns (th and td) in the views tables so we can add columns to views with a plugin. Is this possible now?

avatar mbabker
mbabker - comment - 22 Oct 2016

A way to inject columns (th and td) in the views tables so we can add columns to views with a plugin. Is this possible now?

Hannes' wrote this JGrid class that conceivably could do it (the issue with it though is you're working more with objects than HTML in layouts).

avatar mbabker mbabker - change - 22 Oct 2016
The description was changed
avatar mbabker mbabker - edited - 22 Oct 2016
avatar joomla-cms-bot joomla-cms-bot - change - 22 Oct 2016
Labels Removed: ?
avatar mbabker
mbabker - comment - 22 Oct 2016

Query part was me messing stuff up. That's handled now. Just need to do the JavaScript.

avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

how about the view templates trigger a plugin event on the end of TH and TD draw?

something like

  • onContentDrawTableTh($context)
  • onContentDrawTableTd($context, $item)
avatar mbabker
mbabker - comment - 22 Oct 2016

Do we really want to trigger events at the end of every row? That seems very non-optimal (granted not being able to change the layouts isn't much better...).

avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

hum ... anyway i guess we need a way to solve this.
Also, i guess solving this would be nice for extension developers.

avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

this should be removed too, right? i think it's unused.

Also in 3.7.x there are some new opinions with vote that don't yet exists in 4.x branch
See here https://github.com/joomla/joomla-cms/pull/11225/files

avatar mbabker
mbabker - comment - 22 Oct 2016

That PR says to me that going this way with the integration is pretty much impossible (we lack events, rightfully so, for query manipulation in the models). The whole point of plugin behaviors is to make things optional and configurable; if we have stuff hardcoded into the component that seems like a function that can't be in a plugin.

avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

i agree, but that PR was merged in 3.7.x some new options in the XML files that this new refactor you're doing imho should also have.

avatar mbabker
mbabker - comment - 22 Oct 2016

Well, considering the 4.0 branch is based on staging and not 3.7, it's hard to include stuff that doesn't exist in the base branch ?

avatar andrepereiradasilva
andrepereiradasilva - comment - 22 Oct 2016

eheh ok them

avatar alikon
alikon - comment - 22 Oct 2016

when this PR will be completed we can look at #11225 new options as well

avatar mbabker mbabker - edited - 23 Oct 2016
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2016
The description was changed
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2016
Category Administration Components Language & Strings Front End Plugins Administration Components Language & Strings Front End JavaScript Plugins
avatar mbabker mbabker - change - 23 Oct 2016
Title
[4.0] [WIP] Restructure Voting Plugin Integration
[4.0] Restructure Voting Plugin Integration
avatar mbabker mbabker - edited - 23 Oct 2016
avatar mbabker mbabker - change - 23 Oct 2016
Title
[4.0] [WIP] Restructure Voting Plugin Integration
[4.0] Restructure Voting Plugin Integration
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2016
Labels Removed: ?
avatar mbabker
mbabker - comment - 23 Oct 2016

Did the AJAX part of this. It's now running fully. Updated issue description with all relevant data.

avatar cwps
cwps - comment - 25 Oct 2016

Hi, if its not a trouble, wouldn't it be more flexible for user if we can have an option to create a template override for this plugin?

avatar mbabker
mbabker - comment - 25 Oct 2016

That's already a feature in 3.7.

avatar piotr-cz
piotr-cz - comment - 27 Oct 2016

@cwps see #11300.

Thanks @mbabker

avatar wilsonge
wilsonge - comment - 28 Nov 2016

Can you merge in staging here Michael :)

avatar mbabker
mbabker - comment - 28 Nov 2016

I have to make time to do a merge and figure out how to deal with the added features in 3.7 that make this decoupling a much harder task.

avatar mbabker
mbabker - comment - 7 Jan 2017

Closing. This has to be rethought because of the 3.7 changes. In short, there isn't a way to decouple the plugin and component now.

avatar mbabker mbabker - change - 7 Jan 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-01-07 16:51:37
Closed_By mbabker
avatar mbabker mbabker - close - 7 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - change - 7 Jan 2017
Category Administration Components Language & Strings Front End Plugins JavaScript Administration com_content Language & Strings Front End JavaScript Plugins Components

Add a Comment

Login with GitHub to post a comment