Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25785813
  
    --- 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 --
    
    This relates to the recent conversation on Slack. I wanted to remove as 
much Backbone as possible before sending it to the store. Just felt a bit 
cleaner passing an array rather than a collection. But I realize this is kind 
of moot since they're models anyway. I can 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.
---

Reply via email to