InlineEditor should support default text

Bug #396681 reported by Barry Warsaw
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LAZR Javascript Library
Fix Released
Undecided
Barry Warsaw
Launchpad itself
Fix Released
High
Barry Warsaw

Bug Description

Use case:

Product.programminglang can be None when nothing has been set yet. When showing the programming languages and allowing inline editing, I want to display "Not yet specified" as the default text. As soon as the edit button is clicked though, I want the edit field to be cleared. If the edit is canceled, the widget should display "Not yet specified" again. If the field has a value, either because it's initial value was not None or because the user edited it inline, then the value should be shown as the text.

Here's some thoughts captured from IRC:

<mars> barry, ok, so you want to decouple the inline editor from the on-page text, if the on-page text is the default value
<mars> barry, should be simple: add an attribute "defaultValue" to the EditableText (not the inline editor)
<mars> barry, and then you would certainly need to work with the show/hide state changes, or set the default editor state
<mars> barry, I think setting the default editor state may be cleaner, and then on hide, check the editor's value - if it is 'null', show the default text again
<mars> barry, well, null or ""
<barry> mars: that sounds about right
<barry> mars: although it also sounds like enough work to not want to do it in this branch ;0
<mars> null or "" or s.replace(' ', '')
<mars> barry, true, but if you do write a new branch, it should be small
<mars> and cohesive
<barry> mars: right. it's a lazr-js change though so it would have to be separate anyway
<mars> barry, make that "defaultText", not "defaultValue" - you want to show the defaultText if the editor has the defaultValue :)

Barry Warsaw (barry)
Changed in launchpad-registry:
assignee: nobody → Barry Warsaw (barry)
importance: Undecided → High
milestone: none → 2.2.7
status: New → Triaged
Barry Warsaw (barry)
Changed in launchpad-registry:
status: Triaged → In Progress
Barry Warsaw (barry)
Changed in launchpad-registry:
status: In Progress → Fix Committed
Changed in lazr-js:
assignee: nobody → Barry Warsaw (barry)
status: New → Fix Committed
Curtis Hovey (sinzui)
tags: added: story-guided-project-registration
Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 396681 Fix released

Fixed released in Launchpad sinzui.

Changed in launchpad-registry:
status: Fix Committed → Fix Released
Barry Warsaw (barry)
Changed in lazr-js:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.