common.js 821 字节
Newer Older
S
Sercan 已提交
1 2 3 4 5
/**
 * Created by RSercan on 26.12.2015.
 */
strSessionConnection = 'connection';
strSessionCollectionNames = 'collectionNames';
S
Sercan 已提交
6 7 8 9 10 11 12
strSessionSelectedCollection = 'selectedCollection';

clearSessions = function () {
    Session.set(strSessionCollectionNames, undefined);
    Session.set(strSessionConnection, undefined);
    Session.set(strSessionSelectedCollection, undefined);
};
S
Sercan 已提交
13 14 15 16 17 18 19 20 21

Template.registerHelper(strSessionConnection, function () {
    if (Session.get(strSessionConnection)) {
        return Connections.findOne({_id: Session.get(strSessionConnection)});
    }
});

Template.registerHelper(strSessionCollectionNames, function () {
    return Session.get(strSessionCollectionNames);
S
Sercan 已提交
22 23 24 25 26
});

Template.registerHelper(strSessionSelectedCollection, function () {
    return Session.get(strSessionSelectedCollection);
});