Example #1
0
  "change input": function (event) {
    const productId = ReactionProduct.selectedProductId();
    const updateMeta = {
      key: $(event.currentTarget).parent().children(
        ".metafield-key-input").val(),
      value: $(event.currentTarget).parent().children(
        ".metafield-value-input").val()
    };
    if (this.key) {
      Meteor.call("products/updateMetaFields", productId, updateMeta,
        this);
      $(event.currentTarget).animate({
        backgroundColor: "#e2f2e2"
      }).animate({
        backgroundColor: "#fff"
      });
      return Tracker.flush();
    }

    if (updateMeta.value && !updateMeta.key) {
      $(event.currentTarget).parent().children(".metafield-key-input").val(
        "").focus();
    }
    if (updateMeta.key && updateMeta.value) {
      Meteor.call("products/updateMetaFields", productId, updateMeta);
      Tracker.flush();
      $(event.currentTarget).parent().children(".metafield-key-input").val(
        "").focus();
      return $(event.currentTarget).parent().children(
        ".metafield-value-input").val("");
    }
  }
Example #2
0
  "change input": function (event) {
    const productId = ReactionProduct.selectedProductId();
    const updateMeta = {
      key: Template.instance().$(event.currentTarget).parent().children(".metafield-key-input").val(),
      value: Template.instance().$(event.currentTarget).parent().children(".metafield-value-input").val()
    };

    if (this.key) {
      const index = Template.instance().$(event.currentTarget).closest(".metafield-list-item").index();
      Meteor.call("products/updateMetaFields", productId, updateMeta, index);
      Template.instance().$(event.currentTarget).animate({
        backgroundColor: "#e2f2e2"
      }).animate({
        backgroundColor: "#fff"
      });
      return Tracker.flush();
    }

    if (updateMeta.value && !updateMeta.key) {
      Template.instance().$(event.currentTarget).parent().children(".metafield-key-input").val("").focus();
    }
    if (updateMeta.key && updateMeta.value) {
      Meteor.call("products/updateMetaFields", productId, updateMeta);
      Tracker.flush();
      Template.instance().$(event.currentTarget).parent().children(".metafield-key-input").val("").focus();
      return Template.instance().$(event.currentTarget).parent().children(".metafield-value-input").val("");
    }
  }
Example #3
0
  "click .update-product-weight": function (event) {
    event.preventDefault();

    const tag = ReactionProduct.getTag();
    const positions = this.positions && this.positions[tag] || {};
    let weight = positions.weight || 0;

    if (weight < 2) {
      weight++;
    } else {
      weight = 0;
    }

    const position = {
      weight: weight,
      updatedAt: new Date()
    };
    Meteor.call("products/updateProductPosition", this._id, position, tag, error => {
      if (error) {
        Logger.warn(error);
        throw new Meteor.Error(403, error);
      }
    });
    return Tracker.flush();
  }
        it('Router.go to route.', function () {
            expect(RouterInstance.path()).toBe('/');

            RouterInstance.go('route01');
            Tracker.flush();

            expect(RouterInstance.path()).toBe('/route01');
        });
Example #5
0
 'click #show-create': function(evt, tmpl) {
     if(this.isDisabled){
         return;
     }
     Session.set('evidenceShowNew', true);
     Tracker.flush();
     activateInput($('input[name=referenceID]'));
 },
        it ('Router.params print the params if params are given to Router.go', function() {
            let param = 'heyimbored';
            RouterInstance.go('route03', { param_01: param });
            Tracker.flush();

            expect(RouterInstance.params()).toEqual(jasmine.objectContaining({
                param_01: param
            }));
        });
Example #7
0
  this.editList = () => {
    this.state.set ( 'editing', true );

    // force the template to redraw based on the reactive change
    Tracker.flush ();
    // We need to wait for the fade in animation to complete to reliably focus the input
    Meteor.setTimeout ( () => {
      this.$ ( '.js-edit-form input[type=text]' ).focus ();
    }, 400 );
  };
Example #8
0
  this.editList = () => {
    this.state.set('editing', true);

    // force the template to redraw based on the reactive change
    Tracker.flush();
    // TODO -- I think velocity introduces a timeout before actually setting opacity on the
    //   element, so I can't focus it for a moment.
    Meteor.setTimeout(() => {
      this.$('.js-edit-form input[type=text]').focus();
    });
  };
 beforeEach(function() {
     RouterInstance.go('Home');
     Tracker.flush();
 });
        it('Router.routeName prints the routeName of a route with out a routeName.', function () {
            RouterInstance.go('/justapath');
            Tracker.flush();

            expect(RouterInstance.routeName()).toBe('/justapath');
        });
Example #11
0
 'click #adminUser-show-edit': function(evt, tmpl) {
     Session.set('adminUserEditingId', this._id);
     Tracker.flush();
     activateInput(tmpl.find('input[name=fullName]'));
 },
Example #12
0
 this.parent().update({ typeId }, (err) => {
   Tracker.flush();
   this.expandCollapsed(this.standardId());
 });
Example #13
0
 this.parent().update({ sectionId }, () => {
   Tracker.flush();
   this.expandCollapsed(this.standardId());
 });
Example #14
0
 toggleEdit = function(_id){
     getScrollPosition();
     Session.set('evidenceEditingId', _id);
     Tracker.flush();
     activateInput($('input[name=referenceID]')[0]);
 },
Example #15
0
 'click #show-create-btn': function(evt, tmpl) {
     Session.set('evidenceShowNew', true);
     Tracker.flush();
     activateInput($('input[name=referenceID]'));
 },
 withDiv((el) => {
   const ourTemplate = _.isString(template) ? Template[template] : template;
   Blaze.renderWithData(ourTemplate, data, el);
   Tracker.flush();
   callback(el);
 });