SimpleSlideView icon indicating copy to clipboard operation
SimpleSlideView copied to clipboard

Determine default changeView behavior based on source order

Open tylersticka opened this issue 11 years ago • 4 comments

Currently, the changeView method requires a value for the action argument of either "push" or "pop".

It would be nice if the source order of the views could determine the action to take in cases where that value is not provided. This could be accomplished by comparing the value of @$views.index(@$activeView) with the value of @$views.index($targetView).

This could also allow us to add a new data-attribute, data-changeview, which could do either a push or pop depending on the source order.

tylersticka avatar Apr 22 '14 16:04 tylersticka

@tylersticka I want to be sure I understand: assuming something like a data-changeview attr, when triggered (click by default), is it that the view indicated (as either the value of the attr or in the href attr) should be pushed if it's later in the DOM and popped if it's earlier? Trying to get my head around this!

lyzadanger avatar Apr 22 '14 20:04 lyzadanger

@lyzadanger What you just described is exactly correct. :)

tylersticka avatar Apr 22 '14 21:04 tylersticka

@lyzadanger Also, if you'd like, we could use the major version change to change up that syntax.

One thing I've wondered is if it makes more sense to have a separate data-changeview-direction, or to change up the syntax entirely so it's data-slideview-direction: "push" and always either the href or a data-slideview attribute?

(Typed hurriedly, sorry if it is incoherent.)

tylersticka avatar Apr 22 '14 21:04 tylersticka

This is complete on the v2.0.0 branch.

lyzadanger avatar Apr 25 '14 21:04 lyzadanger