StripedListEditingView.js revision 466bd434c374b0274b8ed61ef525714ce149a186
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * The contents of this file are subject to the terms of the Common Development and
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Distribution License (the License). You may not use this file except in compliance with the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * specific language governing permission and limitations under the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * When distributing Covered Software, include this CDDL Header Notice in each file and include
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Header, with the fields enclosed by brackets [] replaced by your own identifying
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * information: "Portions copyright [year] [name of copyright owner]".
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Copyright 2015 ForgeRock AS.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/*global define*/
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkdefine("org/forgerock/openam/ui/admin/views/realms/policies/common/StripedListEditingView", [
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "underscore",
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "org/forgerock/commons/ui/common/main/AbstractView" ,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "org/forgerock/commons/ui/common/main/EventManager",
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "org/forgerock/commons/ui/common/util/Constants"
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk], function ($, _, AbstractView, EventManager, Constants) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk baseRender: function (data, tpl, el, callback) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.parentRender(function () {
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk this.flashDomItem(this.$el.find(".text-success"), "text-success");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk addItem: function (e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk var pending = this.getPendingItem(e), // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if (!this.isValid(e)) { // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk EventManager.sendEvent(Constants.EVENT_DISPLAY_MESSAGE_REQUEST, "invalidItem");
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk this.flashDomItem(this.$el.find(".editing"), "text-danger");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if (self.isExistingItem(pending, item)) { // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk EventManager.sendEvent(Constants.EVENT_DISPLAY_MESSAGE_REQUEST, "duplicateItem");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.flashDomItem(this.$el.find(".list-group-item:eq(" + duplicateIndex + ")"), "text-danger");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk deleteItem: function (e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.data.items = this.getCollectionWithout(e); // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } // provide child implementation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk $.doTimeout(_.uniqueId(className), 2000, function () {