>Maybe tweak the JS to popup with autocompletion suggestions as soon as the data selector is focussed?
Not possible without lots of hacking of core-autocomplete :/

Maybe integrating the jqueryUI autocomplete combobox widget (js is in core) would be the best thing to do.
http://jqueryui.com/demos/autocomplete/#combobox

Unfortunately my JS skills are rather limited, so any help is welcome.

Comments

sepgil’s picture

Component: User Interface » User interface
StatusFileSize
new8.36 KB
new66.03 KB

implemented it.
If you use the seven theme as you're administration theme you'll need the patch of the patch of this issue #928572: Improve interaction states and add corner classes to jQuery UI Seven Theme in order to see the combo box like button.

sepgil’s picture

Status: Active » Needs review

forgot to set the status...

Status: Needs review » Needs work

The last submitted patch, rules-905158.patch, failed testing.

fago’s picture

+  // Create an Rules namespaces if it does not exist.
+  if (Rules == null) {
+    var Rules = {};
+  }

Rules is part of Drupal, so I guess we should be somewhere under Drupal -> Drupal.Rules.

+      $( "button" ).button();

I do not think this extra spaces are valid JS code style?

+    var object = this;

We should try to come up with better variable names here. Perhaps 'instance' makes clear it is an instance of the current "class"? Or better something like Autocomplete ?

+/* IE 6 hack for max-height.
+   */
+* html ul.rule-autocomplete{
+  height: 23em;
+}

Is this wrong spacing part of the hack? Probably.

-#autocomplete .rules-dsac-group {
+.rules-dsac-group {
 	font-style: italic;
 	background-color: #CCCCCC;
 	color: #222222;
 }

Let's start to adopt lower case hex codes too.

+      '#autocomplete_path' => RulesPluginUI::path($element->root()->name, 'autocomplete' . '/' . $name),
+      '#size' => 75, // So that the autocomplete selection is big enough to display descriptions without word wraps.
     );

The comment should be above the actual PHP line.

+  $types['rules_autocomplete'] = array(
+    '#input' => TRUE,
+    '#pre_render' => array('form_pre_render_conditional_form_element'),
+    '#process' => array('rules_data_selection_autocomplete_path'),
+    '#theme' => 'rules_autocomplete',
+  );

This is specific to the data selection widget, but the naming doesn't reflect his. Better use 'rules_data_selection' instead of 'rules_autocomplete' as element type. I think we could leave the theme and JS generic as "rules_autocomplete" though.

sepgil’s picture

Assigned: Unassigned » sepgil
Status: Needs work » Needs review
StatusFileSize
new8.69 KB

Fixed the issues

Status: Needs review » Needs work

The last submitted patch, rules-905158-2.patch, failed testing.

sepgil’s picture

StatusFileSize
new10.28 KB

This new Patch should apply...

sepgil’s picture

Status: Needs work » Needs review
StatusFileSize
new10.28 KB

forgot to set the status

Status: Needs review » Needs work

The last submitted patch, rules-905158-3.patch, failed testing.

fago’s picture

Status: Needs work » Needs review

#8: rules-905158-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, rules-905158-3.patch, failed testing.

fago’s picture

I've done some small improvements, mostly on the PHP side and committed it. thanks :)

+ I've done some css improvements.

Further possible improvements/problems:
* Click in the textfields lets the autocomplete popup. But click on the button to hide it now, doesn't work.
* When selecting a group ending with the colon, the autocomplete suggestions should refresh and the popup should stay open.

sepgil’s picture

Status: Needs work » Needs review
StatusFileSize
new2.74 KB

corrected the 2 problems...

sepgil’s picture

StatusFileSize
new3.32 KB

Noticed that by fixing the first issue, the fix for the second problem was broken. With this patch, both problems should be gone...

fago’s picture

Status: Needs review » Fixed

thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

carvalhar’s picture

hi,
i need to implement jquery ui autocomplete combobox at my drupal 6 installation.
Can you give me an advice about how you did it?

thanks.