Skip to content

Instantly share code, notes, and snippets.

@kitlangton
Created July 3, 2015 03:51
Show Gist options
  • Save kitlangton/2b537ff4c6ded45501e4 to your computer and use it in GitHub Desktop.
Save kitlangton/2b537ff4c6ded45501e4 to your computer and use it in GitHub Desktop.
module Main
class BoxesController < Volt::ModelController
model :store
def create_box
boxes << Box.new(width: 100, height: 100)
end
def delete_boxes
boxes.reverse.map(&:destroy)
end
end
end
<:Title>
boxes index
<:Body>
<h1>Boxes</h1>
<button e-click="create_box">Create Box</button>
<button e-click="delete_boxes">Delete Boxes</button>
<div class="boxes-container">
{{ _boxes.each do |box| }}
<:box model="{{ box }}">
{{ end }}
</div>
<:Box>
<div class="box">
Box
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment