Skip to content

Commit

Permalink
#671: Improve chart editor UI/UX
Browse files Browse the repository at this point in the history
  • Loading branch information
alonho committed Nov 30, 2015
1 parent 8d20180 commit 3b24f56
Show file tree
Hide file tree
Showing 10 changed files with 434 additions and 339 deletions.
1 change: 1 addition & 0 deletions rd_ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<script src="/bower_components/leaflet/dist/leaflet.js"></script>
<script src="/bower_components/angular-bootstrap-show-errors/src/showErrors.js"></script>
<script src="/bower_components/d3/d3.min.js"></script>
<script src="/bower_components/angular-ui-sortable/sortable.js"></script>
<!-- endbuild -->

<!-- build:js({.tmp,app}) /scripts/scripts.js -->
Expand Down
1 change: 1 addition & 0 deletions rd_ui/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ angular.module('redash', [
'angular-growl',
'angularMoment',
'ui.bootstrap',
'ui.sortable',
'smartTable.table',
'ngResource',
'ngRoute',
Expand Down
30 changes: 30 additions & 0 deletions rd_ui/app/scripts/directives/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,34 @@
}
};
});

directives.directive('onDestroy', function () {
/* This directive can be used to invoke a callback when an element is destroyed,
A useful example is the following:
<div ng-if="includeText" on-destroy="form.text = null;">
<input type="text" ng-model="form.text">
</div>
*/
return {
restrict: "A",
scope: {
onDestroy: "&",
},
link: function(scope, elem, attrs) {
console.log(scope.onDestroy);
scope.$on('$destroy', function() {
scope.onDestroy();
});
}
};
});

directives.directive('colorBox', function () {
return {
restrict: "E",
scope: {color: "="},
template: "<span style='width: 12px; height: 12px; background-color: {{color}}; display: inline-block; margin-right: 5px;'></span>"
};
});

})();
19 changes: 18 additions & 1 deletion rd_ui/app/scripts/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,21 @@ angular.module('redash.filters', []).
}
return $sce.trustAsHtml(text);
}
}]);
}])

.filter('remove', function() {
return function(items, item) {
if (items == undefined)
return items;
if (item instanceof Array) {
var notEquals = function(other) { return item.indexOf(other) == -1; }
} else {
var notEquals = function(other) { return item != other; }
}
var filtered = [];
for (var i = 0; i < items.length; i++)
if (notEquals(items[i]))
filtered.push(items[i])
return filtered;
};
});

0 comments on commit 3b24f56

Please sign in to comment.