-
Posts
6,629 -
Joined
-
Last visited
-
Days Won
358
Everything posted by bernhard
-
@Sipho adrians BCE could also be an option for you. you can also include the lister as field in the page editor: @szabesz totally wrong it supports all fields - you just have to write your own return statement. that's what i was talking about: it's a little more effort to setup but it's a LOT more versatile. and it has column sorting and filtering onboard. also pagination of the results. for now it does only support ajax in one whole dataset. so tha pagination is done client side. that would have to be improved for large scale situations but it's totally doable. for example an image column would be as simple as this: Regarding the core-topic: I totally agree and i think it would be awesome if @ryan could take a look at my module and think about adding this to processwire. For me this has been an invaluable benefit in my last years projects... but it's still too incomplete for public use and would need some tweaking regarding support of mobile devices and - even more important - large scale.
-
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
just to show that this module can render any kind of field (seems that this was not clear enough: https://processwire.com/talk/topic/16929-choose-custom-repeater-template/?do=findComment&comment=148803 ) a simple column showing images: // pic $col = new dtCol; $col->name = "pic"; $col->title = 'pic'; $col->className = 'minwidth'; $col->data = function($page) { if(!$page->pics->count()) return ''; return $page->pics->each(function($img) { return "<img src='{$img->maxSize(200,200)->url}' alt=''><br>"; }); }; $t->cols->add($col); so you can do whatever you want and whatever the API + PHP can do... the module even supports a plugin-system where we can easily build cell-renderers that handle common tasks and make rendering even easier. this for example is the js file of the column filter that shows a filter input on top of each column: /** * this plugin creates filter inputs for every column * * #### usage #### * just set your table's settings: { colfilter: true } * * #### issues #### * the column filter breaks the table's column alignment on window resize * * #### roadmap #### * make it possible to have different kind of inputs like range sliders and dropdowns * */ /** * make sure that the tables searching setting is set to true */ $(document).on('beforeInit.rdt', '.RockDatatable', function(e, dt) { if(!dt.settings.colfilter) return; $table = $(dt.el); if(dt.settings.searching == false) console.log('overwriting setting "searching" to true for table ' + $table.attr('id')); dt.settings.searching = true; }); /** * add colfilter row to table header */ $(document).on('afterInit.rdt', '.RockDatatable', function(e, dt) { if(!dt.settings.colfilter) return; var $table = $(e.target); // table dom element var table = $table.DataTable(); var $thead = table.table().header(); // prepare the new header row var $tr = $("<tr role='row' class='colfilter' />"); $.each(dt.columnNames, function() { $tr.append($('<th><input type="text" class="colfilter"></th>')); }); // add it to the table header $tr.prependTo($thead); }); /** * handle filterinputs */ colfiltertimer = 0; $(document).on('keypress keyup change', 'input.colfilter', function(e) { var $input = $(this); var $tr = $input.closest('tr'); var $th = $input.closest('th'); // datatables splits the table in 2 divs when scrollX is used! thats why we need to find the table via the wrapper var table = $input.closest('.dataTables_wrapper').find('table.RockDatatable').DataTable(); var regex = false; // disable enter form submit var keyCode = e.keyCode || e.which; if (keyCode === 13) { e.preventDefault(); return false; } // delay search while typing clearTimeout(colfiltertimer); colfiltertimer = setTimeout(function() { table.columns($th.index()+':visIdx').search($input.val(), regex, false).draw(); }, 500); }); this may look complex in the beginning but once we have such a plugin we only have to set one option of the table and the filter inputs appear -
what features are you talking about exactly? I'm using my DataTables Module/Field for all my Projects recently. It's a little bit more effort in the setup but a lot more powerful regarding display features. Though i have to admit that the mobile support could be improved... I'm using links to pw-modals a lot for editing. So it's not real ajax-inline editing but i like how simple and versatile everything is. also a nice example: but there is still a lot to do, so i'm curious what you guys think is missing for pagetables crowdfunding would be nice
-
maybe you could either use a lister with ajax editing: https://processwire.com/blog/posts/inline-ajax-page-editing-comes-to-listerpro-processwire-2.6.6/ or if you only have simple text inputs and don't need selector support you could use my handsontable module:
-
just a wild guess and maybe complete nonsense but did you try your script without the logging? the log saves to files, so maybe that's getting slow (and huge logfiles)? but copying half a million pages data from parents to children sounds not too good anyhow and i guess (second guess in 3 sentences ^^ ) there is a better solution...
-
don't know if i understand you correctly... maybe the "pagetable" is something for you? you can just install it from modules > core > profields: page table it has some extension modules:
-
hi sirhc, you could create a page reference field on your photo-template and when a user clicks on like you can add this user to the pagefield. if you have lots of users (likes) that could cause some problems on the page edit screen i guess, but if you set the field to hidden it should work. like count is as easy as counting referenced pages (users). show all liked photos would be an easy selector like "template=photo,likes=youruserid" most likes this week... hmmm... that's not possible with the setup above. then maybe it's better to create 2 new templates: 1) likes (just the parent for all likes) 2) like (pagefield referencing the photo, user that liked) then you can create a new "like" page whenever a user likes a photo and then you can also count all likes of that week: $pages->count("template=like,photo=yourphotoid,created>xxx,created<yyy"); and counting all likes for one photo would be even easier: $pages->count("template=like,photo=yourphotoid");
-
does that help?
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
bernhard replied to David Karich's topic in Modules/Plugins
i don't know what the code does exactly, so if you also don't understand it in detail you have 3 options wait and hope that somebody else helps you you invest some time, learn something about REGEX and try to find a way that prevents the module of minifying your comments buy procache for 49$ and be happy (for 1 site) and benefit of a lot more options and improvements that it offers (or pay 169$ for unlimited sites) -
Nice site! Maybe i should also try to start using the uikit admin theme... @last screenshot: Gallerie should be Galerie
- 1 reply
-
- 2
-
-
nice one, thanks for sharing!
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
bernhard replied to David Karich's topic in Modules/Plugins
https://github.com/FlipZoomMedia/ProcessWire-AIOM-All-In-One-Minify/blob/AIOM%2B/AllInOneMinify.module#L993-L1014 -
hi @AndZyk and thank you for your feedback Yes, you are right in both points. I'll add this on my todo-List. The streched team images are on iOs i guess? If yes, then we are already working on that.
-
@pandaman i've never used magento but i've used one approach in other projects that could maybe also be interesting for you: the project was a step-by-step move from joomla to processwire and we changed only one part to processwire and had the joomla site running side-by-side. not sure if something similar could work in your scenario but that's what i did: my pw site did a request to the joomla site and fetched its HTML. this way all the html + design came from the joomla site and i could manage the menu etc from within the joomla admin. i then used something like http://simplehtmldom.sourceforge.net/ and replaced the content dom element by the pw-content. so basically the wrapper came from joomla and the content from PW. of course the html fetching was cached, because otherwise that would be terribly slow. also the script and image paths can be tricky. but maybe it's something you want to consider... said that, i admit that this can be a quite hacky solution. but sometimes quick hacks are not the worst solution
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
bernhard replied to David Karich's topic in Modules/Plugins
hi tires, if you are looking for better performance i would highly recommend you take a look at procache: https://processwire.com/api/modules/procache/#procache-html-minification you have lots of options regarding html minification there that would solve your problem. -
hi alf and welcome to the forum did you read the docs of mpdf regarding svg? https://mpdf.github.io/what-else-can-i-do/images.html maybe there is some helpful information..
-
https://www.baumrock.com/portfolio/hr-diamonds.com/ I built this website for my client hrdiamonds.com - a great HR company based in Vienna, Austria. They were totally unhappy with the result of the former agency so it was easier to rebuild the website from scratch than adopting the old CMS (that was actually only 2 years young!)... Design by @lokomotivan built with UiKit Highlights: Frontend-Editing barba.js for smooth page transitions ProCache, of course Favourite client quote of the CEO: Happy to hear your feedback
- 4 replies
-
- 16
-
-
RockReplacer - Easy Tag Replacements and simple IF-Blocks
bernhard replied to bernhard's topic in Modules/Plugins
i'm not sure but i think hannacode does not support the if statements like [myifstatement]this is shown only to superusers for example[/myifstatement] second, hannacode is a textformatter module that works only as a formatter for fields. i use my module to replace tags in emails and pdfs (ok that would also be possible with the textformatter and i'm thinking of adding a textformatter to call all my replacements, but i just wanted to have my own way of doing it...). and third, i prefer to define things with single files and not to write code into some field's config field. you can then use git for version control. next on the roadmap is to support else-statements like this: [superuser] access [else] sorry, only for superusers :) [/superuser] -
Didn't know that, of course that's a perfect solution! Thanks Sorry for this rtfm
-
RockReplacer - Easy Tag Replacements and simple IF-Blocks
bernhard replied to bernhard's topic in Modules/Plugins
one more complex example: in the pdf creating module: $mpdf->WriteHTML(modules('RockReplacer')->replace($block->body, ['report' => $this->report])); the users edit-screen: the users help-section: the resulting pdf: and the replacementfile: <?php namespace RockReplacer; class dataoverview extends Replacer { public function desc() { return $this->_('Fügt eine Tabelle mit einer Zusammenfassung über alle Feedbacks + Rollen ein'); } public function replace($vars) { $report = $vars['report']; $project = $report->closest('template=project'); $fn = $report->fn; ob_start(); ?> <div class="dataoverview"> <h3><?= $this->_('Feedbackübersicht'); ?></h3> <table class="size-psmall striped"> <tr> <th class="text-center"><?= $this->_('Rolle'); ?></th> <th class="text-center"><?= $this->_('Eingeladen'); ?></th> <th class="text-center"><?= $this->_('Abgegeben'); ?></th> <th class="text-center"><?= $this->_('Rücklaufquote'); ?></th> </tr> <?php foreach($report->getRoles() as $role): ?> <tr> <td><?= $role->title ?></td> <td class="text-center"> <?php $invited = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role" ); echo $invited; ?> </td> <td class="text-center"> <?php $done = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role". ",fbdone=1" ); echo $done; ?> </td> <td class="text-center"><?= $invited ? round(($done/$invited)*100, 0) : 0 ?>%</td> </tr> <?php endforeach; ?> </table> [...] </div> <?php return ob_get_clean(); } } -
RockReplacer - Easy Tag Replacements and simple IF-Blocks
bernhard posted a topic in Modules/Plugins
I built this module because I needed a versatile solution to replace tags and simple if-blocks in some E-Mails and PDF documents. If you only need to replace static tags (no if-conditions), then you can use default PW api and need no module: $str = "My favourite color is {color}."; $texttools = $sanitizer->getTextTools(); echo $texttools->populatePlaceholders($str, ['color' => 'red']); // output: My favourite color is red. Usage: See the two example Files in the folder /replacements Methods: replacementsTable() Renders an overview of all available replacements (see the example in the Module's config file: Create new Replacements: Simply copy the sample file and adopt to your needs. Download: https://gitlab.com/baumrock/RockReplacer -
also fine
-
@adrian, what do you think of changing the "clear results" button in the console to a "don't clear results checkbox" meaning that every console submit clears the log unless the checkbox is checked. i find myself having to clean the console a lot while developing those days...
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
bernhard replied to kongondo's topic in Modules/Plugins
yeah, i also went with ajax for now. but it's strange that it worked before... and it seems more complicated now than necessary and with pw that's usually the feeling when something is wrong -
and we also had this one recently: