<commit_before>'use strict';

var Backbone = require('backbone'),
    $ = require('jquery'),
    loadTemplate = require('../utils/loadTemplate'),
    baseVw = require('./baseVw');

module.exports = baseVw.extend({

  className: "flexCol-6 borderBottom",

  events: {
    'click .js-item': 'itemClick',
    'click .js-about': 'aboutClick',
    'click .js-itemShortEdit': 'editItemClick',
    'click .js-itemShortDelete': 'deleteItemClick',
    'click .js-itemShortDeleteConfirm': 'deleteItem',
    'click .js-itemShortDeleteCancel': 'cancelConfirmDelete',
    'click .js-itemShortClone': 'cloneItemClick'
  },

  initialize: function(options){
    //pre-load image
    this.parentEl = $(options.parentEl);
    this.listenTo(this.model, 'change', this.render);
    //if price has already been set, render
    if (this.model.get('priceSet') !== 0){
      this.render();
    }

    //store avatar reference in localStorage for other views
    var localAvatar = this.model.get('avatarURL') || this.model.get('serverUrl')+"get_image?hash="+this.model.avatar_hash+"&guid="+this.model.get('guid');
    localAvatar && localStorage.setItem('userAvatar-'+this.model.get('guid'), localAvatar);

    this.listenTo(window.obEventBus, "followUser", function(options){
      if (options.view === this || options.guid !== this.model.get('guid')) {
        return;
      }

      this.model.set('ownFollowing', true);
    });

    this.listenTo(window.obEventBus, "unfollowUser", function(options){
      if (options.view === this || options.guid !== this.model.get('guid')) {
        return;
      }

      this.model.set('ownFollowing', false);
    });

    this.listenTo(window.obEventBus, "blockingUser", function(e){
      if (e.guid == this.model.get('guid')) {
        this.model.set('isBlocked', true);
      }      
    });

    this.listenTo(window.obEventBus, "unblockingUser", function(e){
      if (e.guid !== this.model.get('guid')) {
        this.model.set('isBlocked', false);
      }      
    });
  },

  render: function(){
    var self = this;
    loadTemplate('./js/templates/itemShort.html', function(loadedTemplate) {
      self.$el.html(loadedTemplate(self.model.toJSON()));

      //append the view to the passed in parent
      self.parentEl.append(self.$el);

      if($(".js-list3").closest(".js-store").length ) {
          $(".js-store .js-list3 .flexCol-6").toggleClass('flexCol-6 flexCol-12');
          $(".js-store .js-list3 .homeFeedChatButton").css("display", "none");
          $(".js-store .js-list3 .gridItemControls").css("width", "600px");
          $(".gridItemControls").prepend( $(".js-store .js-list3 .itemPrice .itemPriceTag") );
          $(".itemPriceTag").css({"color": "#030303", "background-color": "#FFF", "position": "relative", "top": "72px", "margin-left": "8px" });
      }
    });<commit_msg>fix the price tag error in profile page<commit_after>'use strict';

var Backbone = require('backbone'),
    $ = require('jquery'),
    loadTemplate = require('../utils/loadTemplate'),
    baseVw = require('./baseVw');

module.exports = baseVw.extend({

  className: "flexCol-6 borderBottom",

  events: {
    'click .js-item': 'itemClick',
    'click .js-about': 'aboutClick',
    'click .js-itemShortEdit': 'editItemClick',
    'click .js-itemShortDelete': 'deleteItemClick',
    'click .js-itemShortDeleteConfirm': 'deleteItem',
    'click .js-itemShortDeleteCancel': 'cancelConfirmDelete',
    'click .js-itemShortClone': 'cloneItemClick'
  },

  initialize: function(options){
    //pre-load image
    this.parentEl = $(options.parentEl);
    this.listenTo(this.model, 'change', this.render);
    //if price has already been set, render
    if (this.model.get('priceSet') !== 0){
      this.render();
    }

    //store avatar reference in localStorage for other views
    var localAvatar = this.model.get('avatarURL') || this.model.get('serverUrl')+"get_image?hash="+this.model.avatar_hash+"&guid="+this.model.get('guid');
    localAvatar && localStorage.setItem('userAvatar-'+this.model.get('guid'), localAvatar);

    this.listenTo(window.obEventBus, "followUser", function(options){
      if (options.view === this || options.guid !== this.model.get('guid')) {
        return;
      }

      this.model.set('ownFollowing', true);
    });

    this.listenTo(window.obEventBus, "unfollowUser", function(options){
      if (options.view === this || options.guid !== this.model.get('guid')) {
        return;
      }

      this.model.set('ownFollowing', false);
    });

    this.listenTo(window.obEventBus, "blockingUser", function(e){
      if (e.guid == this.model.get('guid')) {
        this.model.set('isBlocked', true);
      }      
    });

    this.listenTo(window.obEventBus, "unblockingUser", function(e){
      if (e.guid !== this.model.get('guid')) {
        this.model.set('isBlocked', false);
      }      
    });
  },

  render: function(){
    var self = this;
    loadTemplate('./js/templates/itemShort.html', function(loadedTemplate) {
      self.$el.html(loadedTemplate(self.model.toJSON()));

      //append the view to the passed in parent
      self.parentEl.append(self.$el);

      if($(".js-list3").closest(".js-store").length ) {
          $(".js-store .js-list3 .flexCol-6").toggleClass('flexCol-6 flexCol-12');
          $(".js-store .js-list3 .homeFeedChatButton").css("display", "none");
          $(".js-store .js-list3 .gridItemControls").css("width", "600px");
          $(".js-store .js-list3 .flexCol-12 .gridItemControls").each(function() {
            $(this).prepend( $(this).siblings().find(".itemPrice .itemPriceTag") );
          });
          $(".itemPriceTag").css({"color": "#030303", "background-color": "#FFF", "position": "relative", "top": "72px", "margin-left": "8px" });
      }
    });
{'fraction_non_alphanumeric': 0.1917215102182196, 'fraction_numerical': 0.008313127814340146, 'mean_word_length': 3.2061179898033503, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2063462', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1812, 'n_words': 319}