diff --git a/packages/reaction-core/client/helpers/helpers.coffee b/packages/reaction-core/client/helpers/helpers.coffee index 9977ebf5ee1..096bec41e97 100644 --- a/packages/reaction-core/client/helpers/helpers.coffee +++ b/packages/reaction-core/client/helpers/helpers.coffee @@ -13,16 +13,24 @@ String::toCamelCase = -> s = s.replace(/([0-9]+)([a-zA-Z])/g, (a, b, c) -> b + c.toUpperCase() ) - s + return s + ### # quick and easy snippet for toggling sessions +# accepts string name, see http://docs.meteor.com/#/basic/session +# optional pass positive param match ### -@toggleSession = (session_variable) -> - if Session.get(session_variable) - Session.set session_variable, false +@toggleSession = (sessionVariable, positive) -> + check sessionVariable, String + session = Session.get sessionVariable + positive = positive || true + + if _.isEqual positive, session + Session.set sessionVariable, false else - Session.set session_variable, true - return + Session.set sessionVariable, positive + + return Session.get sessionVariable ### # method to return tag specific product diff --git a/packages/reaction-core/client/templates/dashboard/settings/settingsGeneral/settingsGeneral.html b/packages/reaction-core/client/templates/dashboard/settings/settingsGeneral/settingsGeneral.html index 7bf9f594a2a..3bd267d21b1 100644 --- a/packages/reaction-core/client/templates/dashboard/settings/settingsGeneral/settingsGeneral.html +++ b/packages/reaction-core/client/templates/dashboard/settings/settingsGeneral/settingsGeneral.html @@ -1,5 +1,5 @@