Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25777625
--- Diff: app/addons/documents/views-changes.js ---
@@ -18,108 +18,51 @@ define([
// Libs
"addons/fauxton/components",
'addons/documents/changes/components.react',
-
- // Plugins
- "plugins/prettify"
+ 'addons/documents/changes/actions'
],
-function(app, FauxtonAPI, Components, Changes, prettify, ZeroClipboard) {
+function(app, FauxtonAPI, Components, Changes, ChangesActions) {
var Views = {};
- // wrapper for React component. The wrapper allows us to tie the React
component into the Fauxton
+ // wrappers for React components. The wrapper allows us to tie the React
component into the Fauxton
// page load lifecycle
Views.ChangesHeaderReactWrapper = FauxtonAPI.View.extend({
afterRender: function () {
Changes.renderHeader(this.el);
},
cleanup: function () {
- Changes.removeHeader(this.el);
+ Changes.remove(this.el);
}
});
- Views.Changes = Components.FilteredView.extend({
- template: "addons/documents/templates/changes",
-
+ Views.ChangesReactWrapper = FauxtonAPI.View.extend({
initialize: function () {
this.listenTo(this.model.changes, 'sync', this.render);
this.listenTo(this.model.changes, 'cachesync', this.render);
this.filters = [];
},
- events: {
- "click button.js-toggle-json": "toggleJson"
- },
-
- toggleJson: function(event) {
- event.preventDefault();
-
- var $button = this.$(event.target),
- $container =
$button.closest('.change-box').find(".js-json-container");
-
- if (!$container.is(":visible")) {
- $button
- .text("Close JSON")
- .addClass("btn-secondary")
- .removeClass("btn-primary");
- } else {
- $button.text("View JSON")
- .addClass("btn-primary")
- .removeClass("btn-secondary");
- }
-
- $container.slideToggle();
+ afterRender: function () {
+ ChangesActions.setChanges({
+ changes: this.model.changes.models,
--- End diff --
Out of interest, any specific reason you pass the model array instead of
the collection? I would think it makes more sense to pass the collection.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---