Skip to content

Commit

Permalink
images save
Browse files Browse the repository at this point in the history
  • Loading branch information
drewlesueur committed Aug 10, 2011
1 parent ff83e49 commit ff4eca8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
17 changes: 4 additions & 13 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ define "bubble-view", () ->

filebox = fileBoxMaker()
filebox.on "uploaded", (urls) ->
log "triggering add images with"
log urls
#trigger addimages view
trigger "addimages", model, urls

el = $ """
<div>
<span class="editable" data-prop="address"></span>
Expand All @@ -69,10 +68,8 @@ define "bubble-view", () ->
"""
fileDroppable el
el.bind "filedroppablefiles", (e, files) ->
console.log files
filebox.uploadFiles files
el.bind "filedroppableurls", (e, url) ->
console.log url
addImage url

el.find(".file-upload").append(filebox.getEl()).append(filebox.getProgressBars())
Expand Down Expand Up @@ -104,6 +101,7 @@ define "bubble-view", () ->
images = el.find(".images").val().split("\n")
drews.trigger triggeree, "modelviewvalchanged", model, "images", images
self.handleSaveImages = handleSaveImages
addImages model.images #initail addimages
self

# this is the presenter
Expand Down Expand Up @@ -157,13 +155,7 @@ define "map-page-presenter", () ->

#addimages presenter
addImages = (listing, urls) ->
console.log "presenter add images called"
console.log listing
console.log listing.addImages
listing.addImages urls
log "done"
log listing.addImages
log "done again"
#listingMaker.addImages listing, urls
self.addImages = addImages
# bind addimages presenter
Expand Down Expand Up @@ -228,6 +220,7 @@ define "map-page-view", () ->
else
done status
self.lookup = lookup
#addListing view
addListing = (listing, bubbleContent, cb=->) =>
latlng = new google.maps.LatLng listing.lat, listing.lng
marker = new google.maps.Marker
Expand Down Expand Up @@ -273,7 +266,7 @@ define "listing", () ->
#addImages model
addImages = (urls) ->
attrs.images or= []
attrs.images.concat urls
attrs.images = attrs.images.concat urls
self.images = attrs.images
#trigger addimages model
trigger "addimages", urls
Expand All @@ -286,8 +279,6 @@ define "listing", () ->
return self.attrs[prop]

save = (cb=->) ->
log "saving"
log attrs
severus.save "listings", attrs, (error, _listing) ->
_.extend attrs, _listing
cb error, self
Expand Down
17 changes: 3 additions & 14 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ff4eca8

Please sign in to comment.