Giter VIP home page Giter VIP logo

Comments (10)

yellowled avatar yellowled commented on June 1, 2024

Status update:

  • entryproperties is done
  • I can't test karma properly in my test installation. The part that I can test is done, but the backend doesn't display any entries, so this needs more work.
  • Almost done with statistics, but it should get equal heights. I'm not sure how to reference the JS plugin properly here – need to discuss this with @onli at some point.

from serendipity.

onli avatar onli commented on June 1, 2024

Alright. Quite a lot of commits!

from serendipity.

yellowled avatar yellowled commented on June 1, 2024

Yup. I have an “off day”, e.g. spare time.

The more I think about it, the more I think we should get rid of the need to reference JS plugins in template files altogether and have some kind of centralized, JS-based loading mechanism for them. Sort of lazy-load them in serendipity_editor.js.tpl or something.

from serendipity.

onli avatar onli commented on June 1, 2024

Sounds good. Though with the current setup, it's quite easy to have those files available in other templates. I don't have a straight plan on how to build such a centralized system, do you have a specific implementation in mind?

from serendipity.

yellowled avatar yellowled commented on June 1, 2024

I see two “issues” with including them in templates:

  • I’m not 100% sure about it, but I think even if you reference JS plugins at the end of the .tpl file, they're not always going to end up before the </body> element. I'd really like to avoid having script elements all over the content area.
  • In serendipity_event_statistics' case, there is no .tpl file (which is fine by me, I have gotten used to working in the PHP code directly, I even think I simplified some of it – which isn't that hard given its age). But in that case, I'd have to reference e.g. syncHeight from 2k11's admin template directory to make it work, which means I'd have to hard code it into the plugin's .php file. First of all, I don't think that's a good idea. Second, I wouldn't know how to do that properly. I mean, how do I even get the correct path to the .js file from there?

I see two approaches for this:

  • We could just include all the plugins in serendipity_editor.js.tpl. That's probably not too smart since it would become HUGE (probably even minified/gzipped), and the plugins are not needed in every part of the backend. Then again, it would be cached and we wouldn't have any cases of “Oh, the plugin isn't loaded here, we need to include it first”.
  • We could lazy-load the plugins with “poor man's AJAX”. This can even be combined with Modernizr's JS object to only load the plugins on specific screen resolutions. I used to have code for this in an older version of my HTML project boilerplate. However, I'm not sure about side effects here.

Open to comments or other suggestions, of course.

from serendipity.

onli avatar onli commented on June 1, 2024

I mean, how do I even get the correct path to the .js file from there?

Normally, that is not too complicated. We know exactly where it is located, so we can get the path from the template-functions, like it would be done in smarty. Like in https://github.com/s9y/Serendipity/blob/master/include/admin/plugins.inc.php#L558:

echo '<script src="' . serendipity_getTemplateFile('dragdrop.js') . '" type="text/javascript"></script>';

I'd really like to avoid having script elements all over the content area.

Alright, especially since the load-order is important. The lazy-load-option you linked doesn't seem too bad to me. But still: That would go into the serendipity_editor.js.tpl? This would make it even harder for another admin template to replace that file, if backend plugins rely on specific js-scripts being loaded there…

Another option is to use the new js-hook and emit the javascript there, but only if on the specific page. Or I could just convert it into a .tpl and we could solve it like in the normal backend, manually.

from serendipity.

yellowled avatar yellowled commented on June 1, 2024

I think this is something we should discuss later and more in detail. All “solutions” have their pros, cons and caveats. I like the idea of a new js hook. I really don't want to anyone else write/convert more .tpl files, it's fine for this way.

I guess I'll just use the code you posted above (thanks) and we'll discuss the js hook or other solutions later. It's not something we would have to have in an alpha test.

from serendipity.

onli avatar onli commented on June 1, 2024

Fine with me (just as a note: the hook already exists in 2.0), let's discuss this later.

from serendipity.

yellowled avatar yellowled commented on June 1, 2024

Funny thing: I just tried the equal heights things – doesn't work at all (visually) here. :D

The things with equal heights is that it works pretty well if the height of all boxes is approximately equal anyway, but that's not the case here. Some of the statistics boxes can get pretty high while others only have little content.

But it's still good we discussed all this because I think we really need the JS hook in the long run.

from serendipity.

yellowled avatar yellowled commented on June 1, 2024

Forgot the reference in the commit: serendipity_event_karma solved in c1c71b3. Karma plugin not emitting anything in the backend was solved previously/something which needed to be explicitly turned on in the plugin's config.

from serendipity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.