couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Refactored Layout and View, upgraded...
Date Fri, 01 Aug 2014 15:04:39 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/22#discussion_r15700560
  
    --- Diff: app/core/layout.js ---
    @@ -10,82 +10,31 @@
     // License for the specific language governing permissions and limitations under
     // the License.
     
    -define([
    -  "backbone", 
    -  "plugins/backbone.layoutmanager"
    -], function(Backbone) {
    +define(function(require, exports, module) {
    +  var Backbone = require("backbone");
    +  var LayoutManager = require("plugins/backbone.layoutmanager");
     
    -  // A wrapper of the main Backbone.layoutmanager
    -  // Allows the main layout of the page to be changed by any plugin.
    -  var Layout = function () {
    -    this.layout = new Backbone.Layout({
    -      template: "templates/layouts/with_sidebar",
    -    });
    +  var Layout = Backbone.Layout.extend({
    +    template: "templates/layouts/with_sidebar",
     
    -    this.layoutViews = {};
    -    this.el = this.layout.el;
    -  };
    -
    -  Layout.configure = function (options) {
    -    Backbone.Layout.configure(options);
    -  };
    -
    -  // creatings the dashboard object same way backbone does
    -  _.extend(Layout.prototype, {
    -    render: function () {
    -      return this.layout.render();
    -    },
    +    // Either tests or source are expecting synchronous renders, so disable
    +    // asynchronous rendering improvements.
    +    useRAF: false,
     
         setTemplate: function(template) {
           if (template.prefix){
    -        this.layout.template = template.prefix + template.name;
    +        this.template = template.prefix + template.name;
           } else{
    -        this.layout.template = "templates/layouts/" + template;
    +        this.template = "templates/layouts/" + template;
           }
    +
           // If we're changing layouts all bets are off, so kill off all the
           // existing views in the layout.
    -      _.each(this.layoutViews, function(view){view.remove();});
    -      this.layoutViews = {};
    +      this.removeView();
           this.render();
    -    },
    -
    -    setView: function(selector, view, keep) {
    -      this.layout.setView(selector, view, false);
    -
    -      if (!keep) {
    -        this.layoutViews[selector] = view;
    -      }
    -
    -      return view;
    -    },
    -
    -    renderView: function(selector) {
    --- End diff --
    
    We actually still need this method. As its called in a couple places in the modules. We
could probably just alias it for the proper Backbone.layoutmanager methods.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message