Skip to content

Instantly share code, notes, and snippets.

@phivk
Last active August 28, 2018 22:11
Show Gist options
  • Save phivk/18365a439a81fad25c2dbe9fbd26a091 to your computer and use it in GitHub Desktop.
Save phivk/18365a439a81fad25c2dbe9fbd26a091 to your computer and use it in GitHub Desktop.
GMAB Sorting Station&
GMAB Sorting Station&
Sorting
user_select sort by Date -> Sorted by Date
user_select sort by Colour -> Sorted by Colour
user_select sort by Views -> Sorted by Views
user_select sort by Size -> Sorted by Size
user_select sort by Title -> Sorted by Title
Sorted by Date
Sorted by Colour
Sorted by Views
Sorted by Size
Sorted by Title
Zoom
Small
user_increase zoom -> Large
Large
user_decrease zoom -> Small
Pan
Left
user_scroll right -> Middle
Middle*
user_scroll left -> Left
user_scroll right -> Right
Right
user_scroll left -> Middle
function render_state(state){
if (state.image_url) {
return $("img",
{
src: state.image_url,
style: {
width: "100px",
margin: "1rem"
}
}
);
}
else {
return $(
"h1",
{
style: {
display: 'inline-block',
width: "12rem",
margin: '1rem',
}
},
state.name
);
}
}
function render_button(model, eventToEmit, buttonText) {
console.log(model);
return $(
'button',
{
style: {
display: 'inline-block',
width: "100px",
margin: '1rem',
},
onClick: function(){ model.emit(eventToEmit) }
},
buttonText
)
}
function render(model){
console.log(model);
return $(
"div",
render_state(model.active_states[0]),
$("br"),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment