Merge branch 'feature/maintenance_message' into develop
This commit is contained in:
commit
b0ffaf1e5a
3 changed files with 76 additions and 0 deletions
26
app/assets/javascripts/app/controllers/maintenance.js.coffee
Normal file
26
app/assets/javascripts/app/controllers/maintenance.js.coffee
Normal file
|
@ -0,0 +1,26 @@
|
|||
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)
|
||||
App.Event.trigger(
|
||||
'ws:send'
|
||||
action: 'broadcast'
|
||||
event: 'session:maintenance'
|
||||
spool: false
|
||||
data: {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' )
|
|
@ -0,0 +1,28 @@
|
|||
class App.MaintenanceWidget extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# bind on event to show message
|
||||
App.Event.bind 'session:maintenance', (data) =>
|
||||
console.log('hannes was here')
|
||||
new Message(data)
|
||||
|
||||
|
||||
class Message extends App.ControllerModal
|
||||
constructor: ->
|
||||
super
|
||||
@render()
|
||||
|
||||
render: ->
|
||||
@html App.view('modal')(
|
||||
title: @title,
|
||||
message: @message
|
||||
detail: @detail
|
||||
close: @close
|
||||
)
|
||||
@modalShow(
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
)
|
||||
|
||||
App.Config.set( 'maintenance', App.MaintenanceWidget, 'Widgets' )
|
22
app/assets/javascripts/app/views/maintenance.jst.eco
Normal file
22
app/assets/javascripts/app/views/maintenance.jst.eco
Normal 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 btn-primary submit">Send Message</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Reference in a new issue