Skip to content

Instantly share code, notes, and snippets.

Shop.controller "OrderCycleCtrl", ($scope, $rootScope, OrderCycle) ->
$scope.changeOrderCycle = ->
OrderCycle.set_order_cycle($scope.order_cycle_id)
Shop.factory 'OrderCycle', ($resource) ->
class OrderCycle
@set_order_cycle: (id)->
console.log "setting order cycle " + id
# Ajaxy shit here
angular.module("Shop").controller "ProductsCtrl", ($scope, Product) ->
$scope.products = Product.all()
Shop.factory 'Product', ($resource) ->
class Product
@all: ->
response = $resource("/shop/products").query()
%select{"ng-model" => "order_cycle_id", "ng-options" => "c.id for c in #{@order_cycles.to_json}"}
%option{value: ""} Please Select
%select{"ng-model" => "order_cycle_id"}
%option{value: ""} Please Select
%option{value: 27} 27
%option{value: 29} 29
{{ order_cycle_id }}
Shop.controller "OrderCycleCtrl", ($scope, OrderCycle) ->
$scope.order_cycle_id = 27
Expected [ { test : 'cats' } ] to be [ { test : 'cats' } ]
WTF?
describe 'Shop services', ->
$httpBackend = null
Product = null
beforeEach ->
module 'Shop'
Shop.factory 'Product', ($resource) ->
class Product
@all: ->
$resource("/shop/products").query()
describe 'Shop services', ->
$httpBackend = null
Product = null
OK! Interesting design question for y'all.
I have a model called Enterprise. Enterprises can be distributors, suppliers or both.
In the UI we access everything either as a distributor or as a supplier.
About 75% of the distributor/supplier functionality is shared, and the tables are identical.
However, A: that the views/controllers are different, and B: distributors and suppliers each
have their own set of scopes etc.
I want to be able to access my distributors and suppliers as separate models, so I can A: keep
%li{:class => ("active" if true)}
Blah
Gives me
<li>
Blah
</li>
it "gives me the pickup time for an order_cycle" do
d = create(:distributor_enterprise, name: 'Green Grass')
oc1 = create(:simple_order_cycle, name: 'oc 1', distributors: [d])
exchange = Exchange.find(oc1.exchanges.to_enterprises(d).outgoing.first.id)
exchange.update_attribute :pickup_time, "turtles"
helper.stub!(:current_order_cycle).and_return oc1
helper.pickup_time.should == "turtles"
end
#Embedded file name: /Volumes/Jenkins/live/Projects/AppLive/Resources/MIDI Remote Scripts/_Framework/SubjectSlot.py
"""
Family of classes for maintaining connections with optional subjects.
"""
from itertools import izip, repeat
from functools import partial, wraps
from Signal import Signal
from Util import instance_decorator, monkeypatch, monkeypatch_extend, NamedTuple
from Disconnectable import Disconnectable, CompoundDisconnectable