Skip to content

Instantly share code, notes, and snippets.

@jgaskins
Last active September 12, 2018 13:05
Show Gist options
  • Save jgaskins/b386c127062697c4b62e75c60939380c to your computer and use it in GitHub Desktop.
Save jgaskins/b386c127062697c4b62e75c60939380c to your computer and use it in GitHub Desktop.
Time travel component for Clearwater+GrandCentral
class TimeTravel
include Clearwater::Component
# @param store [GrandCentral::VersionedStore]
def initialize(store)
@store = store
end
def render
div([
button({ onclick: proc { store.rollback } }, '<'),
input(
type: :range,
oninput: proc { |e|
store.go_to_version e.target.value.to_i
},
),
button({ onclick: proc { store.redo } }, '<'),
" #{store.current_version} / #{store.total_versions}",
])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment