-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
Just found nolt.io by coincidence and tried it out... It's really simple to setup a Roadmap with voting functionality: https://53261ae5.nolt.io/ What do you think? Could that be useful?
-
- 5
-
-
Page Reference field set via API for module configuration
bernhard replied to LAPS's topic in Module/Plugin Development
I'd recommend using Tracy Debugger for two reasons You have the field settings and field code panels where you can inspect your necessary properties Tracy has many many examples of how you can add fields to your module's config screen $f = $this->wire('modules')->get("InputfieldAsmSelect"); $f->attr('name', 'hideDebugBarFrontendTemplates'); $f->label = __('No debug bar in selected frontend templates', __FILE__); $f->description = __('Disable the debug bar on pages with the selected templates.', __FILE__); $f->columnWidth = 50; foreach($this->wire('templates') as $t) { $f->addOption($t->id, $t->name); } if($data['hideDebugBarFrontendTemplates']) $f->attr('value', $data['hideDebugBarFrontendTemplates']); $fieldset->add($f); -
Possible bug in selectors as associative arrays?
bernhard replied to Zeka's topic in API & Templates
I'd consider this a bug -
Is there a pw-plugin for popup-window by click?
bernhard replied to franciccio-ITALIANO's topic in Getting Started
Are you talking about the backend or frontend? ProcessWire has https://github.hubspot.com/vex/docs/welcome/ on board. -
Awesome to see that, need to look at that library as I've never heard about it... I've built a function to get data instantly very easily - have a look at the pluck() function in RockGridItem.js; It works similar to jQuery Datatables library that I've used before. And I found getting data there quite easier than with aggrid. That's why I built a similar replacement. See this example where I can select selected or filtered items: // get items var rockmailer_to = $('input[name=rockmailer_to]:checked').val(); var items; var testmail = false; if(rockmailer_to == 'selected') items = grid.pluck('id', {selected: true}); else if(rockmailer_to == 'filtered') items = grid.pluck('id', {filter: true}); else { // custom test address var testmail = $('#Inputfield_rockmailer_test').val(); if(!testmail) { ProcessWire.alert('You need to specify a Test-Mail-Address!'); return; } items = [testmail]; testmail = true; } if(!items.length) ProcessWire.alert('No items selected/filtered'); Wow @Beluga just had a look at apex charts and that looks fantastic! I was short before creating a module for chartjs but then quite a lot of client work popped in... I'd be very happy to assist you in creating a charting module that plays well together with RockGrid, so if you are interested please drop me a line via PM ?
-
The new concept of function for manipulating the columns really makes sense and is great to work with ? Whenever you create useful coldef functions please let me know - maybe others can also benefit from it. Here is one new that I just added: RockGrid.colDefs.yesNo() Here a simple example showing the status of an E-Mail (sent yes or no): col = grid.getColDef('rockmailer_sent'); col = RockGrid.colDefs.yesNo(col, {headerName: 'Status'}); And here a "more complex" example that splits a page reference field with a list of IDs and returns true if a page is part of that list and false if is not: col = RockGrid.colDefs.yesNo(col, { headerName: grid.js.listtitle, isYes: function(val) { if(!val) return false; val = val.split(","); return val.indexOf(String(grid.js.list)) > -1 ? true : false; } });
-
I need to send E-Mails with embedded images. Therefore the image urls need to be absolute httpUrls instead of relative ones like /site/assets/...; I didn't find one, so I created this: <?php namespace ProcessWire; /** * Converts relative CKEditor image urls to httpUrls * eg /site/assets/files/123/demo.png * to https://www.demo.com/site/assets/files/123/demo.png */ class TextformatterImagesHttpUrl extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'Relative Image Urls to HttpUrls', 'version' => '1.0.0', 'summary' => "Converts relative CKEditor image urls to httpUrls.", ); } public function format(&$str) { $url = $this->wire->config->urls->files; $httpUrl = $this->wire->pages->get(1)->httpUrl; $httpUrl .= ltrim($url, "/"); $url = str_replace("/", "\/", $url); $str = preg_replace("/src=\"$url/m", "src=\"$httpUrl", $str); } }
- 1 reply
-
- 5
-
-
-
[NOOB QUESTION] How to select a page in multi language environment?
bernhard replied to Gadgetto's topic in Getting Started
I have to support the existing anwers. It totally depends on you what the best option for selecting the page is. And the most important part of that question is WHY you want to select this page... Is the page a settings page? Then it might be the best to select it via ID (changing names to not break your code) Is the page part of some listing (eg list all news items on the news overview page --> select it via children/parent or via template, eg $pages->children(), $pages->find('template=newsitem'); Many other scenarios, so your explanation is a bit too general imho ? -
Glad to see RockGrid in action, thx for the screenshots ? What kind of improvements do you mean? Only thing I can think of is that you use ActionIcons for that. You can add them before or after the cell content. And you can show them always or only on hover: Sample code is some posts above, see RockGrid.colDefs.addIcons() PS: On non-fixed-width columns it's better to add icons BEFORE so that they are still visible even if the cell has more content than can be displayed.
-
The latest version makes it possible to put your rockgrid files in a custom directory. That's handy (necessary) when you are developing modules that ship with rockgrids. A processmodule would be as simple as that: /** * manage all lists */ public function executeLists() { $form = $this->modules->get("InputfieldForm"); $form->add([ 'type' => 'RockGrid', 'name' => 'lists', 'assetsDir' => __DIR__."/grids", ]); return $form->render(); }
-
Interesting, thx @Zeka it also works on a different install ? Ah, I guess that's because I set them to be singular... Yes, just checked that: The minimal theme is loaded also on the second run now that I changed "singular" to FALSE. Is that the expected behaviour? Not sure if that makes sense and how this singular feature could maybe affect code also in other szenarios...
-
Just pushed v0.0.14 to github - caution, there is a BREAKING CHANGE (but a small one ? ) Initially I implemented a concept of column definition plugins to reuse column modifications ( for example you almost always want icons to show/edit/delete the row instead of showing the page id). Now that works with helper functions that are available through the RockGrid.colDefs object (and you can of course extend that with your own helper functions). It's easy to create those functions: document.addEventListener('RockGridReady', function(e) { RockGrid.colDefs.fixedWidth = function(col, width) { col.width = width || 100; col.suppressSizeToFit = true; return col; }; }); And using them is a lot easier than before: // before grid.addColDefPlugins({ id: 'rowactions', }); var col = grid.getColDef('id'); col.headerName = 'ID'; col.width = 70; col.suppressSizeToFit = true; col.suppressFilter = true; col.pinned = 'left'; // after var col = grid.getColDef('id'); col = RockGrid.colDefs.rowActions(col); col.pinned = 'left'; It will replace your ID with those icons: There are plugins available to add your custom actions to that column (or any other column) and you can even combine those plugins: col = grid.getColDef('title'); col = RockGrid.colDefs.fixedWidth(col, 100); col = RockGrid.colDefs.addIcons(col, [{ icon: 'file-pdf-o', cls: 'pw-panel', dataHref: function(params) { if(!params.data.pdfs) return; var pdfs = params.data.pdfs.split(','); if(!pdfs.length) return; return '/site/assets/files/' + params.data.id + '/' + pdfs[pdfs.length-1]; }, label: function(params) { return 'show invoice PDF ' + params.data.id; }, }]);
-
BTW: My smart filter does already support multiple filters (AND and OR) >50 <100 would list all items that are above 50 and below 100 ber bau would find Bernhard Baumrock, but not "Bernhard Muster" bernhard | beluga would find both "Bernhard Baumrock", "Bernhard Muster" AND "beluga" PS: So maybe you could just create a custom button wherever you want that sets my smart filter to one of those options. Even Regex is possible.
-
Something similar is now built into the core: https://processwire.com/blog/posts/processwire-3.0.118-core-updates/
-
Glad my answer helped you somehow. I don't have time to look into that in detail. You can have a look at how I built the smartfilter. It's a 100% custom filter and you can build your very own filter as well. I'd be happy to help you if you are building something like the https://www.ag-grid.com/javascript-grid-filter-set/ , because that's definitely something others (including me) would benefit of. You might also want to use my debounce function so that the filter does not fire on every single key press.
-
@Pete could you please also have a look at this issue? Thanks in advance!
-
Thanks for sharing! Awesome site ? I wonder why you didn't create a module for that. There was a discussion about that recently: But in your case I think it would make sense to pack it into a module. You could then: update it with one click across several websites extend the $page object via hooks instead of creating a new class share it with the community via github&co and the modules directory This: <?php namespace Processwire; use schwarzdesign\PasswordProtectedPage; $protectedPage = new PasswordProtectedPage($page); $protectedPage->handleRequest(); if (!$protectedPage->userCanAccess()) { [...] Would then become that: <?php namespace Processwire; $page->handleRequest(); if(!$page->userCanAccess()) { [...] And it would be really easy to achieve in your (autoload) module: $this->wire->addHook("Page::handleRequest", function($event) { // your code here }); I think you could even get rid of the "handleRequest" call and do that automatically in the background.
-
New post: Rebuilding processwire.com (part 2)
bernhard replied to ryan's topic in News & Announcements
Maybe the place for such resources would be the blog - just like we already do (and did: https://processwire.com/blog/posts/introducing-tracy-debugger/ ) -
First call is correct, second call is empty? Any ideas why that could be?