<file_sep>//Meteor.publish("users", function () {
//    return Meteor.users.find({_id: this.userId()});
//});
Meteor.users.deny({
    update: function() {
        return true;
    }
});<file_sep>ViewModel.addBinding("files", {
  on: "change",

  get(event, $elem) {
    return $elem.prop("files");
  }
});
<file_sep>// Class for binding nexuses
Nexus = class Nexus extends Base {
  constructor(view, selector, binding, context = {}) {
    // Ensure type of arguments
    check(selector, Match.OneOf(String, Match.Where(_.isElement)));
    check(binding, Match.OneOf(String, Binding));
    check(context, Object);

    // Possibly get binding
    if (_.isString(binding))
      binding = Binding.get(binding);

    let is_detached = binding.option("detached"),
        key;


    // Call constructor of Base
    super(view, binding.name);

    // Possibly create nexuses list
    if (!(this.view[ViewModel.nexusesKey] instanceof List))
      this.view[ViewModel.nexusesKey] = new List;


    // Static properties on nexus instance
    defineProperties(this, {
      // Element selector
      selector: { value: selector },

      // Calling context of bind
      context: { value: context },

      // Whether to run the set function when updating
      setPrevented: { value: null, writable: true }
    });

    // Possibly add key to nexus
    if (!is_detached && _.isArray(context.args) && _.isString(context.args[0])) {
      key = context.args[0];

      defineProperties(context, {
        // Viewmodel key
        key: { value: key }
      });
    }


    // Static properties on context object
    defineProperties(context, {
      // Reference to view
      view: { value: view },

      // Reference to template instance
      templateInstance: { value: templateInstance(view) },

      // Method bound to instance
      preventSet: { value: this.preventSet.bind(this) }
    });

    // Possibly ensure existence of a viewmodel
    if (!is_detached && !(context.viewmodel instanceof ViewModel)) {
      let vm = ViewModel.ensureViewmodel(view, key);
      
      defineProperties(context, {
        // Reference to viewmodel
        viewmodel: { value: vm }
      });
    }


    // Add binding resolved with context
    defineProperties(this, {
      // Binding definition
      binding: { value: binding.definition(this.context) }
    });


    // Unbind element on view refreshed
    this.onRefreshed(this.unbind);

    // Unbind element on view destroyed
    this.onDestroyed(this.unbind);

    // Unbind element on computation invalidation
    this.onInvalidate(() => this.unbind(true));


    // Bind element on view ready
    this.onReady(this.bind);
  }


  // Get viewmodel property
  getProp() {
    let vm = this.context.viewmodel,
        has_prop = vm && !_.isUndefined(this.context.key) && _.isFunction(vm[this.context.key]);

    return has_prop ? vm[this.context.key] : null;
  }

  // Whether the element is present in the document body
  inBody() {
    return document.body.contains(this.elem);
  }

  // Bind element
  bind() {
    let $elem = $(this.elem || this.selector);

    if (!this.elem) {
      // Save element on nexus
      defineProperties(this, {
        elem: { value: $elem[0] }
      });
    }

    // Don't bind if element is no longer present
    if (!this.inBody())
      return false;


    let binding = this.binding,
        prop = this.getProp();


    if (binding.init) {
      // Ensure type of definition property
      check(binding.init, Function);

      let init_value = prop && prop();

      // Run init function immediately
      binding.init.call(this.context, $elem, init_value);
    }


    if (binding.on) {
      // Ensure type of definition property
      check(binding.on, String);

      let listener = event => {
        if (binding.get) {
          // Ensure type of definition property
          check(binding.get, Function);

          let result = binding.get.call(this.context, event, $elem, prop);

          // Call property if get returned a value other than undefined
          if (prop && !_.isUndefined(result)) {
            // Don't trigger set function from updating property
            if (this.setPrevented !== false)
              this.preventSet();

            prop.call(this.context.viewmodel, result);
          }
        }
        else if (prop) {
          // Call property if get was omitted in the binding definition
          prop.call(this.context.viewmodel, event, this.context.args, this.context.hash);
        }

        // Mark that we are exiting the update cycle
        Tracker.afterFlush(this.preventSet.bind(this, null));
      };

      // Save listener for unbind
      defineProperties(this, {
        listener: { value: listener }
      });

      // Register event listener
      $elem.on(binding.on, listener);
    }


    if (binding.set) {
      // Ensure type of definition property
      check(binding.set, Function);
      
      // Wrap set function and add it to list of autoruns
      this.autorun(comp => {
        if (comp.firstRun) {
          // Save computation for unbind
          defineProperties(this, {
            comp: { value: comp }
          });
        }

        let new_value = prop && prop();

        if (!this.setPrevented)
          binding.set.call(this.context, $elem, new_value);
      });
    }


    // Add to view list
    this.view[ViewModel.nexusesKey].add(this);

    // Add to global list
    Nexus.add(this);

    return true;
  }

  // Unbind element
  unbind(do_unbind = this.view.isDestroyed || !this.inBody()) {
    // Unbind elements that are no longer part of the DOM
    if (do_unbind) {
      let binding = this.binding,
          prop = this.getProp();


      // Possibly unregister event listener
      if (this.listener)
        $(this.elem).off(binding.on, this.listener);

      // Possibly stop set autorun
      if (this.comp)
        this.comp.stop();

      
      // Possibly run dispose function
      if (binding.dispose) {
        // Ensure type of definition property
        check(binding.dispose, Function);

        binding.dispose.call(this.context, prop);
      }


      // Remove from global list
      Nexus.remove(this);

      // Remove from view list
      this.view[ViewModel.nexusesKey].remove(this);
    }

    return do_unbind;
  }


  // Change prevented state of nexus
  preventSet(state = true) {
    // Ensure type of argument
    check(state, Match.OneOf(Boolean, null));

    this.setPrevented = state;
  }
};

// Decorate Nexus class with list methods operating on an internal list
List.decorate(Nexus);
<file_sep>ViewModel.addBinding("class", {
  set($elem) {
    let classes = this.hash;

    // Keyword arguments must be present
    if (_.isObject(classes)) {
      // Possibly only use indicated keys
      if (this.args.length)
        classes = _.pick(classes, this.args);

      _.each(classes, (value, class_name) => $elem.toggleClass(class_name, value || false));
    }
  }
}, {
  // This binding doesn't need a viewmodel
  detached: true
});
<file_sep>ViewModel.addBinding("key", {
  on: "keyup",

  get(event, $elem, prop) {
    let use_hash = _.isNumber(_.isObject(this.hash) && this.hash.keyCode),
        key_code = use_hash ? this.hash.keyCode : parseInt(this.args[1], 10);

    if (event.which === key_code)
      prop(event, this.args, this.hash);
  }
});
<file_sep>Meteor.startup(function() {
    $('body').attr('data-uk-observe', '1');
});<file_sep>ViewModel.addBinding("disabled", {
  set($elem, new_value) {
    $elem.prop("disabled", new_value);
  }
});
<file_sep>// Class for reactive lists
List = class List extends Array {
  constructor(...args) {
    super(...args);

    // Add dependency to list
    defineProperties(this, {
      dep: { value: new Tracker.Dependency }
    });
  }


  // Reactively add an item
  add(...items) {
    this.push(...items);

    this.dep.changed();
  }

  // Reactively remove an item
  remove(...items) {
    let result = false;

    _.each(items, item => {
      let index = this.indexOf(item),
          is_found = !!~index;

      if (is_found) {
        this.splice(index, 1);

        this.dep.changed();

        result = true;
      }
    });

    return result;
  }


  // Reactively get an array of matching items
  find(test) {
    this.dep.depend();

    // Possibly remove items failing test
    if (test) {
      return _.filter(this, (...args) => {
        if (_.isFunction(test))
          return test(...args);
        else if (_.isObject(args[0]) && _.isFunction(args[0].test))
          return args[0].test(test);
      });
    }

    return this.slice();
  }

  // Reactively get the first current item at index
  findOne(test, index) {
    if (_.isNumber(test))
      index = test, test = null;

    return this.find(test).slice(index || 0)[0] || null;
  }


  // Decorate an object with list methods operating on an internal list
  static decorate(obj, reference_key) {
    // Ensure type of arguments
    check(obj, Match.OneOf(Object, Function));
    check(reference_key, Match.Optional(String));

    // Internal list
    let list = new List;

    // Property descriptors
    let descriptor = {
      add: { value: list.add.bind(list) },
      remove: { value: list.remove.bind(list) },
      find: { value: list.find.bind(list) },
      findOne: { value: list.findOne.bind(list) }
    };

    // Possibly add a reference to the internal list
    if (reference_key)
      descriptor[reference_key] = { value: list };

    // Add bound methods
    defineProperties(obj, descriptor);
  }
};
<file_sep>Template.ContactsList.viewmodel({
    myName: function () {
        if (Meteor.userId()) {
            return Meteor.users.find({_id: Meteor.userId()}).fetch()._id;
        }
    },
    addToTask: function () {
        console.log("addToTask");
        Session.set('addToTask', 'true');
    },
    showAddTask: function () {
        return Session.get('addToTask');
    },
    onDestroyed: function () {
        console.log("ondestroy");
    },
    onCreated: function () {
        console.log("oncreated");
    },
    onRendered: function () {
        var str = " <NAME>   ";
        var nameArr = s.words(str);
        var nAl = nameArr.length;
        var nextTLastW = s(nameArr[nAl -2]).trim().capitalize().value();
        var lastWord = s(nameArr[nAl -1]).trim().capitalize().value();
        console.log(nAl);
        console.log(nextTLastW.charAt(0) + lastWord.charAt(0));
        $('.popupthis').popup({
            popup: '#popupthis',
            on    : 'click',
            onVisible: function () {
                console.log("onVisible");
            },
            exclusive: 'true'
        });
    }
});<file_sep>ViewModel.addBinding("value", function () {
  let use_hash = _.isObject(this.hash),
      throttle = use_hash && this.hash.throttle || parseInt(this.args[1], 10),
      leading = use_hash && _.isBoolean(this.hash.leading) ? this.hash.leading : String(this.args[2]) === "true",
      get = function (event, $elem, prop) {
        this.preventSet();

        prop($elem.val());
      };

  if (throttle)
    get = _.throttle(get, throttle, { leading: leading });

  return {
    set($elem, new_value) {
      $elem.val(new_value);
    },
    
    on: "cut paste keyup input change",

    get: get
  };
});
<file_sep>Template.Index.viewmodel({
    //showCases: 'hello',
    aCases: function () {
        //$('.ui.modal').modal('show');
        Session.set("cPanelContent", "CasesList")
    },
    aTasks: function () {
        Session.set("cPanelContent", "TasksList")
    },
    aNotes: function () {
        Session.set("cPanelContent", "NotesList")
    },
    aMsgs: function () {
        Session.set("cPanelContent", "MsgsList")
    },
    aContacts: function () {
        Session.set("cPanelContent", "ContactsList")
    },
});
Template.CPanel.viewmodel({
    aCases: function () {
        var showCases = Session.get("cPanelContent");
        if (showCases == 'CasesList'){
            return 'CasesList'
        }
        return ''
    },
    aTasks: function () {
        var aTasks = Session.get("cPanelContent");
        if ( aTasks == 'TasksList'){
            return 'TasklsList'
        }
        return ''
    },
    aNotes: function () {
        var aNotes = Session.get("cPanelContent");
        if ( aNotes == 'NotesList'){
            return 'NotesList'
        }
        return ''
    },
    aMsgs: function () {
        var aNotes = Session.get("cPanelContent");
        if ( aNotes == 'MsgsList'){
            return 'MsgsList'
        }
        return ''
    },
    aContacts: function () {
        var aContacts = Session.get("cPanelContent");
        if ( aContacts == 'ContactsList'){
            return 'ContactsList'
        }
        return ''
    },
});
<file_sep>ViewModel.addBinding("checked", {
  set($elem, new_value) {
    $elem.prop("checked", new_value);
  },

  on: "change",

  get(event, $elem) {
    return $elem.prop("checked");
  }
});
<file_sep>ViewModel.addBinding("enterKey", {
  on: "keyup",

  get(event, $elem, prop) {
    if (event.which === 13)
      prop(event, this.args, this.hash);
  }
});
<file_sep>AccountsTemplates.configureRoute('resetPwd', {
    name: 'resetPwd',
    path: '/reset-password',
    template: 'signInAtForm',
    layoutTemplate: 'defaultLayout',
    layoutRegions: {
        top: 'defaultHeader',
        //footer: 'myFooter'
    },
    contentRegion: 'main'
});
AccountsTemplates.configureRoute('signIn', {
    name: 'signin',
    path: '/login',
    template: 'signInAtForm',
    layoutTemplate: 'defaultLayout',
    layoutRegions: {
        top: 'defaultHeader',
        //footer: 'myFooter'
    },
    contentRegion: 'main'
});<file_sep>ViewModel.addBinding("radio", {
  set($elem, new_value) {
    if ($elem.val() === new_value)
      $elem.prop("checked", true);
  },
  
  on: "change",

  get(event, $elem) {
    return $elem.val();
  }
});
<file_sep>FlowRouter.route('/', {
    triggersEnter: [AccountsTemplates.ensureSignedIn],
    subscriptions: function() {
        this.register('users', Meteor.subscribe('users'));
    },
    action: function() {
        BlazeLayout.render("defaultLayout", {top: "defaultHeader", main: "Index"});
    }
});
FlowRouter.route('/logout', {
    action: function() {
        Meteor.logout();
        FlowRouter.go('/')
    }
});
<file_sep>ViewModel.addBinding("focused", {
  set($elem, new_value) {
    if (new_value)
      $elem.focus();
    else
      $elem.blur();
  },
  
  on: "focus blur",

  get(event) {
    return event.type === "focus";
  }
});
<file_sep>/*
  Private package utility functions
*/

// Use ES5 property definitions when available
defineProperties = function (obj, props) {
  if (_.isFunction(Object.defineProperties))
    Object.defineProperties(obj, props);
  else
    _.each(props, (prop, key) => obj[key] = prop.value);
};

// Get closest template instance for view
templateInstance = function (view) {
  do if (view.template && view.name !== "(contentBlock)" && view.name !== "Template.__dynamic" && view.name !== "Template.__dynamicWithDataContext")
    return view.templateInstance();
  while (view = view.parentView);

  return null;
};

// Get the current path, taking FlowRouter into account
// https://github.com/kadirahq/flow-router/issues/293
getPath = function () {
  if (typeof FlowRouter !== "undefined")
    return FlowRouter.current().path;

  return location.pathname + location.search;
};
