FLUID-823: Provide a means for centrally storing component defaults instead of using .prototype

Metadata

Source
FLUID-823
Type
New Feature
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Colin Clark
Reporter
Colin Clark
Created
2008-06-25T19:41:10.000-0400
Updated
2011-02-22T16:27:54.069-0500
Versions
  1. 0.1
  2. 0.3
  3. 0.4beta1
  4. 0.4
Fixed Versions
  1. 0.4
Component
  1. Framework

Description

Typical components currently attach their default values (such as style names and element selectors) to their constructor function's prototype. As we move into an architectural approach where prototypes and this are not regularly used, we need a central place to put default values for components.

Comments

  • Colin Clark commented 2008-06-25T19:49:25.000-0400

    This patch adds a simple new method to Fluid.js that provides a way of storing and accessing defaults. Here's how it might be used:

    fluid.defaults("tabs", {
    selectors: {
    tabContainer: "#tabs",
    tabs: "#tabs > li",
    panels: "#panels > div"
    },

    styles: {
    selected: "selected",
    highlighted: "highlighted"
    }
    });

  • Colin Clark commented 2008-06-25T19:49:52.000-0400

    These are the unit tests for fluid.defaults().

  • Anastasia Cheetham commented 2008-06-27T16:12:05.000-0400

    Colin, this looks good to me. Do we want to add some global definition of component names for the components we're working on? To prevent, say, inlineedit vs. inline-edit vs. inline_edit...

  • Antranig Basman commented 2008-08-08T21:18:23.000-0400

    I suggest that the component name simply be the name of the global function which is used to create it. This will start to harmonise with our "mini-IoC" structure emerging from things like fluid.invokeGlobalFunction etc.

  • Colin Clark commented 2008-09-02T12:37:29.000-0400

    Agreed, and this is how our components currently use the defaults store.

  • Michelle D'Souza commented 2011-02-22T16:27:54.067-0500

    Closing issues that were resolved for 1.0 and earlier releases.