Skip to content

Instantly share code, notes, and snippets.

@dlai0001
Last active December 22, 2015 09:38
Show Gist options
  • Save dlai0001/6452827 to your computer and use it in GitHub Desktop.
Save dlai0001/6452827 to your computer and use it in GitHub Desktop.
# Product model
App.Product = DS.Model.extend(
descripton: DS.attr('string')
expirationDate: DS.attr('date')
imageUrl: DS.attr('string')
location: DS.attr('string')
quantity: DS.attr('number')
quantityUnit: DS.attr('string')
type: DS.attr('string')
profile: DS.belongsTo('profile')
)
# Map Main Routes in the application.
App.Router.map ( ->
@route "index", path: "/"
@route "register", path: "/register"
@route "messages", path: "/messages"
@resource "myfruits", path: "/myfruits", ( ->
@route "item", path: "/:product_id"
@route "new", path: "/new"
return
)
)
App.MyfruitsItemRoute = Ember.Route.extend(
renderTemplate: ( ->
@render("myfruits-item", {outlet: "itemview"})
return
)
model: ( (params) ->
return @store.find('product', params.product_id)
)
setupController: ((controller, model) ->
@controllerFor('myfruits').set('myfruitsItemSubroute', true)
controller.set('model', model)
return
)
)
<div class="container">
<h1>{{type}} ???</h1>
{{partial notifications}}
{{!-- Fruit image upload --}}
<div class="control-group">
<label class="control-label" for="file-select">Picture</label>
<div class="controls">
<div class="span3">
<div>
{{view App.DndImageUploadView valueBinding=fruitPic srcBinding=imageUrl}}
</div>
<div id="file-upload-progress" class="progress hide">
<div class="bar"></div>
</div>
</div>
<div>
<input id="file-select" class="btn" type="file" multiple="false" style="z-index: 2; position: absolute; opacity: 0; width: 150px;" title="Select a profile picture to upload."/>
<span class="btn" style="position: absolute; width: 150px;">Select file</span>
</div>
</div>
</div> <!-- end of file select control group -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment