Jump to content

teppo

PW-Moderators
  • Content Count

    2,419
  • Joined

  • Last visited

  • Days Won

    64

Posts posted by teppo


  1. 9 hours ago, wbmnfktr said:

    First off all... I stumbled across this by accident and didn't follow the whole conversation... more or less... but as far as I understand the Adminbar (module) is only available to those who are logged in. So why bother with any libraries, browser extensions and such that (in most cases) only apply to those who aren't logged in?

    You're correct that AdminBar only applies to users who are logged in. There's no "guest user" when it comes to AdminBar – only superusers and users with the "adminbar" permission will see anything out of the ordinary. Regardless, since AdminBar outputs features visible on the front-end, it's very much connected with everything else happening there.

    What you're missing here is that being logged in won't disable those browser extensions or nullify the effects of third party libraries – so it's not true that those features would only apply to users who aren't logged in. As such, it's very important that admin bar is as "tolerant" as possible, so that it won't break or cause new problems if you decide to implement a new JavaScript library on your site (or enable a browser feature/plugin).

    • Like 1

  2. 29 minutes ago, d'Hinnisdaël said:

    I agree the admin link itself and the edit link should stay anchor tags. Create, browse and logout, however, aren't semantically speaking links since they potentially have side effects (create, logout) or only trigger module JS (browse).

    There is one case that will create pages by merely following a link: when a template is configured to use the »Name format for children« setting in order to skip the page-add step. In that case, a new empty page is created every time the link is opened. I use that setting on most templates, that's probably why I noticed.

    The logout could be implemented using just a form and a submit button, using the form action for the logout URL. Not sure if ProcessWire currently supports custom redirect URIs after logout or if you might have to hook into the logout process for that.

    You're right that browse isn't really a link – that's definitely one that shouldn't be represented by <a> tag 👍

    Logout is a border case: technically it can be a link, just like it is right now, but you're right that it probably shouldn't be. On the other hand even changing it to a form isn't, in my opinion, quite enough – it should also provide and validate some sort of nonce/token, just to be sure that it can't be abused. There's no redirect after logout at the moment either, so that's not a major problem. Anyway, I'll figure something out for the next minor release of the module.

    Create is one of the cases where a link usually makes sense: it should be a link to the "new page" view in Admin in case the modal mode is disabled or JavaScript is for whatever reason out of equation. That being said, I've almost never used the "name format" option, so I didn't even think of that – that behaviour is indeed problematic and needs to be addressed somehow 🙂

    29 minutes ago, d'Hinnisdaël said:

    Turbolinks in particular switches out the whole body, but the problem here is that since there's no actual reload, stylesheets and scripts stay active on the page, so you mostly need to make sure that you don't cross between frontend and backend with any of these libraries, whatever part of the HTML they switch out.

    I've found a hacky solution by canceling any AJAX page visits if the URL matches the ProcessWire admin URL, but that means the frontend code needs to have a 3rd-party backend module in mind, which feels wrong.

    It just occurred to me that my earlier explanation was flawed 😞

    If you reload, say, just the <main> element within your <body>, and Admin Bar remains as-is, the links/buttons there will point to the wrong page. As such using such plugins you probably would need to reload Admin Bar as well. I could add support for modifying target/parent IDs with JavaScript, but that would still require extra steps for the developer anyway. Also thought about using URL in this case, but that wouldn't help, as Admin Bar can't know for sure if you're using "real" URLs or some custom format (via URL segments, History API, or something else.)

    Currently I'm thinking that an option for reloading / re-rendering Admin Bar via JavaScript might actually be the best option here: in most situations the module would work right out-of-the-box, but if you do use some sort of front-end routing / transition code, you could somehow tell it to update. Not a perfect solution, so any suggestions are welcome.

    --

    By the way, if – and only if – it turns out that one/some links can't be easily switched to buttons without sacrificing something else, do you know if role="button" would help at all?

    I wouldn't use that unless I really have to (reinventing <button> with ARIA attributes is almost always just plain dumb), but this might be one of those cases where it's actually the most sensible approach – it would be an improvement in terms of accessibility, but I've no idea if it would help with preload/prefetch/etc. features 🙂


  3. Hey folks – a quick update: Wireframe 0.5.0 was released couple of days ago. Compared to 0.4.x this version mainly fixes bugs and improves performance – nothing particularly major, but if you're using Wireframe, it's a recommended update.

    On a loosely related note, Tracy Debugger has been really helpful in figuring things out, identifying bottlenecks, etc. Brilliant module 🙂

    • Like 5

  4. 13 hours ago, d'Hinnisdaël said:

    @teppo I just installed the module but noticed all links are anchor tags, which is a bit problematic since these links can be triggered involuntarily by scripts or browsers prefetches. When combined with frontend link preloaders (e.g. InstantClick) or browser prefetching (e.g. Google Chrome Page Prefetch), this results in newly-created orphan pages or mystery logouts. Is there a way the module can be updated to use buttons instead?

    Thanks for the feedback!

    Replacing <a> tags with buttons was originally on my list, but I've been pushing it back as there are some additional considerations here:

    • There are some "proper links" (such as the admin link) that should remain that way. As such, this wouldn't apply to all links automatically.
    • When the modal ("slide overlay" in module settings) mode is disabled, almost every item should be a regular link – except for browse, which technically shouldn't do anything there, as in that case it's just an indicator of your "current state".
    • Admin Bar should work regardless of JavaScript. This makes it more robust, and as such more accessible.

    That last point isn't an argument against using buttons, just something to keep in mind when making changes: everything should remain functional regardless, which could mean links by default (when JS isn't available, or working as expected) and buttons otherwise. Since default styling is now based on BEM, it should make this easier in some respects, though; technically what element is used shouldn't matter anyway.

    I don't actually see (m)any notable issues in the current behaviour. None of the built-in Admin Bar features will create any content without user actually submitting a form – and I'd be very surprised if a plugin did that on itself. The logout link is problematic though, you're absolutely right on that one – I've added this on my todo list, but not entirely sure yet how to handle it.

    I'm not familiar with Turbolinks, but the way Barba.js usually works is that you define a container, which you then switch with new content. I'm not particularly experienced in this regard, but to my best understanding you wouldn't usually define your entire <body> element as a container, and since AdminBar attempts to place itself as the last element right before </body> closing tag, normally this shouldn't be an issue – though again, this is just based on my (quite likely lacking) understanding of such libraries 🙂

    • Like 1

  5. 2 hours ago, toni said:

    In Addition, this is what a broken image looks like:
     

    
    $ cat /Users/base/Desktop/cmueller_dasstillebildverlassen4.780x0.jpg 
    
    This is intentionally invalid image data.

     

    This is how Pageimage handles errors that occur while trying to create variations. You can view the relevant parts of the code here.

    I'm not entirely sure if the error is visible while logged in as superuser, but one option would be enabling debug mode via $config->debug in /site/config.php – this way it should be saved into the image-sizer log file in /site/assets/logs/. Note that you don't want to enable debug mode if this is a live site, though. Optionally if you know when the error is going to occur, you can manually output the $img->error property after the size() call 🙂

    There are a few reasons why this can happen, so the first thing would definitely be checking that error message.


  6. Hey stanoliver!

    First of all, it's difficult to say exactly how to set this up without knowing how your site has been set up etc. but if you're looking for a simple solution, you might want to take a look at the search template in the "classic" site profile: https://github.com/processwire/processwire/blob/master/site-classic/templates/search.php. This is a very bare-bones approach, though, and as such it doesn't handle things like those highlights – but it might be a sensible starting point for your own custom feature. Just modify the fields to search from etc.

    I know you said that you'd like to achieve this without a module, but I do still think that SearchEngine would make sense here. It does quite a bit for you out of the box.

    Hope this helps a bit.


  7. 8 hours ago, tires said:

    There is a little mistake with the logo in the uikit theme.

    Could you clarify this a bit, what kind of mistake are you seeing? So far I haven't noticed anything wrong here, so it might be browser-dependent, or perhaps even site-dependent (Admin Bar is affected by site styles as well, so there's always a chance for that).

    Please let me know what browser you're using, how it behaves – and if possible, a screenshot would be really helpful too 👍

    8 hours ago, tires said:

    And the order of the elements i added to "Items displayed in the admin bar" is not adopting the right way.

    You mean when you add items via config settings? The order there doesn't actually affect the order of items in the Admin Bar – at least yet. That's something I have on my todo list, but not sure yet when I'll get to it 🙂


  8. Hey folks! Just wondering what everyone is using these days for taking notes on Mac 🙂

    I'm setting up a new laptop, and this need came up – once again. On my previous (work) laptop I used TextWrangler and stored notes as markdown files to a directory called "notes" as "YYYY-MM-DD_note-name-here.md", and on the one before that I used Evernote (not sure why but somehow that didn't feel particularly comfy). I've also tried OneNote, but overall it felt quite confusing, and perhaps a bit too "power user oriented".

    As long as I can take notes easily, store them in some sensible way (preferably ordered by date and perhaps tagged or something), and perform searches on them I'd be perfectly happy. For a while I thought I'd found the perfect solution in an app called "Bear", but turns out it's commercial, and I'd really prefer something free... though it's still on my list, in case I don't find anything better 🙂

    Any suggestions – what do you use, and why?


  9. 5 hours ago, tires said:

    My updated theme is attached.

    adminbar-tires-responsive2.png.341efdba7d2c5fcda521781b7c29f2c4.png

    tires.zip 5.15 kB · 0 downloads

    Thanks – this is now included with the latest release, 2.2.1 🙂

    I made a couple of minor adjustments: in mobile size the dropdown was positioned slightly too far down so there was a gap between the icon in the bar and the dropdown, and the "ul li > a, ul li > strong" CSS rule was changed to ".adminbar__link" in order to avoid unintentionally affecting unrelated lists on the site.

    9 hours ago, adrian said:

    Perhaps just a dropdown from the "Edit" link that says "Edit in Admin". But of course the main top-level Edit link would edit in the overlay, so no need to wait for the dropdown to appear when wanting to edit this way. ??

    I'll have to think about this a bit, not sure yet how it would fit the module. Technically this could be a relatively simple modification: the dropdown feature used for the "user" item applies to any item that has a "children" array, so one option would be adding that for the edit link. Haven't tested this yet, so not entirely sure, but that's one option at least 🙂


  10. 9 hours ago, adrian said:

    Not sure if this is a good idea or not, but what about a way to choose between edit modes from the AdminBar? Inline Edit vs Admin Edit, or something along those lines. Not sure whether they should be separate buttons, or a dropdown for the alternate (not default) method, or perhaps long-click (although this takes training users so not sure this is a good idea).🙂

    Just checking that I got this right: do you mean that while the "slide overlay" is enabled and Admin Bar links (such as edit, new, and profile) will normally open the edit view in a "modal" window, there would be some way to open the target URL without the modal instead – going to the "full" admin interface? 🙂

    If so, I can see value in this idea, but I'm not yet sure how to make that happen without messing up the simplicity of the UI or causing potentially confusing side-effects. Take long-click for an example: in my experience it's actually quite common for users to long-click or double-click things by accident (or by habit), so in my opinion (in a web based GUI) it's usually bad UX for these to lead to a different outcome vs. "regular click".

    Anyway, I'd be interested in implementing this if there's a way to do it in a sensible way. And please let me know if I've misunderstood your idea 🙂

    • Like 1

  11. Hey folks! Just released AdminBar 2.2.0. Here's what's new:

    • New module config settings for selecting items displayed in the Admin Bar.
    • New items, disabled/hidden by default: "profile" (simple profile edit link) and "user" (basically the same concept as the profile edit dropdown menu in Admin).
      • If "user" is displayed, there's a config setting for items displayed under it as well.
    • New hookable method ___getData(). The returned array is converted to an object and stored as JSON (data-adminbar) on the Admin Bar element. This was mainly added for future JS features, but can be used by themes etc. as well.
      • Hookable methods and their primary purposes are now also documented in the README.md file.
    • Quite a bit of code was rewritten – again. I've been splitting some methods to smaller ones to improve maintainability, fixing small issues, improving accessibility to some degree (still needs a lot of work though), etc. Hopefully didn't cause too many new problems in the process... 🙂

    Here's a screenshot with new items enabled, though one probably wouldn't want to enable profile and user (and all the user dropdown items) at the same time – and yes, my user name on this site is "admin", so it looks a bit silly when there's an "admin" link before and below it as well 😞

    adminbar-2-2-0.jpg.d364137b1c6a1f495bff091f0cea567a.jpg

    ---

    On 8/7/2019 at 2:42 AM, tires said:

    I added some improvements to my theme and a little responsive part too.
    Maybe you would like to add the new css to the module.

    Thanks! This will be the next item on my list 🙂

    • Like 4

  12. 41 minutes ago, adrian said:

    The reason it's not all tied to PW's debug mode is that if debug mode is on and for some reason Tracy doesn't capture the errors (unlikely/impossible I suppose), guest users may see PW/PHP error messages (not good!), so I like to have Tracy's Development mode tools (debug bar / bluescreen error stacks, etc) available for superusers even when debug mode is off on a live site.

    I hope that explains a little of my thinking, but if you are struggling with the way things are set up and would like to see changes, I am definitely willing to consider your suggestions - I haven't revisited this logic in many years!

    Thanks for the reply, @adrian. Your logic makes perfect sense to me!

    I didn't think this through: I'm not used to debugging anything on production, so it didn't even occur to me that this way one can actually use Tracy on a real production / live site. I'll have to agree that enabling debug mode on production is a bad idea – partly because something may indeed slip through to the front end, and partly because some modules etc. may in fact behave differently (such as output some sort of debug log on screen) when the debug mode is enabled 🙂

    I can definitely live with this, it's really not an issue. Mainly it was just a bit confusing while getting started with the module.

    41 minutes ago, adrian said:

    If you're interested, you may like to look through the other 3rd party panels available for the Tracy core: https://componette.com/search/tracy - in particular there are a couple of XDebug related panels that you might find helpful - they don't seem to be actively developed anymore, but perhaps you could investigate and we could implement one into TracyDebugger if helpful.

    In general, I'd definitely appreciate any thoughts you have on Tracy and its functionality.

    Awesome – definitely will check those out!

    I've only been using Tracy "seriously" as of this morning, but I must say that I'm quite enjoying it already. It's a massive tool and so far I've only used a tiny fraction of its features, but I can see a lot of value in it 🙂

    • Like 1

  13. 2 hours ago, Ivan Gretsky said:

    Maybe not the direct answer to your question, but You can easilly enable/disable Tracy in config dependant on your $config->debug setting.

    Thanks Ivan! 🙂

    So it would seem that I can at least solve this by setting that $config->tracyDisabled based on my own rules (or just use the same rules by stating that "$config->tracyDisabled = !$config->debug"), and then setting the output mode to DEVELOPMENT (or alternatively forcing development mode for superusers, since that's what I'm usually logged in while developing anyway).

    Still would seem more "streamlined" if Tracy utilised ProcessWire's built-in debug mode flag, but again there may be a good reason why a more nuanced setup is required.

    ... although, now that I'm reading the docs more carefully, I'm also wondering if I should just stick with DEVELOPMENT mode all the time. I'm not entirely sure (yet) what's the harm in that, considering that only superusers and users with the tracy-debugger permission should see anything out of ordinary anyway – right? Or is this setting going to do/affect something else? Basically it seems that this setting is useful in case, say, a client is going through the site as a superuser and you don't want them to see the Tracy bar 🤔

    --

    Another thing I've been wondering – and this is completely unrelated to the questions above – is whether Tracy provides support for breakpoints, as in points of code where execution should stop and display current "state" in some manner?

    I'm aware of the bd() function, but couldn't find anything pointing to this direction specifically. There is the bp() function, but apparently it's a different concept entirely – more like a timer than a breakpoint, really. Coming from Xdebug I'm used to relying on breakpoints while debugging features that I want to walk through step-by-step, stop before they are fully executed, etc. If the answer is "no", that's fine – I can always just use Xdebug on the side 🙂

    Edit: should've kept digging further. Found this from the blog entry introducing Tracy Debugger:

    Quote

    While Tracy doesn't provide breakpoints/step through code functionality the way Xdebug does, it does provide a wide variety other features that I think make it a valuable tool, whether you use it in conjunction with Xdebug, or on its own.

    I guess that answers my question above, and the suggested solution is indeed a combination of Tracy + Xdebug 😅

    • Like 1

  14. Hey @adrian! Sorry if this has been discussed/answered already – tried to browse a bit but there's just so much information here. Anyway, as I've been trying to integrate Tracy into my regular process, I've ran into a bit of a dilemma regarding the "output mode" setting.

    The thing is that I'm used to displaying errors on screen when ProcessWire's debug mode is enabled, but Tracy seems to override that. The solution to this would apparently be the "output mode" setting, but since in my case the development often happens on a publicly viewable (development) domain, the "DETECT" setting doesn't work for me (as it assumes that my site is in PRODUCTION mode), and I already have programmatic rules in place for enabling $config->debug depending on the state of the site / environment. I would've assumed the debug mode to force Tracy to dev mode as well, but it seems that it doesn't.

    I guess I'm mainly asking if this would make sense, or if there's a reason to keep Tracy's output mode and $config->debug separate? 🙂


  15. 29 minutes ago, adrian said:

    which I think makes the module useful for anyone/everyone and actually I think even with this checked, it would solve this copy/clone issue because the cloned page is unpublished and so as long as the title is changed before it is published, it will still rename the page when changing the title.

    Technically yes, but I'm not entirely sure I like this idea. Perhaps it's just because I'm used to the way the system works now, but if I were editing some content, it wouldn't be obvious to me that if I change the title nothing happens – except if the status of the page is unpublished.

    Again, this is obviously just something one needs to be aware of, but personally I don't feel that it's intuitive enough. It's quite possible that I'm in the minority here, but I often tweak the title multiple times while the page is unpublished, yet I've already figured out the name I want to give it. Similarly I can sometimes take a page "offline" for a bigger update, and then restore it. In my opinion a clear indicator about what the name (/URL) is, so that I remember to update it if need be, is a better solution 🙂

    Note: I have had numerous use cases where a template behaves exactly like Adrian has described above, i.e. name is autogenerated from title. But these are usually specific cases, such as a personnel directory or something like that.

    2 hours ago, bernhard said:

    I was thinking of that... Then I thought it might make sense to put all those little admin "bugfixes" in a module that we can install on any site. But then I thought that's basically the same as AOS, so maybe it would be something for @tpr ?

    Sure. It's not wrong to release a specific feature as a tiny stand-alone module, though – there's a case to be made for modules that do just one thing well 🙂

    • Like 1

  16. 3 hours ago, bernhard said:

    Ok, I get your points and agree. What do you think of displaying the url directly under the title field and show an edit icon that takes you directly to the settings tab?

    Something along these lines would be great!

    Nitpicking, but I wouldn't use an icon alone (for accessibility and usability reasons), but other than that it's definitely a feature I'd be using. Idea for a module? 🙂


  17. 56 minutes ago, formulate said:

    Yikes! This is a major issue for me. Any ideas about how to work around this?

    A character limit of 128 on page names seems kind of messed up. I wonder what Ryan's logic is behind this decision. At least relaxing it to 256 would surely be acceptable?

    The limit of 128 characters has been in place for many years now. Personally I don't see a huge issue in raising it, or at least allowing longer names but making this an optional feature, but in the end that's a decision for @ryan. You can always open a new issue at the processwire-requests repository, requesting support for longer page names and explaining your use case and need for these.

    I can't remember if the reason for this limit has been discussed before. Browsers have some kind of limits in place, but these days those should be pretty much a non-issue as far as I can tell. Database level scalability probably shouldn't be a massive issue here either.

    That being said, I must add that this might be the first time I've heard anyone requesting longer than 128 character page names – so while it may seem messed up to you, it seems to me that your use case is actually not a particularly common one. In fact for most sites page names longer than 128 characters would very likely result in usability issues, and – just for an example – for the sort of projects I usually work on I definitely wouldn't want to allow that. 128 characters is already much longer than what makes sense 🙂

    As for workarounds, depending on your use case you might be able to use URL segments here instead. That's just one idea, though.

    41 minutes ago, formulate said:

    Ok I was wrong. I thought for a moment my script worked, but it didn't. Even using $sanitizer->pageName with the maxlength set to 256 doesn't work. It gets overridden somewhere and truncated to 128.

    The name field in the pages table is varchar(128), so that's at least one place that will enforce the limit.

    • Like 3
×
×
  • Create New...