-
Posts
1,514 -
Joined
-
Last visited
-
Days Won
45
Everything posted by gebeer
-
Yes, using VSCodium. Running smoothly for the last 3 years or so. Prefer that over the original binary from Microsoft that comes with all their telemetry shenanigans. Only drawback is that some extensions from the official MS extensions store are not (yet) published at https://open-vsx.org/ which is the default extensions source in VSCodium. But you can still manually download the vsx file from the official store and install. Other than that, I'm very happy with my telemetry-free VSCode experience. Depending on your distribution, you can find the package in the official repos of your distro or in the AUR for Arch (which I'm on btw). Cannot confirm that. On my end it feels ok. But then, I don't have the comparison with MS windows. Can only compare it to Cursor which (unfortunately) is only available as AppImage. And those are not as well integrated into your OS as native packages are.
-
Actually that post is where I got to learn that we can use loaded() for initialisation. It is great that you discussed this in such detail there, especially the drawbacks. I thought, since the OP seems to have a lot of expertise in using page classes, I'd ask him if he had found a more elegant way than using loaded(). And putting everything together that I have learned about page classes, I will avoid initialisation of props using loaded() with DefaultPage going on from here ?
-
This was most likely what caused that behaviour. So yeah, we have to be very mindful there. Guess I needed to learn that the hard way ? Great suggestions here. And thanks for your thoughts on properties in page classes and the very well structured example you give. There might be a good reason to avoid them, since they add overhead to Page loading. And I haven't found other methods like init or ready that are suitable for attaching those properties. Since my main goal with them was to have sensibly named props that intellisense can discover, I might as well stick with methods. After having worked for some time with implementing those props via the loaded() method in the past, nowadays I avoid them for the reasons mentioned.
-
What a great writeup! Thank you for putting your time into this. It could be part of the official docs for page classes. I would be interested in your reasoning behind naming the base class BasePage. In the docs that you linked, Ryan suggests DefaultPage. In https://github.com/processwire/processwire/blob/3cc76cc886a49313b4bfb9a1a904bd88d11b7cb7/wire/config.php#L202 it says: So are you using BasePage to not have every Page be based automatically on DefaultPage? I'm asking this, because I am using the DefaultPage class quite a lot and in some cases it caused some minor unexpected behaviours because the class is used for every Page. Would love to see how you implement properties in your base page class. Specifically how and where do you assign them? I utilize the loaded() method to assign those properties and found that it added lots of overhead because loaded() is called for every page that is loaded in a PW lifecycle when using it on the DefaultPage class. And that seemed a bit expensive to me, especially if construction of some properties requires more complex and expensive logic. Here's an example on how I implement custom properties on runtime class DefaultPage extends Page { // trait that provides methods for responsive images use ResponsiveImages; // define statuses that should be excluded from loadingcustom properties const excludeStatuses = array( Page::statusTrash, Page::statusUnpublished, Page::statusDraft, ); public $introTitle; public $introText; // set custom properties in loaded public function loaded() { // load custom properties only for allowed statuses if (!empty(array_intersect(array_keys($this->status(true)), self::excludeStatuses))) return; $this->set('introTitle', $this->text); $this->set('introText', nl2br($this->textarea)); } } I found that loaded() is called for every page regardless of their status. So I prevent loaded() from assigning properties for some statuses where the properties are not needed. Why I want to have custom properties in the first place? Almost all fields in my PW installations get very generic names like text, textarea, rte, image, text2 etc. I am using those fields in different templates for different purposes. Custom properties are a nice way to access those generic fields in a more meaningful manner and have them available in intellisense.
-
Thanks for clarifying this. I hadn't tested it before suggesting it as potential solution. But I had some cases in the past where this resolved my module permission issues.
-
Looking for an AI assistant for code? Consider Supermaven
gebeer replied to gornycreative's topic in Dev Talk
I get better results with Claude Sonnet than with GPT4o. Been using 3.5 Sonnet since it came out. Currently using it through Anthropic API with https://www.continue.dev/. In continue config I disabled the autocomplete and use Supermaven for that. The continue chat interface integrates nice and I could choose from more models if I desired to do so. With the Supermaven pro plan, you get 5$ of monthly credits for the chat models. Don't know about pricing for additional chat requests above that. Couldn't find it on Supermavens website. When going through Anthropic API, the usage cost is very detailed and transparent. Anyways, exciting to see so much going on in the AI assistant space and great to have so many options. -
[SOLVED] Disable "add" button in Page Reference field
gebeer replied to Pavel Radvan's topic in General Support
To simply hide the Add button of the PageListSelectMultiple field for non-superusers or for all, you can use some custom JS. Example: JS in site/templates/scripts/admin-custom.js // custom admin script console.log("admin-custom.js loaded"); /** * Hides the "Add" button for the Inputfield Page List Select Multiple field with given fieldName. * This function is intended to restrict access to adding existing items for non-superuser roles. */ function hideAddButtonForInputfieldPagelistSelectMultiple(fieldName) { // Uncomment the following line to also hide for superusers // config object is globally available in the admin and contains user objecyt with roles array // if (config.user.roles.includes('superuser')) return; const wrapper = document.getElementById('wrap_Inputfield_' + fieldName); if (!wrapper) return; const start = wrapper.querySelector('a.PageListSelectActionToggleStart'); if (start) { start.style.display = 'none'; } } window.onload = function () { hideAddButtonForInputfieldPagelistSelectMultiple('my_pagelist_select_multiple'); // pass in your field name here }; To load that script in site/templates/admin.php ... // load site/templates/admin-custom.js $config->scripts->add($config->urls->templates . 'scripts/admin-custom.js'); /** @var Config $config */ require($config->paths->core . "admin.php"); You could do this with custom CSS. But there you don't have the user role available. EDIT: or you do it with CSS and load it depending on user role in admin.php ? site/templates/admin.php // load site/templates/admin-custom.css for non superusers if(!$user->isSuperuser()) $config->styles->add($config->urls->templates . 'styles/admin-custom.css'); ... site/templates/styles/admin-custom.css /* Hides the "Add" button for the Inputfield Page List Select Multiple field with name "my_pagelist_select_multiple" */ #wrap_Inputfield_my_pagelist_select_multiple a.PageListSelectActionToggleStart { display: none; } Hope this helps. -
Try following the steps here: https://www.perplexity.ai/search/first-steps-in-processwire-cms-vJ0lNwzDRY6eaXW.skftsw This should get you started.
-
IMO your solution seems a bit hacky. Don't know enough about the structure of your module and how you load it in your Page Classes. But here are 2 ways you could approach it. You could use https://processwire.com/api/ref/modules/get-module/ which has an option noPermissionCheck which lets you load the module regardless of the current users permissions. It seems that you have already isolated the required methods into _motif_include.php. You could refactor and put them in their own module (which depends on the main module and gets installed by it). That module could then have different permission settings. That would be a much cleaner approach IMO.
-
Looking for an AI assistant for code? Consider Supermaven
gebeer replied to gornycreative's topic in Dev Talk
Same for me. Installed it yesterday and went straight for the trial of pro plan because of the insane context window of 1 million tokens. If the model sees that much of your codebase it can make much better suggestions. Even on the free plan you get 300.000 tokens context which is way more than any of the other autocomplete models can digest. The speed is absolutely amazing. Guess I will switch from Codeium. -
I am running the current ("old") version of MM. The documentation at https://mediamanager.kongondo.com/documentation/ used to be for that version. Checking the docs, I just realized that they are work in progress. Where has the documentation for the current ("old") version gone? It would be useful (not only for new users of your module) if they still could access the documentation for the current version. This would certainly help to avoid frustration ? When MM Next is out, there should still be documentation for the old version alongside the new one.
-
Looking for an AI assistant for code? Consider Supermaven
gebeer replied to gornycreative's topic in Dev Talk
Thank you for the insight. Just today I had the clear proof that Codeium autocomplete was well aware of the context. At least the last edited file (like they say in their docs). Can't say for sure that it also has context from the whole codebase. Need to check that. Will also give Supermaven a try and see how it compares. -
Looking for an AI assistant for code? Consider Supermaven
gebeer replied to gornycreative's topic in Dev Talk
Interesting. I watched Theo's video but haven't tried it yet. Mainly because I'm very happy with https://codeium.com/. Also very fast and quite good completions. Been using this for almost a year now and it has made much progress in quality and features. In addition to code completion you get AI chat, DocBlock Creation, Refactoring and much more. It seems to very intelligently grasp the context it needs to provide good completions without you having to configure anything. You can even improve performance by fine tuning some settings. I am using this inside the Cursor editor instead of their Copilot++ feature. -
Ever so often when working with JS, we need the good old console.log(). It is really tedious and time consuming having to type that out manually. Also, I like descriptive logs. Here's a little keybinding which addresses that and saved me a tons of time. I have it in the User keybindings.json { "key": "ctrl+shift+m", "command": "runCommands", "args": { "commands": [ { "command": "editor.action.clipboardCopyAction" }, { "command": "cursorLineEnd" }, { "command": "lineBreakInsert" }, { "command": "cursorDown" }, { "command": "editor.action.insertSnippet", "args": { "snippet": "console.log(\"${CLIPBOARD}\", ${CLIPBOARD});" } } ] }, "when": "editorTextFocus && editorHasSelection" } What it does: You select the var you want to log, press Ctrl+Shift+m (or any combination you prefer). This will go to the end of the current line, insert a line break, move down to the new line and insert the console.log() statement. Example: before with marked var: after with log statement: Hope someone will find this useful ?
- 246 replies
-
- 3
-
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
It is actually not that wild. Once you got the hang of the terminology, config file structure and basics of nix lang, it is fun setting up your machine. And in the case I had to move to a different machine quickly, all is setup exactly as I need it with copying over the config files and issueing one command.
-
Link page with multiple pages by field value in backend
gebeer replied to Pavel Radvan's topic in General Support
Happy to hear that you figured it out! -
Having exactly the same experience with vim keybinds. Haven't really bothered switching. As for terminal filemanagers, the keybinds are fully configurable. And yazi comes out of the box with hjkl and arrow keys. same here ? I'm on the same path there. But it is really hard. Especially getting away from Google. So many websites that offer easy login, some map API keys for my clients etc. But on the Smartphone, I'm running Lineage for MicroG for about 1 year now. It is pretty great. Some apps, like OpenAI and one of my banking apps, are not installable though, due to them requiring Play Secure or some BS service from the playstore. Might work with the next upgrade of the OS...
-
Given that you are using your UIKit+Tailwind combination, this sounds like a viable solution. Not sure though if text-white on the container will override input text and placeholder colors as welll as icon colors. So it would be still kind of a mess. I'd prefer to do this with uk classes if possible since I'm on a pure UIKit project. But given that you work way more with UIKit than me, there doesn't seem to be an easy solution. I'll wait what the client ays to the dark search bar before I get my hands dirty. Hopefully they like it ?
-
So here I am, fighting with UIKit (again). Offcanvas feature is great and works a charm out of the box. Only thing, those offcanvas bars are dark background by default. You could change that through variable overrides, sure. But what if you have 2 bars, one for nav (mobile) and one for an AJAX search thingy and you want the former to have dark and the latter to have light background? Easy right? Just add sth like uk-background-default and uk-dark to the uk-offcanvas-bar container. Done. Right? No. Shoot. what is happening here? White text, White icon, white input with white placeholder text. So not much to see here. Bonkers. 7 mins traveling through perplexity search later reveals an old closed (but seemingly not solved) GH issue. It suggests that back in 2021 offcanvas did not support the inverse component. Too bad, especially since it still does not seem to support it. Why the heck would it be such a hassle for a seemingly easy task? Is this such an exotic use case? Enough of the rambling. On to the obvious question: how do people solve this (other than suggested solution involving writing tons of CSS)? Is there a generic way of doing this with uk-classes in 2024? Your input would be much appreciated so I can move on to more exciting tasks ?
-
Go for it! The distro you choose doesn't really matter imo. Just use the one you feel most comfortable with. I'm full time on Linux since 2003 and haven't thought about switching back to Win or Mac ever since. Maybe Linux on Mac hardware ? Back in the days Ubuntu was released as free DVD via mailorder ? My journey went from Ubuntu to Debian Based Mint (LMDE) with Mate, then Cinnamon desktop. I finally settled on Arch (btw) for the last 8 years or so. Now I'm in the process of switching to NixOS for its deterministic setup approach and reproducability of exactly the same system on multiple machines. Lot's of fun if you're coming from a programming background. Anyways, as for graphics apps, I've been using a pirated CS6 in VMs for many years. Then switched to Photopea. Not doing a lot of graphics. But sometimes really am missing Illustrator, mainly for its text on path features. You can do it with Inkscape but it is fiddly as hell. Photopea is even better with that. File manager color labels: Nautilus on Gnome needs an extension for that from a custom PPA. If you feel comfortable using gnome extensions and packages from random PPAs out there, you could go that route. Gnome is great in itself. But, you already said it, might break easily when using extensions. Kinda like the Wordpress Plugin Hell. KDE does not have that out of the box as far as I'm aware. Found a 6 years old extension... Maybe you missed out on terminal file managers. There's a ton out there. I love yazi with vim style key binds (configurable through toml file). It has file colors/icons out of the box if you use Nerd Fonts in the terminal and feels really nice for a terminal application: You can disable snaps and replace them with flatpak which is a way better ecosystem given you have ample disk space. This depends very much on the hardware and distro used. You really should have had a better exoperience given that you bought a Linux optimized laptop. I have one, too (Tuxedo with AMD) and it seems I got lucky or they did a better job than your vendor. Never hear even the faintest fan noise. Then I have a 10 year old Asus ZenBook. Still running like a champ with very moderate noise under high loads. Linux is so awesome because of all the choices it gives you. Can be a bit overwhelming at the start, though. Man, I could talk hours on end about this topic. What a great way to procrastinate ?
-
Module RockFrontendTailwind - A Tailwind Starter Profile for RockFrontend
gebeer replied to gebeer's topic in Modules/Plugins
Yeah, that one is actually pretty cool, because you can mix UIKit styles (or any Framework for that matter) with Tailwind. It has no fully featured webpack setup like my module, though. -
Module RockFrontendTailwind - A Tailwind Starter Profile for RockFrontend
gebeer replied to gebeer's topic in Modules/Plugins
@HMCB thanks for the Like on my post. In case you want to use my module, you need to update npm package versions to the latest ones. Haven't done that in a while... -
You could do a check for existance of window.htmx and then conditionally include it from CDN. Sth along these lines if (typeof window.htmx === 'undefined') { var script = document.createElement('script'); script.src = "https://unpkg.com/htmx.org@latest"; script.integrity = "sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2"; // Not sure if this works reliably with @latest script.crossOrigin = "anonymous"; document.head.appendChild(script); script.onload = function() { console.log("htmx loaded successfully!"); }; script.onerror = function() { console.error("Failed to load htmx!"); }; } else { console.log("htmx is already loaded."); }
- 29 replies
-
- 1
-
-
- formbuilder
- ajax
-
(and 1 more)
Tagged with:
-
Thanks for the module! htmx is awesome and absolutely the right tool for such things.
- 29 replies
-
- 3
-
-
- formbuilder
- ajax
-
(and 1 more)
Tagged with: