Open Bug 1009561 Opened 6 years ago Updated Last year

Consider adding ItemType options to panels

Categories

(Firefox for Android :: Awesomescreen, defect)

All
Android
defect
Not set

Tracking

()

People

(Reporter: lucasr, Unassigned)

References

(Blocks 1 open bug)

Details

Right now, we define the itemtype for a view by using the Item 'enum':

{
  title: gStrings.GetStringFromName("title"),
  views: [
    { type: Home.panels.View.GRID,
      itemType: Home.panels.Item.IMAGE,
      dataset: DATASET_ID }
  ]
};

It would be nice if we could set certain options to configure the items in a view instead of having to create separate item types with small layout veriations. One way to go about this could be to allow add-on developers to optionally define itemType as an object:


{
  title: gStrings.GetStringFromName("title"),
  views: [
    { type: Home.panels.View.GRID,
      itemType: {
         type: Home.panels.Item.IMAGE,
         defaultTitle: gStrings.GetStringFromName("defaultTitle"),
         maxDescriptionLength: 30 
      },
      dataset: DATASET_ID }
  ]
};

Thoughts?
I think this sounds like a good idea. My only concern is bogging down the API with more complicated options, but we can use sensible defaults to counteract that, like how you can omit itemType entirely right now.

I like the idea of default title, but what about other defaults, like a default icon? Adding yet another nested object sounds we might be taking things too far. Perhaps we shouldn't include default data types and leave it up to the add-on's storage logic to take care of that.

I think a good way to start would be just implementing a maximum description length, which would fix the issue reported in bug 1010359. I'm not sure if we should set a specific maximum description, or just disable ellipsizing. I think disabling ellipsizing would be better, since add-on developers could just enforce a max description length when storing their data.
You need to log in before you can comment on or make changes to this bug.