<commit_before>if (!ORYX.Plugins)
    ORYX.Plugins = {};

if (!ORYX.Config)
    ORYX.Config = {};

ORYX.Plugins.ServiceRepoIntegration = Clazz.extend({
    repoDialog: undefined,
    repoContent: undefined,

    construct: function(facade){
        this.facade = facade;

        if(ORYX.READONLY != true) {
            this.facade.offer({
                'name':ORYX.I18N.View.connectServiceRepo,
                'functionality': this.jbpmServiceRepoConnect.bind(this),
                'group': "servicerepogroup",
                'icon': ORYX.BASE_FILE_PATH + "images/repository_rep.gif",
                'description': ORYX.I18N.View.connectServiceRepoDesc,
                'index': 4,
                'minShape': 0,
                'maxShape': 0,
                'isEnabled': function(){
                    return ORYX.READONLY != true;
    //				profileParamName = "profile";
    //				profileParamName = profileParamName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    //				regexSa = "[\\?&]"+profileParamName+"=([^&#]*)";
    //		        regexa = new RegExp( regexSa );
    //		        profileParams = regexa.exec( window.location.href );
    //		        profileParamValue = profileParams[1];
    //				return profileParamValue == "jbpm";
                }.bind(this)
            });
        }
    },
    jbpmServiceRepoConnect : function() {
        this._showInitialRepoScreen();
    },
    _showInitialRepoScreen : function() {
        this.repoContent = new Ext.Panel({
            layout:'table',
            html: '

No Service Repository specified.'
        });

        var connectToRepo = new Ext.Button({
            text: 'Connect',
            handler: function(){
                this._updateRepoDialog(Ext.getCmp('serviceurlfield').getValue());
            }.bind(this)
        });

        this.repoDialog = new Ext.Window({
            autoCreate: true,
            autoScroll:true,
            layout: 	'fit',
            plain:		true,
            bodyStyle: 	'padding:5px;',
            title: 		ORYX.I18N.View.connectServiceRepoDataTitle,
            height: 	440,
            width:		600,
            modal:		true,
            fixedcenter:true,
            shadow:		true,
            proxyDrag: 	true,
            resizable:	true,
            items: 		[this.repoContent],
            tbar: [
                {
                    id: 'serviceurlfield',
                    xtype: 'textfield',
                    fieldLabel: 'URL',
                    name: 'repourl',
                    width: '300',
                    value: 'Enter Service Repository URL',
                    handleMouseEvents: true,
                    listeners: {
                        render: function() {
                            this.getEl().on('mousedown', function(e, t, eOpts) {Ext.getCmp('serviceurlfield').setValue("");});
                        }
                    }
                },
                connectToRepo
            ],
            buttons:[
                {
                    text:ORYX.I18N.jPDLSupport.close,
                    handler:function(){
                        this.repoDialog.hide();
                    }.bind(this)
                }
            ]
        });
        this.repoDialog.on('hide', function(){
            if(this.repoDialog) {
                this.repoDialog.destroy(true);
                delete this.repoDialog;
            }
        });
        this.repoDialog.show();
    },
    _updateRepoDialog : function(serviceRepoURL) {
        this.facade.raiseEvent({
            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
            ntype		: 'info',
            msg         : ORYX.I18N.View.connectServiceRepoConnecting,
            title       : ''

        });
        Ext.Ajax.request({
            url: ORYX.PATH + "jbpmservicerepo",
            method: 'POST',
            success: function(request){
                try {
                    if(request.responseText == "false") {
                        this.repoDialog.remove(this.repoContent, true);
                        this.repoContent = new Ext.Panel({
                            layout:'table',
                            html: '

No Service Repository specified.'
                        });
                        this.repoDialog.add(this.repoContent);
                        this.repoDialog.doLayout();
                        ORYX.EDITOR._pluginFacade.raiseEvent({
                            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                            ntype		: 'error',
                            msg         : 'Failed to connect to the Service Repository.',
                            title       : ''
                        });
                    } else {
                        this._showJbpmServiceInfo(request.responseText, serviceRepoURL);
                    }
                } catch(e) {
                    this.repoDialog.remove(this.repoContent, true);
                    this.repoContent = new Ext.Panel({
                        layout:'table',
                        html: '

No Service Repository specified.'
                    });
                    this.repoDialog.add(this.repoContent);
                    this.repoDialog.doLayout();
                    ORYX.EDITOR._pluginFacade.raiseEvent({
                        type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                        ntype		: 'error',
                        msg         : 'Connecting the the Service Repository failed:' + e,
                        title       : ''
                    });
                }
            }.createDelegate(this),
            failure: function(){
                this.repoDialog.remove(this.repoContent, true);
                this.repoContent = new Ext.Panel({
                    layout:'table',
                    html: '

No Service Repository specified.'
                });
                this.repoDialog.add(this.repoContent);
                this.repoDialog.doLayout();
                ORYX.EDITOR._pluginFacade.raiseEvent({
                    type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                    ntype		: 'error',
                    msg         : 'Failed to connect to the Service Repository.',
                    title       : ''
                });
            },
            params: {
                action: 'display',
                profile: ORYX.PROFILE,
                uuid : ORYX.UUID,
                repourl : serviceRepoURL
            }
        });
    },
    _showJbpmServiceInfo : function(jsonString, serviceRepoURL) {
        var jsonObj = jsonString.evalJSON();

        var myData = [];
        var j = 0;
        for (var key in jsonObj) {
            myData[j] = jsonObj[key];
            j++;
        }

        var store = new Ext.data.SimpleStore({
            fields: [{name: 'name'},
                {name: 'displayName'},
                {name: 'icon'},
                {name: 'category'},
                {name: 'explanation'},
                {name: 'documentation'},
                {name: 'inputparams'},
                {name: 'results'}
            ],
            data : myData
        });

        var grid = new 	Ext.grid.GridPanel({
            store: store,
            columns: [
                {header: 'ICON', width: 50, sortable: true, dataIndex: 'icon', renderer: this._renderIcon},
                {header: 'NAME', width: 100, sortable: true, dataIndex: 'displayName'},
                {header: 'EXPLANATION', width: 100, sortable: true, dataIndex: 'explanation'},
                {header: 'DOCUMENTATION', width: 100, sortable: true, dataIndex: 'documentation', renderer: this._renderDocs},
                {header: 'INPUT PARAMETERS', width: 200, sortable: true, dataIndex: 'inputparams'},
                {header: 'RESULTS', width: 200, sortable: true, dataIndex: 'results'},
                {header: 'CATEGORY', width: 100, sortable: true, dataIndex: 'category'}
            ],
            title: 'Service Nodes. Double-click on a row to install.',
            autoHeight:true,
            frame:true
        });

        grid.on('rowdblclick', function(g, i, e) {
            // g is the grid
            // i is the index
            // e is the event

            ORYX.EDITOR._pluginFacade.raiseEvent({
                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                ntype		: 'info',
                msg         : ORYX.I18N.View.installingRepoItem,
                title       : ''

            });

            var aname = g.getStore().getAt(i).get('name');
            var acategory = g.getStore().getAt(i).get('category');
            // send request to server to install the selected service node
            Ext.Ajax.request({
                url: ORYX.PATH + 'jbpmservicerepo',
                method: 'POST',
                success: function(request) {
                    try {
                        if(request.responseText == "false") {
                            ORYX.EDITOR._pluginFacade.raiseEvent({
                                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                                ntype		: 'error',
                                msg         : 'Failed to install the repository assets.',
                                title       : ''
                            });
                        } else {
                            ORYX.EDITOR._pluginFacade.raiseEvent({
                                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                                ntype		: 'success',
                                msg         : 'Assets successfully installed. Save and re-open your process to start using them.',
                                title       : ''
                            });
                        }
                    } catch(e) {
                        ORYX.EDITOR._pluginFacade.raiseEvent({
                            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                            ntype		: 'error',
                            msg         : 'Installing the repository assets failed: ' + e,
                            title       : ''
                        });
                    }
                }.createDelegate(this),
                failure: function(){
                    ORYX.EDITOR._pluginFacade.raiseEvent({
                        type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                        ntype		: 'error',
                        msg         : 'Failed to install the repository assets.',
                        title       : ''
                    });
                }.createDelegate(this),
                params: {
                    action: 'install',
                    profile: ORYX.PROFILE,
                    uuid : ORYX.UUID,
                    asset : aname,
                    category : acategory,
                    repourl : serviceRepoURL
                }
            });

        });

        this.repoDialog.remove(this.repoContent, true);
        this.repoContent = new Ext.TabPanel({
            activeTab: 0,
            border: false,
            width:'100%',
            height:'100%',
            tabPosition: 'top',
            layoutOnTabChange: true,
            deferredRender : false,
            defaults:{autoHeight: true, autoScroll: true},
            items: [{
                title: 'Service Nodes',
                anchor: '100%',
                autoScroll   : true,
                layout       : 'table',
                items: [grid],
                margins: '10 10 10 10',
                listeners: {
                    'tabchange': function(tp, p) {
                        tabs.doLayout();
                    }}
            }]
        });
        this.repoDialog.add(this.repoContent);
        this.repoDialog.doLayout();
    },
    _renderIcon: function(val) {
        return '';
    },

    _renderDocs: function(val) {
        return 'link';
    }
});<commit_msg>BZ 1060786 -  Service Repository popup in designer needs scrollbar<commit_after>if (!ORYX.Plugins)
    ORYX.Plugins = {};

if (!ORYX.Config)
    ORYX.Config = {};

ORYX.Plugins.ServiceRepoIntegration = Clazz.extend({
    repoDialog: undefined,
    repoContent: undefined,

    construct: function(facade){
        this.facade = facade;

        if(ORYX.READONLY != true) {
            this.facade.offer({
                'name':ORYX.I18N.View.connectServiceRepo,
                'functionality': this.jbpmServiceRepoConnect.bind(this),
                'group': "servicerepogroup",
                'icon': ORYX.BASE_FILE_PATH + "images/repository_rep.gif",
                'description': ORYX.I18N.View.connectServiceRepoDesc,
                'index': 4,
                'minShape': 0,
                'maxShape': 0,
                'isEnabled': function(){
                    return ORYX.READONLY != true;
    //				profileParamName = "profile";
    //				profileParamName = profileParamName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    //				regexSa = "[\\?&]"+profileParamName+"=([^&#]*)";
    //		        regexa = new RegExp( regexSa );
    //		        profileParams = regexa.exec( window.location.href );
    //		        profileParamValue = profileParams[1];
    //				return profileParamValue == "jbpm";
                }.bind(this)
            });
        }
    },
    jbpmServiceRepoConnect : function() {
        this._showInitialRepoScreen();
    },
    _showInitialRepoScreen : function() {
        this.repoContent = new Ext.Panel({
            layout:'table',
            html: '

No Service Repository specified.'
        });

        var connectToRepo = new Ext.Button({
            text: 'Connect',
            handler: function(){
                this._updateRepoDialog(Ext.getCmp('serviceurlfield').getValue());
            }.bind(this)
        });

        this.repoDialog = new Ext.Window({
            autoCreate: true,
            autoScroll:true,
            layout: 	'fit',
            plain:		true,
            bodyStyle: 	'padding:5px;',
            title: 		ORYX.I18N.View.connectServiceRepoDataTitle,
            height: 	440,
            width:		600,
            modal:		true,
            fixedcenter:true,
            shadow:		true,
            proxyDrag: 	true,
            resizable:	true,
            items: 		[this.repoContent],
            tbar: [
                {
                    id: 'serviceurlfield',
                    xtype: 'textfield',
                    fieldLabel: 'URL',
                    name: 'repourl',
                    width: '300',
                    value: 'Enter Service Repository URL',
                    handleMouseEvents: true,
                    listeners: {
                        render: function() {
                            this.getEl().on('mousedown', function(e, t, eOpts) {Ext.getCmp('serviceurlfield').setValue("");});
                        }
                    }
                },
                connectToRepo
            ],
            buttons:[
                {
                    text:ORYX.I18N.jPDLSupport.close,
                    handler:function(){
                        this.repoDialog.hide();
                    }.bind(this)
                }
            ]
        });
        this.repoDialog.on('hide', function(){
            if(this.repoDialog) {
                this.repoDialog.destroy(true);
                delete this.repoDialog;
            }
        });
        this.repoDialog.show();
    },
    _updateRepoDialog : function(serviceRepoURL) {
        this.facade.raiseEvent({
            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
            ntype		: 'info',
            msg         : ORYX.I18N.View.connectServiceRepoConnecting,
            title       : ''

        });
        Ext.Ajax.request({
            url: ORYX.PATH + "jbpmservicerepo",
            method: 'POST',
            success: function(request){
                try {
                    if(request.responseText == "false") {
                        this.repoDialog.remove(this.repoContent, true);
                        this.repoContent = new Ext.Panel({
                            layout:'table',
                            html: '

No Service Repository specified.'
                        });
                        this.repoDialog.add(this.repoContent);
                        this.repoDialog.doLayout();
                        ORYX.EDITOR._pluginFacade.raiseEvent({
                            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                            ntype		: 'error',
                            msg         : 'Failed to connect to the Service Repository.',
                            title       : ''
                        });
                    } else {
                        this._showJbpmServiceInfo(request.responseText, serviceRepoURL);
                    }
                } catch(e) {
                    this.repoDialog.remove(this.repoContent, true);
                    this.repoContent = new Ext.Panel({
                        layout:'table',
                        html: '

No Service Repository specified.'
                    });
                    this.repoDialog.add(this.repoContent);
                    this.repoDialog.doLayout();
                    ORYX.EDITOR._pluginFacade.raiseEvent({
                        type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                        ntype		: 'error',
                        msg         : 'Connecting the the Service Repository failed:' + e,
                        title       : ''
                    });
                }
            }.createDelegate(this),
            failure: function(){
                this.repoDialog.remove(this.repoContent, true);
                this.repoContent = new Ext.Panel({
                    layout:'table',
                    html: '

No Service Repository specified.'
                });
                this.repoDialog.add(this.repoContent);
                this.repoDialog.doLayout();
                ORYX.EDITOR._pluginFacade.raiseEvent({
                    type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                    ntype		: 'error',
                    msg         : 'Failed to connect to the Service Repository.',
                    title       : ''
                });
            },
            params: {
                action: 'display',
                profile: ORYX.PROFILE,
                uuid : ORYX.UUID,
                repourl : serviceRepoURL
            }
        });
    },
    _showJbpmServiceInfo : function(jsonString, serviceRepoURL) {
        var jsonObj = jsonString.evalJSON();

        var myData = [];
        var j = 0;
        for (var key in jsonObj) {
            myData[j] = jsonObj[key];
            j++;
        }

        var store = new Ext.data.SimpleStore({
            fields: [{name: 'name'},
                {name: 'displayName'},
                {name: 'icon'},
                {name: 'category'},
                {name: 'explanation'},
                {name: 'documentation'},
                {name: 'inputparams'},
                {name: 'results'}
            ],
            data : myData
        });

        var grid = new 	Ext.grid.GridPanel({
            store: store,
            columns: [
                {header: 'ICON', width: 50, sortable: true, dataIndex: 'icon', renderer: this._renderIcon},
                {header: 'NAME', width: 100, sortable: true, dataIndex: 'displayName'},
                {header: 'EXPLANATION', width: 100, sortable: true, dataIndex: 'explanation'},
                {header: 'DOCUMENTATION', width: 100, sortable: true, dataIndex: 'documentation', renderer: this._renderDocs},
                {header: 'INPUT PARAMETERS', width: 200, sortable: true, dataIndex: 'inputparams'},
                {header: 'RESULTS', width: 200, sortable: true, dataIndex: 'results'},
                {header: 'CATEGORY', width: 100, sortable: true, dataIndex: 'category'}
            ],
            title: 'Service Nodes. doud-click on a row to install.',
            autoScroll : true,
            viewConfig : {
                autoFit : true
            }
        });

        grid.on('rowdblclick', function(g, i, e) {
            // g is the grid
            // i is the index
            // e is the event

            ORYX.EDITOR._pluginFacade.raiseEvent({
                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                ntype		: 'info',
                msg         : ORYX.I18N.View.installingRepoItem,
                title       : ''

            });

            var aname = g.getStore().getAt(i).get('name');
            var acategory = g.getStore().getAt(i).get('category');
            // send request to server to install the selected service node
            Ext.Ajax.request({
                url: ORYX.PATH + 'jbpmservicerepo',
                method: 'POST',
                success: function(request) {
                    try {
                        if(request.responseText == "false") {
                            ORYX.EDITOR._pluginFacade.raiseEvent({
                                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                                ntype		: 'error',
                                msg         : 'Failed to install the repository assets.',
                                title       : ''
                            });
                        } else {
                            ORYX.EDITOR._pluginFacade.raiseEvent({
                                type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                                ntype		: 'success',
                                msg         : 'Assets successfully installed. Save and re-open your process to start using them.',
                                title       : ''
                            });
                        }
                    } catch(e) {
                        ORYX.EDITOR._pluginFacade.raiseEvent({
                            type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                            ntype		: 'error',
                            msg         : 'Installing the repository assets failed: ' + e,
                            title       : ''
                        });
                    }
                }.createDelegate(this),
                failure: function(){
                    ORYX.EDITOR._pluginFacade.raiseEvent({
                        type 		: ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
                        ntype		: 'error',
                        msg         : 'Failed to install the repository assets.',
                        title       : ''
                    });
                }.createDelegate(this),
                params: {
                    action: 'install',
                    profile: ORYX.PROFILE,
                    uuid : ORYX.UUID,
                    asset : aname,
                    category : acategory,
                    repourl : serviceRepoURL
                }
            });

        });

        this.repoDialog.remove(this.repoContent, true);
        this.repoContent = new Ext.TabPanel({
            activeTab: 0,
            border: false,
            width:'100%',
            height:'100%',
            tabPosition: 'top',
            layoutOnTabChange: true,
            deferredRender : false,
            items: [{
                title: 'Service Nodes',
                autoScroll : true,
                items: [grid],
                layout: 'fit',
                margins: '10 10 10 10'
            }]
        });
        this.repoDialog.add(this.repoContent);
        this.repoDialog.doLayout();
    },
    _renderIcon: function(val) {
        return '';
    },

    _renderDocs: function(val) {
        return 'link';
    }
});<|endoftext|>


<commit_before>/*
 * jQuery Tree Multiselect
 * v1.14.2
 *
 * (c) Patrick Tsai et al.
 * MIT Licensed
 */

(function($) {
  var options;

  $.fn.treeMultiselect = function(opts) {
    options = mergeDefaultOptions(opts);
    this.each(function() {
      var originalSelect = $(this);
      originalSelect.attr('multiple', '').css('display', 'none');

      var uiBuilder = new UiBuilder();
      uiBuilder.build(originalSelect);

      var selectionContainer = uiBuilder.selections;

      generateSelections(originalSelect, selectionContainer);

      addDescriptionHover(selectionContainer);
      addCheckboxes(selectionContainer);
      checkPreselectedSelections(originalSelect, selectionContainer);

      if (options.allowBatchSelection) {
        armTitleCheckboxes(selectionContainer);
        uncheckParentsOnUnselect(selectionContainer);
        checkParentsOnAllChildrenSelected(selectionContainer);
        showSemifilledParents(selectionContainer);
      }

      if (options.collapsible) {
        addCollapsibility(selectionContainer);
      }

      var selectedContainer = uiBuilder.selected;
      updateSelectedAndOnChange(selectionContainer, selectedContainer, originalSelect);

      armRemoveSelectedOnClick(selectionContainer, selectedContainer);
    });
    return this;
  };

  function textOf(el) {
    return $(el).clone().children().remove().end().text();
  }

  var UiBuilder = function() {};
  UiBuilder.prototype.build = function(el) {
    var tree = document.createElement('div');
    tree.className = "tree-multiselect";
    $(el).after(tree);

    var selections = document.createElement('div');
    selections.className = "selections";
    $(tree).append(selections);

    var selected = document.createElement('div');
    selected.className = "selected";
    $(tree).append(selected);

    this.tree = tree;
    this.selections = selections;
    this.selected = selected;
  };

  var Option = function(value, text, description, index) {
    this.value = value;
    this.text = text;
    this.description = description;
    this.index = index;
  };

  function mergeDefaultOptions(options) {
    var defaults = {
      allowBatchSelection: true,
      sortable: false,
      collapsible: true,
      sectionDelimiter: '/',
      showSectionOnSelected: true,
      startCollapsed: false
    };
    return $.extend({}, defaults, options);
  }

  function generateSelections(originalSelect, selectionContainer) {
    var data = {};

    function insertOption(path, option) {
      var currentPos = data;
      for (var i = 0; i < path.length; ++i) {
        var pathPart = path[i];

        if (!currentPos[pathPart]) {
          currentPos[pathPart] = [];
        }
        currentPos = currentPos[pathPart];

        if (i == path.length - 1) {
          currentPos.push(option);
          break;
        }

        pathPart = path[i + 1];
        var existingObj = null;
        for (var j = 0; j < currentPos.length; ++j) {
          var arrayItem = currentPos[j];
          if ((arrayItem.constructor != Option) && $.isPlainObject(arrayItem) && arrayItem[pathPart] && (typeof arrayItem[pathPart] !== 'undefined')) {
            existingObj = arrayItem;
            break;
          }
        }

        if (existingObj) {
          currentPos = existingObj;
        } else {
          var newLength = currentPos.push({});
          currentPos = currentPos[newLength - 1];
        }
      }
    }

    $(originalSelect).find("> option").each(function() {
      var path = $(this).attr('data-section').split(options.sectionDelimiter);
      var optionValue = $(this).val();
      var optionName = $(this).text();
      var optionDescription = $(this).attr('data-description');
      var optionIndex = $(this).attr('data-index');
      var option = new Option(optionValue, optionName, optionDescription, optionIndex);
      insertOption(path, option);
    });

    fillSelections.call(selectionContainer, data);
  }

  function fillSelections(data) {
    function createSection(title) {
      var section = document.createElement('div');
      section.className = "section";

      var sectionTitle = document.createElement('div');
      sectionTitle.className = "title";
      sectionTitle.innerHTML = title;

      $(section).append(sectionTitle);
      $(this).append(section);
      return section;
    }

    function createItem(option) {
      var text = option.text;
      var value = option.value;
      var description = option.description;
      var index = option.index;

      var selection = document.createElement('div');
      selection.className = "item";
      $(selection).text(text || value).attr({
        'data-value': value,
        'data-description': description,
        'data-index': index
      });
      $(this).append(selection);
    }

    if (data.constructor == Option) {
      createItem.call(this, data);
    } else if ($.isArray(data)) {
      for (var i = 0; i < data.length; ++i) {
        fillSelections.call(this, data[i]);
      }
    } else if (typeof data === 'object') {
      for (var key in data) {
        if (!data.hasOwnProperty(key)) continue;
        var section = createSection.call(this, key);
        fillSelections.call(section, data[key]);
      }
    } else {
      createItem.call(this, data);
    }
  }

  function addDescriptionHover(selectionContainer) {
    var description = $("?");
    var targets = $(selectionContainer).find("div.item[data-description!=''][data-description]");
    description.prependTo(targets);

    $("div.item > span.description").unbind().mouseenter(function() {
      var item = $(this).parent();
      var description = item.attr('data-description');

      var descriptionDiv = document.createElement('div');
      descriptionDiv.className = "temp-description-popup";
      descriptionDiv.innerHTML = description;

      descriptionDiv.style.position = 'absolute';

      item.append(descriptionDiv);
    }).mouseleave(function() {
      $("div.temp-description-popup").remove();
    });
  }

  function addCheckboxes(selectionContainer) {
    var checkbox = $('<input />', { type: 'checkbox' });
    var targets = null;
    if (options.allowBatchSelection) {
      targets = $(selectionContainer).find("div.title, div.item");
    } else {
      targets = $(selectionContainer).find("div.item");
    }
    checkbox.prependTo(targets);
    $(selectionContainer).find('input[type=checkbox]').click(function(e) {
      e.stopPropagation();
    });
  }

  function checkPreselectedSelections(originalSelect, selectionContainer) {
    var selectedOptions = $(originalSelect).val();
    if (!selectedOptions) return;

    var selectionWithOption = $(selectionContainer).find("div.item").filter(function() {
      var item = $(this);
      return selectedOptions.indexOf(item.attr('data-value')) !== -1;
    });
    $(selectionWithOption).find("> input[type=checkbox]").prop('checked', true);
  }

  function armTitleCheckboxes(selectionContainer) {
    var titleCheckboxes = $(selectionContainer).find("div.title > input[type=checkbox]");
    titleCheckboxes.change(function() {
      var section = $(this).closest("div.section");
      var checkboxesToBeChanged = section.find("input[type=checkbox]");
      var checked = $(this).is(':checked');
      checkboxesToBeChanged.prop('checked', checked);
    });
  }

  function uncheckParentsOnUnselect(selectionContainer) {
    var checkboxes = $(selectionContainer).find("input[type=checkbox]");
    checkboxes.change(function() {
      if ($(this).is(":checked")) return;
      var sectionParents = $(this).parentsUntil(selectionContainer, "div.section");
      sectionParents.find("> div.title > input[type=checkbox]").prop('checked', false);
    });
  }

  function checkParentsOnAllChildrenSelected(selectionContainer) {
    function check() {
      var sections = $(selectionContainer).find("div.section");
      sections.each(function() {
        var section = $(this);
        var sectionItems = section.find("div.item");
        var unselectedItems = sectionItems.filter(function() {
          var checkbox = $(this).find("> input[type=checkbox]");
          return !(checkbox.is(":checked"));
        });
        if (unselectedItems.length === 0) {
          var sectionCheckbox = $(this).find("> div.title > input[type=checkbox]");
          sectionCheckbox.prop('checked', true);
        }
      });
    }

    onCheckboxChange(selectionContainer, check);
  }

  function showSemifilledParents(selectionContainer) {
    function check() {
      var sections = $(selectionContainer).find("div.section");
      sections.each(function() {
        var section = $(this);
        var items = section.find("div.item");
        var numSelected = items.filter(function() {
          var item = $(this);
          return item.find("> input[type=checkbox]").prop('checked');
        }).length;

        var sectionCheckbox = $(this).find("> div.title > input[type=checkbox]");
        var isIndeterminate = (numSelected !== 0 && numSelected !== items.length);
        sectionCheckbox.prop('indeterminate', isIndeterminate);
      });
    }

    onCheckboxChange(selectionContainer, check);
  }

  function addCollapsibility(selectionContainer) {
    var hideIndicator = "-";
    var expandIndicator = "+";

    var titleDivs = $(selectionContainer).find("div.title");

    var collapseDiv = document.createElement('span');
    collapseDiv.className = "collapse-section";
    if (options.startCollapsed) {
      $(collapseDiv).text(expandIndicator);
      titleDivs.siblings().toggle();
    } else {
      $(collapseDiv).text(hideIndicator);
    }
    titleDivs.prepend(collapseDiv);

    $("span.collapse-section").unbind().click(function(e) {
      e.stopPropagation();
      var indicator = $(this).text();
      $(this).text(indicator ==  hideIndicator ? expandIndicator : hideIndicator);
      var jqTitle = $(this).parent();
      jqTitle.siblings().toggle();
    });

    titleDivs.click(function() {
      $(this).find("> span.collapse-section").trigger('click');
    });
  }

  function updateSelectedAndOnChange(selectionContainer, selectedContainer, originalSelect) {
    function createSelectedDiv(selection) {
      var text = selection.text;
      var value = selection.value;
      var sectionName = selection.sectionName;

      var item = document.createElement('div');
      item.className = "item";
      item.innerHTML = text;

      if (options.showSectionOnSelected) {
        $(item).append("" + sectionName + "");
      }

      $(item).attr('data-value', value)
             .prepend("×")
             .appendTo(selectedContainer);
    }

    function addNewFromSelected(selections) {
      var currentSelections = [];
      $(selectedContainer).find("div.item").each(function() {
        currentSelections.push($(this).data('value'));
      });

      var selectionsNotAdded = selections.filter(function(selection) {
        return currentSelections.indexOf(selection.value) == -1;
      });

      selectionsNotAdded.forEach(function(selection) {
        createSelectedDiv(selection);
      });

      armRemoveSelectedOnClick(selectionContainer, selectedContainer);
    }

    function removeOldFromSelected(selections) {
      var selectionTexts = [];
      selections.forEach(function(selection) {
        selectionTexts.push(selection.value);
      });

      $(selectedContainer).find("div.item").each(function() {
        var selection = $(this).data('value');
        if (selectionTexts.indexOf(selection) == -1) {
          $(this).remove();
        }
      });
    }

    function updateOriginalSelect() {
      var jqOriginalSelect = $(originalSelect);

      var selected = [];
      $(selectedContainer).find("div.item").each(function() {
        selected.push($(this).attr('data-value'));
      });

      jqOriginalSelect.val(selected);

      $(originalSelect).html($(originalSelect).find("option").sort(function(a, b) {
        var aValue = selected.indexOf($(a).attr('value'));
        var bValue = selected.indexOf($(b).attr('value'));

        if (aValue > bValue) return 1;
        if (aValue < bValue) return -1;
        return 0;
      }));
    }

    function update() {
      var selectedBoxes = $(selectionContainer).find("div.item").has("> input[type=checkbox]:checked");
      var selections = [];
      selectedBoxes.each(function(box) {
        var text = textOf(this);
        var value = $(this).attr('data-value');
        var index = $(this).attr('data-index');
        $(this).attr('data-index', undefined);
        var sectionName = $.map($(this).parentsUntil(selectionContainer, "div.section").get().reverse(), function(parentSection) {
          return textOf($(parentSection).find("> div.title"));
        }).join(options.sectionDelimiter);
        selections.push({ text: text, value: value, index: index, sectionName: sectionName });
      });
      selections.sort(function(a, b) {
        var aIndex = parseInt(a.index);
        var bIndex = parseInt(b.index);
        if (aIndex > bIndex) return 1;
        if (aIndex < bIndex) return -1;
        return 0;
      });

      addNewFromSelected(selections);
      removeOldFromSelected(selections);
      updateOriginalSelect();

      if (options.sortable) {
        var jqSelectedContainer = $(selectedContainer);
        jqSelectedContainer.sortable({
          update: function(event, ui) {
            updateOriginalSelect();
          }
        });
      }
    }

    onCheckboxChange(selectionContainer, update);
  }

  function armRemoveSelectedOnClick(selectionContainer, selectedContainer) {
    $(selectedContainer).find("span.remove-selected").unbind().click(function() {
      var value = $(this).parent().attr('data-value');
      var matchingSelection = $(selectionContainer).find("div.item[data-value='" + value + "']");
      var matchingCheckbox = matchingSelection.find("> input[type=checkbox]");
      matchingCheckbox.prop('checked', false);
      matchingCheckbox.trigger('change');
    });
  }

  function onCheckboxChange(selectionContainer, callback) {
    var checkboxes = $(selectionContainer).find("input[type=checkbox]");
    checkboxes.change(function() {
      callback();
    });
    callback();
  }
})(jQuery);
<commit_msg>Rename some variables to make more sense<commit_after>/*
 * jQuery Tree Multiselect
 * v1.14.2
 *
 * (c) Patrick Tsai et al.
 * MIT Licensed
 */

(function($) {
  var options;

  $.fn.treeMultiselect = function(opts) {
    options = mergeDefaultOptions(opts);
    this.each(function() {
      var originalSelect = $(this);
      originalSelect.attr('multiple', '').css('display', 'none');

      var uiBuilder = new UiBuilder();
      uiBuilder.build(originalSelect);

      var selectionContainer = uiBuilder.selections;

      generateSelections(originalSelect, selectionContainer);

      addDescriptionHover(selectionContainer);
      addCheckboxes(selectionContainer);
      checkPreselectedSelections(originalSelect, selectionContainer);

      if (options.allowBatchSelection) {
        armTitleCheckboxes(selectionContainer);
        uncheckParentsOnUnselect(selectionContainer);
        checkParentsOnAllChildrenSelected(selectionContainer);
        showSemifilledParents(selectionContainer);
      }

      if (options.collapsible) {
        addCollapsibility(selectionContainer);
      }

      var selectedContainer = uiBuilder.selected;
      updateSelectedAndOnChange(selectionContainer, selectedContainer, originalSelect);

      armRemoveSelectedOnClick(selectionContainer, selectedContainer);
    });
    return this;
  };

  function textOf(el) {
    return $(el).clone().children().remove().end().text();
  }

  var UiBuilder = function() {};
  UiBuilder.prototype.build = function(el) {
    var tree = document.createElement('div');
    tree.className = "tree-multiselect";
    $(el).after(tree);

    var selections = document.createElement('div');
    selections.className = "selections";
    $(tree).append(selections);

    var selected = document.createElement('div');
    selected.className = "selected";
    $(tree).append(selected);

    this.tree = tree;
    this.selections = selections;
    this.selected = selected;
  };

  var Option = function(value, text, description, index) {
    this.value = value;
    this.text = text;
    this.description = description;
    this.index = index;
  };

  function mergeDefaultOptions(options) {
    var defaults = {
      allowBatchSelection: true,
      sortable: false,
      collapsible: true,
      sectionDelimiter: '/',
      showSectionOnSelected: true,
      startCollapsed: false
    };
    return $.extend({}, defaults, options);
  }

  function generateSelections(originalSelect, selectionContainer) {
    var data = {};

    function insertOption(path, option) {
      var currentPos = data;
      for (var i = 0; i < path.length; ++i) {
        var pathPart = path[i];

        if (!currentPos[pathPart]) {
          currentPos[pathPart] = [];
        }
        currentPos = currentPos[pathPart];

        if (i == path.length - 1) {
          currentPos.push(option);
          break;
        }

        pathPart = path[i + 1];
        var existingObj = null;
        for (var j = 0; j < currentPos.length; ++j) {
          var arrayItem = currentPos[j];
          if ((arrayItem.constructor != Option) && $.isPlainObject(arrayItem) && arrayItem[pathPart] && (typeof arrayItem[pathPart] !== 'undefined')) {
            existingObj = arrayItem;
            break;
          }
        }

        if (existingObj) {
          currentPos = existingObj;
        } else {
          var newLength = currentPos.push({});
          currentPos = currentPos[newLength - 1];
        }
      }
    }

    $(originalSelect).find("> option").each(function() {
      var path = $(this).attr('data-section').split(options.sectionDelimiter);
      var optionValue = $(this).val();
      var optionName = $(this).text();
      var optionDescription = $(this).attr('data-description');
      var optionIndex = $(this).attr('data-index');
      var option = new Option(optionValue, optionName, optionDescription, optionIndex);
      insertOption(path, option);
    });

    fillSelections.call(selectionContainer, data);
  }

  function fillSelections(data) {
    function createSection(title) {
      var section = document.createElement('div');
      section.className = "section";

      var sectionTitle = document.createElement('div');
      sectionTitle.className = "title";
      sectionTitle.innerHTML = title;

      $(section).append(sectionTitle);
      $(this).append(section);
      return section;
    }

    function createItem(option) {
      var text = option.text;
      var value = option.value;
      var description = option.description;
      var index = option.index;

      var selection = document.createElement('div');
      selection.className = "item";
      $(selection).text(text || value).attr({
        'data-value': value,
        'data-description': description,
        'data-index': index
      });
      $(this).append(selection);
    }

    if (data.constructor == Option) {
      createItem.call(this, data);
    } else if ($.isArray(data)) {
      for (var i = 0; i < data.length; ++i) {
        fillSelections.call(this, data[i]);
      }
    } else if (typeof data === 'object') {
      for (var key in data) {
        if (!data.hasOwnProperty(key)) continue;
        var section = createSection.call(this, key);
        fillSelections.call(section, data[key]);
      }
    } else {
      createItem.call(this, data);
    }
  }

  function addDescriptionHover(selectionContainer) {
    var description = $("?");
    var targets = $(selectionContainer).find("div.item[data-description!=''][data-description]");
    description.prependTo(targets);

    $("div.item > span.description").unbind().mouseenter(function() {
      var item = $(this).parent();
      var description = item.attr('data-description');

      var descriptionDiv = document.createElement('div');
      descriptionDiv.className = "temp-description-popup";
      descriptionDiv.innerHTML = description;

      descriptionDiv.style.position = 'absolute';

      item.append(descriptionDiv);
    }).mouseleave(function() {
      $("div.temp-description-popup").remove();
    });
  }

  function addCheckboxes(selectionContainer) {
    var checkbox = $('<input />', { type: 'checkbox' });
    var targets = null;
    if (options.allowBatchSelection) {
      targets = $(selectionContainer).find("div.title, div.item");
    } else {
      targets = $(selectionContainer).find("div.item");
    }
    checkbox.prependTo(targets);
    $(selectionContainer).find('input[type=checkbox]').click(function(e) {
      e.stopPropagation();
    });
  }

  function checkPreselectedSelections(originalSelect, selectionContainer) {
    var selectedOptions = $(originalSelect).val();
    if (!selectedOptions) return;

    var selectedOptionDivs = $(selectionContainer).find("div.item").filter(function() {
      var item = $(this);
      return selectedOptions.indexOf(item.attr('data-value')) !== -1;
    });
    $(selectedOptionDivs).find("> input[type=checkbox]").prop('checked', true);
  }

  function armTitleCheckboxes(selectionContainer) {
    var titleCheckboxes = $(selectionContainer).find("div.title > input[type=checkbox]");
    titleCheckboxes.change(function() {
      var section = $(this).closest("div.section");
      var checkboxesToBeChanged = section.find("input[type=checkbox]");
      var checked = $(this).is(':checked');
      checkboxesToBeChanged.prop('checked', checked);
    });
  }

  function uncheckParentsOnUnselect(selectionContainer) {
    var checkboxes = $(selectionContainer).find("input[type=checkbox]");
    checkboxes.change(function() {
      if ($(this).is(":checked")) return;
      var sectionParents = $(this).parentsUntil(selectionContainer, "div.section");
      sectionParents.find("> div.title > input[type=checkbox]").prop('checked', false);
    });
  }

  function checkParentsOnAllChildrenSelected(selectionContainer) {
    function check() {
      var sections = $(selectionContainer).find("div.section");
      sections.each(function() {
        var section = $(this);
        var sectionItems = section.find("div.item");
        var unselectedItems = sectionItems.filter(function() {
          var checkbox = $(this).find("> input[type=checkbox]");
          return !(checkbox.is(":checked"));
        });
        if (unselectedItems.length === 0) {
          var sectionCheckbox = $(this).find("> div.title > input[type=checkbox]");
          sectionCheckbox.prop('checked', true);
        }
      });
    }

    onCheckboxChange(selectionContainer, check);
  }

  function showSemifilledParents(selectionContainer) {
    function check() {
      var sections = $(selectionContainer).find("div.section");
      sections.each(function() {
        var section = $(this);
        var items = section.find("div.item");
        var numSelected = items.filter(function() {
          var item = $(this);
          return item.find("> input[type=checkbox]").prop('checked');
        }).length;

        var sectionCheckbox = $(this).find("> div.title > input[type=checkbox]");
        var isIndeterminate = (numSelected !== 0 && numSelected !== items.length);
        sectionCheckbox.prop('indeterminate', isIndeterminate);
      });
    }

    onCheckboxChange(selectionContainer, check);
  }

  function addCollapsibility(selectionContainer) {
    var hideIndicator = "-";
    var expandIndicator = "+";

    var titleDivs = $(selectionContainer).find("div.title");

    var collapseDiv = document.createElement('span');
    collapseDiv.className = "collapse-section";
    if (options.startCollapsed) {
      $(collapseDiv).text(expandIndicator);
      titleDivs.siblings().toggle();
    } else {
      $(collapseDiv).text(hideIndicator);
    }
    titleDivs.prepend(collapseDiv);

    $("span.collapse-section").unbind().click(function(e) {
      e.stopPropagation();
      var indicator = $(this).text();
      $(this).text(indicator ==  hideIndicator ? expandIndicator : hideIndicator);
      var jqTitle = $(this).parent();
      jqTitle.siblings().toggle();
    });

    titleDivs.click(function() {
      $(this).find("> span.collapse-section").trigger('click');
    });
  }

  function updateSelectedAndOnChange(selectionContainer, selectedContainer, originalSelect) {
    function createSelectedDiv(selection) {
      var text = selection.text;
      var value = selection.value;
      var sectionName = selection.sectionName;

      var item = document.createElement('div');
      item.className = "item";
      item.innerHTML = text;

      if (options.showSectionOnSelected) {
        $(item).append("" + sectionName + "");
      }

      $(item).attr('data-value', value)
             .prepend("×")
             .appendTo(selectedContainer);
    }

    function addNewFromSelected(selections) {
      var currentSelections = [];
      $(selectedContainer).find("div.item").each(function() {
        currentSelections.push($(this).data('value'));
      });

      var selectionsNotAdded = selections.filter(function(selection) {
        return currentSelections.indexOf(selection.value) == -1;
      });

      selectionsNotAdded.forEach(function(selection) {
        createSelectedDiv(selection);
      });

      armRemoveSelectedOnClick(selectionContainer, selectedContainer);
    }

    function removeOldFromSelected(selections) {
      var selectionTexts = [];
      selections.forEach(function(selection) {
        selectionTexts.push(selection.value);
      });

      $(selectedContainer).find("div.item").each(function() {
        var selection = $(this).data('value');
        if (selectionTexts.indexOf(selection) == -1) {
          $(this).remove();
        }
      });
    }

    function updateOriginalSelect() {
      var jqOriginalSelect = $(originalSelect);

      var selected = [];
      $(selectedContainer).find("div.item").each(function() {
        selected.push($(this).attr('data-value'));
      });

      jqOriginalSelect.val(selected);

      $(originalSelect).html($(originalSelect).find("option").sort(function(a, b) {
        var aValue = selected.indexOf($(a).attr('value'));
        var bValue = selected.indexOf($(b).attr('value'));

        if (aValue > bValue) return 1;
        if (aValue < bValue) return -1;
        return 0;
      }));
    }

    function update() {
      var selectedBoxes = $(selectionContainer).find("div.item").has("> input[type=checkbox]:checked");
      var selections = [];
      selectedBoxes.each(function(box) {
        var text = textOf(this);
        var value = $(this).attr('data-value');
        var index = $(this).attr('data-index');
        $(this).attr('data-index', undefined);
        var sectionName = $.map($(this).parentsUntil(selectionContainer, "div.section").get().reverse(), function(parentSection) {
          return textOf($(parentSection).find("> div.title"));
        }).join(options.sectionDelimiter);
        selections.push({ text: text, value: value, index: index, sectionName: sectionName });
      });
      selections.sort(function(a, b) {
        var aIndex = parseInt(a.index);
        var bIndex = parseInt(b.index);
        if (aIndex > bIndex) return 1;
        if (aIndex < bIndex) return -1;
        return 0;
      });

      addNewFromSelected(selections);
      removeOldFromSelected(selections);
      updateOriginalSelect();

      if (options.sortable) {
        var jqSelectedContainer = $(selectedContainer);
        jqSelectedContainer.sortable({
          update: function(event, ui) {
            updateOriginalSelect();
          }
        });
      }
    }

    onCheckboxChange(selectionContainer, update);
  }

  function armRemoveSelectedOnClick(selectionContainer, selectedContainer) {
    $(selectedContainer).find("span.remove-selected").unbind().click(function() {
      var value = $(this).parent().attr('data-value');
      var matchingSelection = $(selectionContainer).find("div.item[data-value='" + value + "']");
      var matchingCheckbox = matchingSelection.find("> input[type=checkbox]");
      matchingCheckbox.prop('checked', false);
      matchingCheckbox.trigger('change');
    });
  }

  function onCheckboxChange(selectionContainer, callback) {
    var checkboxes = $(selectionContainer).find("input[type=checkbox]");
    checkboxes.change(function() {
      callback();
    });
    callback();
  }
})(jQuery);
<|endoftext|>


<commit_before>var webpack = require('webpack');

plugins = [
  new webpack.DefinePlugin({
    DEVELOPMENT: JSON.stringify(JSON.parse(process.env.NODE_ENV === 'development' || true)),
    PRODUCTION:  JSON.stringify(JSON.parse(process.env.NODE_ENV === 'production' || false))
  })
];

if (process.env.NODE_ENV === 'production') {
  plugins.push(new webpack.optimize.DedupePlugin());
  plugins.push(new webpack.optimize.UglifyJsPlugin());
}

module.exports = {
  entry: {
    fkit: './src/fkit.js'
  },
  output: {
    filename: '[name].js',
    path:     './dist',
    library:  'fkit'
  }
};
<commit_msg>Webpack config cleanups.<commit_after>var webpack = require('webpack');

plugins = [
  new webpack.DefinePlugin({
    DEVELOPMENT: process.env.NODE_ENV === 'development' || true,
    PRODUCTION:  process.env.NODE_ENV === 'production' || false
  })
];

if (process.env.NODE_ENV === 'production') {
  plugins.push(new webpack.optimize.DedupePlugin());
  plugins.push(new webpack.optimize.UglifyJsPlugin());
}

module.exports = {
  entry: {
    fkit: './src/fkit.js'
  },
  output: {
    filename: '[name].js',
    path:     './dist',
    library:  'fkit'
  }
};
<|endoftext|>


<commit_before>(function() {
/* globals define, Ember, jQuery */

  function processEmberShims() {
    var shims = {
      'ember': {
        'default': Ember
      },
      'ember-application': {
        'default': Ember.Application
      },
      'ember-array': {
        'default': Ember.Array
      },
      'ember-array/mutable': {
        'default': Ember.MutableArray
      },
      'ember-array/utils': {
        'A':            Ember.A,
        'isEmberArray': Ember.isArray,
        'wrap':         Ember.makeArray
      },
      'ember-component': {
        'default': Ember.Component
      },
      'ember-components/checkbox': {
        'default': Ember.Checkbox
      },
      'ember-components/text-area': {
        'default': Ember.TextArea
      },
      'ember-components/text-field': {
        'default': Ember.TextField
      },
      'ember-controller': {
        'default': Ember.Controller
      },
      'ember-controller/inject': {
        'default': Ember.inject.controller
      },
      'ember-controller/proxy': {
        'default': Ember.ArrayProxy
      },
      'ember-controllers/sortable': {
        'default': Ember.SortableMixin
      },
      'ember-debug': {
        'log':      Ember.debug,
        'inspect':  Ember.inspect,
        'run':      Ember.runInDebug,
        'warn':     Ember.warn
      },
      'ember-debug/container-debug-adapter': {
        'default': Ember.ContainerDebugAdapter
      },
      'ember-debug/data-adapter': {
        'default': Ember.DataAdapter
      },
      'ember-deprecations': {
        'deprecate':      Ember.deprecate,
        'deprecateFunc':  Ember.deprecateFunc
      },
      'ember-enumerable': {
        'default': Ember.Enumerable
      },
      'ember-evented': {
        'default': Ember.Evented
      },
      'ember-evented/on': {
        'default': Ember.on
      },
      'ember-globals-resolver': {
        'default': Ember.DefaultResolver
      },
      'ember-helper': {
        'default':  Ember.Helper,
        'helper':   Ember.Helper && Ember.Helper.helper
      },
      'ember-instrumentation': {
        'instrument':   Ember.Instrumentation.instrument,
        'reset':        Ember.Instrumentation.reset,
        'subscribe':    Ember.Instrumentation.subscribe,
        'unsubscribe':  Ember.Instrumentation.unsubscribe
      },
      'ember-locations/hash': {
        'default': Ember.HashLocation
      },
      'ember-locations/history': {
        'default': Ember.HistoryLocation
      },
      'ember-locations/none': {
        'default': Ember.NoneLocation
      },
      'ember-map': {
        'default':      Ember.Map,
        'withDefault':  Ember.MapWithDefault
      },
      'ember-metal/destroy': {
        'default': Ember.destroy
      },
      'ember-metal/events': {
        'addListener':    Ember.addListener,
        'removeListener': Ember.removeListener,
        'send':           Ember.sendEvent
      },
      'ember-metal/get': {
        'default': Ember.get,
        'getProperties': Ember.getProperties
      },
      'ember-metal/mixin': {
        'default': Ember.Mixin
      },
      'ember-metal/observer': {
        'default':        Ember.observer,
        'addObserver':    Ember.addObserver,
        'removeObserver': Ember.removeObserver
      },
      'ember-metal/on-load': {
        'default':  Ember.onLoad,
        'run':      Ember.runLoadHooks
      },
      'ember-metal/set': {
        'default':        Ember.set,
        'setProperties':  Ember.setProperties,
        'trySet':         Ember.trySet
      },
      'ember-metal/utils': {
        'aliasMethod':  Ember.aliasMethod,
        'assert':       Ember.assert,
        'cacheFor':     Ember.cacheFor,
        'copy':         Ember.copy,
        'guidFor':      Ember.guidFor
      },
      'ember-object': {
        'default': Ember.Object
      },
      'ember-owner/get': {
        'default': Ember.getOwner
      },
      'ember-owner/set': {
        'default': Ember.setOwner
      },
      'ember-platform': {
        'assign':         Ember.assign || Ember.merge,
        'create':         Ember.create,
        'defineProperty': Ember.platform.defineProperty,
        'hasAccessors':   Ember.platform.hasPropertyAccessors,
        'keys':           Ember.keys
      },
      'ember-route': {
        'default': Ember.Route
      },
      'ember-router': {
        'default': Ember.Router
      },
      'ember-runloop': {
        'default':      Ember.run,
        'begin':        Ember.run.begin,
        'bind':         Ember.run.bind,
        'cancel':       Ember.run.cancel,
        'debounce':     Ember.run.debounce,
        'end':          Ember.run.end,
        'join':         Ember.run.join,
        'later':        Ember.run.later,
        'next':         Ember.run.next,
        'once':         Ember.run.once,
        'schedule':     Ember.run.schedule,
        'scheduleOnce': Ember.run.scheduleOnce,
        'throttle':     Ember.run.throttle
      },
      'ember-service': {
        'default': Ember.Service
      },
      'ember-service/inject': {
        'default': Ember.inject.service
      },
      'ember-set/ordered': {
        'default': Ember.OrderedSet
      },
      'ember-string': {
        'camelize':     Ember.String.camelize,
        'capitalize':   Ember.String.capitalize,
        'classify':     Ember.String.classify,
        'dasherize':    Ember.String.dasherize,
        'decamelize':   Ember.String.decamelize,
        'fmt':          Ember.String.fmt,
        'htmlSafe':     Ember.String.htmlSafe,
        'loc':          Ember.String.loc,
        'underscore':   Ember.String.underscore,
        'w':            Ember.String.w
      },
      'ember-utils': {
        'isBlank':    Ember.isBlank,
        'isEmpty':    Ember.isEmpty,
        'isNone':     Ember.isNone,
        'isPresent':  Ember.isPresent,
        'tryInvoke':  Ember.tryInvoke,
        'typeOf':     Ember.typeOf
      }
    };

    // populate `ember/computed` named exports
    shims['ember-computed'] = {
      'default': Ember.computed
    };
    var computedMacros = [
      "empty","notEmpty", "none", "not", "bool", "match",
      "equal", "gt", "gte", "lt", "lte", "alias", "oneWay",
      "reads", "readOnly", "deprecatingAlias",
      "and", "or", "collect", "sum", "min", "max",
      "map", "sort", "setDiff", "mapBy", "mapProperty",
      "filter", "filterBy", "filterProperty", "uniq",
      "union", "intersect"
    ];
    for (var i = 0, l = computedMacros.length; i < l; i++) {
      var key = computedMacros[i];
      shims['ember-computed'][key] = Ember.computed[key];
    }

    for (var moduleName in shims) {
      generateModule(moduleName, shims[moduleName]);
    }
  }

  function processTestShims() {
    if (Ember.Test) {
      var testShims = {
        'ember-test': {
          'default': Ember.Test
        },
        'ember-test/adapter': {
          'default': Ember.Test.Adapter
        },
        'ember-test/qunit-adapter': {
          'default': Ember.Test.QUnitAdapter
        }
      };

      for (var moduleName in testShims) {
        generateModule(moduleName, testShims[moduleName]);
      }
    }
  }

  function generateModule(name, values) {
    define(name, [], function() {
      'use strict';

      Object.defineProperty(values, '__esModule', {
        value: true
      });

      return values;
    });
  }

  processEmberShims();
  processTestShims();
  generateModule('jquery', { 'default': self.jQuery });
  generateModule('rsvp', { 'default': Ember.RSVP });
})();
<commit_msg>Bring back the deprecation for older shims.<commit_after>(function() {
/* globals define, Ember, jQuery */

  function processEmberShims() {
    var shims = {
      'ember-application': {
        'default': Ember.Application
      },
      'ember-array': {
        'default': Ember.Array
      },
      'ember-array/mutable': {
        'default': Ember.MutableArray
      },
      'ember-array/utils': {
        'A':            Ember.A,
        'isEmberArray': Ember.isArray,
        'wrap':         Ember.makeArray
      },
      'ember-component': {
        'default': Ember.Component
      },
      'ember-components/checkbox': {
        'default': Ember.Checkbox
      },
      'ember-components/text-area': {
        'default': Ember.TextArea
      },
      'ember-components/text-field': {
        'default': Ember.TextField
      },
      'ember-controller': {
        'default': Ember.Controller
      },
      'ember-controller/inject': {
        'default': Ember.inject.controller
      },
      'ember-controller/proxy': {
        'default': Ember.ArrayProxy
      },
      'ember-controllers/sortable': {
        'default': Ember.SortableMixin
      },
      'ember-debug': {
        'log':      Ember.debug,
        'inspect':  Ember.inspect,
        'run':      Ember.runInDebug,
        'warn':     Ember.warn
      },
      'ember-debug/container-debug-adapter': {
        'default': Ember.ContainerDebugAdapter
      },
      'ember-debug/data-adapter': {
        'default': Ember.DataAdapter
      },
      'ember-deprecations': {
        'deprecate':      Ember.deprecate,
        'deprecateFunc':  Ember.deprecateFunc
      },
      'ember-enumerable': {
        'default': Ember.Enumerable
      },
      'ember-evented': {
        'default': Ember.Evented
      },
      'ember-evented/on': {
        'default': Ember.on
      },
      'ember-globals-resolver': {
        'default': Ember.DefaultResolver
      },
      'ember-helper': {
        'default':  Ember.Helper,
        'helper':   Ember.Helper && Ember.Helper.helper
      },
      'ember-instrumentation': {
        'instrument':   Ember.Instrumentation.instrument,
        'reset':        Ember.Instrumentation.reset,
        'subscribe':    Ember.Instrumentation.subscribe,
        'unsubscribe':  Ember.Instrumentation.unsubscribe
      },
      'ember-locations/hash': {
        'default': Ember.HashLocation
      },
      'ember-locations/history': {
        'default': Ember.HistoryLocation
      },
      'ember-locations/none': {
        'default': Ember.NoneLocation
      },
      'ember-map': {
        'default':      Ember.Map,
        'withDefault':  Ember.MapWithDefault
      },
      'ember-metal/destroy': {
        'default': Ember.destroy
      },
      'ember-metal/events': {
        'addListener':    Ember.addListener,
        'removeListener': Ember.removeListener,
        'send':           Ember.sendEvent
      },
      'ember-metal/get': {
        'default': Ember.get,
        'getProperties': Ember.getProperties
      },
      'ember-metal/mixin': {
        'default': Ember.Mixin
      },
      'ember-metal/observer': {
        'default':        Ember.observer,
        'addObserver':    Ember.addObserver,
        'removeObserver': Ember.removeObserver
      },
      'ember-metal/on-load': {
        'default':  Ember.onLoad,
        'run':      Ember.runLoadHooks
      },
      'ember-metal/set': {
        'default':        Ember.set,
        'setProperties':  Ember.setProperties,
        'trySet':         Ember.trySet
      },
      'ember-metal/utils': {
        'aliasMethod':  Ember.aliasMethod,
        'assert':       Ember.assert,
        'cacheFor':     Ember.cacheFor,
        'copy':         Ember.copy,
        'guidFor':      Ember.guidFor
      },
      'ember-object': {
        'default': Ember.Object
      },
      'ember-owner/get': {
        'default': Ember.getOwner
      },
      'ember-owner/set': {
        'default': Ember.setOwner
      },
      'ember-platform': {
        'assign':         Ember.assign || Ember.merge,
        'create':         Ember.create,
        'defineProperty': Ember.platform.defineProperty,
        'hasAccessors':   Ember.platform.hasPropertyAccessors,
        'keys':           Ember.keys
      },
      'ember-route': {
        'default': Ember.Route
      },
      'ember-router': {
        'default': Ember.Router
      },
      'ember-runloop': {
        'default':      Ember.run,
        'begin':        Ember.run.begin,
        'bind':         Ember.run.bind,
        'cancel':       Ember.run.cancel,
        'debounce':     Ember.run.debounce,
        'end':          Ember.run.end,
        'join':         Ember.run.join,
        'later':        Ember.run.later,
        'next':         Ember.run.next,
        'once':         Ember.run.once,
        'schedule':     Ember.run.schedule,
        'scheduleOnce': Ember.run.scheduleOnce,
        'throttle':     Ember.run.throttle
      },
      'ember-service': {
        'default': Ember.Service
      },
      'ember-service/inject': {
        'default': Ember.inject.service
      },
      'ember-set/ordered': {
        'default': Ember.OrderedSet
      },
      'ember-string': {
        'camelize':     Ember.String.camelize,
        'capitalize':   Ember.String.capitalize,
        'classify':     Ember.String.classify,
        'dasherize':    Ember.String.dasherize,
        'decamelize':   Ember.String.decamelize,
        'fmt':          Ember.String.fmt,
        'htmlSafe':     Ember.String.htmlSafe,
        'loc':          Ember.String.loc,
        'underscore':   Ember.String.underscore,
        'w':            Ember.String.w
      },
      'ember-utils': {
        'isBlank':    Ember.isBlank,
        'isEmpty':    Ember.isEmpty,
        'isNone':     Ember.isNone,
        'isPresent':  Ember.isPresent,
        'tryInvoke':  Ember.tryInvoke,
        'typeOf':     Ember.typeOf
      }
    };

    // populate `ember/computed` named exports
    shims['ember-computed'] = {
      'default': Ember.computed
    };
    var computedMacros = [
      "empty","notEmpty", "none", "not", "bool", "match",
      "equal", "gt", "gte", "lt", "lte", "alias", "oneWay",
      "reads", "readOnly", "deprecatingAlias",
      "and", "or", "collect", "sum", "min", "max",
      "map", "sort", "setDiff", "mapBy", "mapProperty",
      "filter", "filterBy", "filterProperty", "uniq",
      "union", "intersect"
    ];
    for (var i = 0, l = computedMacros.length; i < l; i++) {
      var key = computedMacros[i];
      shims['ember-computed'][key] = Ember.computed[key];
    }

    for (var moduleName in shims) {
      generateModule(moduleName, shims[moduleName]);
    }
  }

  function processTestShims() {
    if (Ember.Test) {
      var testShims = {
        'ember-test': {
          'default': Ember.Test
        },
        'ember-test/adapter': {
          'default': Ember.Test.Adapter
        },
        'ember-test/qunit-adapter': {
          'default': Ember.Test.QUnitAdapter
        }
      };

      for (var moduleName in testShims) {
        generateModule(moduleName, testShims[moduleName]);
      }
    }
  }

  function generateModule(name, values, deprecated) {
    define(name, [], function() {
      'use strict';

      Ember.deprecate('Importing the module `' + name +'` has been deprecated. Please use the new module imports.', !deprecated, {
        id: 'ember-cli-shims.deprecated-shims',
        until: '3.0.0',
        url: 'https://github.com/emberjs/rfcs/blob/master/text/0176-javascript-module-api.md'
      });

      Object.defineProperty(values, '__esModule', {
        value: true
      });

      return values;
    });
  }

  generateModule('ember', { default: Ember });
  processEmberShims();
  processTestShims();
  generateModule('jquery', { 'default': self.jQuery });
  generateModule('rsvp', { 'default': Ember.RSVP });
})();
<|endoftext|>


<commit_before>export const guestlist = [
    {
        id: 'rsvp',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: null,
        names: ['you'],
    },
    {
        id: 'shelley-and-tony',
        rsvp: true,
        type: 'family',
        size: 1,
        lastname: 'Day',
        names: ['Shelley', 'Tony'],
    },
    {
        id: 'rebecca-and-josh',
        rsvp: true,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Rebecca', 'Josh'],
    },
    {
        id: 'moose-and-amy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Moose', 'Amy'],
    },
    {
        id: 'steph-and-chris',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Steph', 'Chris'],
    },
    {
        id: 'mike-and-judy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Stringer',
        names: ['Mike', 'Judy'],
    },
    {
        id: 'paul',
        rsvp: false,
        type: 'family',
        size: 0,
        lastname: 'Stringer',
        names: ['Paul'],
    },
    {
        id: 'natasha',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Bale',
        names: ['Natasha'],
    },
    {
        id: 'kirsity',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Bale',
        names: ['Kirsity'],
    },
    {
        id: 'aunty-jude',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: null,
        names: ['Aunty Jude'],
    },
    {
        id: 'robyn-and-dave',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Aunty Robyn', 'Uncle Dave'],
    },
    {
        id: 'emma-and-brett',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Emma', 'Brett'],
    },
    {
        id: 'jane-and-jeremy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Jane', 'Jeremy'],
    },
    {
        id: 'sophie-and-matt',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Lang',
        names: ['Sophie', 'Matt'],
    },
    {
        id: 'jethro-and-nicole',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Riggins',
        names: ['Jethro', 'Nicole'],
    },
    {
        id: 'lathan-and-nikita',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Riggins',
        names: ['Lathan', 'nikita'],
    },
    {
        id: 'teena-lais-and-tess',
        rsvp: false,
        type: 'friends',
        size: 2,
        lastname: 'Morris',
        names: ['Teena', 'Lais', 'Tess'],
    },
    {
        id: 'richard-carissa-and-aria',
        rsvp: false,
        type: 'family',
        size: 2,
        lastname: 'Morris',
        names: ['Uncle Richard', 'Carissa', 'Aria'],
    },
    {
        id: 'roger',
        rsvp: false,
        type: 'family',
        size: 0,
        lastname: null,
        names: ['Uncle Roger'],
    },
    {
        id: 'ann-and-uwe',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Engbers',
        names: ['Ann', 'Uwe'],
    },
    {
        id: 'nicola-and-mike',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Blyth',
        names: ['Nicola', 'Mike'],
    },
    {
        id: 'gabby-and-murray',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Gabby', 'Murray'],
    },
    {
        id: 'nicola',
        rsvp: true,
        type: 'friends',
        size: 0,
        lastname: 'Valk',
        names: ['Nicola'],
    },
    {
        id: 'sara-and-mike',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Allan',
        names: ['Sara', 'Mike'],
    },
    {
        id: 'lisa-and-sas',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Lisa', 'Sas'],
    },
    {
        id: 'pinky-and-gemma',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Pinky', 'Gemma'],
    },
    {
        id: 'beth-and-matt',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Lee',
        names: ['Beth', 'Matt'],
    },
    {
        id: 'bufty-and-vicente',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Bufty', 'Vincente'],
    },
    {
        id: 'daniel-and-teana',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'McKechnie',
        names: ['Daniel', 'Teana'],
    },
    {
        id: 'lauren-and-chris',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Menzies',
        names: ['Lauren', 'Chris'],
    },
    {
        id: 'katrina-and-geoff',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'England',
        names: ['Katrina', 'Geoff'],
    },
    {
        id: 'rach-and-dave',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Rachel', 'Dave'],
    },
    {
        id: 'lilla',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: 'Bothma',
        names: ['Lilla'],
    },
    {
        id: 'terri',
        rsvp: true,
        type: 'friends',
        size: 0,
        lastname: 'Hardisty',
        names: ['Terri'],
    },
    {
        id: 'freya',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: 'Flockton',
        names: ['Freya'],
    },
    {
        id: 'claire-and-ben',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Langley',
        names: ['Claire', 'Ben'],
    },
    {
        id: 'gay-and-bob',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Harvey',
        names: ['Gay', 'Bob'],
    },
    {
        id: 'bev-and-ian',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Lopdell',
        names: ['Bev', 'Ian'],
    },
    {
        id: 'jill',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Waru',
        names: ['Jill'],
    },
    {
        id: 'matt-and-mindy',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Windross',
        names: ['Matt', 'Mindy'],
    },
    {
        id: 'brendon-and-amy',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Wallis',
        names: ['Brendon', 'Amy'],
    },
    {
        id: 'cam-and-nina',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Field',
        names: ['Cam', 'Nina'],
    },
    {
        id: 'clint-and-eugenie',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Williams',
        names: ['Clint', 'Eugenie'],
    },
    {
        id: 'stacey-and-damien',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Stacey', 'Damien'],
    },
    {
        id: 'kelly-and-jason',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'White',
        names: ['Kelly', 'Jason'],
    },
    {
        id: 'shanee-and-jean',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Ramirez',
        names: ['Shanee', 'Jean'],
    },
    {
        id: 'indran-and-leanne',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Pillay',
        names: ['Indran', 'Leanne'],
    },
    {
        id: 'pratheen',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Pratheen', 'partner'],
    },
    {
        id: 'sarah-and-simon',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Bamfield',
        names: ['Sarah', 'Simon'],
    },
    {
        id: 'lynn-and-david',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Wigg',
        names: ['Lynn', 'David'],
    },
    {
        id: 'lynda-and-peter',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Betts',
        names: ['Lynda', 'Peter'],
    },
    {
        id: 'liz-and-gordon',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Liz', 'Gordon'],
    },
    {
        id: 'richard-and-diana',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Wilks',
        names: ['Richard', 'Diana'],
    },
    {
        id: 'dave-and-margaret',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Dave', 'Margaret'],
    },
    {
        id: 'mary-and-andrew',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Bullivent',
        names: ['Mary', 'Andrew'],
    },
    {
        id: 'nick-and-bernie',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Page',
        names: ['Nick', 'Bernadette'],
    },
    {
        id: 'vic-and-pia',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Vic', 'Pia'],
    },
    {
        id: 'sarah-and-mimi',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Sarah', 'Mimi'],
    },
];
<commit_msg>adding andrew<commit_after>export const guestlist = [
    {
        id: 'rsvp',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: null,
        names: ['you'],
    },
    {
        id: 'shelley-and-tony',
        rsvp: true,
        type: 'family',
        size: 1,
        lastname: 'Day',
        names: ['Shelley', 'Tony'],
    },
    {
        id: 'rebecca-and-josh',
        rsvp: true,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Rebecca', 'Josh'],
    },
    {
        id: 'moose-and-amy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Moose', 'Amy'],
    },
    {
        id: 'steph-and-chris',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Steph', 'Chris'],
    },
    {
        id: 'mike-and-judy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Stringer',
        names: ['Mike', 'Judy'],
    },
    {
        id: 'paul',
        rsvp: false,
        type: 'family',
        size: 0,
        lastname: 'Stringer',
        names: ['Paul'],
    },
    {
        id: 'natasha',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Bale',
        names: ['Natasha'],
    },
    {
        id: 'kirsity',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Bale',
        names: ['Kirsity'],
    },
    {
        id: 'aunty-jude',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: null,
        names: ['Aunty Jude'],
    },
    {
        id: 'robyn-and-dave',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Aunty Robyn', 'Uncle Dave'],
    },
    {
        id: 'emma-and-brett',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Emma', 'Brett'],
    },
    {
        id: 'jane-and-jeremy',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Jane', 'Jeremy'],
    },
    {
        id: 'sophie-and-matt',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Lang',
        names: ['Sophie', 'Matt'],
    },
    {
        id: 'jethro-and-nicole',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Riggins',
        names: ['Jethro', 'Nicole'],
    },
    {
        id: 'lathan-and-nikita',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Riggins',
        names: ['Lathan', 'nikita'],
    },
    {
        id: 'teena-lais-and-tess',
        rsvp: false,
        type: 'friends',
        size: 2,
        lastname: 'Morris',
        names: ['Teena', 'Lais', 'Tess'],
    },
    {
        id: 'richard-carissa-and-aria',
        rsvp: false,
        type: 'family',
        size: 2,
        lastname: 'Morris',
        names: ['Uncle Richard', 'Carissa', 'Aria'],
    },
    {
        id: 'roger',
        rsvp: false,
        type: 'family',
        size: 0,
        lastname: null,
        names: ['Uncle Roger'],
    },
    {
        id: 'ann-and-uwe',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Engbers',
        names: ['Ann', 'Uwe'],
    },
    {
        id: 'nicola-and-mike',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Blyth',
        names: ['Nicola', 'Mike'],
    },
    {
        id: 'gabby-and-murray',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Gabby', 'Murray'],
    },
    {
        id: 'nicola',
        rsvp: true,
        type: 'friends',
        size: 0,
        lastname: 'Valk',
        names: ['Nicola'],
    },
    {
        id: 'sara-and-mike',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Allan',
        names: ['Sara', 'Mike'],
    },
    {
        id: 'lisa-and-sas',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Lisa', 'Sas'],
    },
    {
        id: 'pinky-and-gemma',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Pinky', 'Gemma'],
    },
    {
        id: 'beth-and-matt',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Lee',
        names: ['Beth', 'Matt'],
    },
    {
        id: 'bufty-and-vicente',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Bufty', 'Vincente'],
    },
    {
        id: 'daniel-and-teana',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'McKechnie',
        names: ['Daniel', 'Teana'],
    },
    {
        id: 'lauren-and-chris',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Menzies',
        names: ['Lauren', 'Chris'],
    },
    {
        id: 'katrina-and-geoff',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'England',
        names: ['Katrina', 'Geoff'],
    },
    {
        id: 'rach-and-dave',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Rachel', 'Dave'],
    },
    {
        id: 'lilla',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: 'Bothma',
        names: ['Lilla'],
    },
    {
        id: 'terri',
        rsvp: true,
        type: 'friends',
        size: 0,
        lastname: 'Hardisty',
        names: ['Terri'],
    },
    {
        id: 'freya',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: 'Flockton',
        names: ['Freya'],
    },
    {
        id: 'claire-and-ben',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Langley',
        names: ['Claire', 'Ben'],
    },
    {
        id: 'gay-and-bob',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Harvey',
        names: ['Gay', 'Bob'],
    },
    {
        id: 'bev-and-ian',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Lopdell',
        names: ['Bev', 'Ian'],
    },
    {
        id: 'jill',
        rsvp: true,
        type: 'family',
        size: 0,
        lastname: 'Waru',
        names: ['Jill'],
    },
    {
        id: 'matt-and-mindy',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Windross',
        names: ['Matt', 'Mindy'],
    },
    {
        id: 'brendon-and-amy',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Wallis',
        names: ['Brendon', 'Amy'],
    },
    {
        id: 'cam-and-nina',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Field',
        names: ['Cam', 'Nina'],
    },
    {
        id: 'clint-and-eugenie',
        rsvp: true,
        type: 'friends',
        size: 1,
        lastname: 'Williams',
        names: ['Clint', 'Eugenie'],
    },
    {
        id: 'stacey-and-damien',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Stacey', 'Damien'],
    },
    {
        id: 'kelly-and-jason',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'White',
        names: ['Kelly', 'Jason'],
    },
    {
        id: 'shanee-and-jean',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: 'Ramirez',
        names: ['Shanee', 'Jean'],
    },
    {
        id: 'indran-and-leanne',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Pillay',
        names: ['Indran', 'Leanne'],
    },
    {
        id: 'pratheen',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: null,
        names: ['Pratheen', 'partner'],
    },
    {
        id: 'sarah-and-simon',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Bamfield',
        names: ['Sarah', 'Simon'],
    },
    {
        id: 'lynn-and-david',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Wigg',
        names: ['Lynn', 'David'],
    },
    {
        id: 'lynda-and-peter',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Betts',
        names: ['Lynda', 'Peter'],
    },
    {
        id: 'liz-and-gordon',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Liz', 'Gordon'],
    },
    {
        id: 'richard-and-diana',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Wilks',
        names: ['Richard', 'Diana'],
    },
    {
        id: 'dave-and-margaret',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Dave', 'Margaret'],
    },
    {
        id: 'mary-and-andrew',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Bullivent',
        names: ['Mary', 'Andrew'],
    },
    {
        id: 'nick-and-bernie',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: 'Page',
        names: ['Nick', 'Bernadette'],
    },
    {
        id: 'vic-and-pia',
        rsvp: false,
        type: 'family',
        size: 1,
        lastname: null,
        names: ['Vic', 'Pia'],
    },
    {
        id: 'sarah-and-mimi',
        rsvp: false,
        type: 'friends',
        size: 1,
        lastname: '',
        names: ['Sarah', 'Mimi'],
    },
    {
        id: 'andrew',
        rsvp: false,
        type: 'friends',
        size: 0,
        lastname: 'Kuhn',
        names: ['Andrew'],
    },
];
<|endoftext|>


<commit_before>/**
 * This controller maintains a project object and belongs to the view porject.single.html.
 */
(function() {
	'use strict';
	angular.module('ljprojectbuilderApp.project').controller('projectSingleCtrl', projectSingleCtrl);

	projectSingleCtrl.$inject = ['$scope', '$routeParams', 'projectConnectorFactory', 'dialogService', 'gotoProject'];
	function projectSingleCtrl($scope, $routeParams, projectConnectorFactory, dialogService, gotoProject) {
		var ctrl = this;

		ctrl.doMaintain = doMaintain;
		ctrl.doMaintainDomain = doMaintainDomain;
		ctrl.doMaintainGenerate = doMaintainGenerate;
		ctrl.gotoProject = gotoProject;
		ctrl.closeDialog = closeDialog;
		ctrl.dialog = dialogService.dialog;
		init();

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintain() {
			if (ctrl.form.$dirty) {
				if (ctrl.project != null && ctrl.project.id != null) {
					projectConnectorFactory.updateProject(ctrl.project).then(saveSuccessAll, saveError);
				} else {
					projectConnectorFactory.createProject(ctrl.project).then(saveSuccessAll, saveError);
				}
			} else {
				gotoProject.all();
			}
		}

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintainDomain() {
			if (ctrl.form.$dirty) {
				if (ctrl.project != null && ctrl.project.id != null) {
					projectConnectorFactory.updateProject(ctrl.project).then(saveSuccessDomain, saveError);
				} else {
					projectConnectorFactory.createProject(ctrl.project).then(saveSuccessDomain, saveError);
				}
			} else {
				gotoProjectDomain();
			}
		}

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintainGenerate() {
			if (ctrl.form.$dirty) {
				if (ctrl.project != null && ctrl.project.id != null) {
					projectConnectorFactory.updateProject(ctrl.project).then(saveSuccessGenerate, saveError);
				} else {
					projectConnectorFactory.createProject(ctrl.project).then(saveSuccessGenerate, saveError);
				}
			} else {
				gotoProjectGenerate();
			}
		}

		/**
		 * Standard function for initialization.
		 */
		function init() {
			ctrl.project = {};
			ctrl.templateAll = [];
			projectConnectorFactory.getTemplateAll().then(setTemplateAll, null);
			$scope.$on('$routeChangeSuccess', function (scope, next, current) {
				if ($routeParams.projectid != undefined && $routeParams.projectid !== ctrl.project.id) {
					ctrl.project.id = $routeParams.projectid;
					ctrl.projectid = ctrl.project.id;
					projectConnectorFactory.loadProject(ctrl.project.id).then(setProject, loadError);
				}
				if ($routeParams.projectid == null) {
					ctrl.project = {};
				}
			});
		}

		/**
		 * Used for setting the database result to the representation-object in the controller.
		 */
		function setProject(response) {
			ctrl.project = response;
			ctrl.projecttitle = response.title;
		}

		function setTemplateAll(response) {
			ctrl.templateAll = response;
			ctrl.project.template = response[0];
		}

		/**
		 * Success message after saving.
		 */
		function saveSuccessAll(response) {
			setProject(response);
			dialogService.showDialog("project.dialog.success.title", "project.save.success", dialogService.dialog.id.success, gotoProject.all);
		}

		function saveSuccessDomain(response) {
			setProject(response);
			dialogService.showDialog("project.dialog.success.title", "project.save.success", dialogService.dialog.id.success, gotoProjectDomain);
		}

		function saveSuccessGenerate(response) {
			setProject(response);
			dialogService.showDialog("project.dialog.success.title", "project.save.success", dialogService.dialog.id.success, gotoProjectGenerate);
		}

		function gotoProjectDomain() {
			gotoProject.domain(ctrl.project.id);
		}

		function gotoProjectGenerate() {
			gotoProject.generate(ctrl.project.id);
		}

		/**
		 * Error message after saving.
		 */
		function saveError(response) {
			dialogService.showDialog("project.dialog.error.title", "project.save.error", dialogService.dialog.id.error, function(){});
		}

		/**
		 * Error message after loading the project.
		 */
		function loadError(response) {
			dialogService.showDialog("project.dialog.error.title", "project.load.error", dialogService.dialog.id.error, gotoProject.all);
		}

		function closeDialog(dialogid) {
			dialogService.closeDialog(dialogid);
		}
	}
})();<commit_msg>attempt to reduce code duplication<commit_after>/**
 * This controller maintains a project object and belongs to the view porject.single.html.
 */
(function() {
	'use strict';
	angular.module('ljprojectbuilderApp.project').controller('projectSingleCtrl', projectSingleCtrl);

	projectSingleCtrl.$inject = ['$scope', '$routeParams', 'projectConnectorFactory', 'dialogService', 'gotoProject'];
	function projectSingleCtrl($scope, $routeParams, projectConnectorFactory, dialogService, gotoProject) {
		var ctrl = this;

		ctrl.doMaintain = doMaintain;
		ctrl.doMaintainDomain = doMaintainDomain;
		ctrl.doMaintainGenerate = doMaintainGenerate;
		ctrl.gotoProject = gotoProject;
		ctrl.closeDialog = closeDialog;
		ctrl.dialog = dialogService.dialog;
		init();

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintain() {
			if (ctrl.form.$dirty) {
				doMaintainThenGoto(gotoProject.all);
			} else {
				gotoProject.all();
			}
		}

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintainDomain() {
			if (ctrl.form.$dirty) {
				doMaintainThenGoto(gotoProjectDomain);
			} else {
				gotoProjectDomain();
			}
		}

		/**
		 * Standard function to edit the project configuration.
		 */
		function doMaintainGenerate() {
			if (ctrl.form.$dirty) {
				doMaintainThenGoto(gotoProjectGenerate);
			} else {
				gotoProjectGenerate();
			}
		}

		function doMaintainThenGoto(gotoDestination) {
			var saveFunction = isUpdate() ? projectConnectorFactory.updateProject : projectConnectorFactory.createProject;
			saveFunction(ctrl.project).then(saveSuccessCallbackThatGoesTo(gotoDestination), saveError);
		}

		function isUpdate() {
			return ctrl.project != null && ctrl.project.id != null;
		}

		/**
		 * Standard function for initialization.
		 */
		function init() {
			ctrl.project = {};
			ctrl.templateAll = [];
			projectConnectorFactory.getTemplateAll().then(setTemplateAll, null);
			$scope.$on('$routeChangeSuccess', function (scope, next, current) {
				if ($routeParams.projectid != undefined && $routeParams.projectid !== ctrl.project.id) {
					ctrl.project.id = $routeParams.projectid;
					ctrl.projectid = ctrl.project.id;
					projectConnectorFactory.loadProject(ctrl.project.id).then(setProject, loadError);
				}
				if ($routeParams.projectid == null) {
					ctrl.project = {};
				}
			});
		}

		/**
		 * Used for setting the database result to the representation-object in the controller.
		 */
		function setProject(response) {
			ctrl.project = response;
			ctrl.projecttitle = response.title;
		}

		function setTemplateAll(response) {
			ctrl.templateAll = response;
			ctrl.project.template = response[0];
		}

		/**
		 * Success message after saving.
		 */
		function saveSuccessCallbackThatGoesTo(gotoDestination) {
			return function (response) {
				setProject(response);
				dialogService.showDialog("project.dialog.success.title", "project.save.success", dialogService.dialog.id.success, gotoDestination);
			}
		}

		function gotoProjectDomain() {
			gotoProject.domain(ctrl.project.id);
		}

		function gotoProjectGenerate() {
			gotoProject.generate(ctrl.project.id);
		}

		/**
		 * Error message after saving.
		 */
		function saveError(response) {
			dialogService.showDialog("project.dialog.error.title", "project.save.error", dialogService.dialog.id.error, function(){});
		}

		/**
		 * Error message after loading the project.
		 */
		function loadError(response) {
			dialogService.showDialog("project.dialog.error.title", "project.load.error", dialogService.dialog.id.error, gotoProject.all);
		}

		function closeDialog(dialogid) {
			dialogService.closeDialog(dialogid);
		}
	}
})();<|endoftext|>