Jump to content

d'Hinnisdaël

Members
  • Posts

    215
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by d'Hinnisdaël

  1. How does everybody feel about creating a separate language pack for official and/or popular modules which would usually be in the site folder? I just noticed the Norwegian language pack making that switch.

    Especially for the Pro modules (Lister, FormBuilder) it would be nice to have a drop-in solution. And if you don't need them, just install the core language pack and everything stays the same. As far as I can tell, the current de-DE language pack doesn't include module translations, right?

    I'd be willing to create a repo and get things rolling.

    • Like 3
  2. 2 hours ago, bernhard said:

    yeah, I'm working on something but don't have anything usable yet ? 

    Just reading through the thread now, that looks very promising! Working with event dates from the API/selector side is quite messy but it seems like it doesn't have to be ?

  3. Format Datetime fields as Carbon instances.

    You can find the latest release and the complete readme on Github.

    Installation

    composer require daun/datetime-carbon-format

    Usage

    All Datetime fields will now be formatted as Carbon instances instead of strings. Some examples:

    // $page->date is a Datetime field
    // Output format: j/n/Y
    
    echo $page->date;                    // 20/10/2020
    echo $page->date->add('7 days');     // 27/10/2020
    echo $page->date->format('l, F j');  // Monday, October 20
    echo $page->date->year;              // 2020
    echo $page->date->diffForHumans();   // 28 minutes ago

    Frontend only

    The ProcessWire admin seems to expect datetime fields to be strings. This module will only return Carbon instances on frontend page views.

    Date output format

    When casting a Carbon instance to a string (usually when outputting the field in a template), the field's date output format will be respected.

    Links

    GitHub • Readme • Carbon docs

     

     

    PS. I remember reading about a Carbon module in a recent newsletter, but couldn't find it anywhere. Was that you, @bernhard?

    • Like 13
  4. 1 minute ago, bbeer said:

    sorry you're right they got to the browser as %23prodDescription. So we would need to strip %23prodDescription this.

    I think what I meant to say was that the hash (#prodDescription) is never sent to the server. ProcessWore doesn't know about it. Any redirects that are dependent on the presence or absence of a hash need to be done in JavaScript on the client.

  5. What are you using ProcessWire for in this scenario? Will you have other internal content managed in ProcessWire or will you just be using it to render the external content on the frontend?

    I've done the latter before (using PW only to import and display data) und wouldn't recommend doing it. Importing the data is just a lot of added complexity. A static site generator might be a better solution here.

  6. 1 minute ago, Sevarf2 said:

    Hi, did you solved this issue? I have the same problem and even removing the segmentation from home page the issue persists.

    There's two ways I've tried in the past that worked:

    1. Use a regex for your allowed url segments so it won't match "sitemap.xml"

    2. Trigger a 404 manually from your homepage template file if the first input segment is "sitemap.xml"

    • Like 2
  7. 14 hours ago, antpre said:

    I have a question, can't get to pass option to a chart panel.

    The code looks right to me. The fact that you're seeing a chart at all means there's probably something off in the way your options are structured. The panel itself only sets the defaults so overriding them like you're doing it should work. I'm afraid I won't be of much help here since debugging Chart.js config is a bit out of scope of this module ?

  8. 13 minutes ago, zoeck said:

    I have a problem with the new version, each time I open the dashboard, I get 2 messages

    Right, thanks, I left a session message in there. I pushed a patch at version 0.7.1. While it propagates to the module directory, removing line 119 of DashboardPanelCollection.module should work as well.

    • Like 1
  9. On 8/3/2020 at 3:56 PM, ryan said:

    There's a reply in that thread that says it only happens of entity encoding textformatter is disabled for the title field. I think it's rare for someone to disable that textformatter on the title field and something I wouldn't usually recommend doing. But I think we can also accommodate the request in that report, just wanted to return to it later when back on the dev branch because it's a change of behavior that I think needs more thorough dev branch testing.

    I would second MoritzLost's viewpoint here. Most template engines auto-escape output — so as soon as you use Twig or Latte for your views, it's best to disable the entity formatter for all fields and let the template engine handle it.

    • Like 1
  10. Release 0.7.0 adds a few features and fixes an issue reported by @MoritzLost.

    • Collection panel: Field names as column headers
      The collections panel now uses the field label as column header. No need to pass them in explicitly anymore. See the docs on column headers for details.
    • Shortcuts panel: Add option to hide shortcut summaries
      Disable the summaries altogether by setting the summaries option to false.
    • Shortcuts panel: Fix undefined-index error when destructuring shortcuts
    • Like 4
  11. 23 hours ago, apeisa said:

    One suggestion - not sure I understand the reason for current Collection pagination? It only shows the count of results, instead of showing actual pager. Changing this to actual pager is trivial, but probably something you would like to offer as an option?

    There's really two reasons this isn't implemented:

    1 — I don't think it's all that necessary. For actual browsing of data that requires state and pagination, there's much better tools available: PageList and PageLister, among others. The pagination info, as implemented currently, is merely meant to communicate that there's more results than currently shown and avoid any confusion there.

    2 — It's probably not that trivial to build. The native pagination breaks down once you do any sorting or render multiple paginated panels on a dashboard. To make it work well, it would have to be a custom-built solution that fetches results via AJAX and does the sorting server-side.

    I'm not currently doing any substantial work on the module, however I'm planning to implement some missing features when I find the time later this summer. In the meantime, I'll happily accept pull requests for a working pagination feature.

    • Like 2
  12. @Markus (Blue Tomato) I had a chance to use this on a production site and it's working great! Looks fantastic. Quite a bit faster than expected as well — I measured 10ms per image on a low-end Digital Ocean box, so no need for atomic caching so far. Thanks again for releasing, really appreciate this one ?

    • Like 2
  13. Very interesting! This is definitely the cleanest and most straight-forward option for generating low-quality image placeholders. Thanks for releasing ?

    Two questions  @Markus (Blue Tomato):

    1. How is performance for generating the data URIs? Do you generate them on the fly for every request or do you store the final LQIP data URI somewhere as well? My current implementation puts the tiny 200byte LQIP file alongside the source image; I wonder what's better here: generating in memory or reading from disk.

    2. I remember you releasing a similar tool for generating SVG shapes — did you stop using that in favor of the blurhash or are you using both in parallel?

  14. @Sevarf2 How do you manage state in your template — get variables?

    The template panel works best for displaying static data. For creating pages and importing data I'd suggest creating a custom panel type. That'd make it much easier to manage the required multi-step processes. Or better yet, a Process module for importing data and a separate dashboard panel that only kicks off the import and hands off the actual workload to the main module.

    • Like 1
  15. 8 minutes ago, Sevarf2 said:

    Hi @d'Hinnisdaël I'm using the module in all my projects now, very well done. Just one issue or something I missed to configure, when I'm using the template panel in which I need to create some pages based on buttons action I got PW fatar error class Page not found.

    Not sure what you're running into here. If you have a repo or gist with the code that's blowing up, I'm happy to take a look. Best bet is to make sure your templates are properly namespaced (ProcessWire).

  16. On 5/4/2020 at 5:08 PM, MoritzLost said:

    Hi @d'Hinnisdaël, I have a couple more suggestions for the Shortcuts & Collection panels, hope you don't mind ?

    All of these are good points, actually. I'm surprised I missed the default field label thing, since it's kind of the standard behavior in most core modules and especially useful in multi-language environments. I'm currently short on time, but will tackle these as soon as things settle down.

  17. 11 hours ago, MarkE said:

    However, I have a problem with the chart panel. My code is below (the data is just a test and will be replaced by integer variables)

    Chart.js expects an array at datasets, even if you just use a single one. It'll work once you wrap that in brackets again.

    • Like 1
  18. 23 hours ago, joer80 said:

    Would you consider adding an insert action to the collection panel?  That way people can add children?

    The collection panel does allow for an ›Add New‹ button. It's just not documented at the moment.

    You can either specify the child page's template or the parent page and it'll figure it out. For the template option to work, the child template must have a default parent defined. This should work:

    $panels->add([
      'panel' => 'collection',
      'title' => 'Widgets',
      'data' => [
        'collection' => 'template=widget, limit=6',
    
        // Option A: Add to child template's defined parent page
        'template' => 'widget',
    
        // Option B: Add to specific parent page (page, ID or selector)
        'parent' => 'template=widget-list',
      ]
    ]);

     

    • Like 2
  19. 22 hours ago, bernhard said:

    At the moment I have this in place and need to test it over the next weeks ?

      Looks great! Let me know how it's faring and I'm happy to use that instead of the page's process setting.

    22 hours ago, bernhard said:

    I agree that it is not the nicest thing to layout pages using InputfieldForm elements, but I think it would be the better way to push PW in that regard than creating custom solutions. We all know the benefits of using existing components.

    You're doing a good job convincing me here. It does make sense conceptually and thinking about the module ecosystem as a whole. That said, the module is currently at a point where I'm not missing much in terms of functionality and am not that keen on re-writing the whole output layer with no new features to show for it. And it's not like I have the time, with everybody currently wanting to expand their online stores... If anything, I'd put that on the list for version 1.0 as a summer/fall project since it'd be a breaking change either way. If you definitely need this and need it soon, I'm happy to accept a pull request.

    Quote

    How would I display one of your - I say it again - really nice looking dashboard panels in one of my modules?

    But why would you want to re-use a dashboard panel in another module? That doesn't make sense to me. The way I see a dashboard working is the other way around: it displays a condensed form of information found elsewhere, e.g. shortcuts from all possible admin views, a single chart from a whole host of data, the most recent news pages from a whole archive of them, and so on. If anything, you'd re-use a fieldset from one of your modules in the dashboard. Using markup from an existing module in a dashboard panel is working just fine — with the exception of granular access control and conditional visibility. Which to me seem minor but might be a deal-breaker for more corporate-y types of applications.

    • Like 2
  20. Hi @bernhard, thanks for your feedback, really appreciated. There's a few things to unpack here:

    Module dependencies

    The panel modules need to inherit from an actual class from a separate PHP file which made things more difficult than I'd like to admit. So right now I'm happy it's working properly at all. I wouldn't dwell on this issue too long since all modules are within a single folder and the naming is quite obvious. Might revisit this in the future.

    Exit on save

    I'd always expect »Exit & Save« on a page edit form to get me back to the page tree, since that's the level above. I'm happy to make that configurable, though.

    Admin home process

    Can you think of a way to permanently and consistently re-route everything to the admin homepage instead of the page tree? And then still have the page tree clickable as a stand-alone view? That would be a better solution that the current one for sure. I've had a previous version that changes the admin parent's process manually and changes it back on uninstall, but that was buggy as hell and really scared me.

    Asset CDN

    Good point about the intranet. I'm really uncomfortable bundling dependencies in projects. There's something quite icky about it and using a CDN feels like sort of a happy middle ground, but your point is valid.

    Panels as Inputfield

    I get what you're saying about not re-inventing the wheel. I'm afraid I have to disagree here, though.

    Input fields primarily serve the need to create complex forms, to arrange components for user input. In ProcessWire, it's become common to use them for everything under the sun since they're as close to a universal layout component as it gets. Might be a misnomer in hindsight, but I don't feel like every layout panel in the admin needs to be an input panel. It's useful for sure, but I don't see the need to have every container in the backend inherit from the base Inputfield class. They come with a lot of additional logic that doesn't apply to simple output panels, like the collapsing stuff and the conditional display logic.

    For context, the initial version of the module was created the way you suggested, using ProcessWire's input fields and fieldsets. There was just no way to make them look nice and behave the way the module required. Laying them out in a grid with proper spacing and responsive sizing was plain horrible. You're not only fighting a hundred separate existing CSS rules for margins and outlines but ProcessWire's internal JS for collapsing/uncollapsing/calculating of field widths on top. One of the requirements for me was to have 'renderless' panels without border, background or margin to achieve floating panels for charts. Undoing all the internal inputfield styling just wasn't something I was comfortable spending my time on.

    Out of curiosity: what's a possible scenario for re-using a dashboard panel in some other part of the admin?

     

     

    • Like 1
×
×
  • Create New...