From 451ba1c01b8e0c2120f33ab3994bfc38b0037fbf Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Mon, 8 Jun 2015 12:05:04 +0800 Subject: [PATCH] panel rows adjust to span the number of visible columns --- .../admin/index_utils/directives/panel_row.js.coffee | 6 +++++- app/assets/javascripts/templates/admin/panel.html.haml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/index_utils/directives/panel_row.js.coffee b/app/assets/javascripts/admin/index_utils/directives/panel_row.js.coffee index bc14ddbe75..40a5062a27 100644 --- a/app/assets/javascripts/admin/index_utils/directives/panel_row.js.coffee +++ b/app/assets/javascripts/admin/index_utils/directives/panel_row.js.coffee @@ -1,4 +1,4 @@ -angular.module("admin.indexUtils").directive "panelRow", (Panels) -> +angular.module("admin.indexUtils").directive "panelRow", (Panels, Columns) -> restrict: "C" templateUrl: "admin/panel.html" scope: @@ -7,6 +7,10 @@ angular.module("admin.indexUtils").directive "panelRow", (Panels) -> link: (scope, element, attrs) -> scope.template = "" selected = null + scope.columnCount = Columns.visibleCount + + scope.$on "columnCount:changed", (event, count) -> + scope.columnCount = count setTemplate = -> if selected? diff --git a/app/assets/javascripts/templates/admin/panel.html.haml b/app/assets/javascripts/templates/admin/panel.html.haml index fac75a4fea..be0c98109f 100644 --- a/app/assets/javascripts/templates/admin/panel.html.haml +++ b/app/assets/javascripts/templates/admin/panel.html.haml @@ -1,2 +1,2 @@ -%td{ colspan: 4 } +%td{ colspan: "{{columnCount}}" } .panel{ ng: { include: "template" } }