Skip to content

Commit

Permalink
FIX Update GridField.js so it works with new Archive View (silverstri…
Browse files Browse the repository at this point in the history
…pe#559)

* Create archive admin

* Add navigation of other versioned objects in archive via dropdown

* Refactor to extend ModelAdmin, so that we can leverage per model tabs

* Detect which tabs to show

* Add i18n strings, better styling for Other section with message

* Improve messaging, abstract restore action, improve security checks

* Move changes to versioned-admin module

* Remove irrelevant eslintignore reference

* More removal, update bundle

* Make GridField message func widely available
  • Loading branch information
Luke Edwards authored and maxime-rainville committed Jul 12, 2018
1 parent 730fc42 commit a8e5616
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions client/src/legacy/GridField.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ $.entwine('ss', function($) {
return false;
}

var editLink = this.find('.edit-link');
if(editLink.length) this.getGridField().showDetailView(editLink.prop('href'));
var formLink = this.find('.edit-link, .view-link');
if(formLink.length) this.getGridField().showDetailView(formLink.prop('href'));
},
onmouseover: function() {
if(this.find('.edit-link').length) this.css('cursor', 'pointer');
if(this.find('.edit-link, .view-link').length) this.css('cursor', 'pointer');
},
onmouseout: function() {
this.css('cursor', 'default');
Expand Down Expand Up @@ -314,9 +314,26 @@ $.entwine('ss', function($) {
filterState='hidden';
}

this.getGridField().reload({
data: [{name: this.attr('name'), value: this.val(), filter: filterState}]
});
const successCallback = function(data, status, response) {
const messageText = response.getResponseHeader('X-Message-Text');
const messageType = response.getResponseHeader('X-Message-Type');
if (messageText && messageType) {
$("#Form_EditForm_error").addClass(messageType);
$("#Form_EditForm_error").html(messageText);
$("#Form_EditForm_error").show();
}
}

this.getGridField().reload(
{
data: [{
name: this.attr('name'),
value: this.val(),
filter: filterState
}],
},
successCallback
);

e.preventDefault();
},
Expand Down

0 comments on commit a8e5616

Please sign in to comment.