I noticed the Custom search paths only displays as a select dropdown. Is there any way to allow the user to choose the Selector Type(ex. Radio buttons) for the Custom Search Paths and the "Label Text"?
Or maybe Custom Search Paths can be combined with "Content" fieldset.
Not sure if this is possible but here you go
Example Search Form
================
Search input
Label text - Customize your search
radio - Search this site
checkbox - Departments
checkbox - Questions
checkbox - Events
radio - Custom search path
radio - Custom search path
radio - Custom search path
================
I was mainly hoping that a user could click into the search field then see a list of options drop down similar to the sites below
Example www.themeforest.net - click into their search field.
http://tympanus.net/Tutorials/UIElements/SearchBox/
Once it has dropped down the user could check the content types he/she wants to search or the external sites he/she wants to search on.
What do you think would be the best way to handle this?
Thanks
Comment | File | Size | Author |
---|---|---|---|
#30 | popup-displays.png | 42.67 KB | rhymeswithcamera |
#30 | popup-does-not-display.png | 46.48 KB | rhymeswithcamera |
#17 | popup-close.png | 19.48 KB | jdanthinne |
Comments
Comment #1
jdanthinne CreditAttribution: jdanthinne commentedHi,
The first part (adding a label, and choosing a selector type) should be easy. I'm just waiting for the issue #916344: How to reference selected taxonomy term in custom search path? to be fixed (major reworking of custom paths), so I can add more options.
The second part (themeforest-like) is a very very nice idea, but is more a theming/css/js thing, but I'll think about it.
Comment #2
rhymeswithcamera CreditAttribution: rhymeswithcamera commented+1 subscribing
Comment #3
jdanthinne CreditAttribution: jdanthinne commentedI've just upload a new DEV version (should be available tomorrow), with settings for selector type and label text.
Please review.
Comment #4
gmclelland CreditAttribution: gmclelland commentedSo far everything is working correctly for me. I am seeing the selector type and using the checkboxes.
Comment #5
jdanthinne CreditAttribution: jdanthinne commentedGreat. When other current bugs are gone, I'll have a look at the "themeforest"-like thing.
Comment #6
gmclelland CreditAttribution: gmclelland commentedWell I figured out the Themeforest like search. I ended up not using the code from http://tympanus.net/Tutorials/UIElements/SearchBox/. It had a usability problem of the search options disappearing when you mouseout.
If interested, here is the code I used to fade in the search options when the search input is clicked. When you click outside the search input it will make the search options disappear. It works great, but falls short in that it doesn't work with the keyboard. I probably need to spend some more time on keyboard accessibility and abstraction. This works with the stock drupal jquery.
Of course you need to add your own CSS to hide and position the search options.
Comment #7
Everett Zufelt CreditAttribution: Everett Zufelt commentedIs there a demo of this applied somewhere? I am curious if it will work for screen-reader users. IMO, if this doesn't work for keyboard only users it is a regression and not an enhancement.
Comment #8
gmclelland CreditAttribution: gmclelland commentedUnfortunately, there is no demo. It is running locally. It works in IE6+, Firefox, Chrome, Safari, Opera. It should now be keyboard accessible.
I just posted this code to help someone who might be trying to do the same thing.
Comment #9
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedThis is awesome! I want to test it out, but since I'm not a developer, per se, can you tell me what file to copy/paste this code into? Thanks for tackling this!
Comment #10
gmclelland CreditAttribution: gmclelland commentedIn your theme add a javascript file with the code I provided. Make sure your javascript file is referenced in your .info file.
Something like scripts[] = js/cmf_script.js
Then change the variables at the top of the code to match your selectors in your theme. Customize as needed. CSS is needed to control the look and positioning of the dropdown.
Comment #11
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedGot it - and got it working. Now to make it look pretty. He! Thank you!
Comment #12
jdanthinne CreditAttribution: jdanthinne commentedNice script gmclelland! Got it working with some changes.
But I won't implement it in that way. I'd prefer to make a UI in the settings (perhaps within the "Ordering tree") where people could chose what to include in this fading options block, so taxonomy selectors could also be included as well if needed.
Comment #13
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedI may be a Drupal noob, but that's not my story in Facebook land. If this were Facebook, I'd give comment #12 two thumbs up! Thanks @gmclelland and @jdanthinne!
Comment #14
jdanthinne CreditAttribution: jdanthinne commentedHere it is!!
I've just committed a new Dev version.
Now you can put form elements in the "popup" region, and this region will only appear when search field is activated.
I've added css and js for basic behaviour (region hided at first, and position is "absolute"), so update your css definitions to match your theme.
Please test deeply (there are many many changes in the module to achieve this), and review.
Comment #15
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedThis is great! I will try it out in the next day or two and report back.
Comment #16
gmclelland CreditAttribution: gmclelland commented@jdanthinne - So far it looks to be working good with one search field. I haven't tried testing two search fields on the same page.
Is there anyway you could move the close link inside of div.fieldset-content?
You can do this by changing:
Line 107 - custom_search.js
from var popup = $('fieldset.custom_search-popup');
to this var popup = $('fieldset.custom_search-popup div.fieldset-content');
The reason I say this is because I would like the close link to be located in the bottom right of the popup. The only way to do this currently is to set a height and width on the fieldset.custom_search-popup and then absolutely position the close link to the bottom right. The problem with that is, the height of fieldset.custom_search-popup is unknown(it grows in height based on what search options are in it).
By placing the close link inside of the div.fieldset-content, it will naturally fall below(after) all the other elements.
FYI... After making the change, I noticed the popup fades in twice for some reason. I'm still looking into that. The close link is positioned correctly. Maybe it's just my theme?
What's your thoughts? Great job, by the way.
Comment #17
jdanthinne CreditAttribution: jdanthinne commentedOkay, for the double fadeIn, I've changed (and commited to DEV)
if (popup.find('input,select').length) popup.fadeIn().addClass('opened');
to
if (popup.find('input,select').length && !popup.hasClass('opened')) popup.fadeIn().addClass('opened');
.That was happening because the search field has two event listeners 'click' and 'focus' and they both open the popup. With this change, the code checks if it's already open...
And for the change you've made. That doesn't work for me, because there's no
div.fieldset-content
by default (I'm always using Garland for the tests). But you don't need it, I've tested this css definition for the close link:a.custom_search-popup-close { position:absolute; right:5px; bottom:3px;}
and it works fine! (see my screenshot)
Please re-test and re-view :-)
Comment #18
gmclelland CreditAttribution: gmclelland commentedI made the changes you indicated. That fixed the double fade. I changed my css and it worked just as you said.
Hive Five,
-Glenn
Comment #19
jdanthinne CreditAttribution: jdanthinne commentedThanks. That was a nice feature idea :-)
Comment #20
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedI have just tested the 02-Nov-2010 DEV release in my test localhost environment. I've run into two new issues. I suspect that I may not have everything configured right yet.
(1) When I do a keyword search - with or without types - I get an "Oops! This link appears to be broken." Looking at the URL, the port number is missing.
Actual: test.localhost/search/apachesolr_search/[keyword]
Expected: test.localhost:8082/search/apachesolr_search/[keyword]
(2) My search box appears on all pages. On any non-search-related page, when I click into the search box, the popup does not display. Once I execute a search (and add the port # to the URL - see #1), the search box then works as expected.
Actual: Popup only displays when I'm on a .../search/... page.
Expected: Popup displays anytime I click into the search box on any page.
Comment #21
jdanthinne CreditAttribution: jdanthinne commentedCan you download the latest DEV, and run update.php, to be sure…
And then, for (2), does Firebug (Firefox), or WebInspector (Safari/Chrome) throw a javascript error or something?
Comment #22
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedI downloaded the latest DEV, ran update.php (no updates), and ran the same tests in Chrome, Firefox and Safari. No console errors or warnings (that I can tell). I'm still having the same two issues as reported in #20. Regardless of browser, I have to add the port number to all searches, and the popup only shows up on .../search/... pages. Is there something else I should check?
Comment #23
jdanthinne CreditAttribution: jdanthinne commentedOk, I've found the bug for (1). I was using SERVER_NAME instead of HTTP_HOST. Working fine with the port.
Still investigating for (2). Do you have a test address for me to check? Or a DB dump?
Comment #24
gmclelland CreditAttribution: gmclelland commentedFor what it's worth, my search box is showing and working fine on every page. I'm using the context module for block placement, not the block UI.
Comment #25
jdanthinne CreditAttribution: jdanthinne commentedBut is the popup block also showing up on every page?
Comment #26
gmclelland CreditAttribution: gmclelland commentedYes, I have a sitewide context setup that say's to show the custom search block on every page.
Comment #27
jdanthinne CreditAttribution: jdanthinne commentedYeas, but the problem here is not the custom search block itself, but the "contextual" popup block (new feature).
See http://drupal.org/files/issues/popup-close_1.png
Comment #28
gmclelland CreditAttribution: gmclelland commentedYes, the popup is showing correctly on every page for me.
Comment #29
jdanthinne CreditAttribution: jdanthinne commentedSo, I guess, rhymeswithcamera, perhaps there's some javascript added by something else that goes against the popup behaviour.
Comment #30
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedThanks for resolving issue 1 (#20). As for the second issue, I investigated a bit more, and it appears that the HTML for the popup is being generated for all pages as it should. In fact, when I inspect the page, the popup elements are all there - just invisible on the non-search pages.
The only HTML difference (that I can see so far) is the opacity setting. On non-search pages, there is a style setting - "opacity: 0" - and I don't see the popup. On search pages, there's no such setting and I see the popup. I've attached screenshots of the HTML output. What is the best way to override the opacity setting?
Comment #31
gmclelland CreditAttribution: gmclelland commentedJust noticed a problem. When an element is added to the DOM, the behavior gets called again and the close link results in duplicate close links. In my case I noticed it happening when I edit a box with the boxes module. It provides in-page editing of blocks.
The solution is here under behaviors
http://drupal.org/node/205296
I had a similar problem with a Column List Splitter jquery script running again everytime something was added to the DOM.
Here was the code before:
Here is the code after that fixed the problem.
On line 107 in custom_search.js
I think changing
var popup = $('fieldset.custom_search-popup');
to
Hope that helps,
-Glenn
Comment #32
Ela CreditAttribution: Ela commentedThis is a very cool new feature :) Thank you for implementing this.
I have just one problem.. the popup seems to display behind my other blocks, so the options hide behind the block below.. :( any tips on how to fix it?
Comment #33
gmclelland CreditAttribution: gmclelland commented@Ela - change your css on the options element to a higher z-index
Comment #34
Ela CreditAttribution: Ela commented@gmclelland ... I'm sorry for my lack of knowledge .. Can you please give me a tip on how to do that?
Comment #35
gmclelland CreditAttribution: gmclelland commentedIn your theme's .css file try adding:
Comment #36
Ela CreditAttribution: Ela commentedWorks great! Thank you for the tip! :)
Comment #37
Ela CreditAttribution: Ela commented... however now the "search" button appears above the Search input ...
Comment #38
gmclelland CreditAttribution: gmclelland commentedSorry, but the css styles can vary from theme to theme. Without seeing your site I am unable to help.
Comment #39
jdanthinne CreditAttribution: jdanthinne commented@rhymeswithcamera : Strange for this opacity thing… Can you try with another theme (Garland), just to see if it's a bug or something to do with your theme?
Comment #40
jdanthinne CreditAttribution: jdanthinne commented@gmclelland : I've fixed the Boxes js bug, without adding additionnal class, but by adding a context:
var popup = $('fieldset.custom_search-popup', context);
Commited to DEV. Please test & review.
Comment #41
gmclelland CreditAttribution: gmclelland commentedOk, I couldn't download the new dev yet, but I did make the change you specified in custom_search.js. That fixed the close link from duplicating when I click on the "Edit" link of a box with the Boxes module, however I tried clicking the cog icon and choosing "Edit Skin" on a block with the Skinr module installed and the link still duplicates.
I'm not sure what adding the context parameter does, but I know the javascript on the new drupal.org uses the
syntax.
I tried adding this to custom_search.js line 107
and it fixed the Skinr issue and the Boxes module issue.
Hope that helps,
-Glenn
Comment #42
jdanthinne CreditAttribution: jdanthinne commentedOk, committed the ':not' fix as well :-)
Comment #43
rhymeswithcamera CreditAttribution: rhymeswithcamera commentedI switched my theme to Garland and the issue disappears, so it must be tied to my theme (which is a custom subtheme based on Fusion Core). I'll continue to tackle on my end. Thanks.
Comment #44
jdanthinne CreditAttribution: jdanthinne commentedComment #45
nicothezulu CreditAttribution: nicothezulu commentedYou should take care with fusions overflow css property... it will hide the popup box.