Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Project Group fetch-fail. Default props on share component #100

Merged
merged 1 commit into from
Feb 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/annotation/summary.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ Summary = React.createClass
@setState chimpsSeen: true

ProjectGroup.on 'fetch', @onProjectGroupFetch
ProjectGroup.on 'fetch-fail', @onProjectGroupFail
ProjectGroup.fetch()

componentWillUnmount: ->
ProjectGroup.off 'fetch', @onProjectGroupFetch
ProjectGroup.off 'fetch-fail', @onProjectGroupFail

onProjectGroupFetch: ->
groupId = Subject.current.group_id
group = ProjectGroup.find groupId
@setState({
group: group
newChimpsLink: group.metadata.new_chimps_link
}, => @getSiteLocation())

onProjectGroupFail: ->
console.error 'Project Group fetch failed'

getSiteLocation: ->
locationName = @state.group.metadata.site

Expand Down Expand Up @@ -77,7 +81,7 @@ Summary = React.createClass
{noteSummary}
</ul>
</div>
<Share video={@props.video.mp4} zooniverseId={Subject.current.zooniverse_id} />
<Share video={@props.video.mp4} zooniverseId={Subject.current?.zooniverse_id} />
</section>
<section className="map-container">
<figure className="map"><img src={
Expand Down
4 changes: 4 additions & 0 deletions app/share.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Share = React.createClass
socialTitle: 'Zooniverse classification'
socialMessage: 'Classifying on the Zooniverse!'

getDefaultProps: ->
zooniverseId: null
video: null

talkHref: ->
domain = location.hostname.replace /^www\./, ''
"http://talk.#{domain}/#/subjects/#{@props.zooniverseId}"
Expand Down