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

    https://github.com/apache/couchdb-fauxton/pull/421#discussion_r30612649
  
    --- Diff: app/addons/permissions/components.react.jsx ---
    @@ -0,0 +1,221 @@
    +// Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
    +// use this file except in compliance with the License. You may obtain a 
copy of
    +// the License at
    +//
    +//   http://www.apache.org/licenses/LICENSE-2.0
    +//
    +// Unless required by applicable law or agreed to in writing, software
    +// distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT
    +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    +// License for the specific language governing permissions and limitations 
under
    +// the License.
    +
    +define([
    +  'app',
    +  'api',
    +  'react',
    +  'addons/components/react-components.react',
    +  'addons/permissions/stores',
    +  'addons/permissions/actions'
    +],
    +
    +function (app, FauxtonAPI, React, Components, Stores, Actions) {
    +  var LoadLines = Components.LoadLines;
    +  var permissionsStore = Stores.permissionsStore;
    +  var getDocUrl = app.helpers.getDocUrl;
    +
    +  var PermissionsItem = React.createClass({
    +
    +    removeItem: function (e) {
    +      this.props.removeItem({
    +        value: this.props.item,
    +        type: this.props.type,
    +        section: this.props.section
    +      });
    +    },
    +
    +    render: function () {
    +      return (
    +        <li>
    +          <span>{this.props.item}</span>
    +          <button onClick={this.removeItem} type="button" 
className="pull-right close">×</button>
    +        </li>
    +      );
    +    }
    +
    +  });
    +
    +  var PermissionsSection = React.createClass({
    +    getInitialState: function () {
    +      return {
    +        newRole: '',
    +        newName: ''
    +      };
    +    },
    +
    +    getHelp: function () {
    +      if (this.props.section === 'admins') {
    +        return 'Database members can access the database. If no members 
are defined, the database is public. ';
    +      }
    +
    +      return 'Database members can access the database. If no members are 
defined, the database is public. ';
    +    },
    +
    +    addNames: function (e) {
    +      e.preventDefault();
    +      this.props.addItem({
    +        type: 'names',
    +        section: this.props.section,
    +        value: this.state.newName
    +      });
    +
    +      this.setState({newName: ''});
    +    },
    +
    +    addRoles: function (e) {
    +      e.preventDefault();
    +      this.props.addItem({
    +        type: 'roles',
    +        section: this.props.section,
    +        value: this.state.newRole
    +      });
    +
    +      this.setState({newRole: ''});
    +    },
    +
    +    getItems: function (items, type) {
    +      return _.map(items, function (item, i) {
    --- End diff --
    
    you can use native map, i think we can remove underscore/lodash in the 
future as those features are all now implemented into browsers.
    
    http://kangax.github.io/compat-table/es5/#Array.prototype.map


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

Reply via email to