coffeescript-ui
Version:
Coffeescript User Interface System
37 lines (29 loc) • 772 B
text/coffeescript
#CUI = require("coffeescript-ui/public/cui.js")
WeatherService = require('./WeatherService.coffee')
htmlTemplate = require('./weather.html')
CUI.Template.loadTemplateText(htmlTemplate)
class Weather extends CUI.Element
initOpts: ->
super()
city:
mandatory: true
check: String
render: ->
template = new CUI.Template
name: "weather"
map:
temperature: true
skytext: true
humidity: true
waitBlock = new CUI.WaitBlock(element: template)
waitBlock.show()
WeatherService.getWeather()
.always =>
waitBlock.destroy()
.done((data) =>
for key of template.map
template.append(data[key], key)
)
template
module.exports = Weather