diff --git a/Gemfile.lock b/Gemfile.lock index b857286..bf9349d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -230,7 +230,7 @@ GEM activesupport (= 4.0.5) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.1) + rake (10.3.2) ransack (1.2.3) actionpack (>= 3.0) activerecord (>= 3.0) diff --git a/app/assets/javascripts/updateChart.js b/app/assets/javascripts/updateChart.js index 6bc27eb..078bdf7 100644 --- a/app/assets/javascripts/updateChart.js +++ b/app/assets/javascripts/updateChart.js @@ -123,26 +123,18 @@ function setupColumns(current_user, channel_id) { function createWindowsWithData (data, current_user, channel_id, colName) { for (var i in data) { - //each array element has a single chart object as an associative array with the type as the key - // so I need to iterate over a array with size=1 to get a string with the window type - for (var type in data[i]) { - var wtype = type; - } - if (data[i].chart_window) window = data[i].chart_window; - if (data[i].plugin_window) window = data[i].plugin_window; - if (data[i].portlet_window) window = data[i].portlet_window; - if (window == "undefined") - var window = (data[i].portlet_window) ? data[i].portlet_window : data[i].chart_window; + // set the window and window_type + var window = data[i].window; + var window_type = window.window_type; colId = window.col; title = window.title; var content = window.html; - if (data[i].chart_window) { - var windowId = window.id; - $("body").append("
"); - } - var portlet = addWindow(colName, colId, window.id, wtype, title, content); + if (window.window_type === 'chart') { + $("body").append(""); + } + var portlet = addWindow(colName, colId, window.id, window_type, title, content); portlet.each ( decoratePortlet(current_user) ) ; portlet.find( ".ui-toggle" ).click( uiToggleClick ); @@ -157,10 +149,10 @@ var createWindows = function (current_user, channel_id, colName) { }; } -function addWindow(colName, colId, windowId, wtype, title, content) { +function addWindow(colName, colId, windowId, window_type, title, content) { $("#"+colName+"_dialog"+colId).append('