A framework for enabling per-page javascript on multi-page web applications.
===
Include terse.js in your HTML:
<script type="text/javascript" src="/js/terse.js"></script>
Place this fragment of code on the bottom of each page:
<script type="text/javascript">
terse.go("<?php terseJson ?>");
</script>
Provide an object with a controller, action, and params:
PHP:
$terseJson = ["controller": "purchases", "action": "edit", "params": "showPastOrders=false"];
Ruby on Rails:
def index
@terseJson = {:controller => "purchases", :action => "edit", :params => "showPastOrders=false"}
respond_to do |format|
format.html # index.html.erb
end
end
npm install
npm test