Closed Bug 877467 Opened 8 years ago Closed 8 years ago

Remove "children" markup style from Prompt.jsm.

Categories

(Firefox for Android Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: wesj, Assigned: wesj)

Details

Attachments

(1 file)

I realized as I was writing some examples, the the children style of message I created for Prompt.jsm isn't ideal for what consumers probably want. Right now you can pass something like:

prompt.setSingleChoiceItems([
  { label: "Header", children: [
    {label: "Child"}
  ]}
]).show(function(data) {
  // data.button is the index of the clicked on item
});

Prompt.jsm converts the list from nested arrays a single flat array, where having an "index" for an item makes sense. In the nested for we return it doesn't. We either need to modify the return value we pass to the callback to indicate "Find the first item inside the first item", or just have callers pass in a flat list. I'm going to vote for the later.
Attached patch Patch v1Splinter Review
So... I'm still fighting to not expose the normal syntax here. This makes setListItems just take a flat list. Items can have any of "header", "menu", or "child" attributes to control how they're styled (they are all independent so theoretically you could have a header that was indented as a child, and that had a "more" button on its right hand side). That's opposed to what java (currently) expects, "isGroup", "inGroup" or "isParent".
Attachment #756107 - Flags: review?(mark.finkle)
Comment on attachment 756107 [details] [diff] [review]
Patch v1

This is a sticky situation. In most cases, I don't expect devs to use, as opposed to the simple list. I'm in favor of simplifying though, but being able to get the right return value is even more important.
Attachment #756107 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/950b81e80876
Assignee: nobody → wjohnston
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.