Jump to content
Macrura

Selectize.js modules family

Recommended Posts

1 minute ago, adrian said:

I haven't seen any issues and it should be fine, because it uses PHP's version_compare() which support comparison of integer and string version numbers

Thanks, good to know.

  • Like 1

Share this post


Link to post
Share on other sites
On 11/16/2017 at 3:44 PM, Robin S said:

Did you push this yet? Not seeing any new commit in the repo. I think there might be some other issue with the module regarding the modules directory, because the directory is showing v0.0.3 but SelectizeImageTags.info.php is v0.0.7. Maybe the getModuleInfo() in the main module file is still being read despite being commented out?

@Robin SI think you were right about it seeing the commented out stuff - crazy! I just removed all of the commented out module config and was able to get the mods directory to up it to the latest version...

  • Like 1

Share this post


Link to post
Share on other sites

@Macrura Follow up from

 

I'm doing this:

$data = array(
    'title' => $page->title,
    'sum' => $page->summary
);
return $data;

 

'<div class="item">' +
'<span style="display:block;font-size:14px;font-weight:bold;">' + JSON.stringify(item) + '</span>' +
'</div>'

The result is:

{"title":{},"sum":{},"text":"Child page example 1","value":"1002","$order":1}

So my fields are empty, but there is "text" etc.

Share this post


Link to post
Share on other sites
'<div class="item">' +
'<span style="display:block;font-size:14px;font-weight:bold;">' + escape(item.title) + ' ' + escape(item.sum) + '</span>' +
'</div>'

also if you want a link you would add a line like this:

' <a class="pw-modal pw-modal-medium" href="' + escape(item.edit_href) + '">Edit <i class="fa fa-edit"></i></a></div>' +

Share this post


Link to post
Share on other sites

@Macrura: Thank you, but this is not working here. As I wrote in the other thread, this shows only [object Object].

To see what is going on, I use JSON.stringify(item) and as you can see above, my values (title,sum) are empty.

text, value and $order have values.

Share this post


Link to post
Share on other sites

You may be running into the multilanguage issue that was brought up here:

also, are you using the correct inputfield type (e.g. multiple vs single)?

Share this post


Link to post
Share on other sites

@Macrura

Yes, it's true. Strange, I am logged in as default language user and I want the default language value.

Still I have to do this way:

$eng = $page->wire->languages->get('default');
$data = array(
    'title' =>$page->title->getLanguageValue($eng),
    'sum' => $page->summary->getLanguageValue($eng),
);

Thank you.

Share this post


Link to post
Share on other sites
6 hours ago, theo said:

Yes, it's true. Strange, I am logged in as default language user and I want the default language value.

it may have something to do with output formatting being off; not sure, i haven't worked with language yet. But it would be good to know how to explain to get this to work for multilanguage sites.

Share this post


Link to post
Share on other sites

Hello, @Macrura! Thanks for your wonderful modules. Used them on 2 projects with full success and satisfaction))

Now I have a need to implement something like this, but do not have the budget to buy it. I was wondering if your InputfieldSelectize module could do something alike. I can see that the limitation has to be the number of pages that the module can load without getting php and the server to through an error. Do you have any experience with managing relatively large amount of pages with this module? Like 100 to 1000? Did you do any kind of search and/or ajax loading?

  • Like 1

Share this post


Link to post
Share on other sites

@Ivan Gretsky

i do have an inputfield version for ajax that is in development, i think it works pretty well; i can post back here once i am able to test it again  - i will attach it to the post so you can try it out.

  • Like 3

Share this post


Link to post
Share on other sites

Cool! I was guessing you will try to create something like this as soon as I tried the power of InputfieldSelectize :rolleyes:.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, Macrura said:

i will attach it to the post so you can try it out.

Sounds cool, I'm also interested. I do use a licensed Visual Page Selector but in my use case the UX of VPS is just too complex for the simple task I use it for, so your module might allow for better user experience.

  • Like 1

Share this post


Link to post
Share on other sites

i haven't worked on this ajax module for several months so it really is not ready, but i do have a working version if you want to try it. It needs testing, and work;
The screenshots show some elements of the setup in case of any confusion.

5ad696b28bd41_Edit_Field__selectize_ajax_test__localhost.thumb.jpg.cc8fa2436160d61441194969bd798a5e.jpg

5ad696a571de3_Edit_Field__selectize_ajax_test__localhost.thumb.jpg.007010619836122a6acf3d82e6363102.jpg

5ad696ac5597b_Edit_Field__selectize_ajax_test__localhost.thumb.jpg.2f4b993631f05491abc035dffdfbbfde.jpg

---the field---

Edit_Page__Selectize_Ajax_Testing_•_localhost.jpg

---the files---

InputfieldSelectizeAjax.js

InputfieldSelectizeAjax.module

 

  • Like 4

Share this post


Link to post
Share on other sites

Latest version of all modules have the fixed version compare, and the inputfield now also has the Ajax version included, but that one is still beta; it is largely a copy of the core inputfield, so shouldn't exhibit any errors, but may need work to make full use of the possibilities.

  • Like 1

Share this post


Link to post
Share on other sites

Noting here in case anyone has attempted to use any Selectize inputfield with the AdminThemeUikit, there are some known issues.

(1) the latest versions of InputfieldSelectize should work, meaning you should see selectable options now.
Prior to the latest version, the single select inputfield didn't work, and the uk-select class had to be removed from the field.

(2) Selectize Multiple works, but is slow, and almost non-functional if you try and filter options.

This is a major problem, and I have no idea how to fix it; there must be some javascript being triggered and going into a loading cycle when on Uikit, as opposed to Reno or Default; It is assumed that Selecize single would also suffer from this when filtering, but I haven't tested that yet.

If anyone know how to test or determine what the cause of Uikit not working right with Selectize, it would be greatly appreciated!

  • Like 1

Share this post


Link to post
Share on other sites

@Macrura I just installed your module / inputfield for the very first time, on the latest PW dev, and it simply doesn't work (only tried it with images so far).

My settings are in the attachment. When I have it like that, I get the following error when I want to edit a page:

Error

Call to a member function size() on boolean
Source file
File: C:/xampp/htdocs/processwire-dev/site\modules\InputfieldSelectize\InputfieldSelectize.module(118) : eval()'d code:2

I tried it with the default theme and Uikit as well. Do you see anything wrong in the settings? The fields are all there in my template, and the code is directly copy and pasted from one of your original posts in this thread.

The full error (with all system variables etc.) is here: https://drive.google.com/file/d/1mF4ZkWNe7hE8oZULqLUZmFMddv8nCOr5/view?usp=sharing

(image too big to upload in the forum)

 

Thanks!

localhost_processwire-dev_behindthescenes_setup_field_edit_id=113.png

Share this post


Link to post
Share on other sites

You'd really need to be checking to see if there is an image, here in your code it takes the assumption there is always an image; but instead you'd want to check if there is an image prior to running size on it; that would solve your issue.

$image = '';
if(count($page->images)) $image = $page->images->first();
$thumb = '';
$dims = '';
if($image !='') {
    $thumb = $image->size(100,100)->url;
    $dims = $image->width . 'x' . $image->height;
}
$data = array(
    'title'       => $page->title,
    'thumb'       => $thumb,
    'img_dims'    => $dims,
    'edit_src'    => $page->editUrl
);
'<div class="item" style="width:100%;">' +
    (item.thumb ? '<div class="image-wrapper" style="float:left;"><img src="' + escape(item.thumb) + '" alt=""></div>' : '') +
    '<div class="info-wrapper" style="float:left; padding:5px;">' +
        '<span style="font-size:14px;font-weight:bold">' + escape(item.title) + '</span><br>' +
        '<span>Type: ' + escape(item.type) + '</span><br>' +
        (item.img_dims ? '<span>Dims: ' + escape(item.img_dims) + 'px</span><br>' : '') +
        '<a class="pw-modal pw-modal-medium" href="' + escape(item.edit_src) +
        '">Edit <span class="ui-icon ui-icon-extlink"></span></a></div>' +
'</div>'

 

Share this post


Link to post
Share on other sites

@Macrura Thanks for this useful module - I've recently started using it. Any updates on using this in the new UIKit admin theme?

Share this post


Link to post
Share on other sites

it works well, are you seeing css problems?

Share this post


Link to post
Share on other sites

After an upgrade :

2018-05-09 12:39:13    Detected core version change 3.0.88 => 3.0.101
2018-06-23 14:27:03    Detected core version change 3.0.101 => 3.0.106

 

selectize.thumb.png.9c6b4974d577f8fd0e7084688eb16b2f.png

 

Share this post


Link to post
Share on other sites

@flydev, thanks - that's like a relative positioning problem with UiKit (in the tags field); i think i added some jQuery that removes the uikit class from the inputfield, maybe I didn't commit that change yet, will check now.

  • Like 1

Share this post


Link to post
Share on other sites

as far as I know the latest version of the inputfields all support UiKit theme; After upgrading all to the latest, you can post screenshots if you see any issues.

  • Like 1

Share this post


Link to post
Share on other sites

Hey @Macrura. Great module! Using code example above for the image example, seeing this on latest pw dev:455957929_ScreenShot2019-06-05at17_14_35.thumb.png.c078cc587604c1a9d2ddb13f07b5ce1d.png 

This is happening through the admin theme setting explicit height for the selectize-control div, see below:

.uk-form-small:not(textarea):not([multiple]):not([size]) {
    height: 30px;
    padding-left: 8px;
    padding-right: 8px;
}

.uk-form-small:not(textarea):not([multiple]) {
    height: 30px;
    padding-left: 8px;
    padding-right: 8px;
}

 

Share this post


Link to post
Share on other sites

@Mikie, thanks for the report, fixed now in next version.

In the meantime if you want this fixes, change line 31 in InputfieldSelectize.js from what it is now to this:

$(".AdminThemeUikit .InputfieldSelectize select").removeClass('uk-select uk-form-small uk-form-large');

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      After forgetting the class name of the wonderful AdminPageFieldEditLinks module for what feels like the 100th time I decided I needed to give my failing memory a helping hand...
      Autocomplete Module Class Name
      Provides class name autocomplete suggestions for the "Add Module From Directory" field at Modules > New.
      Requires ProcessWire >= v3.0.16.
      Screencast

      Installation
      Install the Autocomplete Module Class Name module.
      Configuration
      Choose the type of autocomplete options list: "Module class names from directory" or "Custom list of module class names". The latter could be useful if you regularly install some modules and would prefer a shorter list of autocomplete suggestions. The list of class names in the modules directory is generated when the Autocomplete Module Class Name module is installed. It doesn't update automatically (because the retrieval of the class names is quite slow), but you can use the button underneath when you want to retrieve an updated list of class names from the directory. The "fuzzy search" option uses custom filter and item functions for Awesomplete so that the characters you type just have to exist in the module class name and occur after preceding matches but do not need to be contiguous. Uncheck this option if you prefer the standard Awesomplete matching. Custom settings for Awesomplete can be entered in the "Awesomplete options" field if needed. See the Awesomplete documentation for more information.  
      https://github.com/Toutouwai/AutocompleteModuleClassName
      https://modules.processwire.com/modules/autocomplete-module-class-name/
    • By teppo
      MarkupMenu is a markup module for generating menu trees. When provided a root page as a starting point, it generates a navigation tree (by default as a HTML "<ul>" element wrapped by a "<nav>" element) from that point onwards. If you've also provided it with current (active) page, the menu will be rendered accordingly, with current item highlighted and items rendered up to that item and its children (unless you disable the "collapsed" option, in which case the full page tree will be rendered instead).
      Modules directory: https://modules.processwire.com/modules/markup-menu/ GitHub repository: https://github.com/teppokoivula/MarkupMenu Usage
      As a markup module, MarkupMenu is intended for front-end use, but you can of course use it in a module as well. Typically you'll only need the render() method, which takes an array of options as its only argument:
      echo $modules->get('MarkupMenu')->render([ 'root_page' => $pages->get(1), 'current_page' => $page, ]); Note: if you omit root_page, site root page is used by default. If you omit current_page, the menu will be rendered, but current (active) page won't be highlighted etc.
      A slightly more complex example, based on what I'm using on one of my own sites to render a (single-level) top menu:
      echo $modules->get('MarkupMenu')->render([ 'current_page' => $page, 'templates' => [ 'nav' => '<nav class="{classes} menu--{menu_class_modifier}" aria-label="{aria_label}">%s</nav>', 'item_current' => '<a class="menu__item menu__item--current" href="{item.url}" tabindex="0" aria-label="Current page: {item.title}">{item.title}</a>', ], 'placeholders' => [ 'menu_class_modifier' => 'top', 'aria_label' => 'Main navigation', ], 'include' => [ 'root_page' => true, ], 'exclude' => [ 'level_greater_than' => 1, ], ]); Note: some things you see above may not be entirely sensible, such as the use of {menu_class_modifier} and {aria_label} placeholders. On the actual site the "nav" template is defined in site config, so I can define just these parts on a case-by-case basis while actual nav markup is maintained in one place.
      Please check out the README file for available render options. I'd very much prefer not to keep this list up to date in multiple places. Basically there are settings for defining "templates" for different parts of the menu (list, item, etc.), include array for defining rules for including in the menu and exclude array for the opposite effect, classes and placeholders arrays for overriding default classes and injecting custom placeholders, etc. 🙂
      MarkupMenu vs. MarkupSimpleNavigation
      TL;DR: this is another take on the same concept. There are many similarities, but also some differences – especially when it comes to the supported options and syntax. If you're currently using MarkupSimpleNavigation then there's probably no reason to switch over.
      I'd be surprised if anyone didn't draw lines between this module and Soma's awesome MarkupSimpleNavigation. Simply put, I've been using MSN (...) for a number of years, and it's been great – but there have been some smallish issues with it, particularly with the markup generation part, and it's also doing some things in a way that just doesn't work for me – the xtemplates thing being one of these. In many ways it's less about features, and more about style.
      In MarkupMenu I've tried to correct these little hiccups, modernise the default markup, and allow for more flexibility with placeholder variables and additional / different options. MarkupMenu was built for ProcessWire 3.0.112+ and PHP 7.1+, it's installable with Composer, and I have a few additional ideas (such as conditional placeholders) on my todo list.
      One smallish and rather specific difference is that MarkupMenu supports overriding default options via $config->MarkupMenu. I find myself redefining the default markup for every site, which until now meant that each site has a wrapper function for MarkupSimpleNavigation (to avoid code / config repetition), and this way I've been able to omit that 🙂
      Requirements
      ProcessWire >= 3.0.112 PHP >= 7.1.0 If you're working on an earlier version of ProcessWire or PHP, use MarkupSimpleNavigation instead.
    • By Robin S
      Repeater Images
      Adds options to modify Repeater fields to make them convenient for "page-per-image" usage. Using a page-per-image approach allows for additional fields to be associated with each image, to record things such as photographer, date, license, links, etc.
      When Repeater Images is enabled for a Repeater field the module changes the appearance of the Repeater inputfield to be similar (but not identical) to an Images field. The collapsed view shows a thumbnail for each Repeater item, and items can be expanded for field editing.
      Screencast

      Installation
      Install the Repeater Images module.
      Setup
      Create an image field to use in the Repeater field. Recommended settings for the image field are "Maximum files allowed" set to 1 and "Formatted value" set to "Single item (null if empty)". Create a Repeater field. Add the image field to the Repeater. If you want additional fields in the Repeater create and add these also. Repeater Images configuration
      Tick the "Activate Repeater Images for this Repeater field" checkbox. In the "Image field within Repeater" dropdown select the single image field. You must save the Repeater field settings to see any newly added Image fields in the dropdown. Adjust the image thumbnail height if you want (unlike the core Images field there is no slider to change thumbnail height within Page Edit). Note: the depth option for Repeater fields is not compatible with the Repeater Images module.
      Image uploads feature
      There is a checkbox to activate image uploads. This feature allows users to quickly and easily add images to the Repeater Images field by uploading them to an adjacent "upload" field.
      To use this feature you must add the image field selected in the Repeater Images config to the template of the page containing the Repeater Images field - immediately above or below the Repeater Images field would be a good position.
      It's recommended to set the label for this field in template context to "Upload images" or similar, and set the visibility of the field to "Closed" so that it takes up less room when it's not being used. Note that when you drag images to a closed Images field it will automatically open. You don't need to worry about the "Maximum files allowed" setting because the Repeater Images module overrides this for the upload field.
      New Repeater items will be created from the images uploaded to the upload field when the page is saved. The user can add descriptions and tags to the images while they are still in the upload field and these will be retained in the Repeater items. Images are automatically deleted from the upload field when the page is saved.
      Tips
      The "Use accordion mode?" option in the Repeater field settings is useful for keeping the inputfield compact, with only one image item open for editing at a time. The "Repeater item labels" setting determines what is shown in the thumbnail overlay on hover. Example for an image field named "image": {image.basename} ({image.width}x{image.height})  
      https://github.com/Toutouwai/RepeaterImages
      https://modules.processwire.com/modules/repeater-images/
    • By EyeDentify
      Hello There Guys.

      I am in the process of getting into making my first modules for PW and i had a question for you PHP and PW gurus in here.

      I was wondering how i could use an external library, lets say TwitterOAuth in my PW module.
      Link to library
      https://twitteroauth.com/

      Would the code below be correct or how would i go about this:
      <?PHP namespace ProcessWire; /* load the TwitterOAuth library from my Module folder */ require "twitteroauth/autoload.php"; use Abraham\TwitterOAuth\TwitterOAuth; class EyeTwitter extends WireData,TwitterOAuth implements Module { /* vars */ protected $twConnection; /* extend parent TwitterOAuth contructor $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret); */ public function myTwitterConnection ($consumer_key, $consumer_secret, $access_token, $access_token_secret) { /* save the connection for use later */ $this->twConnection = TwitterOAuth::__construct($consumer_key, $consumer_secret, $access_token, $access_token_secret); } } ?> Am i on the right trail here or i am barking up the wrong tree?
      I don´t need a complete solution, i just wonder if i am including the external library the right way.
      If not, then give me a few hint´s and i will figure it out.

      Thanks a bunch.

      /EyeDentify
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


×
×
  • Create New...