This is a simple calc project using OPFCLI
<div class="hero-unit">
<form name="formx">
<input type=text size=4 value=12 name="a">
<input type="button" value=" + " onClick="suma(this.form)">
<input type="button" value=" - " onClick="resta(this.form)">
<input type="button" value=" x " onClick="multiplica(this.form)">
<input type="button" value=" / " onClick="divide(this.form)">
<input type="number" size=4 value=3 name="b"> = <input type "number" value=0 name="ans" size=9>
</form>
</div>
require('lib/setup')
Spine = require('spine')
GeneralModal = require("modals/generalModal")
class App extends Spine.Controller
@extend Spine.Controller.ModalController
events:
"click .btn1" : "suma"
constructor: ->
super
@setupModal()
@html require("views/layout")
suma = (form) ->
a = eval_(form.a.value)
b = eval_(form.b.value)
c = a + b
form.ans.value = c
resta = (form) ->
a = eval_(form.a.value)
b = eval_(form.b.value)
c = a - b
form.ans.value = c
multiplica = (form) ->
a = eval_(form.a.value)
b = eval_(form.b.value)
c = a * b
form.ans.value = c
divide = (form) ->
a = eval_(form.a.value)
b = eval_(form.b.value)
c = a / b
form.ans.value = c
a_pow_b = (form) ->
a = eval_(form.a.value)
b = eval_(form.b.value)
c = Math.pow(a, b)
form.ans.value = c
module.exports = App