Title Make removing a single keyword more intuitive
Priority wish Status chatting
Superseder Nosy List eric.araujo, eric.smith, ezio.melotti, r.david.murray, sandro.tosi
Assigned To Topics

Created on 2011-03-28.19:08:19 by sandro.tosi, last changed 2011-12-13.16:02:43 by ezio.melotti.

msg1937 (view) Author: sandro.tosi Date: 2011-03-28.19:08:18
where there is only one keyword, the most intuitive (at least for me :) way to remove it is to de-select it, and not to choose '- no selection -' at the top of the keywork menu.

Do you think such a change might be an improvement worth to be done?

msg1938 (view) Author: eric.smith Date: 2011-03-28.19:20:41
There's usually a platform-specific way of doing this. On my Ubuntu box, it's control-click on the currently selected item. I don't think it would be possible (or desirable) to do this in a platform-independent way.
msg1939 (view) Author: sandro.tosi Date: 2011-03-28.19:24:47
I think I'm missing a bit the "platform-specific" thing; I could be more about being browser-independent, but any browser has it's way to do it, in chromium it's shift-click, but that's something a user of that browser is "used to", since it's a common html element and the way to select/deselect an item from a list IME is the same on a given browser.
msg1941 (view) Author: r.david.murray Date: 2011-03-29.11:21:32
Eric, Sandro is talking about the fact that if you use the platform/browser specific method to deselect the *last* keyword that is selected, and then you click submit...nothing happens.  That is, that keyword is still set.  To unset it, you have to actively select '- no selection -' and hit submit, which is not particularly intuitive.  Presumably the server side code is doing nothing in the case where "nothing is selected", instead of unsetting the last flag.  This should in theory be fixable :)
msg1942 (view) Author: eric.smith Date: 2011-03-29.14:46:10
Thanks, David. I agree that the mythical 'someone' could make the server-side treat the two ways of saying 'no selection' the same way.

I realize the whole thing isn't terribly intuitive, and I often have to click around until I can figure out how it works.
msg1943 (view) Author: eric.smith Date: 2011-03-29.14:47:02
Hit "submit" too soon. I meant to add:

I doubt enough people figure out how to unselect everything in order to justify making this change.
msg1953 (view) Author: r.david.murray Date: 2011-03-31.13:51:58
See issue 386, which certainly seems to indicate this is a real problem :)
msg2352 (view) Author: ezio.melotti Date: 2011-12-13.16:02:43
FWIW I tried to replace the select/option with checkboxes, but the code was starting to get a bit too ugly so I gave up for now.

If I replace
 <td tal:content="structure python:context['keywords'].menu(height=5)">keywords</td>
 <td><tal:block tal:repeat="key context/keywords">
     <input tal:attributes="value python:key._nodeid" name="keywords" type="checkbox">
     <tal:block tal:content="python:str(key._klass.get(key._nodeid, 'name'))" />

I can get a check box for each /selected/ keyword, with its name next to it.
Using str(key._klass.get(key._nodeid, 'name')) to get to the name isn't too pretty already, and getting the list of all the keywords seems even worse.
In there's the code that creates the select/option, and IIUC to get the list of keywords names it does:
        for optionid in options:
            # get the option value, and if it's None use an empty string
            option = linkcl.get(optionid, k) or ''

where options is:
        options = [opt
            for opt in linkcl.filter(None, conditions, sort_on)
            if"View", self._client.userid,
                linkcl.classname, itemid=opt)]

where linkcl is:
        linkcl = self._db.getclass(self._prop.classname)

maybe there's an easy way to do this, but if that's the case I didn't find it.  Putting all this in an extension might avoid some clutter in the template though.

The current code has a <select name="keywords"> and several <option value="N">keyname</option>, where N is the id.  The post request contains all the selected options, e.g. &keywords=2&keywords=3, or if "no selection" is selected, the request should be &keywords=-2,-3 (where 2 and 3 are the ids of the selected keywords).
Having several <input name="keywords" value="N" type="checkbox"> seems to work without having to change the server side but it still won't solve the original problem.

IIUC when you remove the last keyword, no '&keywords=' is sent to the server and in this case, instead of removing all the keywords, it leaves them unchanged.  Therefore you need to select "no selection" in order to send a &keywords=-N that explicitly removes the last keyword.
Date User Action Args
2011-12-13 16:02:43ezio.melottisetnosy: + eric.araujo, ezio.melotti
messages: + msg2352
2011-03-31 13:51:58r.david.murraysetmessages: + msg1953
2011-03-29 14:47:02eric.smithsetmessages: + msg1943
2011-03-29 14:46:10eric.smithsetmessages: + msg1942
2011-03-29 11:21:32r.david.murraysetnosy: + r.david.murray
messages: + msg1941
2011-03-28 19:24:47sandro.tosisetmessages: + msg1939
2011-03-28 19:20:41eric.smithsetstatus: unread -> chatting
nosy: + eric.smith
messages: + msg1938
2011-03-28 19:08:19sandro.tosicreate