-Editor.prototype.setupUI = function() {
- // set up the UI visually and attach callbacks
- var self = this;
-
- self.rootDiv.makeHorizPanel({}); // TODO: this probably doesn't belong into jQuery
- // self.rootcDiv.css('top', ($('#header').outerHeight() ) + 'px');
-
- $('#panels > *.panel-wrap').each(function() {
- var panelWrap = $(this);
- $.log('wrap: ', panelWrap);
- var panel = new Panel(panelWrap);
- panelWrap.data('ctrl', panel); // attach controllers to wraps
- panel.load($('.panel-toolbar select', panelWrap).val());
-
- $('.panel-toolbar select', panelWrap).change(function() {
- var url = $(this).val();
- self.savePanelOptions();
- panelWrap.data('ctrl').load(url);
- });
-
- $('.panel-toolbar button.refresh-button', panelWrap).click(
- function() {
- panel.refresh();
- } );
- });
-
- $(document).bind('panel:contentChanged', function() {
- self.onContentChanged.apply(self, arguments)
- });
-
- $('#toolbar-button-save').click( function (event, data) {
- self.saveToBranch();
- } );
-
- $('#toolbar-button-update').click( function (event, data) {
- if (self.updateUserBranch()) {
- // commit/update can be called only after proper, save
- // this means all panels are clean, and will get refreshed
- // do this only, when there are any changes to local branch
- self.refreshPanels();
- }
- } );
-
- $('#toolbar-button-commit').click( function (event, data) {
- self.sendPullRequest();
- event.preventDefault();
- event.stopPropagation();
- return false;
- } );
- self.rootDiv.bind('stopResize', function() {
- self.savePanelOptions()
- });
-}
-