From d46739142e5589ae18d1c8c995715763c27671be Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Fri, 7 Jun 2013 16:58:43 +0200 Subject: [PATCH 1/3] transfer --- .../controllers/maintenance_widget.js.coffee | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/assets/javascripts/app/controllers/maintenance_widget.js.coffee diff --git a/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee new file mode 100644 index 000000000..16213578f --- /dev/null +++ b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee @@ -0,0 +1,25 @@ +class App.MaintananceWidget extends App.Controller + constructor: -> + super + + # bind on event to show message + App.Event.bind 'session:maintanance', (data) => + console.log('hannes was here') + + +class Message extends App.ControllerModal + constructor: -> + super + @render() + + render: -> + @html App.view('modal')( + title: 'Maintanance Message', + message: @message + detail: @detail + close: @close + ) + @modalShow( + backdrop: false, + keyboard: false, + ) From db0922e95630a17c5579e7539e7df88bf42e11bf Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 7 Jun 2013 17:01:46 +0200 Subject: [PATCH 2/3] Added missing widget registration. --- .../javascripts/app/controllers/maintenance_widget.js.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee index 16213578f..206f463d3 100644 --- a/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee +++ b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee @@ -1,7 +1,7 @@ class App.MaintananceWidget extends App.Controller constructor: -> super - + # bind on event to show message App.Event.bind 'session:maintanance', (data) => console.log('hannes was here') @@ -23,3 +23,5 @@ class Message extends App.ControllerModal backdrop: false, keyboard: false, ) + +App.Config.set( 'maintanance', App.MaintananceWidget, 'Widgets' ) From 2cbdb49e0629fda4d7546da0fd891a1009c23b55 Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Sat, 8 Jun 2013 15:12:28 +0200 Subject: [PATCH 3/3] first step - send maintenance message to maintenance widget via UI --- .../app/controllers/maintenance.js.coffee | 21 ++++++++++++++++++ .../controllers/maintenance_widget.js.coffee | 7 +++--- .../javascripts/app/views/maintenance.jst.eco | 22 +++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/app/controllers/maintenance.js.coffee create mode 100644 app/assets/javascripts/app/views/maintenance.jst.eco diff --git a/app/assets/javascripts/app/controllers/maintenance.js.coffee b/app/assets/javascripts/app/controllers/maintenance.js.coffee new file mode 100644 index 000000000..682e807d3 --- /dev/null +++ b/app/assets/javascripts/app/controllers/maintenance.js.coffee @@ -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' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee index 206f463d3..9b927e8bf 100644 --- a/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee +++ b/app/assets/javascripts/app/controllers/maintenance_widget.js.coffee @@ -5,6 +5,7 @@ class App.MaintananceWidget extends App.Controller # bind on event to show message App.Event.bind 'session:maintanance', (data) => console.log('hannes was here') + new Message(data) class Message extends App.ControllerModal @@ -14,14 +15,14 @@ class Message extends App.ControllerModal render: -> @html App.view('modal')( - title: 'Maintanance Message', + title: @title, message: @message detail: @detail close: @close ) @modalShow( - backdrop: false, - keyboard: false, + backdrop: true, + keyboard: true, ) App.Config.set( 'maintanance', App.MaintananceWidget, 'Widgets' ) diff --git a/app/assets/javascripts/app/views/maintenance.jst.eco b/app/assets/javascripts/app/views/maintenance.jst.eco new file mode 100644 index 000000000..f4b75acb9 --- /dev/null +++ b/app/assets/javascripts/app/views/maintenance.jst.eco @@ -0,0 +1,22 @@ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
\ No newline at end of file