Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/05/2020 in all areas

  1. This is a very early realease and at the moment more of a proof of concept that needs some more work (not a lot though!). Currently it adds VSCode snippets for all hookable methods and adds proper variable type declarations so that we get intellisense automatically: This module was easy to build thx to @adrian's work on TracyDebugger (Tracy is a dependency for the module). What I'm missing at the moment and where @adrian could hopefully provide some help: I'd like to list the arguments of the hookable method automatically. As you can see in the screencast I have to type $event->arguments(0) manually all the time. Does tracy's api explorer know something about the used arguments? If yes it would be trivial to add this to the snippets generator ? PS: It adds two versions of all hooks: One regular hook that adds a separate function and one inline hook that does the same inline (as shown in the GIF). PPS: Currently the module does build the snippets file automatically only if it does not exist. It would be great if the module recreated the file whenever the api changed. @adrian any hints what the easiest way would be to achieve that? https://github.com/BernhardBaumrock/RockHookSnippets
    5 points
  2. This week we’ve got a few new and interesting core updates in progress, though none quite ready to release just yet. So rather than releasing version 3.0.154 today, I thought we'd instead take a brief look at what’s coming over the next few weeks… https://processwire.com/blog/posts/processwire-updates-and-additions-in-progress/
    3 points
  3. TrelloWire This is a module that allows you to automatically create Trello cards for ProcessWire pages and update them when the pages are updated. This allows you to setup connected workflows. Card properties and change handling behaviour can be customized through the extensive module configuration. Every action the module performs is hookable, so you can modify when and how cards are created as much as you need to. The module also contains an API-component that makes it easy to make requests to the Trello API and build your own connected ProcessWire-Trello workflows. Warning: This module requires ProcessWire 3.0.167 which is above the current stable master release at the moment. Features All the things the module can do for you without any custom code: Create a new card on Trello whenever a page is added or published (you can select applicable templates). Configure the target board, target list, name and description for new cards. Add default labels and checklists to the card. Update the card whenever the page is updated (optional). When the status of the card changes (published / unpublished, hidden / unhidden, trashed / restored or deleted), move the card to a different list or archive or delete it (configurable). You can extend this through hooks in many ways: Modifiy when and how cards are created. Modify the card properties (Target board & list, title, description, et c.) before they are sent to Trello. Create your own workflows by utilizing an API helper class with many convenient utility methods to access the Trello API directly. Feedback & Future Plans Let me know what you think! In particular: If you find any bugs report them here or on Github, I'll try to fix them. This module was born out of a use-case for a client project where we manage new form submissions through Trello. I'm not sure how many use-cases there are for this module. If you do use it, tell me about it! The Trello API is pretty extensive, I'll try to add some more helper methods to the TrelloWireApi class (let me know if you need anything in particular). I'll think about how the module can support different workflows that include Twig – talk to me if you have a use-case! Next steps could be a dashboard to manage pages that are connected to a Trello card, or a new section in the settings tab to manage the Trello connection. But it depends on whether there is any interest in this ? Links Repository on Github Complete module documentation (getting started, configuration & API documentation) TrelloWire in the modules directory Module configuration
    1 point
  4. --- There might be some changes to this module in the near future! Please see this comment --- I guess we have all been there... We need to store a price to a product. "Ok, easy, let's create a new field for that in the PW backend!" might be the first thought. But then the headache starts... What about TAX? What about NET and GROSS values? And what about rounding problems when not using the correct float or decimal values ( https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/ )? Meet RockPrice - a brand new (and not well tested!) module to save you from those headaches and make the UI more compact and reactive (nobody wants to calc tax/net/gross manually!). If you discover any issues or have suggestions for improvement please let me know! ? --- Download: https://github.com/BernhardBaumrock/RockPrice --- RockPrice Price Fieldtype + Inputfield for ProcessWire CMS Settings Usage The field always returns a RockPriceMulti object. This object contains an array of items and the totals vor vat, net and gross (where tax stands for the tax rate in percent and vat for the actual tax value, eg. Euros or Dollars): d($page->price); d($page->price->items->first()); API Saving field value: $page->setAndSave('price', [1000, 20]); $page->setAndSave('price', [ [1000, 20], [3000, 10], ]); Comparisons $p1 = new RockPrice(1000, 20); $p2 = new RockPrice(1000, 10); d($p1->equals($p2)); // false $m1 = new RockPriceMulti([$p1, $p2]); $m2 = new RockPriceMulti([$p1, $p2]); $m3 = new RockPriceMulti([$p2, $p1]); // flipped! d($m1->equals($m2)); // true d($m1->equals($m3)); // false d($m1->equals($m3, true)); // true (ignoring sort order)
    1 point
  5. $testpage = $pages->get(1252); $tespage->of(false); $testpage->designers->add(1200); $testpage->save('designers');
    1 point
  6. Hi @mel47, I'm happy to hear that! Yes, you can! You can use this to output fields from the page to the Trello card. For example, by default the card body contains a link to the page: {httpUrl}, this will be the page's url after parsing. You can use both custom fields as well as system fields. For example: **Page title: {title}** Page content: {body} Page was created at {created} This approach is somewhat limited. For example, the {created} placeholder will output the raw timestamp, and as far as I'm aware there's no way to change that to a proper date format. But that's why all methods are hookable. For example, if you want to append the (properly formatted) creation date to the body of all cards (when they are created or updated), you can hook TrelloWireCard::setBody: <?php // site/ready.php namespace ProcessWire; wire()->addHookBefore('TrelloWireCard::setBody', function (HookEvent $e) { $body = $e->arguments(0); $card = $e->object; if ($card->page) { $body .= sprintf("\n\nCreated at: %s", date('Y-m-d', $card->page->created)); $e->arguments(0, $body); } }); You can hook different methods of TrelloWire or TrelloWireCard depending on when you want to modify the cards, there's a complete list of hookable methods in the README. Currently the only things you can do through the module configuration when a page is published is (1) create a new card for this page or (b) restore the card associated with this page if it was previously archived. It's also possible to update the card whenever the page is saved, though that doesn't differentiate between status changes. If you want to perform a specific action after a page is published (like, for example, tick one of the checklist items), you can do that through hooks and use the TrelloWireApi class to perform the action through the Trello API. If you need some help with that let me know what you want to do! Yes, you can create cards manually in your template files. In that case, I would first deactivate the automatic card creation through the configuration. Then you can create cards manually: // replace with a check for your button if ($buttonWasClicked) { $TrelloWire = $modules->get('TrelloWire'); $page = wire('page'); $card = $TrelloWire->buildCardData($page); // dont create cards for pages that are already associated with a card if (!$card->id) { $TrelloWire->createCardForPage($card, $page); } } Let me know if it's working for you! Something on my To-Do list for this module is to add some "recipes" for stuff like that ? I think both methods are equivalent, wirePopulateStringTags just passes through to the populatePlaceholders method. Some of those methods are really well hidden in the documentation, those are super handy and should definitely be more visible!
    1 point
  7. Not my business (and no offence) but have you considered adding unit tests (there is none in the repo)? This is a sensitive area where accuracy is crucial, tests could improve the overall quality a lot. I can recommend ProcessNetteTester if you don't have any other preferred. In general tests for user supplied modules in PW are very rare (perhaps close to zero as I know, including my own modules), although it would be a sign of quality if there were some conditions to only accept modules with tests to the modules directory.
    1 point
  8. Oh wow! I discovered Trello just last week (yes, more free time during lockdown...). We were planning to use it as a project management tool for my (non-tech) team to enriched the content of the website (yes, again, lockdown...). Basically, I created some lists : "to do", "done", "added to website". The module will allow me to create the page (unpublished) with an automated checklist (text, image, translations), so people will choose one card, assign to self and work on the subject. When everything will be checked, they will move to "done", until I added the new content to the website (I'm the only one having backend access and I want it stay like this). So for now, it's working. And I like the fact I could add some automatic text without having to copy manually. Could I ask something? I'm not sure I understand what is wirePopulateStringTags Do I can use this to pull out the creation date or the child pages? Can it could be possible to add a trigger on "publishing" a page in status change handling? And last question. I guess via a hook, I should be able to create a button to automating card creation for existing pages? Thanks a lot! Mel
    1 point
  9. Ok... you stepped up my game. No doubt. Still... I'll try to get into my old code.
    1 point
  10. Have to test this here... especially for those special occassions like 1.234,00 or 1,234.00 as I'm here on a mixed language/locale setup (DE/US) which is actually quite challenging for most online banking solutions that often deny any input. I'll report back as soon as I can.
    1 point
  11. Looks great! Let me know how it's faring and I'm happy to use that instead of the page's process setting. 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. 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.
    1 point
  12. Hi kongondo, I just wanted to report a little UI inconsistency: I was editing a CKEditor-textarea and inserted a link by using "Select Media from Media Manager". In the Media Manager modal window, I used the table view, in order to see the filenames. Now, selecting any of the thumbnails didn't give any visual feedback. The red frame indicator only appears in the grid view, but not in the table view. I did a clean install of Processwire and Media Manager, but the issue persisted. Update: I think I found the issue. Here is a fix for insertMediaLINK($s) in MediaManager.js: Before: $inputs.each(function () { // skip current input if ($(this).attr('id') == 'media-' + $dataValue) return; // invert checked status $(this).prop("checked", inverseState).change(); }); After: $inputs.each(function () { // skip current input var $dv = $(this).attr('id').substr(6).replace('-tabular', ''); if ($dv == $dataValue) return; // invert checked status $(this).prop("checked", inverseState).change(); }); The line was taken from removeMediaThumbsView($a) in InputfieldMediaManager.js.
    1 point
  13. Thanks again for your feedback. I tested the privacy & imprint URLs and there really was a small bug about the multi language URLs. When you update the module the multi language URLs should work now. Example of external media: <!-- This is the output container --> <div id="player"></div> <script type="optin" data-type="text/javascript" data-category="external_media"> // 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an <iframe> (and YouTube player) // after the API code downloads. var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '360', width: '640', videoId: 'M7lc1UVf-VE', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } // 4. The API will call this function when the video player is ready. function onPlayerReady(event) { event.target.playVideo(); } // 5. The API calls this function when the player's state changes. // The function indicates that when playing a video (state=1), // the player should play for six seconds and then stop. var done = false; function onPlayerStateChange(event) { if (event.data == YT.PlayerState.PLAYING && !done) { setTimeout(stopVideo, 6000); done = true; } } function stopVideo() { player.stopVideo(); } </script> See this for more info about the YouTube API. The code above is from their example.
    1 point
×
×
  • Create New...