How to use the globals.BADGE_HOST function in globals

To help you get started, we’ve selected a few globals 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 cyverse / troposphere / troposphere / static / js / collections / MyBadgeCollection.js View on Github external
import Backbone from "backbone";
import Badge from "models/Badge";
import globals from "globals";

export default Backbone.Collection.extend({
    model: Badge,
    url: globals.BADGE_HOST + "/1",

    parse: function(response) {
        this.meta = {
            count: response.count,
            next: response.next,
            previous: response.previous
        };
        return response.instances.map(function(instance) {
            return instance.badge;
        });
    }
});
github cyverse / troposphere / troposphere / static / js / actions / BadgeActions.js View on Github external
grant: function(params) {
        try {
            var badge = params.badge,
                email = stores.ProfileStore.get().get("email"),
                system = globals.BADGE_SYSTEM,
                secret = globals.BADGE_SECRET,
                csrftoken = this.getCookie("csrftoken"),
                badgeSlug = badge.get("slug");
        } catch (err) {
            return;
        }
        $.ajax({
            url: globals.BADGE_HOST,
            type: "POST",
            dataType: "json",
            contentType: "application/json",
            headers: {
                "X-CSRFToken": csrftoken
            },
            data: JSON.stringify({
                email: email,
                system: system,
                badgeSlug: badgeSlug,
                secret: secret
            }),
            success: function() {
                NotificationController.info("You have earned a badge!");
                Utils.dispatch(BadgeConstants.GRANT_BADGE, {
                    badge: badge
github cyverse / troposphere / troposphere / static / js / models / Badge.js View on Github external
import Backbone from "backbone";
import globals from "globals";

export default Backbone.Model.extend({
    urlRoot: globals.BADGE_HOST
});
github cyverse / troposphere / troposphere / static / js / collections / BadgeCollection.js View on Github external
import Backbone from "backbone";
import Badge from "models/Badge";
import globals from "globals";

export default Backbone.Collection.extend({
    model: Badge,
    url: globals.BADGE_HOST,

    parse: function(response) {
        this.meta = {
            count: response.count,
            next: response.next,
            previous: response.previous
        };
        return response.badges;
    }
});