first step - send maintenance message to maintenance widget via UI

This commit is contained in:
Johannes Nickel 2013-06-08 15:12:28 +02:00
parent a7986fdbc1
commit b801fba146
3 changed files with 47 additions and 3 deletions

View file

@ -0,0 +1,21 @@
class App.Maintenance extends App.ControllerContent
events:
'submit form': 'sendMessage'
constructor: ->
super
# render page
@render()
render: ->
@html App.view('maintenance')()
sendMessage: (e) ->
e.preventDefault()
params = @formParam(e.target)
console.log(params)
App.Event.trigger('session:maintanance', {title: params.HeaderText, message: params.Message})
App.Config.set( 'maintenance', App.Maintenance, 'Routes' )
App.Config.set( 'maintenance', { prio: 3600, parent: '#admin', name: 'Maintenance Message', target: '#maintenance', role: ['Admin'] }, 'NavBar' )

View file

@ -5,6 +5,7 @@ class App.MaintananceWidget extends App.Controller
# bind on event to show message # bind on event to show message
App.Event.bind 'session:maintanance', (data) => App.Event.bind 'session:maintanance', (data) =>
console.log('hannes was here') console.log('hannes was here')
new Message(data)
class Message extends App.ControllerModal class Message extends App.ControllerModal
@ -14,14 +15,14 @@ class Message extends App.ControllerModal
render: -> render: ->
@html App.view('modal')( @html App.view('modal')(
title: 'Maintanance Message', title: @title,
message: @message message: @message
detail: @detail detail: @detail
close: @close close: @close
) )
@modalShow( @modalShow(
backdrop: false, backdrop: true,
keyboard: false, keyboard: true,
) )
App.Config.set( 'maintanance', App.MaintananceWidget, 'Widgets' ) App.Config.set( 'maintanance', App.MaintananceWidget, 'Widgets' )

View file

@ -0,0 +1,22 @@
<div class="page-header">
<h1>Maintenance Message<small></small></h1>
</div>
<form class="form-horizontal" id="maintenanceForm">
<div class="control-group">
<label class="control-label" for="HeaderText">Header Text</label>
<div class="controls">
<input type="text" id="HeaderText" name="HeaderText" placeholder="Header Text">
</div>
</div>
<div class="control-group">
<label class="control-label" for="Message">Message</label>
<div class="controls">
<textarea id="Message" name="Message" class="" rows="8" placeholder="Maintenance Message"></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Send Message</button>
</div>
</div>
</form>