
Cybermano
Members-
Posts
87 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Cybermano
-
Custom Notes (former List of Allergens)
Cybermano replied to Cybermano's topic in Module/Plugin Development
Hi Robin, thanks for your reply and your suggestions. I totally missed your HC dialogue: I can't wait to study that module, I will look in depth asap ? And the page reference (yes, I use a repeater) is also a great idea ... I hadn't thought of that. Tks! -
Food Allergens Module A simple List of Food Allergens My needs were to provide a simple list of food allergens for our clients with restaurant related activity. The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window. This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea. This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens. --- Main features The basis All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module). Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list). A step further With the tips of @bernhard, @Soma (and many others), see here , the magic happens. The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list. A little further Why scroll to the top of the page to click a link? The next step was to create a sticky button only in the food menu pages. Again with a @bernhard tip I moved into the customization of this simple module and the related hook. --- How to use this module After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM): View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens". At the same way, the option for the sticky button, but with a plus The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>. Video Explanation In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call. This because I've set a specific one for each allergen to show up a tooltip in the front end. Registrazione #33.mp4 Registrazione #34.mp4 --- Last but not the least Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible. I always learn a lot here, so I would share my code for whom it could be interested. I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module. Obviously you are free to modify the code as per your needs. Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). ? I hope be helpful or for inspiration. Bye ready.phpList-ITA.htmlList-ENG.htmlAllergens.module README.md
-
Hello. I confirm you that I was able to implement the panel view. Thank you so much. I owe you a truck of beers! ? I dare, for those who may then use the same snippet you posted, that the url of the link must be between the quotes (and in my case I also had to remove #pw-masthead, not having a specific id). $(document).ready(function() { pwPanels.addPanel($("a[href='/your/admin/link/url']")); }); I also thank @Soma for publishing this tutorial, otherwise I would sail in the deepest dark ...;) All you are my hero! ? P.S. My next target is to hook my restaurant menu repeater to create a button with the same link, (so editors could obtain the list in place, without scrolling to top). If all will go right, I will share the code of the hook, the button and the List of Allergens (Hanna Code). Of course I will use your suggestion for the button... ? admin-pw-panel.mp4
-
Hi, I'm setting a custom page via this module ( many thanls to @bernhard for this, to @Soma @bernhard @adrian for their posts, and to all others that raise my level every day ). Awesome stuff! My scenario is to prepare a sort of little vademecum for safe-editors: a simply list of suggestion that they could open while edidting a page, without exit their page and read the custom admin one added via this module, accessible with a specific permission. I've setted all and it works perfectly, but I'm looking for how dispaly this page in panel mode: I suppose (surely I'm wrong... ? ) to have to set a class "pw-panel" in the html link. Well, I've serched along the forum and on the web but I've not find anything useful. I've also tryed (pure guess) to set "link" and "attrs" into the declaration of the page array (at the beginnin of the module), like this way (but it doesn't work): 'page' => [ 'name' => 'allergens', // You guessed! It's the list of the food allergens for a restaurant site :) 'parent' => 'page', 'title' => 'Allergen List', // Could this be correct? // 'link' => $config->urls->admin . "page/allergens/", // 'attrs' => 'class="pw-panel" ' ], Anybody has a suggestion how set panel mode behaviour? Many thanks in advance
-
Hi all! In free time, I've played a bit with WireMailSmtp. Thanks to a lot of tutorials/explanation found on these forum and in the API pages, I find my way and my settings. For future readers taht maybe could need somthing similar, I've started here, here and here ( tks @ryan, @horst and many other contributors) . The power of PW always impresses... Bye!
-
Hi there. First of all many thanks for the great module! We are using it only for logged users and it works like a charm. Any suggestions on how to send an email after the user vote ? (Maybe the simplyest way, if there's one...) Could it be an implementation for this module? Tons of thanks in advance.
-
Translate Select Options Fieldtype when getting all available options
Cybermano replied to Neo's topic in General Support
Hi everybody. I refresh this old thread because I had also the same issue. For the solution I have found (don't remember where*): echo $option->getTitle(); For me it works fine, hope to be helpful. *found here, thanks @schwarzdesign : -
datetimepicker DateTime Picker - Translation
Cybermano replied to Cyber-mano's topic in Getting Started
Hi! Finally a co-worker (thanks to @Mike-it ) and I found the solution: into the Datetime field settings, only "numeric" format for dates. Not "literal" ones (maybe somewhere the name of the Months won't match the translation file). Saved Page: Many thanks also @Zeka for his time.