-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like a simple syntax for interacting with my data objects (Data Utils) #282
Comments
From discussion on 8/22:
|
The result's (collection or model) toJSON() is added to the view's prepare namespaced by the behavior's alias. i.e. a behavior with the alias demographics that is model-typed will add the demographics model's .toJSON() value to the view's template context as:
a behavior with the alias appointments that is collection-typed will add the appointment collection's .toJSON() value to the view's template context as:
Options:
example configuration:
Behaviors can be pre-configured so you just set the behavior to use along with any deviations from the defaults.
Dependencies between data behaviors:
|
comparison of current API and new one to determine whether it is too verbose / boilerplate-ish:
New:
|
is it worth trying to collapse id(s)/idProperty/criteria into a single configuration property? |
accessing properties:
|
Awesome. Let's talk next Monday about this
|
@kentmw sounds good. |
Notes from Cat:
|
for cache, model and type - it might be worth having 2 behaviors instead of a switch for one behavior. The goal is to specify these things separately:
Options
as for the type I could make those boolean fields (isCollectionResult, isModelResult) but I thought the enum style was more readable. You could just use type: 'collection' or type: 'model', the enums just attempt to reduce spelling issues. |
The two behaviors approach sounds cleaner to me and would clear up the interactions that seemed weird to me with those fields. |
Notes from call on 10/3:
Now:
Updated:
Summary:
|
Updated API:Options:
example configuration:
Behaviors can be pre-configured so you just set the behavior to use along with any deviations from the defaults.
Dependencies between data behaviors:
Existing API vs new APIcomparison of current API and new one to determine whether it is too verbose / boilerplate-ish: Now:
New:
|
Is this redundant when the use of an id vs ids could tell you what is needed? |
id and ids are aliases. returnSingleResult is what things are actually keyed to. we could infer, but I wanted it to be more explicit |
Updated API based on peer review comments:Options:
example configuration:
Behaviors can be pre-configured so you just set the behavior to use along with any deviations from the defaults.
Dependencies between data behaviors:
Existing API vs new APIcomparison of current API and new one to determine whether it is too verbose / boilerplate-ish: Now:
New:
|
api update question... should we change |
that would also open us up to using any property of the view as an idContainer and still use the simple string syntax:
|
I'm down
…On Thu, Dec 15, 2016 at 4:27 PM Josh Young ***@***.***> wrote:
that would also open us up to using any property of the view as an
idContainer and still use the simple string syntax:
someOtherModel:visitIds
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#282 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaBnN0G6oC4ixf4axBaHt6bKX2o9FZ8ks5rIbCkgaJpZM4JqdR3>
.
|
Review of tonicdev: "IdContainers can also hold the properties as fields on themselves. This is useful when the id values do not change over the lifetime of the idContainer. In this case nested properties are not supported." "Configuring ids using a string description." should be made to look like title "To use a property that is defined on the view as a field just specify the name of the property in the ids configuration:" make "on the view" bold "Note: Due to the duck-typing involved in allowing a single String id we have to use the additional construct of an object containing a field named 'property' for identifying a property using a simple string." add "instead of using the string directly" or some jazz "Supported string identifiable idContainers are:
The long set of code examples after "Supported string identifiable idContainers..." should either have comments that title each example or broken into their own code blocks. Consider adding titles to break up consistent chunks |
I can't figure out how to style stuff in the text - there is an open issue on the forums to add markdown, but the reply was effectively 'not done yet' |
Fang brought up a good question that might be worth revisiting. Would it be worth sacrificing the ability to programatically switch between returnSingleResult true/false (without a .setReturnSingleResult method) for .data to actually be the private collection (when returnSingleResult is false) or something closer to the model (when returnSingleResult is true)? Another option that we talked about is to have 2 different behaviors. One for collection results and one for single results. That completely nukes being able to switch, but it does make the API more precise and allows .data for collection results to just be the private collection directly. And I'm not even sure it make sense to be able to switch between return single result true/false. thoughts? |
Updated API based on changing the separator between idContainer and property from '.' to ':':Options:
example configuration:
Behaviors can be pre-configured so you just set the behavior to use along with any deviations from the defaults.
Dependencies between data behaviors:
Existing API vs new APIcomparison of current API and new one to determine whether it is too verbose / boilerplate-ish: Now:
New:
|
docs are up at https://runkit.com/torso/databehavior/0.0.5 - please review if you have time. |
Comments on 0.0.7 of docs.
** 'viewState' -> idContainer -> viewState
{
|
Should it be a behavior or built-in to the View?
If behavior, one behavior per data object or one behavior per view?
The text was updated successfully, but these errors were encountered: