Skip to content

Instantly share code, notes, and snippets.

Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
link: (scope, elem, attrs, ctrl, transclude)->
scope.title = attrs.title
scope.contents = transclude()
console.log scope.contents
Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
# If I do this then my cancel() function goes on the isolate scope
# But due to transclude my transclude() content is run against the original scope
# So I don't have access to modalInstance
#scope:
Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
scope:
title: "@"
link: (scope, elem, attrs, ctrl, transclude)->
console.log transclude()
Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
scope:
title: "@"
link: (scope, elem, attrs)->
elem.on "click", ->
Darkswarm.filter "date_in_words", ->
(date) ->
moment(date).fromNow()
Darkswarm.filter "sensible_timeframe", (date_in_wordsFilter)->
(date) ->
if moment().add('days', 2) < moment(date)
"Orders open"
else
"Closing in #{date_in_wordsFilter(date)}"
Darkswarm.controller "CheckoutCtrl", ($scope, Order, storage) ->
window.tmp = $scope
$scope.order = $scope.Order = Order
storage.bind $scope, "user", { defaultValue: true}
$scope.disable = ->
$scope.user = false
$scope.details = true
storage.bind $scope, "details"
Darkswarm.factory 'Order', ($resource, Product, order)->
new class Order
constructor: ->
@[name] = method for name, method of order # Clone all data from the order JSON object
# Here we default to the first shipping method if none is selected
@shipping_method_id ||= parseInt(Object.keys(@shipping_methods)[0])
@ship_address_same_as_billing ?= true
shippingMethod: ->
$scope.contact =
active: $scope.active("/contact")
path: "/contact"
# If I use active: '$location.path() == contact.path' this fails - can't use expressions?
%tab{heading: "Contact", active: "contact.active"}
= render "shop/shop/contact"
Darkswarm.controller "TabsCtrl", ($scope, $location) ->
$scope.active = (tab)->
$location.path() == tab
File to import not found or unreadable: foundation/variables.
Load paths:
Sass::Rails::Importer(/Users/willmarshall/Projects/openfoodweb/app/assets/stylesheets/darkswarm/sidebar.css.sass)
/Users/willmarshall/Projects/openfoodweb/app/assets/stylesheets
/Users/willmarshall/.rvm/gems/ruby-1.9.3-p392@openfoodnetwork/gems/compass-0.12.4/frameworks/blueprint/stylesheets
/Users/willmarshall/.rvm/gems/ruby-1.9.3-p392@openfoodnetwork/gems/compass-0.12.4/frameworks/compass/stylesheets
Compass::SpriteImporter
/Users/willmarshall/Projects/openfoodweb/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature
(in /Users/willmarshall/Projects/openfoodweb/app/assets/stylesheets/darkswarm/sidebar.css.sass)