Jump to content

Cybermano

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by Cybermano

  1. -- EDITED -- Have you tried to use only the class without the "a" tag selector? #Inline .button { color: white; background-color: black; } /* Button */ in this case you can add the class "button" to your element/text without assign links before. -- END EDIT -- Hi @bernhard , hope this could be helpful: I found that if you didn't assign a target link to url in "Inser Link", before selecting your text, the tag and classes aren't inserted. Eg. At the field-level, in "Custom style formats CSS" settings, I have: #Buttons a.btn.btn-primary{ /* Std btn */ display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; background-color: #f29404; border-color: #f29404; } and this is the result in the editor: and in front-end page: As I said, I have setted the url before the style/tag assignment. But consider the customization of ProcessPageEditLink that I think it's more powerfull (and TinyMCE inherith all that from pwlink like a charme):
  2. Hi Jonathan, thank you for your inspiration 🙂! Actually lot of the commits are for typos fixes.🤭 I think I've just finished do add the last stuffs (overrides and few minor things), and I attach the last screenshot. Maybe my code could look a bit messy, but I've tested it many times and It seems to work fine (even if something could be too verbose). Don't worry if you are busy: take your time and let me know if there is something wrong or unclear. P.S. Sorry for my bad English, feel free to change every labels/descriptions/notes/comments in the config.
  3. Milestone - Release Candidate Templates and page ids override and Native language names. Native languages in front end list to enhance UX
  4. I was playing a bit... 😉 Added configurable options to show Google Translate product icon, wrap the icon (if enabled) and the select into a single div, styling classes to pass either to the DIV and to the SELECT, customizable label for the first option of the select and restored specific translations as override passing array of language codes (from one to multiple).
  5. Hi Guy Incognito, Thanks for your work, it works well and is really useful in some cases. I've added PR to implement module configuration for two reasons: the url passed to google in your code has a starting language set to "en" (obviously this fits your needs perfectly); the drop-down list with all languages is too long (in my opinion). My idea was to give the possibility to set the starting language according to the default language of the pw site (which in my case is Italian and the first url gave me an error translating other languages because google received English as first language to translate from and not Italian). For the second point, I think that for many users the complete list of languages is superfluous: I would limit the drop down list to only a few languages. I've added an InputfieldAsmSelect in the module config to allow admins to choose only the languages they need. Here's what the form looks like now: And what the selection looks like on the frontend: N.B. For this AsmSelect I have encountered some difficulty in front-end rendering the options as value=>label for languages: I made a workaround by calling a flipped array of your availableLanguages() method. Does anyone here know how to pass an AsmSelect option as a value=>label pair? I tried with foreach ($this->custom_languages as $code => $title) { $url = $this->buildGoogleTranslateUrl($code); $options .= '<option value="'.$url.'">'.$title.'</option>'; } but in this case on the front-end I have an indexed array like [0=>language1,1=>language2, and so on...] So I bypassed with a flipped array foreach ($this->custom_languages as $code) { $url = $this->buildGoogleTranslateUrl($code); $options .= '<option value="'.$url.'">'.$this->available_flipped($code).'</option>'; } Any suggestion is welcome. P.S. The forked module is available here: https://github.com/cybermano/MarkupGoogleTranslate
  6. Thanks. Sorry, but I've missed your reply.
  7. And, for me, this is totally insane: open playground (need to be logged) and copy/paste the following (or "make your own wish"). This is the mind blowing response that appeared to me (except for a little error in the "files" selector): // find all pages with "foo" template, only with parent "FOO" and "bar" greater than January the first, 2021 and having a .jpg or .pdf File $pages = $pages->find("template=foo, parent=FOO, bar>='2021-01-01', files.ext=jpg|pdf"); // echo a bootstrap responsive table with id linked to admin edit echo '<table class="table table-responsive table-striped">'; echo '<thead>'; echo ' <tr>'; echo ' <th>ID</th>'; echo ' <th>Title</th>'; echo ' <th>Bar</th>'; echo ' <th>Files</th>'; echo ' </tr>'; echo '</thead>'; echo '<tbody>'; // for each page foreach($pages as $page) { echo '<tr>'; // if editable, echo link to admin edit if($page->editable()) { echo '<td><a href="'.$page->editUrl().'">'.$page->id.'</a></td>'; } else { echo '<td>'.$page->id.'</td>'; } echo '<td>'.$page->title.'</td>'; echo '<td>'.$page->bar.'</td>'; echo '<td>'; // for each file foreach($page->files as $file) { echo '<a href="'.$file->url.'">'.$file->name.'</a><br>'; } echo '</td>'; echo '</tr>'; } echo '</tbody>'; echo '</table>'; speachless... N.B. Performed in a second moment, the code is added with: $files = $page->files; foreach($files as $file) { if($file->ext == "jpg" || $file->ext == "pdf") { echo '<a href="' . $file->url . '">' . $file->name . '</a>'; }
  8. Parallel projects also look very promising (and stunning), such as generating/manipulating images with DALL•E-2 or creating programming code from natural language with Codex... Just for playing: https://beta.openai.com/codex-javascript-sandbox I have wrote in italian (you can copy/paste): Crea una form con un input numerico chiamato "a" ed una select chiamata "b". alla select aggiungi due opzioni: la prima con valore 1, la seconda con valore 2. Aggiungi ora un pulsante per calcolare la somma dell'input e della select e alla pressione del bottone, visualizza il risultato in un div dal bordo rosso con spessore 1 px ed il carattere in grassetto*. How much coding time could be saved? Even just for the backbone of the script... 🤯
  9. Happy New Year everyone and thanks for sharing! I am amazed with this thing that also chats in other languages: I asked a question in Italian and it gave me a perfect answer… also translating the comments, but not the code statements… 😳👍
  10. I also thought about a problem with the page name (on multilanguage): in fact I'm stunned with all the "___callUnknown('localName', Array)" errors... Could it be due the array structure of the page name on multilanguage ('data' for default lang, and a kind of 'nameXXXX' for the other languages) ? If so, I never received a similar error before... not in page API, not in hooks, not AJAX...
  11. Hi everybody. I'm using this module in a site, either in hooks and in page API and it works fine. (Actually in page API mPdf generates a deprecated method - v5.7 - that I suppress with a postponed @, but all work fine.) Now I'm trying to use it in an AJAX call, handled by another hook "ProcessPageView::execute", but I get an exception due a Page::localName as a method that doesn't exist or is not callable. (in /wire/core/Wire.php line 564) For me it's a strange behavior: why this exception in wire.php? And only with ajax call? I'm not sure, but I think it could depend by a "<br/>" outputted in the JSON parse (from where?), this is the message of the inspector: XHRGEThttps://pdftestsite.com/create-pdf/?page=3527 [HTTP/1.1 500 Internal Server Error 234ms] SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data 1 <br /> 2 3 4 Hmm… Error: Exception: Method Page::localName does not exist or is not callable in this context (in /wire/core/Wire.php line 564) 5 6 #0 /wire/core/Page.php(1808): ProcessWire\Wire->___callUnknown('localName', Array) 7 #1 /wire/core/Wire.php(420): ProcessWire\Page->___callUnknown('localName', Array) 8 #2 /wire/core/WireHooks.php(951): ProcessWire\Wire->_callMethod('___callUnknown', Array) 9 #3 /wire/core/Wire.php(485): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'callUnknown', Array) 10 #4 /wire/core/Wire.php(488): ProcessWire\Wire->__call('callUnknown', Array) 11 #5 /site/modules/Pages2Pdf/Pages2Pdf.module(506): ProcessWire\Wire->__call('localName', Array) 12 #6 /site/modules/Pages2Pdf/Pages2Pdf.module(261): Pages2Pdf->getPDFFilename(Object(ProcessWire\Page), 13 14 This error message was shown because: you are logged in as a Superuser. Error has been logged. 15 16 Does anyone have any idea? At the moment I solved with a in page if($input->get->savepdf) statement, but I prefer to use ajax for a much better controls of the responses. For completeness of information, this is the function invoked from the ajax call, but I'm quite sure it's correct:
  12. Thanks everyone for the suggestions. In fact, if I had known about this "hidden" function, I would never have asked myself how to solve it adding my own custom code ... 🤣 Even if I think the global checkbox is even more immediate.😉 So in case of a next "note" adding, I suggest to consider my option first. 🙂
  13. Hi overoon, I also think that maintaining PW up to date is mandatory, but in this case isn't the reason for the @verdeandrea problem, mine and maybe for the same one occured to others. As far I know, this module doesn't indicate the minimum required version of PW, so I can assume that it works with all of PW versions. In this case it's enough to change few line of code in the module config file, as pointed above. This is only to be clear and it is not a criticism of you or of your post. 😉
  14. Found same problem, and the reason isn't in PW old version as mentioned, but in few line of code of the module that calls the field type in a short but wrong way (in PrivacyWire 1.1.0 it was right). Solved editing PrivacyWireConfig.php at those lines // line 15 'type' => 'asmselct' -> 'type' => 'InputfieldAsmSelect' // lines 126, 151, 273 'type' => 'ckeditor' -> 'type' => 'InputfieldCKEditor' // lines 167, 184 'type' => 'url' -> 'type' => 'InputfieldUrl' I have opened an issue on github: https://github.com/webworkerJoshua/privacywire/issues/25
  15. Maybe it's an intentional lack to be sure and to double check the deleting of the fields from a template. But when developing new sites from older one, for me it's usefull to delete lot of fields quickly. Some times templates needs to be cleaned from lots of fields, so for me it's bit annoying to check all fields one by one (for many templates). I wrote few line of js and loaded them in admin side to have a global checkbox to check all the others for fields removal. Maybe somebody here could consider to implement this feature in the template ui (obviously, in a much more elegant way than mine 😉 ) My code has a very basic behaviour, without the full range of control (just select/unselect all and uncheck when removing one from all checked ones) $(document).ready(function(){ // Only when selected fields to be removed are more than 1 if ($('input[id*="Inputfield_remove_fields_"]').length > 1){ // get fields list to delete and add a global checkbox $('li.Inputfield_remove_fields ul.InputfieldCheckboxesStacked').append('<li><div style="margin-top:20px;"><b><label><input type="checkbox" name="select_all" class="uk-checkbox"><span id="select_all_label" class="pw-no-select">Select All</span></label></b></div></li>'); // some basic logics on checkbox change trigger $('input[name="select_all"]').change(function(){ if ($(this).is(':checked')){ $('input[id*="Inputfield_remove_fields_"]').prop('checked', true); $('span#select_all_label').text('Unselect All'); } else { $('input[id*="Inputfield_remove_fields_"]').prop('checked', false); $('span#select_all_label').text('Select All'); } }) // additional basic logic on field checkboxes uncheck $('input[id*="Inputfield_remove_fields_"]').change(function(){ $('input[name="select_all"]').prop('checked', false); $('span#select_all_label').text('Select All'); }); } }); Then this code has to be loaded in admin.php, as usual after the load of JqueryCore (tanks @Soma http://soma.urlich.ch/posts/custom-js-in-processwire-admin/ ) $config->scripts->add($config->urls->templates . "YOUR_PREFERRED_DIRECTORY/YOUR_FILENAME.js"); Hope it could be useful or for inspiring. A little screencast:
  16. Maybe I've found my way playing a bit. For other newbies like me, I think the pointed requests are: setApikey=> sk_key according to pw syntax $session->set('key', 'value') => $session->set('prod', $page->title) form stands for an html <form></form> with options to get info such as shipping methods, product quantity, discount codes, coupons and so on... to calculate the final amount I think Stripe Payment Links work greatly with a simple <a> tag, such as <a title="Stripe checkout for This Product" href="https://buy.stripe.com/my_productlink" target="_blank">This Product</a> in PW we could have a template with a field for the link and output the same as <a title="Stripe checkout for <?= $page->title ?>" href="<?= $page->stripe_payment_link ?>" target="_blank"><?= $page->title ?></a> and in this case we could also publish into some socials from PW like fb, telegram, and so on. But I think I've missed something important from your post: How does a Stripe Pyment Link interact with the above php checkout?
  17. Hi Angelo, thanks for sharing this. I would like to test it, but I need two clarification if it's possible (from you o from who already tested it): Point 3) Use variables in template 'product': Does $page->title need quotation marks or not? If yes, are you sure to use without concatenation syntax? eg. '"' . $page->title . '"' Point 4) Insert a form in the template 'product': what "form" stands for? It's a specific html form with buying data or something else? ...and last, but not least: please, can you specify which ApiKey to use? Many thanks in advance.
  18. Hi Robin, many thanks for your time and for your "academic" exposition. ? You have clarified me a lot. Surely I have misunderstood your exposition for the sorting by index, into the the linked thread. foreach($r_items as $index => $r) { // Update the sort value of the repeater page // See: https://processwire.com/api/ref/pages/sort/ $pages->sort($r, $index); } I had assumed that in this foreach $pages->sort() stands for $page->repeater_item->sort() I beg your pardon... ? And for the record, now with your help (?) my whole mess (?) is working perfectly ...
  19. Don't worry, in fact I'm sorry for invading your post. Now I'm looking deeper into RobinS indication and affectively it works fine. Surely the fault is mine. Thanks again. ?
  20. Hi MarkE, sorry for bothering you... Unfortunately, compared to expectations, it didn't work out as I hoped. In my case, I have a matrix of scores stored by race, but when I add one or more races (repeater items) for all the competitors, some of this items shift randomly (4 digits are the id of the items, only for debug). Not all the times, but "sometimes"... also randomly... Completing the blank scores, the ID clarify the shift of the repeater items... The ADD/REMOVE items process is done by hook, with getNew() and add() methods (also tried append(), but nothing changed)... In Tracy Debug I can order the repeaters properly, but nothing more: it seems that after sorting the page is not saved ... And into the single competitor page, with Tracy all seems working good, but on each page refresh the repater items are always shifted. The repeater is not saved... Looking for other posts besides your, I found this one by @Robin S but the sorting by index didn't work... ? Do you have any suggestion?
  21. Hi Mark, you are my hero of the day! ?
  22. You’re welcome, and I hope you could enjoy it! ? Please, let me know if it could be helpful.
  23. This is the updated link to GitHub: https://github.com/cybermano/CustomNotes.git And attached the zipped file for the updated module. CustomNotes-main.zip
  24. Hi wbmnfktr, Don't worry, you didn't offend me ? : maybe I could be too verbose and not clear. First of all, this module doesn't install a kind of "tool" that manages food allergens in an automatic way. It moved from a need of this kind. Let's me explain better, if I can. Admin editors (webmaster or their clients too) may need to check recursively some data when edit lot of pages, e.g. inserting allergens in food menu (for each dish). So I thinked to a kind of "post-it" (or a sticky note) to check when I need to edit a page: for example, I'm not a chef nor a restaurant manager and I don't know by heart all the food allergens. So, for many clients that asked to us to maintain web editing and data entry, I built an admin page where I can check the list of allergens. But this slows down the editing process, because the page is loaded as a new page (or it could be loaded as a new tab, switching between it and the page that I'm editing). With the help of many people here, I have developed this module do build a system of "links" that they make appear a "panel" or a "modal" with the list of allergens. Obviously, you must have already setted all your fields, templates and logics. In my case, we have Hanna Code shortcuts to put into "Allergens" field, into a "menu repeater", that will be rendered as a button with tooltip. My Hanna Code item, in this case, is : <button type="button" class="btn btn-sm btn-warning rounded" data-container="body" data-html="true" data-toggle="popover" data-placement="top" data-content="<strong>Mustard</strong> and foods containing mustard."> 10 </button> In other way, you can set a SelectOptions field with Checkboxes: The code logics to display these buttons could be very similar, it doesn't matter. Here comes the help of my module: you can set where to insert the link to the list (e.g. the notes of the "allergens" field, or a sticky button that follow your scrolling). So you can limit the visibility of the link only to specific template, pages, and/or fields. Ad you don't have to open new tab or switching between them: it's available immediately. It helps me very much and speeds up my workflow for data entry. 07-CustomNotes-lr.m4v But this is not only for List of Allergens, of course. You could embed video (with the powerful tool of Video Emebed TextFormatter) , pdf manuals (just insert a link with target="_self", and it will be displayed into the panel or modal windows. In the second case it will be displayed into the whole modal like a "preview", very useful...), and other stuff. Let's think about technical manuals, videotutorials and text abstracts: pdf-docs.mp4.0a806606f78dcd86cecfe22f074c0b80.mp4 All you need to do, it's simply edit the CKEditor textarea into the settings of the module, as you do for each page that you edit. Then you will find a "reminder" where you would to see it. I hope I have explained better the use of this module to you and maybe to everybody that would try it. Now I will upload the upgrades with the corrections of @teppo .
  25. Thanks to @teppo for his support and help. Currently a new PR is merged on GitHub. ASAP I will update the attachments of this thread.
×
×
  • Create New...