Skip to content

Commit

Permalink
Independence of Reaction Commerce
Browse files Browse the repository at this point in the history
reaction-commerce is now an independent, free standing package and can be used in any meteor project without the reaction project
  • Loading branch information
aaronjudd committed Feb 4, 2014
1 parent 5f6a07f commit e1fb3c2
Show file tree
Hide file tree
Showing 52 changed files with 175 additions and 174 deletions.
7 changes: 0 additions & 7 deletions client/app.coffee

This file was deleted.

4 changes: 2 additions & 2 deletions client/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<title>Reaction Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></head>
<main role="main" id="main">
<header>{{yield "header"}}</header>
<header>{{yield "templateHeader"}}</header>
<nav>{{yield "sidebar"}}</nav>
<nav>{{>cartDrawer}}</nav>
<section>
<div class="container">{{yield}}</div>
</section>
</main>
<footer>{{yield "footer"}}</footer>
<footer>{{yield "templateFooter"}}</footer>
</template>
24 changes: 6 additions & 18 deletions client/routing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,18 @@
# *****************************************************
Router.configure
layoutTemplate: "layout"
notFoundTemplate: "notFound"
loadingTemplate: "loading"
yieldTemplates:
siteHeader:
to: "header"

siteFooter:
to: "footer"

dashboardSidebar:
to: "sidebar"


# yieldTemplates:
# footer:
# to: "footer"
# *****************************************************
# generic routes for reaction marketing site layout
# default layout is dashboardLayout template, these
# are all exceptions
# generic routes for reaction layout
# *****************************************************
pages = [

#Header
"pricing"
"contactus"

#Footer
"about"
"team"
Expand Down
17 changes: 0 additions & 17 deletions client/subscriptions.coffee

This file was deleted.

4 changes: 0 additions & 4 deletions client/templates/accessDenied/access_denied.html

This file was deleted.

1 change: 0 additions & 1 deletion client/templates/accounts/accounts.coffee

This file was deleted.

Empty file.
Empty file.
21 changes: 0 additions & 21 deletions client/templates/errors/errors.coffee

This file was deleted.

14 changes: 0 additions & 14 deletions client/templates/errors/errors.html

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,7 @@
# returns "active" if we are on the current route
# we can use this in a class to mark current active nav
# *****************************************************

Template.siteHeader.helpers
activeRouteClass: ->
args = Array::slice.call(arguments, 0)
args.pop()
active = _.any(args, (name) ->
location.pathname is Router.path(name)
)
active and "active"
siteName: () ->
siteName = Shops.findOne().name
siteName


Template.siteHeader.events
Template.header.events
'click #login-dropdown-list a.dropdown-toggle': () ->
setTimeout (->
$("#login-email").focus()
Expand Down
22 changes: 22 additions & 0 deletions client/templates/header/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template name="header">
{{!-- remove this div, insert your header, update routing.coffee --}}
<div class="container alert alert-danger">
<h1>
To use your own header:
<small>change /client/routing.coffee</small>
</h1>
<p>
yieldTemplates:
templateHeader:
to: "header"
</p>
<p> <strong>change "templateHeader" to be any template, for example this template would be</strong>
<p>
:
yieldTemplates:
templateHeader:
to: "header"
</p>
</p>
</div>
</template>
3 changes: 0 additions & 3 deletions common/collections/collections.coffee

This file was deleted.

3 changes: 0 additions & 3 deletions lib/app.coffee

This file was deleted.

Empty file.
8 changes: 8 additions & 0 deletions packages/reaction-commerce/client/app.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Meteor.app = _.extend(Meteor.app || {},
getCurrentShopCursor: () ->
Shops.find({}, {limit: 1});
getCurrentShop: () ->
cursor = Meteor.app.getCurrentShopCursor()
cursor.fetch()[0]
)

Meteor.app = _.extend(Meteor.app || {},
packages:
register: (packageInfo) ->
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Handlebars.registerHelper "hasOwnerAccess", ->
Handlebars.registerHelper "hasDashboardAccess", ->
Meteor.app.hasDashboardAccess()

Handlebars.registerHelper "activeRouteClass", ->
args = Array::slice.call(arguments, 0)
args.pop()
active = _.any(args, (name) ->
location.pathname is Router.path(name)
)
active and "active"

Handlebars.registerHelper "siteName", ->
siteName = Shops.findOne().name
siteName
# *****************************************************
# method to alway return an image,
# or a placeholder for a product variant
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 13 additions & 4 deletions packages/reaction-commerce/client/routing.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Router.configure
notFoundTemplate: "notFound"
loadingTemplate: "loading"

Router.before ->
@subscribe('shops').wait()
@subscribe('cart', Session.get "sessionId", Meteor.userId()).wait()
Expand All @@ -10,9 +14,14 @@ Router.before ->

ShopController = RouteController.extend
yieldTemplates:
'shopHeader': to: 'header'
'dashboardSidebar': to: 'sidebar'
'siteFooter': to: 'footer'
templateHeader:
to: "templateHeader"

templateFooter:
to: "templateFooter"

dashboardSidebar:
to: "sidebar"
before: ->
# should we make it a default as Router.before?
@subscribe('shops').wait()
Expand Down Expand Up @@ -108,7 +117,7 @@ Router.map ->
[share.ConfigDataHandle]
yieldTemplates:
checkoutHeader:
to: "header"
to: "templateHeader"
#completed orders
@route 'cartCompleted',
path: 'completed/:_id',
Expand Down
19 changes: 16 additions & 3 deletions packages/reaction-commerce/client/subscriptions.coffee
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
PackagesHandle = Meteor.subscribe("Packages")
Meteor.subscribe "ReactionPackages"
ReactionConfigHandle = Meteor.subscribe("ReactionConfig")
Meteor.subscribe "UserConfig", Meteor.userId()
# Read from local storage / cookies
Meteor.subscribe "ReactionSessions", amplify.store("reaction.session"), ->
# The server returns only one record, so findOne will return that record
serverSession = new Meteor.Collection("ReactionSessions").findOne()
# Stores into client session all data contained in server session;
# supports reactivity when server changes the serverSession

Session.set "serverSession", serverSession
Session.set "sessionId", serverSession._id
# Stores the server session id into local storage / cookies
amplify.store "reaction.session", serverSession._id

PackagesHandle = @PackagesHandle = Meteor.subscribe("Packages")
share.ConfigDataHandle = Meteor.subscribe 'ConfigData'
Meteor.subscribe 'products'
Meteor.subscribe 'orders'
Meteor.subscribe 'customers'
Meteor.subscribe 'tags'
Meteor.subscribe 'cart'
Meteor.subscribe 'shops'
#shops and cart are subscribed in router



####################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template name="dashboardfooter">
<footer class="unstyled">
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-6"></div>
</nav>
</footer>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Template.templatesFooter.helpers
allSubscriptionsReady: ->
DDP._allSubscriptionsReady()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template name="templatesFooter">
{{#if allSubscriptionsReady}}
<div class="all-subscriptions-ready"></div>
{{/if}}
</template>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template name="siteHeader">
<template name="templateHeader">
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="{{pathFor 'index'}}">{{{siteName}}}</a>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>
<span class="progress-bar {{progressBar}}" role="progressbar" aria-valuenow="{{inventoryQuantity}}" aria-valuemin="0" aria-valuemax="{{inventoryTotal}}" style="width: {{inventoryPercentage}}%">
</span>
<div class="variant-progress-item">
<span class="variant-qty badge">{{inventoryQuantity}}</span>
<span class="badge">{{inventoryQuantity}}</span>
<span class="variant-title">{{title}}</span>
<span class="variant-price pull-right">${{price}}</span>
</div>
Expand Down
4 changes: 4 additions & 0 deletions packages/reaction-commerce/common/collections.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
share.ReactionPalette = @ReactionPalette = new Meteor.Collection(null)

share.ConfigData = @ConfigData = new Meteor.Collection("ConfigData")

PackageConfigSchema = new SimpleSchema
shopId:
type: String
Expand Down
Loading

0 comments on commit e1fb3c2

Please sign in to comment.