Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Posts posted by bernhard

  1. 5 hours ago, cst989 said:

    I guess you can't delete a field from a template just by taking its entry out of the array so you still have to write a migration to do that?

    You can use the "fields-" key instead of "fields" and then it will even remove that field from your template without writing another migration.

    5 hours ago, cst989 said:

    Config migrations seems very cool, is it meant to be an approach you can use on its own or alongside regular migrations?

    They are extremely cool 🙂 And can be used alongside or alone. However anyone wants.

    • Like 1
  2. I think the changed hook is not meant to revert any changes but only to listen to changes and trigger actions.

    But you can do this (not sure this is the best solution) - example using the title field in /site/ready.php:

    wire()->addHookAfter('Page::changed(title)', function (HookEvent $event) {
      $old = $event->arguments(1);
      $new = $event->arguments(2);
    
      $oldStart = substr($old, 0, 3);
      $newStart = substr($new, 0, 3);
      if ($oldStart === $newStart) return;
    
      // save old value to a temporary property that will be used
      // in the saveReady hook to revert to the old value
      $page = $event->object;
      $page->revertTitle = $old;
    });
    wire()->addHookAfter('Pages::saveReady', function (HookEvent $event) {
      $page = $event->arguments(0);
      if ($page->revertTitle) $page->title = $page->revertTitle;
    });

     

    • Like 2
    • Thanks 1
  3. 10 minutes ago, Pavel Radvan said:
    if($page->template == 'your_template') return;

    Hey @Pavel Radvan there is a mistake in my code. It should be != not ==

    --> The purpose of this line is to only execute the rest of the callback for the template that you want. That means if the template is NOT your template, then it should exit.

    My code was not meant to be copy/paste ready. It's a boilerplate code to show you how it works. You have to make it work yourself or ask for help in the forum. But please not in this thread as we are getting out of scope here and we are not talking about RockForms any more. Please create another thread.

  4. Hey Pavel. I think it's the same with all form modules - that's not their primary goal. You'd have to update the page via API.

    But in your case it might be easier to modify the regular PW page edit form via hook:

    <?php
    $wire->addHookAfter('ProcessPageEdit::buildForm', function($event) {
      $form = $event->return;
      
      // the page being edited
      $page = $event->process->getPage();
      if($page->template == 'your_template') return;
      
      // remove a field
      $form->remove('my_field_name');
      
      // sometimes removing fields leads to problems, so you can do this:
      if($f = $form->get('my_field_name')) {
        $f->collapsed = InputfieldForm::statusHidden;
      }
      
      // make a field requried / not required
      if($f = $form->get('your_other_field')) {
        $f->required = true; // or false
      }
    });

    That might be an easier approach?

  5. A quick backup strategy could be to setup https://processwire.com/modules/cronjob-database-backup/ to backup the database every hour (if it's not a huge site). Then at least the maximum risk should go down to the work of 1 hour. There have been several similar reports these days, but as @wbmnfktr mentioned I think they have been related to RepeaterMatrix only?! Not sure what the status of that is @adrian ? Luckily I have not encountered anything like that so far.

    It does not sound like that would be the case, but just to be sure... Do you have very, very much fields on that page? Then you might be hitting your server's max_input_vars limit.

    • Like 2
  6. 4 hours ago, Bia said:

    Otherwise, if your response is just to share jokes about noobs, spare me.

    I haven't seen this happen for over 10 years as it's a very friendly and helpful community and it's also part of our community guidelines: https://processwire.com/talk/topic/8234-community-rules-guidelines/ 😉 If you see anybody violating the rules just contact one of the moderators - no need to blame anybody upfront. Thx

    • Like 7
  7. 19 hours ago, ryan said:
    Quote

    1) UIkit notifications seem to not use the theme's styling:

    @bernhard Thanks for all the feedback! How do I duplicate those notifications? I don't recognize what I'm seeing in your screenshot. I tried ProcessWire.alert() and ProcessWire.confirm() but both are styling correctly.

    Hi @ryan these are just regular UIkit notifications from the Notification component: https://getuikit.com/docs/notification - Just copy this into the console of your devtools:

    UIkit.notification({
        message: 'my-message!',
        status: 'primary',
        pos: 'top-right',
        timeout: 5000
    });
    UIkit.notification({message: 'Danger message…', status: 'danger'});

     

    19 hours ago, ryan said:
    Quote

    2) Could you please add an option to make the button's border radius customisable?
    3) Could you please add an option to make all input's border radius customisable?

    Either of the custom CSS options should enable this. 

    Ryan, this could be the answer to all of my/our questions. The theme was marketed as being easily customisable by changing just a few css variables and I think you did a good job, but as some of the comments show the new style might be missing some. Of course anybody can look into the 3100+ lines CSS file and find the right spot to tweak. But there might be several spots that one has to override. It might be necessary to add !important to make it work. And one might forget about edge cases like RepeaterMatrix, RockPageBuilder, whatsoever. I think some main design decisions should be taken care of the style, not every developer reinventing the wheel over and over again and fixing the same issues over and over again.

    For the buttons it seems to be quite easy. We'd just need a CSS variable for this:

    .ui-button,
    .uk-button,
    .ui-button.ui-state-default,
    .ui-button.ui-state-hover,
    .pw .tox-dialog .tox-button,
    .pw .vex-dialog-button,
    .pw .vex.vex-theme-default .vex-dialog-button {
    	border-radius: 9px;
    }

    Line 2649 of admin.css

    19 hours ago, ryan said:
    Quote

    ...everything that can take user input (<input> <textarea> <button> etc) have some rounded borders.

    I think this is also likely a good use case for the custom CSS options. 

    I disagree for the reasons mentioned above and I ask you 3 guys to rethink that to offer something like this:

    --border-radius: 10px;
    --input-border-radius: var(--border-radius);
    --button-border-radius: var(--border-radius);

    This means if someone wants all input/button elements have the same border radius, let's say 20px, then all he/she has to do is this:

    --border-radius: 20px;

    And if he/she wanted something like the style currently uses it would be something like this:

    --input-border-radius: 0;
    --button-border-radius: 99999px;

     

    19 hours ago, ryan said:
    Quote

    I tried do add the file site/templates/admin.css with the following content:

    Just tried, but it works for me. Are you missing the leading "/" before "site/", i.e. "/site/"  ?

    Thx! Sorry, my bad! I forgot I had a very restrictive .htaccess in place that blocked access to that css file 🙂 I tried both site and /site and both did not work. But now both versions do!

    19 hours ago, ryan said:
    Quote

    Would it be possible to have the admin theme load one CSS file by default. Similar to what we know from /site/ready.php it is often so much nicer to just place a file in a predefined location than to have to update a module's config somewhere.

    I don't usually like having to do extra file_exists() checks, but maybe it makes sense here. Perhaps the admin custom CSS file could be pre-populated with a /site/templates/styles/admin.css or something like that so that it would be the standard it uses, unless you opt to change it to something else. 

    Hmmm. Good point. Not sure. I think it would make things easier to have a common standard, like having a default /site/templates/styles/admin.css for example with just a few comments pointing to the example files at https://github.com/processwire/processwire/tree/dev/wire/modules/AdminTheme/AdminThemeUikit/themes/default/examples

    ---

    Another problem I just realised: My login screen is always the new style. This toggle seems to have no effect? It's not .htaccess this time...

    xUYBu8r.png sxGZDk4.png

    19 hours ago, ryan said:
    Quote

    I'm using #0a2b99 for the primary color and links are near to not readable in dark mode:

    Why choose a color that isn't readable? For anything that has customizable colors, there's a responsibility to choose an appropriate color. In this case, unless you disable dark mode, you'll want to choose a color that works for both. The three predefined color options are there as good examples. Maybe we'll add separate main color choices for light and dark mode, I'm not sure, but it will still be the responsibility of the person configuring the color to choose something that is legible. 

    Because it's the primary color of the CI. That's the whole point for having the primary color customisable, no? The backend should match the main color of the company and that's often a color that is dark to have a good contrast to white. It's not a solution to simply choose another color to make it work on dark mode 😞 

    19 hours ago, ryan said:
    Quote

    Could you probably update the theme to make it inject SVG markup for the logo directly?

    Sure. We're already doing it for the PW logo, so makes sense we should for custom SVG logos as well.

    Great, thx!

    19 hours ago, ryan said:
    Quote

    Regular UIkit <div class='uk-alert'> are not styled properly (they use the default uikit blueish), which is even worse in dark mode:

    Most likely it's something that PW doesn't use, so it isn't styled, but I'm sure it can be. I think we do use uk-alert boxes, but always of a type like "primary" or "warning" or "danger", etc. So maybe we just need to add a style for alerts that aren't of a specific type. 

    Thx. This is the code that it uses:

    <div class="uk-alert">
      ATTENTION - RockMigrations is installed on this system. You can apply changes in the GUI as usual but if any settings are set via code in a migration file they will be overwritten on the next migration cycle!
    </div>

     

    • Like 1
  8. Hey @ryan @diogo @jploch thx for your work on this!

    I have some questions:

    1) UIkit notifications seem to not use the theme's styling:

    6FTXFUC.png

    1.b) Is there a reason why primary buttons are black and not in the primary color?

    2) Could you please add an option to make the button's border radius customisable?

    3) Could you please add an option to make all input's border radius customisable?

    Ideally both would use the same setting by default but could be also set differently. This was one of the changes proposed by @Chris-PW when we were working on a new admin style and I think it makes sense to have everything that can take user input (<input> <textarea> <button> etc) have some rounded borders. We already have lots of lots of lines in the admin to help with grouping content, wrapping inputfields etc. and all those lines add up. Having all clickable elements look slightly different from everything else (but identical on their own) helps a lot in my opinion.

    4) Is there a reason why <select>s have white background and regular inputs have a light grey?

    8x7gi15.png

    5) Is there an option to disable the new toggles and get back to good old checkboxes? See https://axesslab.com/toggles-suck/

    Even if one prefered toggles over checkboxes in general, I think there are some situations where they are absolutely counterproductive, for example here:

    O1p51SW.png

    6) I tried do add the file site/templates/admin.css with the following content:

    :root {
      --border-color: var(--main-background);
      /* --inputs-background: var(--blocks-background); */
    }

    I then put both "site/templates/admin.css" and "/site/templates/admin.css" in the AdminThemeUikit config for "Custom CSS File", but it had no effect. Strangely when I put "wire/modules/AdminTheme/AdminThemeUikit/themes/default/examples/borderless.css" it worked!

    I also tried with this content:

    div {
      border: 1px solid red;
    }

    Still no luck.

    7) Would it be possible to have the admin theme load one CSS file by default. Similar to what we know from /site/ready.php it is often so much nicer to just place a file in a predefined location than to have to update a module's config somewhere.

    This might not sound like a lot to do, but when working with migrations and automated deployment workflows these things get more tedious, because you can't simply change the module config, you have to migrate these changes and then commit them. Also a predefined location reduces the risk of typos, of missing leading slashes, etc.

    8 ) Where to report bugs/issues/requests? In the PW issues repo? Here in this thread? Somewhere else?

    9) When editing a page in a modal (just add &modal=1 to any page edit form) there is a lot of unused space at the top:

    zGgAA7u.png

    10) On the page tree I think it is ok to have the action items text-only in this case (though I'd probably prefer the old style here):

    0zjtnMJ.png

    But on the trash we have some text followed by the action buttons and there this text-only style is really not good imho:

    48BjztB.png

    11) +1 for this:

    On 5/10/2025 at 1:18 AM, Mikie said:

    One suggestion would be to add separate light / dark mode config for main colour, otherwise there will always be accessibility issues with contrast for buttons etc in one or both of light / dark mode.

    I'm using #0a2b99 for the primary color and links are near to not readable in dark mode:

    oPA7puy.png

    12) @ryan As you can see in the screenshot above when using dark mode I'd probably want to change the logo to a white version. If that image were an <svg> this would be quite easy to do with CSS, but at the moment it is using <img src='...'>

    Could you probably update the theme to make it inject SVG markup for the logo directly?

    13) Regular UIkit <div class='uk-alert'> are not styled properly (they use the default uikit blueish), which is even worse in dark mode:

    uGvIRh6.png

    Thx!

    • Like 12
  9. On 4/17/2025 at 9:26 AM, Bia said:

    I am using Processwire 2.5.3, I am waiting for an update and maybe after this I can understand more, also I think I might not have access to everything I am trying to change. I used only easy drag and drop type of web designing. 

    Hey @Bia welcome to the forum.

    I might be wrong but to me it sounds like you still have a wrong assumption what ProcessWire is and how it works. ProcessWire is a development tool to build websites or anything similar. You can not only build websites with it but also intranet applications, backends for single page applications, etc... That means whoever built your website did it THEIR way. Nobody else can know how the website that you are looking at works under the hood.

    That means if you really want/need to change anything on your website there is a 99% chance that you need to change some code for this.

    That also means you need access to the files of your website.

    That also means that you might need to understand how your website is deployed to the server. Your developer might have just copied all files to your server. But he/she might have setup an automated deployment pipeline.

    It also means that it would be wise to first test all your changes locally before you push them to production. Otherwise you risk to break your site and then it might be down until someone can fix it. If you don't have someone for that at hand you risk to have a very bad time with some very uncomfortable questions 😉 But of course it also depends on the type of website you are working on. If it's not important and does not have lot of traffic this might not be a big deal... Who knows.

    I think in your situation it would be the best to find someone experienced to have a look at your project for maybe an hour or two that can explain to you how everything works, how it is setup and what to expect in terms of future maintenance or development and hosting. I'm not talking about how it works in detail but to get the big picture. Then you can decide how to proceed.

    If you want me to do that you can write me a PM or request a meeting at https://www.baumrock.com/en/contact/. There are probably cheaper options though. You can also ask for help in the jobs board or, of course you can always ask questions in the forum. It's a friendly community and answers are free, but while usually you don't wait long for answers it would probably not be the quickest way in your case.

    2 hours ago, Bia said:

    The only thing I need to find now is where is the options from inside the table:

    Screenshot 2025-05-08 113032.png

    Having said all the above to answer your question: If that form is built in code you'd have to open an IDE and search for the term "Culoare:" or "Colored" or "White" in your codebase. Then you might find the file that is responsible for the dropdown. If you don't find anything in code then it means that your developer used some kind of form builder and the data is stored in the database, not in code.

    Hope that helps 🙂 

    • Like 1
  10. 6 hours ago, HMCB said:

    Is there a way to include the calendar view in front-facing pages (public, non-admin; obviously view- only)?

    Hey @HMCB the module does not offer a plug&play calendar for the frontend. Every frontend is different. Every project has different needs. One might need a month view, another project might need a list view or a weekly schedule... All these needs have been solved by libraries like https://fullcalendar.io/docs/initialize-globals so there is no need or justification for RockCalendar to reinvent the wheel. The cost/benefit calculation would clearly be negative here.

    But for everything behind the scenes (the backend) we have a common ground (the PW admin interface), so there you can save a lot of time and effort with RockCalendar.

    RockCalendar should provide all the necessary helpers though to make implementing any calendar (for example one might prefer the toast ui calendar https://ui.toast.com/tui-calendar) as easy as it can get. If you are missing anything let me know and I'll try to add it.

    • Like 1
  11. I've read several times that slow page loads came from lots of pages being loaded into memory when loading the page. This might be due to a poorly configured page reference field (eg a selectbox with thousands of pages) or maybe another module with a totally different purpose. I think you are right that an autocomplete field should not cause any issues.

    I'd try to look into the debug tools first and see how many pages are loaded on that initial iframe request. You should see that in the bottom right corner if debug mode is on.

    • Like 1
  12. 2 minutes ago, Jonathan Lahijani said:

    Is it possible to log errors to the error log?

    I'm not sure, but I think so and that might be a good thing to add. Can you try to modify the rock.php file. There I catch any exceptions and only write the ->getMessage() output to the console.

    If you remove the try/catch, do you get more helpful output?

×
×
  • Create New...