View Single Post
Old 07-23-2016, 11:27 AM   #38
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@Kovid: I should have remembered that you would think that way about adding significant "stuff" to the database. After all, we had that discussion recently. Apologies for bringing it up again, albeit indirectly.

I pulled the changes and (what a surprise ) they work.

I note that 'interpret_as' is overloaded to control on which side of book details the column appears, with short-text appearing on the left and the other three (html, long-text, and markdown) appearing on the right. This means that I cannot have a column containing only a hyperlink or some other short HTML item appear with a label in the left side of the panel.

I see why you didn't choose to use show_heading to determine which side of book details the items appears. That would overload its meaning in the same way "interpret_as" is being overloaded, removing an option that is useful.

The question: does it make sense to you to have another boolean to indicate that the item is to be shown on the left in book details? The boolean widget would be enabled only if show_label is true, or alternatively checking it would force show_label to be true. As far as I can see, the new boolean would be used only in render.py near line 101, where a choice is made to use ans.append instead of adding the value (and the label) to the list of comments. Something like:
Code:
                    if disp.get('show_heading'):
                        if disp.get('show_on_left'):
                            ans.append((field, row % (name, val)))
                            continue
                        val = '<h3 class="comments-heading">%s</h3>%s' % (p(name), val)
I tested it by using disp.get('show_on_left', True).

If you think this is an OK change to make but don't want to do it yourself, I can do it. It should touch only the column creation code and render.py.

EDIT: The changes were easy enough that I went ahead and pushed them.

Last edited by chaley; 07-23-2016 at 12:21 PM.
chaley is offline   Reply With Quote