Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Mikie last won the day on December 6 2018

Mikie had the most liked content!

Community Reputation

88 Excellent

About Mikie

  • Rank
    Full Member

Profile Information

  • Gender
  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Mikie

    HTTP/2 Push

    Above is off topic sorry, I was getting push confused with the http/2 functionality of all resources getting sent async in a single connection (which does happen out the box). Yes, push is confusing and it seems there are no real standards or guidance on how to use it. I feel it is pretty extreme optimisation since after first load things are cached anyway. What would be a candidate for push in PW Admin, assets from unloaded modules or image previews or something?
  2. Mikie

    HTTP/2 Push

    This is all dependent on the server, nothing to do with php as far as I know. If the cache headers are there (which they are for PW admin assets) then it should just work out of the box. See below for one of my sites, all assets h2 brotli encoded and server from browser cache:
  3. Mikie

    HTTP/2 Push

    http/2 + brotil 👌🏻. I use runcloud for clients and now apnscp panel for my server, and both do h2 + br out of the box. I still bundle everything tho since not doing so would involve not using any build system which seem crazy to me, plus after first load things should be cached by the browser so it makes no difference whatsoever after that. Realistically images take up much more space and IMO focus should be given to optimising them as much as possible.
  4. Is there any way to get the $page->_pageTableParent in the admin? It's set by FieldtypePageTable::wakeupValue and is available on the frontend for pages created by a PageTable field.
  5. If anyone hasn't seen it, https://www.11ty.io is pretty amazing for static sites, it gets a lot of things right in my opinion. Much less opinionated than other static generators, allows swapping template languages on the fly throughout or on a page by page basis, and the systems for page data are super powerful and flexible. I just build a startup marketing site with it, a few of the cool things I did were: read filesystem and parse image files to create a globally accessible images object with width, height, ratio data for use with mixins to ouput lazyload containers; parse a csv file to build a really complicated pricing table... no more client requests to change wording on x row, they just edit a google doc I set up for them, I download and drop in the assets folder, rebuild and done!
  6. Thanks @LostKobrakai, this is great, exactly what I needed! Just posting a note anyone else using in modern times, I had problems with this inside a matrix repeater with dynamic content. The version of image-picker from 2016 has this line. Straight jquery click doesn't handle event delegation, so for dynamic content you need to use on( "click", ...). The latest version of image-picker fixes this and swapping out the files in the download linked by LostKobrakai above works fine. https://github.com/rvera/image-picker/releases
  7. Thanks @psy yeah I know about those, it was more an editing workflow thing. Client has 50 + images in a gallery, flagged they were being added to the end not the start. I didnt realise they were using the filesystem select and not just drag dropping onto the field. Having said this, it's interesting that those two workflows for adding images function differently.
  8. Hey, I've tried a search but couldn't find anything about this precisely. Is there any explicit setting to add images to the start of an image field rather than the end on upload? I'm assuming I'll need to figure this out with hooks. Please ignore. Noob mistake asking a question from a client, they weren't drag dropping and I had a brain spasm.
  9. Cool. Just an FYI in case you aren't aware... modules can create and remove admin pages on install / uninstall, which is where that ajax url would live.
  10. Hi, @jploch . Can you explain the workflow, or maybe do a diagram. What I think you want is: - Admin interface uses gridstack.js - In this context (ie your module building on PageTableExtended), each item in the grid contains the child page preview, and the page that is being previewed is where the data for gridstack.js is stored / set If you want to save the data after dragging / resizing an element, I'd probably leverage events from the api here https://github.com/gridstack/gridstack.js/tree/develop/doc and set the data via ajax. To do that you just need an endpoint to send the data to, eg /pw/setgriddata/. Below code is not tested, just an example as I haven't used gridstack.. In the module js file: $('.grid-stack').on('gsresizestop', function(event, elem) { var $elem = $(elem); var data = { width: $elem.data('gs-width'); height: $elem.data('gs-height'); x: $elem.data('gs-x'); y: $elem.data('gs-y'); id: $elem.data('id'); } $.ajax({ url: "/pw/setgriddata/", data: data, }).done(function( msg ) { console.log( msg); }); }); At /pw/setgriddata/: if ($config->ajax && $input->post) { if ($p = $pages->get("id={$input->post->id}") { $p->data_gs_width = $input->post->width; // etc $p->save(); return "Updated page: " . $p->title; } else { return "Could not find page: " . $input->post->id; } } You probably don't want to do this on all resizes however. If you want to do it on page save, again I would probably use gridstack events to populate the input fields you are rendering. Again, very quick... $('.grid-stack').on('gsresizestop', function(event, elem) { var $elem = $(elem); $elem->find(".grid-stack-input#data-gs-width")->val($elem.data("gs-width")); // etc });
  11. Hi @jploch, not sure exactly what you are doing, but can't you have hidden fields either on the main template or sub-templates inside the PageTable that you save data to on a hook?
  12. Ok, figured it out partly, don't need to change the $parsedTemplate->page->render() call in PageTableExtended since that has lots of sideffects. Just need to capture and return the twig output like so: if($options['pageTableExtended']) { $factory = $modules->get('TemplateEngineFactory'); $out = $factory->render("content-gallery", ["p" => $page]); echo $out; } Now I am having trouble using twig filters / php functions in this context, but I believe that is more a TemplateEngineFactory / TemplateEngineTwig issue.
  13. Hi. This module looks really promising for a current job, didn't know about it til now. Does anyone have it working with TemplateEngineFactory / TemplateEngineTwig v2? Eg if a template to be rendered in the admin does either of the below: if($options['pageTableExtended']){ $factory = $modules->get('TemplateEngineFactory'); $controller = $factory->controller('controllers/content-gallery.php', 'content-gallery.html.twig'); $controller->execute(); } if($options['pageTableExtended']) { $factory = $modules->get('TemplateEngineFactory'); $factory->render("content-gallery"); } Only way I can get output in the admin is to change the render method in this this line from: $parsedTemplate->render() to: $parsedTemplate->page->render() Does this make sense, or should i try to hook TemplateFile::render with TemplateEngineFactory for this use case?
  14. I double posted somehow. Sorry! Please delete this one.
  15. Hey, would also love this. More links below: Some other options: https://github.com/madebymany/sir-trevor-js https://github.com/vigetlabs/colonel-kurtz https://editorjs.io https://docs.slatejs.org HN discussion on this topic: https://news.ycombinator.com/item?id=19555633 WSIWYG type editor lists: https://github.com/JefMari/awesome-wysiwyg https://gist.github.com/manigandham/65543a0bc2bf7006a487 What bard is build with: https://prosemirror.net https://tiptap.scrumpy.io Maybe we could all band together and buy an enterprise license for froala to allow redistribution: https://www.froala.com/wysiwyg-editor/examples Squarespace, despite being buggy and bloated, is actually quite an amazing application and a good example of complicated layout building ui. At the very least, it would be nice to have a split pane preview mode for matrix repeater that wasn't an overlay, eg like in that bard demo.
  • Create New...