My-Little-Forum / mylittleforum

A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)
GNU General Public License v3.0
124 stars 48 forks source link

Replace the popups with HTML-templates #760

Open auge8472 opened 5 days ago

auge8472 commented 5 days ago

As first there are two JavaScript-popup pages within MLF. First one is for setting a users own avatar image and the second is for uploading an image to the forum and for selecting previously uploaded images for inclusion in a form entry.

Secondly there are several elements, that are dynamically inserted into a page with JavaScript as overlays. Most of them are part of the posting form, one is the posting preview in the thread overview pages and one the zooming view of images in postings, which are inserted in the postings as preview thumbnails.

The members of the last group, I want to mention, are helper templates with not much own content, that are loaded to make a click on a button to decide something (i.e. flagging as ham, moving a posting and so on). Those have to remain for managing something without access to JavaScript but they should IMHO be supplemented by similarly functioning elements within the page called up. When JavaScript is accessible, create the page internal elements, if not, load the classical template.

IMHO all of these cases can be implemented with HTML-templates (UI side) and with calling the existing processing PHP-code on the server (with possibly necessary adaptions). By inserting the HTML-templates with PHP where they are needed and by inserting them as they are into the DOM of the document in the browser with JavaScript it would be easier to change them if necessary or wanted because one can alter the HTML source code of the template without the need to alter anything in the JavaScript code as long as the selectors for finding the code with JavaScript remains untouched.

The saving of round trips between browser and server would be an additional advantage.

This is a followup for #756.