Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    161

Everything posted by kongondo

  1. Update: Menu Builder Version 0.0.2 is now available. I'll update the original post later + post a new video. Main Changes: Beta status Menus stored as pages (note: just the menu, not the items!) Menu items stored as JSON in a field in the menu pages (empty values not stored) Add menu items from ProcessWire pages using page fields (option to choose between PageAutocomplete and AsmSelect [default]) or a Selector (e.g. template=basic-page, limit-20). For page fields, you can specify a selector to return only those specified pages for selection in the page field (i.e. asm and autocomplete) For page fields, now you can also add css classes and IDs as you add the items Menu settings for nestedSortable - e.g. maxLevels (limit nesting levels) Advanced features (e.g. add pages via selector, menu settings) currently permissible to superadmins only (may change to be permission-based) Delete single or all menu items without deleting the menu itself Lock down menus for editing Highly configurable MarkupMenuBuilder - e.g. can pass menu id, title, name or array to render(); Passing an array means you can conditionally manipulate it before rendering, e.g. make certain menu branches visible only to certain users [untested and the code is up to you!] More... Note: Some nestedSortable features not yet implemented/working (some are not really necessary actually). The module creates 3 fields (menu_items, menu_pages, menu_settings) and 1 template (menus). Menu pages are stored as children under the modules parent page (admin/setup/menu-builder/) - so not accessible in the frontend Issues: Drag and drop (ordering menu items) is some times finicky...something in the js I think or just my mouse.
  2. Not sure you have seen this? Module: TextformatterTwitterReplace https://processwire.com/talk/topic/8868-module-textformattertwitterreplace/
  3. Nice Nico, nice!
  4. Sorted! (seems hackish but I don't really mind unless shown a better way ). Documenting this in case there is a better way.... Add a Hook after AsmSelect's output: wire('page')->addHookAfter("InputfieldAsmSelect::render", $this, "customAsm"); Slightly modify AsmSelect output in customAsm() $value = $event->return; $value = str_replace("\"multiple\"", "\"multipleMB\"", $value);//see why this below.. $event->return = $value; The reason for the str_replace is that in InputfieldAsmSelect.js you have this code: $(document).ready(function() { $(".InputfieldAsmSelect select[multiple=multiple]").each(function() {//note this var $t = $(this); if(typeof config === 'undefined') { var options = { sortable: true }; } else { var options = config[$t.attr('id')]; } $t.asmSelect(options);//note this }); }); We need to change the [multiple=multiple] to point to our custom selector multiple=multipleMB. We don't hack this but in our own .js file we have: $(".InputfieldAsmSelect select[multiple=multipleMB]").each(function() { /* blah blah */ $t.asmSelectMB(options);//this will be the name of our customised asmSelect function Final thing is just to include our customised jquery.asmselect.js, i.e. jquery.asmselect-mb.js. (config->scripts->add()) with the modified function $.fn.asmSelectMB = function(customOptions) { /* blah blah */ This way, I can still set my properties values (e.g. $menuAddPageItems->setAsmSelectOption('sortable', false); ) and Bob's your uncle. Downsides? AsmSelects native JS still gets loaded although I have no use for it. OK, back to coding...
  5. OK, let me try again.... The AsmSelect or any other select field is for choosing the page that the user wants to add to a menu. That menu will be generated in the frontend (a navigational menu). With such HTML menus, usually, one adds CSS properties to the links - CSS ID, CSS Class as well as some other link attributes. So, I need the inputs to send data about these CSS and link attributes (nothing more than that). That info, will be stored elsewhere - hence, the inputs are really shells to temporarily hold data for POST. The pagefield I need for selecting the pages + their ID (from which I can do other stuff - e.g. know their URL, etc...). In essence, if you have had a look at the MenuBuilder thread, I want to mimick what I can already do with the custom menu items (see the table with inputs) - just to improve user experience. For the custom menu items, the user enters each link's title, link and (optionally) CSS details. The difference is that for PW pages, I don't need to enter a link (PW will generate that automatically for me on render) and the title I already have. Given the above. I have several choices. I can use my own js to mimick what AsmSelect does or slightly modify what AsmSelect does to suit my needs. I prefer using AsmSelect (or Autocomplete) just because they are convenient in many cases (as opposed to other page field selects). Currently, rather than reinvent the wheel, I am leaning toward using AsmSelect, just hooking into it and modifying it a bit. This is mainly because I am lazy and js is not my strong point... Thanks for your thoughts!
  6. Thanks for the info. The above is just a prototype - no styling has been applied yet . To clarify, I don't need an inputfield - just some temporary inputs in a table to send additional data for each selected page in the AsmSelect. The data will be saved elsewhere..In addition, I will not need the items to be draggable nor sortable - so I will remove those capabilities.
  7. I'm not double posting . I have been having a conversation with @netcarver about this but thought to expand the discussion. In relation to the module I am working on MenuBuilder and this comment, I need to modify the output of AsmSelect. Its ___render() method is hookable but the method does not have arguments so wondering whether in such a case, the best way is to use a Hook that replaces the whole method? Specifically, what I need to replace in the method is only one line - the one that loads the jquery.asmselect.js. $this->config->scripts->add($this->config->urls->$class . "asmselect/jquery.asmselect.js?v=$ver"); AsmSelect shows selected pages in a <span>Item Label</span>. So, instead of this: I want to have something like this (still rough around the edges!): In order to do that, I have needed to modify the jquery.asmselect.js plus modify the CSS a bit. Alternatively, I tried to remove the file using config->scripts->remove() and adding my modified one but that didn't work. The original jsquery.asmselect.js script was still loaded. I tried this in my Process modules execute() method and executeEdit() and just in case init(). I appreciate any thoughts on this, including alternatives, e.g. just manipulating the dynamically created DOM (the <span>Item Label</span> is dynamically created by jquery.asmselect.js) using jQuery. Also, I think extending the module in this case is an overkill - just to replace one line! Thanks! Edit: Clarification based on comment below. I am not after an inputfield per se. The data in the extra inputs I want will be stored elsewhere
  8. Almost done; mainly waiting for an answer about this: https://processwire.com/talk/topic/7870-asmselect-pagefield-modify-selected-options-order-in-select-dropdown/?p=88609
  9. Hi Steve, Would you be able to share some code how you went about this? Thanks. I am trying to add extra html inputs to the <span></span> that wrap selected asmSelect values. However, not sure this would work in an asmSelect that is called as an input in a Process Module? Have never really understood Hooks comprehensively... Edit Or maybe I should just extend the InputfieldAsmSelectmodule and use my modified jquery.asmselect.js...Any other ideas welcome, thanks.. Edit 2: No, I think hooking into the Class is better/cleaner in this instance..
  10. OK, we are on. I have resumed work on this and taken a newish approach. Hope to post something by end of play tomorrow...
  11. @Mats, Thanks for this. Please consider submitting your module to the modules directory as well as creating a new (support) thread for it
  12. @ridgedale, Welcome to PW and the forums. Multiple Blogs: This issue has been raised a couple of times but I haven't yet resolved how to best implement such a feature: https://processwire.com/talk/topic/7403-module-blog/?p=63775 https://processwire.com/talk/topic/7403-module-blog/?p=63878 https://processwire.com/talk/topic/7403-module-blog/?p=66524 https://processwire.com/talk/topic/7403-module-blog/?p=66528 At the moment it is not possible to have such a split. I am wondering whether this can be achieved by simply adding some field on a post's template to assign it to a particular field...hmm... $post-date-time Change your date's input/output format in the field 'blog_date' $post-summary You can have a post summary by using renderPosts($posts, true) - see the Blog documentation. Alternatively, you can create your own summary field and use that. Blog Styles Purely user preferences...
  13. The following works for me. You first have to enable 'Do you want to manage view and edit access.....' in the Access tab when editing that template. //$t = $page->template;//if on this page $t = $templates->get("skyscraper"); //echo $t->name . '<br>';//confirm we are looking at the right template $tRoles = $t->getRoles(); foreach ($tRoles as $r) { echo $r->name . '<br>'; } getRoles() seem only to work if 'view pages' permission is enabled on that template for a role.
  14. If only Qurus could tell us 'what is not working'....For all we know, this could be a javascript issue. What Diogo said - the next/prev in those demos are all being controlled client-side....from what I can tell...
  15. Yes...as long as $image has been defined somewhere....otherwise it will throw an error (undefined variable $image), no?
  16. You said you were having issues...what issues are those?
  17. It seems different? This is what Qurus has...but of course, I don't know if anything before that has changed <?php echo $page->images->getPrev($image)->url; ?>
  18. As it states in the methods' docs that Diogo linked to: You items need to be in a WireArray first...
  19. These look very nice, thanks for sharing and the write-up! Please add some links to the sites in your post, thanks.
  20. A link maybe?
  21. Maybe document how you made this + solved your issue to help the next guy
  22. Yep, this is what I do. Make sure to tell it to generate docs from .module files as well, not just .php
  23. /wire/modules/Fieldtype/ /wire/modules/Inputfield/
  24. No, sorry...I haven't. I didn't really think there would be interest....Hmm...I'll make a decision this week. If I take it up again I would have to change a few things now that I am a little bit wiser...We'll see.
  25. Don't know much about this but it seems there's one or two issues to consider here. First, the issue about making data entry as easy as possible for the client. They don't want to be 'typing' all those aliases with every page edit. Secondly, there's the main issue - how to create those aliases. In respect of the latter issue, the 'master name' will have to be related to its aliases in one way or another. A common way of relating things in ProcessWire (and you probably know this) is to use page fields. These are related to the first issue in that depending on the level of complexity, page field input such as auto-complete or asmSelect (plus the new tag select) can be quite handy. Is there a reason why you can't use such a system? Will the aliases be manually entered or imported into your (or maybe read from a custom) database? For some really powerful searching, there is also the module Elastic Search. Maybe that could help? See this for instance. I haven't use the module (nor the tool it implements) so can't comment much further. Anyway, these are just initial thoughts...
×
×
  • Create New...