Okay, so the RSS tools in their current state work beautifully, but ALS and DRS don't like the way my form does save-confirmation. So, being programmers, the immediate thought is "can we make one thing that does this all over?" That way, there'd be One Way To Do It, and people wouldn't have room to have flame wars about which was more intuitive.
So with input from ALS and DRS, here's my thought:
All tracked data must be input by a big pile of JSON:
{mytabs: {
mytab1: {
},
mytab2: {
}
}};
We can check whether an item has changed by naming the field in the input and giving some data:
hasChanged('mytabs.mytab1.myfield', 'newfieldvalue')
We can say "yup, let's keep that change" by calling...
dirty.setDirty('mytabs.mytab1.myfield', 'newfieldvalue')
(or maybe later)
dirty.setClean('mytabs.mytab1.myfield')
Then later, we can say
dirty.getValues()
to get a JSON structure of all the things that we claim have changed. That will get passed to a save script, and all will be well.
{mytabs: { mytab1: { myfield: newfieldvalue } } }
In the general case, the programmer will want to attach onChanged handlers to input fields and just call if(hasChanged) setDirty else setClean.
In the more complicated case, it's still flexible enough that you can do your own custom logic (translate a bunch of listbox widgets into some json and check things). So it makes easy things easy and hard things possible.
We might be able to specify a default kind of helper, like...
onChanged = simple_dirty_checker(original_data,change_tracker);
for the simple cases.
Anyways, that will take a little while to write. But I think I've documented what I want it to do, and it should be awesomeness.
No comments:
Post a Comment