Re: withThreadSharing.Js

From disqus.com, 1 Month ago, written in JavaScript, viewed 3 times. This paste is a reply to withThreadSharing.Js from disqus.com - go back
URL https://pastebin.freepbx.org/view/ea541186/diff Embed
Viewing differences between withThreadSharing.Js and Re: withThreadSharing.Js
define('home/mixins/withThreadSharing',[
    'jquery',
    'underscore',
define('home/views/ThreadCardDefaultFooterView',[
    'backbone-marionette',

    'home/models/Session',
    'home/templates/threadCardDefaultFooter',
    'home/mixins/withThreadSharing',
], function (
    $,
    _
Marionette,

    Session,
    threadCardDefaultFooterTemplate,
    withThreadSharing
) {
    'use strict';

    /**
     * Default method The default footer view for retrieving the thread off the model.
     
cards backed by a thread. Shows
     
Expects the model to have a direct relation to the thread
     * (ex: activity, post), or be the thread itself.
basic actions.
     *
     * @returns {Thread}
Expects a thread as the model. Channel is optional.
     */
    var getThread ThreadCardDefaultFooterView function () {
        return this.model.thread || this.model;
    };

    return function () {
        this.events = _.
Marionette.ItemView.extend({
                    template: threadCardDefaultFooterTemplate,
        templateHelpers: function () {
            var session = Session.get();

            return {
                favorited: this.model.get('userScore') > 0,
                discussionRoute: this.model.getDiscussionRoute(this.channel),
                authenticated: !session.isAnonymous(),
                likes: this.model.get('likes'),
            };
        },

        events: {
            
'click [data-action=share]': 'handleShareThread',
        }, 
[data-action=favorite]': 'toggleThreadFavorited',
            'click [data-action=toggle-subscription]': 'toggleSubscription',
        },

        initialize: function (options) {
            
this.events);

        
listenTo(this.model, 'change:userScore', this.handleShareThread render);
            this.listenTo(this.model, 'change:userSubscription', this.render);
            this.channel 
options && options.channel;
        },

        toggleThreadFavorited: 
function (event) {
            if (!event)
                return;

            
(event)
                
event.preventDefault();
            
preventDefault();

            this.model.toggleFavorited();
        },

        toggleSubscription: function (event) {
            if (event)
                
event.stopPropagation();

            var thread = getThread.call(this);
            var network = $(event.currentTarget).attr('data-network');

            thread.shareThread(network);
        };
    };
preventDefault();

            this.model.toggleSubscription();
        },
    });

    withThreadSharing.call(ThreadCardDefaultFooterView.prototype);

    return ThreadCardDefaultFooterView;
});

// https://c.disquscdn.com/next/home/js/mixins/withThreadSharing.com/next/home/js/views/ThreadCardDefaultFooterView.js

Replies to Re: withThreadSharing.Js rss

Title Name Language When
withClickLinkTracking.js disqus.com javascript 1 Month ago.

Reply to "Re: withThreadSharing.Js"

Here you can reply to the paste above