From 22dc319d4bb62aa1bb045313b869b8581ac6a916 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Mon, 18 May 2015 18:24:15 +0300 Subject: view/toolbar__status: refactoring out view --- src/client/view/toolbar__status.js | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/client/view/toolbar__status.js (limited to 'src/client/view') diff --git a/src/client/view/toolbar__status.js b/src/client/view/toolbar__status.js new file mode 100644 index 00000000..a0c5cef0 --- /dev/null +++ b/src/client/view/toolbar__status.js @@ -0,0 +1,45 @@ +"use strict" + +/** + * Manage backend websocket connection + */ +define(['jquery'], +function($) { + + var close_btn, + toolbar__status; + + function toolbar__status() { + + close_btn = $('
x
'); + close_btn.addClass('toolbar__close_btn'); + + toolbar__status = $('#status-bar'); + toolbar__status.append(close_btn); + } + + /** + * display given HTML fragment as status line body + */ + function display_html_frag(toolbar__status_body) { + toolbar__status.children().remove(); + + toolbar__status.append(close_btn); + toolbar__status.append(toolbar__status_body); + toolbar__status_body.addClass('status-bar__body'); + + close_btn.click(function() { + toolbar__status.hide(); + }); + + toolbar__status.show(); + } + + toolbar__status(); + + return { + display_html_frag : display_html_frag, + hide: toolbar__status.hide + }; + +}); -- cgit v1.3.1