How to use the alloy.Collections function in alloy

To help you get started, we’ve selected a few alloy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matomo-org / matomo-mobile-2 / app / lib / Piwik / Tracker.js View on Github external
this.prepareVisitCustomVariables = function () {
        
        var locale      = require('Piwik/Locale');
        var Alloy       = require("alloy");
        var numAccounts = Alloy.Collections.instance("appAccounts").length;
            
        this.setCustomVariable(1, 'OS', Ti.Platform.osname + ' ' + Ti.Platform.version, 'visit');

        // Piwik Version
        this.setCustomVariable(2, 'Matomo Mobile Version', require('Piwik').getAppVersion(), 'visit');

        // Locale of the device + configured locale
        this.setCustomVariable(3, 'Locale', locale.getPlatformLocale() + '::' + locale.getLocale(), 'visit');
        this.setCustomVariable(4, 'Num Accounts', numAccounts, 'visit');
        
        locale   = null;
    };
github appcelerator / alloy / test / apps / testing / ALOY-1033 / _generated / ios / alloy / controllers / index.js View on Github external
this.__controllerPath = "index";
    this.args = arguments[0] || {};
    if (arguments[0]) {
        {
            __processArg(arguments[0], "__parentSymbol");
        }
        {
            __processArg(arguments[0], "$model");
        }
        {
            __processArg(arguments[0], "__itemTemplate");
        }
    }
    var $ = this;
    var exports = {};
    Alloy.Collections.instance("rows");
    $.__views.index = Ti.UI.createWindow({
        backgroundColor: "white",
        layout: "vertical",
        id: "index"
    });
    $.__views.index && $.addTopLevelView($.__views.index);
    $.__views.searchList = Ti.UI.createSearchBar({
        id: "searchList",
        showCancel: true,
        top: 20
    });
    $.__views.index.add($.__views.searchList);
    var __alloyId2 = {};
    var __alloyId5 = [];
    var __alloyId6 = {
        type: "Ti.UI.Label",
github appcelerator / alloy / test / apps / testing / ALOY-817 / _generated / android / alloy / controllers / index.js View on Github external
this.args = arguments[0] || {};
    if (arguments[0]) {
        {
            __processArg(arguments[0], "__parentSymbol");
        }
        {
            __processArg(arguments[0], "$model");
        }
        {
            __processArg(arguments[0], "__itemTemplate");
        }
    }
    var $ = this;
    var exports = {};
    var __defers = {};
    Alloy.Collections.instance("empty");
    Alloy.Models.instance("empty");
    $.anotherModel = Alloy.createModel("empty");
    collectionChange ? Alloy.Collections.empty.on("change", collectionChange) : __defers["Alloy.Collections.empty!change!collectionChange"] = true;
    modelChange ? Alloy.Models.empty.on("change", modelChange) : __defers["Alloy.Models.empty!change!modelChange"] = true;
    anotherModelChange ? $.anotherModel.on("change", anotherModelChange) : __defers["$.anotherModel!change!anotherModelChange"] = true;
    $.__views.index = Ti.UI.createWindow({
        backgroundColor: "#fff",
        fullscreen: false,
        exitOnClose: true,
        id: "index"
    });
    $.__views.index && $.addTopLevelView($.__views.index);
    windowClick ? $.addListener($.__views.index, "click", windowClick) : __defers["$.__views.index!click!windowClick"] = true;
    $.__views.map2 = Alloy.Globals.Map.createView({
        id: "map2"
    });
github appcelerator / alloy / test / apps / testing / ALOY-895 / _generated / mobileweb / alloy / controllers / index.js View on Github external
name: "Spiderman",
            status: false
        }, {
            name: "Wonder Woman",
            status: true
        }, {
            name: "Tony Lukasavage",
            status: false
        } ]);
        Alloy.Collections.heroes.each(function(_m) {
            _m.save();
        });
        Ti.App.Properties.setString("seeded", "yuppers");
        Alloy.Collections.heroes.fetch();
    }
    Alloy.Collections.heroes.fetch();
    $.index.open();
    __defers["$.__views.__alloyId4!click!toggleState"] && $.addListener($.__views.__alloyId4, "click", toggleState);
    _.extend($, exports);
}
github appcelerator / alloy / test / apps / testing / ALOY-913 / _generated / android / alloy / controllers / index.js View on Github external
color: "#fff",
        backgroundColor: "transparent",
        image: "/ic_menu_add.png",
        touchEnabled: false,
        id: "addImage"
    });
    $.__views.addView.add($.__views.addImage);
    $.__views.todoTable = Ti.UI.createView({
        top: Alloy.Globals.tableTop,
        bottom: "46dp",
        layout: "vertical",
        id: "todoTable",
        dataTransform: "transformFunction"
    });
    $.__views.todoWin.add($.__views.todoTable);
    var __alloyId7 = Alloy.Collections["todo"] || todo;
    __alloyId7.on("fetch destroy change add remove reset", __alloyId8);
    exports.destroy = function() {
        __alloyId7 && __alloyId7.off("fetch destroy change add remove reset", __alloyId8);
    };
    _.extend($, $.__views);
    var todos = Alloy.Collections.todo;
    var INDEXES = {
        All: 0,
        Active: 1,
        Done: 2
    };
    var whereIndex = INDEXES["All"];
    $.todoWin.open();
    todos && todos.fetch();
    __defers["$.__views.addView!click!addToDoItem"] && $.addListener($.__views.addView, "click", addToDoItem);
    __defers["__alloyId6!focus!setQuantity"] && $.addListener(__alloyId6, "focus", setQuantity);
github appcelerator / alloy / test / apps / testing / ALOY-440 / _generated / mobileweb / alloy / controllers / index.js View on Github external
this.__controllerPath = "index";
    this.args = arguments[0] || {};
    if (arguments[0]) {
        {
            __processArg(arguments[0], "__parentSymbol");
        }
        {
            __processArg(arguments[0], "$model");
        }
        {
            __processArg(arguments[0], "__itemTemplate");
        }
    }
    var $ = this;
    var exports = {};
    Alloy.Collections.instance("fruits");
    Alloy.Collections.instance("colors");
    $.__views.index = Ti.UI.createWindow({
        backgroundColor: "#fff",
        fullscreen: false,
        exitOnClose: true,
        id: "index"
    });
    $.__views.index && $.addTopLevelView($.__views.index);
    $.__views.picker = Ti.UI.createPicker({
        id: "picker",
        top: 50,
        useSpinner: true
    });
    $.__views.index.add($.__views.picker);
    var __alloyId4 = [];
    $.__views.column1 = Ti.UI.createPickerColumn({
github appcelerator / alloy / test / apps / testing / ALOY-1127 / _generated / mobileweb / alloy / controllers / index.js View on Github external
this.__controllerPath = "index";
    this.args = arguments[0] || {};
    if (arguments[0]) {
        {
            __processArg(arguments[0], "__parentSymbol");
        }
        {
            __processArg(arguments[0], "$model");
        }
        {
            __processArg(arguments[0], "__itemTemplate");
        }
    }
    var $ = this;
    var exports = {};
    Alloy.Collections.instance("test");
    exports.destroy = function() {};
    _.extend($, $.__views);
    Ti.API.info("aloy1127: " + Ti.App.Properties.hasProperty("aloy1127"));
    if (!Ti.App.Properties.hasProperty("aloy1127")) {
        for (var i = 1, j = 7; j > i; i++) Alloy.createModel("test", {
            username: "User " + i
        }).save();
        Ti.App.Properties.setString("aloy1127", "yes");
    }
    Alloy.Collections.test.fetch();
    $.index.addEventListener("open", function() {
        $.destroy();
    });
    $.index.open();
    render();
    _.extend($, exports);
github BOXOUT-THINKERS / TiOpenChat / Resources / iphone / alloy / controllers / contacts.js View on Github external
width: Titanium.UI.FILL,
        height: Titanium.UI.FILL,
        sections: __alloyId63,
        templates: __alloyId3,
        id: "listView"
    });
    $.__views.container.add($.__views.listView);
    exports.destroy = function() {};
    _.extend($, $.__views);
    arguments[0] || {};
    $.container.title = L("c_friendList");
    $.headerTitle1.text = L("cb_profileTitle");
    $.headerTitle2.text = L("cb_favoriteTitle");
    $.headerTitle3.text = L("cb_friendHeaderTitle");
    $.headerTitle4.text = L("cb_searchTitle");
    var contactsCol = Alloy.Collections.instance("contacts");
    Alloy.Collections.instance("message");
    var chatRoomCol = Alloy.Collections.instance("chatRoom");
    var favoriteFriends = [];
    var friends = [];
    var unregisteredFriends = [];
    var ufIndex = 0;
    var unregisteredFriendsNotDisplayCount = 0;
    Alloy.Models.instance("user").on("change:profile", drawProfileRow);
    contactsCol.on("redraw", function() {
        nowOpen && drawContactRow();
    });
    contactsCol.on("fetch", function() {
        nowOpen && drawContactRow();
    });
    contactsCol.on("add", function(model) {
        model.get("isHidden") || model.get("isBlock") || Alloy.Globals.loginC.doingSyncAddress || nowOpen && drawContactRow();
github appcelerator / alloy / samples / apps / advanced / proxy_property_requires / _generated / blackberry / alloy / controllers / index.js View on Github external
$.__views.staticTab = Ti.UI.createTab({
        window: $.__views.staticWindow,
        id: "staticTab",
        title: "static"
    });
    $.__views.index.addTab($.__views.staticTab);
    $.__views.bindingWindow = Ti.UI.createWindow({
        backgroundColor: "#fff",
        id: "bindingWindow",
        title: "binding"
    });
    $.__views.bindingTable = Ti.UI.createTableView({
        id: "bindingTable"
    });
    $.__views.bindingWindow.add($.__views.bindingTable);
    var __alloyId28 = Alloy.Collections["dummy"] || dummy;
    __alloyId28.on("fetch destroy change add remove reset", __alloyId29);
    $.__views.bindingTab = Ti.UI.createTab({
        window: $.__views.bindingWindow,
        id: "bindingTab",
        title: "binding"
    });
    $.__views.index.addTab($.__views.bindingTab);
    $.__views.proxiesWindow = Ti.UI.createWindow({
        backgroundColor: "#fff",
        id: "proxiesWindow",
        title: "proxy properties"
    });
    $.__views.__alloyId36 = Alloy.createController("proxy", {
        id: "__alloyId36"
    });
    var __alloyId37 = [];
github BOXOUT-THINKERS / TiOpenChat / Resources / iphone / alloy / controllers / contactsBan.js View on Github external
fontSize: 14,
            fontWeight: "bold"
        },
        backgroundColor: "#41385b",
        borderRadius: 4,
        id: "hiddenBtn"
    });
    $.__views.footerView.add($.__views.hiddenBtn);
    hiddenContacts ? $.addListener($.__views.hiddenBtn, "click", hiddenContacts) : __defers["$.__views.hiddenBtn!click!hiddenContacts"] = true;
    exports.destroy = function() {};
    _.extend($, $.__views);
    arguments[0] || {};
    $.container.title = L("cb_friendTitle");
    $.blockBtn.title = L("cb_banFriendBtn");
    $.hiddenBtn.title = L("cb_hideFriendBtn");
    var contactsCol = Alloy.Collections.instance("contacts");
    var Q = Alloy.Globals.Q;
    var friendContactsCol;
    var selectedModels = [];
    $.getView().addEventListener("open", function() {
        var allContactsCol = Alloy.Collections.instance("contacts");
        var models = allContactsCol.filter(function(model) {
            return model.get("User_objectId_To") && !(model.get("isHidden") || model.get("isBlock"));
        });
        friendContactsCol = Alloy.createCollection("contacts");
        friendContactsCol.reset(models);
        drawContacts();
        Alloy.Globals.stopWaiting();
    });
    var drawContacts = function() {
        var items = [];
        friendContactsCol.each(function(model) {