Skip to content

Commit

Permalink
Merge pull request getredash#155 from EverythingMe/vis-fix
Browse files Browse the repository at this point in the history
[getredash#144] Allow users to edit raw JSON visualization options
  • Loading branch information
arikfr committed Mar 26, 2014
2 parents a503e20 + 55167ad commit ecb80df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rd_ui/app/scripts/directives/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@
ngModel.$parsers.push(into);
ngModel.$formatters.push(out);

scope.$watch(attr.ngModel, function(newValue) {
element[0].value = out(newValue);
}, true);
}
};
});
Expand Down
1 change: 1 addition & 0 deletions rd_ui/app/scripts/visualizations/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
visualization: '=?'
},
link: function (scope, element, attrs) {
scope.editRawOptions = currentUser.hasPermission('edit_raw_chart');
scope.visTypes = Visualization.visualizationTypes;

scope.newVisualization = function(q) {
Expand Down
5 changes: 5 additions & 0 deletions rd_ui/app/views/visualizations/edit_visualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

<visualization-options-editor></visualization-options-editor>

<div class="form-group" ng-if="editRawOptions">
<label class="control-label">Advanced</label>
<textarea json-text ng-model="visualization.options" class="form-control" rows="10"></textarea>
</div>

<div class="form-group">
<button type="submit" class="btn btn-primary">Save</button>
</div>
Expand Down

0 comments on commit ecb80df

Please sign in to comment.