Skip to content

Commit

Permalink
verify if the UI requires options to be set. directus#1205
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Jul 19, 2016
1 parent a1909e4 commit 6fab07c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/modules/settings/views/TablesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ function(app, Backbone, Directus, BasePageView, TableModel, ColumnModel, UIManag
app.router.removeOverlayPage(that); //, {title: 'Add new column', stretch: true}
that.collection.add(that.model);
that.collection.trigger('change');
openFieldUIView(data);

// Verify whether the UI requires options to be set
// in order to work.
var ui = UIManager._getUI(data.options.get('id'));
if (ui.requireVariables === true) {
openFieldUIOptionsView(data);
}
}});
}
},
Expand Down Expand Up @@ -519,7 +525,7 @@ function(app, Backbone, Directus, BasePageView, TableModel, ColumnModel, UIManag
editUI: function(e) {
var id = e.target.getAttribute('data-id');
var column = this.collection.get(id);
openFieldUIView(column);
openFieldUIOptionsView(column);
},

editRelationship: function(e) {
Expand Down Expand Up @@ -995,7 +1001,7 @@ function(app, Backbone, Directus, BasePageView, TableModel, ColumnModel, UIManag
}
});

function openFieldUIView(column) {
function openFieldUIOptionsView(column) {
var model = column.options;
model.set({id: column.get('ui')});
var schema = app.schemaManager.getColumns('ui', model.id);
Expand Down

0 comments on commit 6fab07c

Please sign in to comment.