hyunsupul / aesop-core

Open-sourced suite of components that empower interactive storytelling in WordPress.
http://aesopstoryengine.com
GNU General Public License v2.0
244 stars 56 forks source link

Implement Conditional Option Loading #135

Open bearded-avenger opened 10 years ago

bearded-avenger commented 10 years ago

The Idea: Hide un-necessary options until the user decides to activate the option. Think Gravity Forms conditional option loading.

My first pass at this was mostly working, however it's hardcoded JS and no easy way for 3rd party plugins to interact with this. The code is in fact in core and still commented out. The issue, is that the "settings view" is pretty much the same for each component. Meaning, which a component is selected, the "view" is the same, with the difference of the new options just being shown.

The issue comes into play, when you have more than one of the same component. This isn't the best way to handle this obviously, so I'd like to investigate a more fool-proof way of this working.

An idea was to utilize the existing option array; for example.

'myoption' => array(
    'depends_on'            => 'name_of_option',
    'depends_on_value' => 'seven'
)

In this scenario, the option would only load if the name_of_option value was seven.

michaelbeil commented 10 years ago

Just saw this. Could be a great feature. anymore thoughts on it?

bearded-avenger commented 10 years ago

Nope! Just need to start on it! May lean on @etcook for this one though. His list is building LOL.

michaelbeil commented 10 years ago

@etcook needs more stacked on his plate.

etcook commented 10 years ago

What am I, a goose? Are you trying to make foie gras?

bearded-avenger commented 10 years ago

googles fois gras

michaelbeil commented 10 years ago

same here

bearded-avenger commented 10 years ago

Just a progress report on this.

  1. The code I wrote is based on cookies, it works but there's currently no way to account for multiple instances.
  2. My second pass was just based on checking the status of opts on load. However, the settings panel is empty on load, until the component is clicked.

This all seems like hax0ry when I think we should really do it right, through options array and handling dynamically.

Punting to 1.4

michaelbeil commented 10 years ago

sounds like a plan.

etcook commented 10 years ago

@bearded-avenger http://api.jquery.com/on/

bearded-avenger commented 10 years ago

on craick?