Example #1
0
const handleRedirect = ( routes, redirect ) => {
	let currentRoute = FlowRouter.getRouteName();
	if ( routes.indexOf( currentRoute ) > -1 ) {
		FlowRouter.go( redirect );
		return true;
	}
};
Example #2
0
export const getPathToMessage = (props) => {
  const currentRouteName = FlowRouter.getRouteName();
  const { params } = FlowRouter.current();
  const queryParams = { at: props._id };

  return FlowRouter.path(currentRouteName, params, queryParams);
};
Example #3
0
Template.App_body.onRendered(function appBodyOnRendered() {
  if (!Meteor.user()) {
    FlowRouter.go('App.login');
  } else if (!Meteor.user().profile.studentData) {
    FlowRouter.go('App.edit');
  };
});
Example #4
0
 $searchInput.focusin(function () {
   if (FlowRouter.getRouteName() != 'home')
     FlowRouter.go('home');
   $searchInput.css('font-family', 'Sweden Sans');
   $searchInput.attr('placeholder', 'Search DJ, genre, etc.');
   $('.tags').removeClass('hidden');
 });
  this.autorun(function() {
    const id = FlowRouter.getParam('_id');
    const key = FlowRouter.current().context.hash;

    if (!secureMessageRetriever && id) {
      secureMessageRetriever = SecureMessageRetriever({ id: id, key: key });
    }
  });
Example #6
0
				Meteor.defer(function() {
					if (Meteor.user() && Meteor.user().defaultRoom) {
						const room = Meteor.user().defaultRoom.split('/');
						FlowRouter.go(room[0], { name: room[1] }, FlowRouter.current().queryParams);
					} else {
						FlowRouter.go('home');
					}
				});
Example #7
0
  this.autorun(() => {
    
       var t = FlowRouter.getParam('t');
       var id = FlowRouter.getParam('id');
     var order = Orders.findOne( id );
     if(order.status !== "end"){
          FlowRouter.go("/cmd"+"/"+order.status+"/"+t+"/"+id);

     }
  });
Example #8
0
function redirectHandler() {
  const targetURL = FlowRouter.getQueryParam('b');
  if (targetURL) {
    FlowRouter.go(targetURL);
  } else {
    FlowRouter.withReplaceState(() => {
      FlowRouter.go('hello');
    });
  }
}
Example #9
0
    this.autorun(()=>{

        if(FlowRouter.getParam('id')){
            ruta.set('/cfs/files/images/'+FlowRouter.getParam('id'));
        }
        else{
            ruta.set('/preview.png');
        }
       
    });
Example #10
0
    template.autorun(() => {
      const currentUser = Meteor.user();
      const organizationsHandle = template.subscribe('currentUserOrganizations');
      if (!Meteor.loggingIn() && organizationsHandle.ready()) {
        if (currentUser) {
          const query = createOrgQueryWhereUserIsMember(currentUser._id);
          const selectedOrganizationSerialNumber = getSelectedOrgSerialNumber();
          const serialNumber = parseInt(selectedOrganizationSerialNumber, 10);
          const orgExists = !!Organizations.findOne({ ...query, serialNumber });

          if (serialNumber && orgExists) {
            this.goToDashboard(serialNumber);
          } else {
            const org = Organizations.findOne(query);
            if (org) {
              localStorage.setItem(
                `${Meteor.userId()}: selectedOrganizationSerialNumber`,
                org.serialNumber,
              );
              this.goToDashboard(org.serialNumber);
            }
          }
        } else {
          FlowRouter.withReplaceState(() => {
            FlowRouter.go('signIn');
          });
        }
      }
    });
Example #11
0
    onSuccess: function (formType, result) {
        let params = {};
        let queryParams = result;
        let path = FlowRouter.path("pos.customerReportGen", params, queryParams);

        window.open(path, '_blank');
    },
Example #12
0
	return Meteor.call('createDirectMessage', room, function(err) {
		if (err) {
			return;
		}
		const subscription = RocketChat.models.Subscriptions.findOne(query);
		RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
	});
Example #13
0
 getItems:function (){
     if(FlowRouter.getParam('id')){
         var id = FlowRouter.getParam('id');
         var item = Orders.findOne({image:id});
         if(item){
             //console.log(item); 
             opciones.set(item.orders);
             //console.log(opciones);
             return item;
         }
         return [];
     }
     else{
         return [];
     }
 },
Example #14
0
						this.importPublicKey(data.publicKey).then(() => {
							this.firstPeer = false;
							FlowRouter.goToRoomById(data.roomId);
							Meteor.defer(() => {
								this.established.set(true);
								this.acknowledge();
							});
						});
Example #15
0
  self.autorun(function () {
    var slug = FlowRouter.getParam('slug');

    self.subscribe('singleParty', slug, {
      onReady: function () {
        var post = Parties.findOne();
        self.subscribe('comments', post._id);
      }
    });
  });
Example #16
0
 self.autorun(()=> {
     let query = FlowRouter.current().queryParams;
     customerReport.callPromise(query)
         .then(function (result) {
             self.dataState.set(result);
         }).catch(function (err) {
             console.log(err.message);
         }
     );
 })
Template["private.posts.upsert"].onCreated(function () {
    this.subscribe("private.posts.one", FlowRouter.getParam("postId"));

    this.state = new ReactiveDict();

    this.autorun(() => {
        this.state.set("postId", FlowRouter.getParam("postId"));
        this.state.set("isEdition", !!this.state.get("postId"));
    });
});
Example #18
0
 'click .btn':function (event){
     event.preventDefault();
     var id = $(event.currentTarget).attr('id');
     var valor = parseInt($(event.currentTarget).attr('valor'));
     var value = event.target.value;
     var text = $(event.target).text();
     var idImage = FlowRouter.getParam('id');
     if(!isRegisterOption(id)){
          Meteor.call('addOrder',id,valor,text,idImage,);
     }
 }
Example #19
0
  (params, queryParams) => {
    const _params = { ...params };
    const _queryParams = { ...queryParams };
    if (withOrgSerialNumber) {
      Object.assign(_params, { orgSerialNumber: getOrgSerialNumber(params) });
    }
    if (withFilter) {
      Object.assign(_queryParams, { filter: getFilter(queryParams) });
    }

    return FlowRouter.path(path, _params, _queryParams);
  };
Example #20
0
Template.sideNav.onRendered(function() {
	SideNav.init();
	menu.init();
	lazyloadtick();
	const first_channel_login = RocketChat.settings.get('First_Channel_After_Login');
	const room = RocketChat.roomTypes.findRoom('c', first_channel_login, Meteor.userId());
	if (room !== undefined && room._id !== '') {
		FlowRouter.go(`/channel/${ first_channel_login }`);
	}

	return Meteor.defer(() => menu.updateUnreadBars());
});
Example #21
0
		Tracker.autorun(function(c) {
			if (FlowRouter.subsReady() === true) {
				Meteor.defer(function() {
					if (Meteor.user() && Meteor.user().defaultRoom) {
						const room = Meteor.user().defaultRoom.split('/');
						FlowRouter.go(room[0], { name: room[1] }, FlowRouter.current().queryParams);
					} else {
						FlowRouter.go('home');
					}
				});
				c.stop();
			}
		});
Example #22
0
            Meteor.call('getJournal', selector, function (err, data) {
                if (data) {
                    if (lastDate != null) {
                        if (moment(lastDate.closeDate).toDate() < data.journalDate) {
                            if (!_.isUndefined(data)) {
                                _.each(data.transaction, function (journal, index) {
                                    journal.indexAccount = 'transaction.' + index + '.account';
                                    journal.indexDr = 'transaction.' + index + '.dr';
                                    journal.indexCr = 'transaction.' + index + '.cr';

                                    journal.dr = formatNumberToSeperate(journal.dr);
                                    journal.cr = formatNumberToSeperate(journal.cr);

                                    itemsState.insert(journal.account, journal);
                                });
                            }
                            FlowRouter.go('/acc/journalUpdate/' + data._id);

                        } else {
                            alertify.error("Can not update, you already end of process!!!");
                        }

                    } else {
                        if (!_.isUndefined(data)) {
                            _.each(data.transaction, function (journal, index) {
                                journal.indexAccount = 'transaction.' + index + '.account';
                                journal.indexDr = 'transaction.' + index + '.dr';
                                journal.indexCr = 'transaction.' + index + '.cr';

                                journal.dr = formatNumberToSeperate(journal.dr);
                                journal.cr = formatNumberToSeperate(journal.cr);

                                itemsState.insert(journal.account, journal);
                            });
                        }
                        FlowRouter.go('/acc/journalUpdate/' + data._id);
                    }
                }
            });
export default function (injectDeps) {
  const AuthCheckCtx = injectDeps(AuthCheck);

  // Move these as a module and call this from a main file
  FlowRouter.route('/', {
    name: 'dashboard',
    action() {
      mount(AuthCheckCtx, {
        content: () => (<Dashboard />)
      });
    }
  });

}
        Accounts.resetPassword(token, password, function(error) {
			$(event.target).removeClass('loading');

            if(error){
                console.log(error);
                if(error.reason == 'Token expired'){
                    Bert.alert('El token para cambiar tu contraseña ya expiro.', 'danger');
                }else{
                    Bert.alert('Error al cambiar contraseña.', 'danger');
                }
            }else{
                FlowRouter.go("/");
                Bert.alert('Hemos cambiado tu contraseña exitosamente.', 'success');
            }
        });
Example #25
0
    data: function () {
        // Get query params
        //FlowRouter.watchPathChange();
        var q = FlowRouter.current().queryParams;

        Fetcher.setDefault('data',false);
        Fetcher.retrieve('data','acc_journalReport',q);

        return Fetcher.get('data');
        /*var callId = JSON.stringify(q);
        var call = Meteor.callAsync(callId, 'acc_journalReport', q);

        if (!call.ready()) {
            return false;
        }
        return call.result();*/
    }
Example #26
0
export default function () {
    route('/', {
        name: 'index',
        action(p, q) {
            FlowRouter.go('game');
        }
    });

    route('/login', {
        name: 'login',
        action(p, q) {
            mount(AppLayout, {
                main: <LoginPage />
            })
        }
    });

    route('/rank', {
        name: 'rank',
        action(p, q) {
            mount(AppLayout, {
                main: <RankPage />
            })
        }
    });

    route('/help', {
        name: 'help',
        action(p, q) {
            mount(AppLayout, {
                main: <HelpPage />
            })
        }
    });

    route('/game', {
        name: 'game',
        action(p, q) {
            mount(AppLayout, {
                main: <GamePage />
            })
        }
    });
}
Example #27
0
function Open(command, params /* , item*/) {
	const dict = {
		'#': ['c', 'p'],
		'@': ['d'],
	};

	if (command !== 'open' || !Match.test(params, String)) {
		return;
	}

	let room = params.trim();
	const type = dict[room[0]];
	room = room.replace(/#|@/, '');

	const query = {
		name: room,
	};

	if (type) {
		query.t = {
			$in: type,
		};
	}

	const subscription = ChatSubscription.findOne(query);

	if (subscription) {
		RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
	}

	if (type && type.indexOf('d') === -1) {
		return;
	}
	return Meteor.call('createDirectMessage', room, function(err) {
		if (err) {
			return;
		}
		const subscription = RocketChat.models.Subscriptions.findOne(query);
		RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
	});

}
Example #28
0
    template.autorun(() => {
      this.isTransfered(false);

      const transferId = FlowRouter.getParam('transferId');
      this.transferId(transferId);

      template.subscribe('transferredOrganization', transferId, {
        onReady: () => {
          const organization = Organizations.findOne({
            'transfer._id': transferId,
            'transfer.newOwnerId': Meteor.userId(),
          });

          if (!organization) {
            return;
          }
          const { name, serialNumber } = organization;
          this.orgName(name);
          this.orgSerialNumber(serialNumber);


          transferOrganization.call({ transferId }, (err) => {
            if (err) {
              this.error(err.reason);
            } else {
              this.isTransfered(true);
            }
          });
        },
        onError: (err) => {
          this.error(err.reason);
          if (err.error === 403) {
            Meteor.logout(() => {
              client.resetStore(); // reset apollo client store on logout
            });
          }
        },
      });
    });
Example #29
0
    'click #btn':function(event){
        event.preventDefault();
        var email = Meteor.user().emails[0].address;
        var imageId = FlowRouter.getParam('id');
        var total = getPrecioTotal();
        var orders = opciones.curValue;
        var temp =  {
            imageId: imageId,
            orders: orders,
            precioTotal: total,         
        };

        itemCarrito.push(temp);

        aux.set(itemCarrito);

        /*var id=carrito.insert({
            email: email,
            pedidos: aux.get(),
        });*/
        console.log("se inserto con exito");
        console.log(aux);

    },
Example #30
0
 onSuccess: function(formType, result) {
   FlashMessages.sendSuccess("Organization was successfully updated");
   FlowRouter.go('organizations');
 },