[RFC|Merged] AJAX
- nickvergessen
- Former Team Member
- Posts: 733
- Joined: Sun Oct 07, 2007 11:54 am
- Location: Stuttgart, Germany
- Contact:
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] AJAX
Couple more things to be AJAXified:
- Voting in polls
- Adding / removing PM recipients
- Voting in polls
- Adding / removing PM recipients
Re: [RFC] AJAX
I suggest changing phpBB/assets/javascript/core.js to be a jQuery plugin. It would make it easier to implement into new areas. You are introducing another "framework" that people will have to figure out when most are already familiar with jQuery. So instead of this
it would be this
Then the plugin would loop through each item and grab all of the data needed from the data attributes.
Code: Select all
$('[data-ajax]').each(function() {
var fn = ($(this).data('ajax') !== 'true') ? $(this).data('ajax') : null;
phpbb.ajaxify({selector: this}, $(this).data('refresh') !== undefined, fn);
});
Code: Select all
$('[data-ajax]').ajaxify();
Eric
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] AJAX
"<wGEric> IMO it would simplify things for mod authors"
In 99% of cases, they just have to use the data-ajax attribute on their element, and everything will be done for them. In the other 1% (where exceptions are required), the code you specified wouldn't work anyway.
I don't think this should be a jQuery plugin, as it isn't really related to jQuery. I do think that the alerts and parse_querystring should be jQuery plugins, but Oleg wouldn't let me
In 99% of cases, they just have to use the data-ajax attribute on their element, and everything will be done for them. In the other 1% (where exceptions are required), the code you specified wouldn't work anyway.
I don't think this should be a jQuery plugin, as it isn't really related to jQuery. I do think that the alerts and parse_querystring should be jQuery plugins, but Oleg wouldn't let me
Re: [RFC] AJAX
Explain? He probably brought up an argument against it, and didn't just "not let you".callumacrae wrote:I do think that the alerts and parse_querystring should be jQuery plugins, but Oleg wouldn't let me
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] AJAX
https://github.com/phpbb/phpbb3/pull/336#r98092naderman wrote:Explain? He probably brought up an argument against it, and didn't just "not let you".callumacrae wrote:I do think that the alerts and parse_querystring should be jQuery plugins, but Oleg wouldn't let me
Re: [RFC] AJAX
I still have reservations about the giant switch statement over the entire phpbb ui. Surely this can't be the best way of doing anything, although I have not spent enough time thinking about it to propose an alternative.
Were translations-related concerns addressed?
Were translations-related concerns addressed?
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] AJAX
What do you mean by the giant switch statement?Oleg wrote:I still have reservations about the giant switch statement over the entire phpbb ui. Surely this can't be the best way of doing anything, although I have not spent enough time thinking about it to propose an alternative.
Lack of translation abilities have been worked around, yes.Oleg wrote:Were translations-related concerns addressed?
Re: [RFC] AJAX
https://github.com/callumacrae/phpbb3/b ... le/ajax.js would be an example.callumacrae wrote: What do you mean by the giant switch statement?
How?callumacrae wrote: Lack of translation abilities have been worked around, yes.
I must say I would have preferred having documentation and explanations of changes instead of having to figure that out the hard way. After multiple hours spent reading the diff I'm starting to see what it is doing. I do expect all points that I requested to be documented be documented.
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] AJAX
That's a horrible piece of code, but there is no way around it without rewriting the buttons / removing support for users with js disabled. I still don't understand what you mean by giant switch statement.Oleg wrote:https://github.com/callumacrae/phpbb3/b ... le/ajax.js would be an example.callumacrae wrote: What do you mean by the giant switch statement?
The language entries are stored in data attributes. What specifically don't you understand?Oleg wrote:How?callumacrae wrote: Lack of translation abilities have been worked around, yes.
I must say I would have preferred having documentation and explanations of changes instead of having to figure that out the hard way. After multiple hours spent reading the diff I'm starting to see what it is doing. I do expect all points that I requested to be documented be documented.