Skip to content
This repository was archived by the owner on Sep 26, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
29279e8
fix paths to broken images (resolves #466)
saschaishikawa Oct 27, 2015
28e565a
add dev credit
saschaishikawa Oct 27, 2015
3c5b697
rename file
saschaishikawa Oct 27, 2015
c141869
Merge branch 'fix-subject-pagination' into old-weather-whaling-produc…
saschaishikawa Oct 27, 2015
1da96f5
Merge branch 'group-styles' into old-weather-whaling-production
saschaishikawa Oct 27, 2015
b690450
[whaling] update project.json file
saschaishikawa Oct 28, 2015
3c91163
show subject info link in task area (only if more than one group avai…
saschaishikawa Oct 28, 2015
b00f7f9
set temporary link to old weather: classic
saschaishikawa Oct 28, 2015
e510496
Merge branch 'master' into old-weather-whaling-production
saschaishikawa Oct 28, 2015
3fb3c6a
[whaling] fix workflows (minor edits)
saschaishikawa Oct 28, 2015
974228b
[whaling] fix help content for mark workflow
saschaishikawa Oct 28, 2015
dfe2b44
fix merge conflict
saschaishikawa Oct 29, 2015
a6fbce2
add subject_set_bookmarks field to user model
saschaishikawa Oct 29, 2015
f64e2df
save bookmark to user model after classification create
saschaishikawa Oct 30, 2015
60f2f97
properly save hash; serialize bookmarks to user
saschaishikawa Oct 30, 2015
3e94ea6
properly save hash (for realz now)
saschaishikawa Oct 30, 2015
ab3fa5e
rename some stuff and clean up
saschaishikawa Oct 30, 2015
6595789
check for bookmark in mark index (and set current page if exists)
saschaishikawa Nov 2, 2015
d599495
set logbook page to last classified
saschaishikawa Nov 2, 2015
147c1b6
move bookmark advancing logic to fetchGroups() method
saschaishikawa Nov 3, 2015
957e61f
fix: throws error when @getCurrentSubjectSet() returns nothing
saschaishikawa Nov 3, 2015
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
Binary file removed app/assets/images/anzac/1_part_att_q.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/att_chest_mesurement.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/att_hearing.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/att_height.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/att_sight.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/background.png
Binary file not shown.
Binary file removed app/assets/images/anzac/hs_mark_help.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/hs_transfer_row.gif
Binary file not shown.
Binary file removed app/assets/images/anzac/logo.png
Binary file not shown.
1 change: 0 additions & 1 deletion app/assets/images/anzac/logo.svg

This file was deleted.

Binary file removed app/assets/images/anzac/sa_att_ex.jpeg
Binary file not shown.
8 changes: 8 additions & 0 deletions app/assets/javascripts/components/mark/index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = React.createClass # rename to Classifier
componentDidMount: ->
@getCompletionAssessmentTask()
@fetchSubjectSetsBasedOnProps()
@fetchGroups()

componentWillMount: ->
@setState taskKey: @getActiveWorkflow().first_task
Expand Down Expand Up @@ -285,6 +286,13 @@ module.exports = React.createClass # rename to Classifier
</p>
}

{
if @getActiveWorkflow()? and @state.groups?.length > 1
<p>
<Link to="/groups/#{@getCurrentSubjectSet().group_id}" className="about-link">About this {@props.project.term('group')}.</Link>
</p>
}

<div className="forum-holder">
<ForumSubjectWidget subject={@getCurrentSubject()} subject_set={@getCurrentSubjectSet()} project={@props.project} />
</div>
Expand Down
16 changes: 14 additions & 2 deletions app/assets/javascripts/lib/fetch-subject-sets-mixin.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ API = require './api'

module.exports =

fetchGroups: ->
API.type("groups").get(project_id: @props.project.id).then (groups)=>

# set page to current bookmark, if exists
if @props.user?.subject_set_bookmarks[@getCurrentSubjectSet()?.id]?
page = @props.user.subject_set_bookmarks[@getCurrentSubjectSet().id]

group.showButtons = false for group in groups # hide buttons by default
@setState
groups: groups
subject_index: page-1 || 0
, =>
console.log 'SKIPPING TO PAGE: ', @state.subject_index + 1

fetchSubjectSetsBasedOnProps: ->

# Establish a callback for after subjects are fetched - to apply additional state changes:
Expand Down Expand Up @@ -32,8 +46,6 @@ module.exports =
group_id: @props.query.group_id ? null
@fetchSubjectSets params, postFetchCallback



# this method fetches the next page of subjects in a given subject_set.
# right now the trigger for this method is the forward or back button in the light-box
# I am torn about whether to set the subject_index at this point? -- AMS
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/lib/fetch-subjects-mixin.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ module.exports =
# Does including instance have a defined callback to call when new subjects received?
if @fetchSubjectsCallback?
@fetchSubjectsCallback()

2 changes: 1 addition & 1 deletion app/assets/javascripts/lib/workflow-methods-mixin.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports =
@forceUpdate()
window.classifications = @state.classifications # make accessible to console
callback() if callback?

@commitClassification(classification)

toggleBadSubject: (e, callback) ->
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class UsersController < ApplicationController

def logged_in_user
providers = User.auth_providers

respond_with AuthStateSerializer.new(user: current_or_guest_user, providers: providers)
end

Expand Down
11 changes: 9 additions & 2 deletions app/models/classification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class Classification
after_create :increment_subject_classification_count #, :check_for_retirement_by_classification_count
after_create :generate_new_subjects
after_create :generate_terms
after_create :place_bookmark # save subject_set id and page number to user model

# removing this after create until we have a use case for the information
# after_create :increment_subject_set_classification_count,
# after_create :increment_subject_set_classification_count,

scope :by_child_subject, -> (id) { where(child_subject_id: id) }
scope :having_child_subjects, -> { where(:child_subject_id.nin => ['', nil]) }
Expand Down Expand Up @@ -73,6 +75,11 @@ def generate_terms
end
end

def place_bookmark
return if self.subject.subject_set_id.nil? || self.subject.order.nil?
user.place_bookmark(self.subject.subject_set_id,self.subject.order)
end

# removing this from the after_create hook in interest of speed. 10/22/15
def increment_subject_set_classification_count
subject.subject_set.inc classification_count: 1
Expand All @@ -97,7 +104,7 @@ def increment_subject_classification_count
# subject.inc classification_count: 1
# Push user_id onto Subject.user_ids using mongo's fast addToSet feature, which ensures uniqueness
subject_returned = Subject.where({id: subject_id}).find_and_modify({"$addToSet" => {classifying_user_ids: user_id.to_s}, "$inc" => {classification_count: 1}}, new: true)

#Passing the returned subject as parameters so that we eval the correct classification_count
check_for_retirement_by_classification_count(subject_returned)
end
Expand Down
19 changes: 14 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class User
class User
include Mongoid::Document
include Mongoid::Timestamps
# Include default devise modules. Others available are:
Expand Down Expand Up @@ -34,12 +34,15 @@ class User

field :avatar, :type => String # URI of image if any
field :profile_url, :type => String # URI of user profile, if any

field :status, :type => String, :default => 'active'
field :role, :type => String, :default => 'user' # user, admin, team
field :guest, :type => Boolean, :default => false
field :tutorial_complete, :type => Boolean, :default => false

# for remembering users' last viewed subject
field :subject_set_bookmarks, :type => Hash, :default => {}

has_many :favourites
has_many :classifications

Expand All @@ -62,6 +65,12 @@ def tutorial_complete!
self.save!(:validate => false)
end

def place_bookmark(subject_set_id,page)
subject_set_id = subject_set_id.to_s
self.subject_set_bookmarks[subject_set_id] = page
save!(:validate => false)
end

def has_favourite?(subject)
favourites.where( subject_id: subject.id ).exists?
end
Expand All @@ -82,8 +91,8 @@ def to_s
name
end

# Steal all the contributions of the given user (e.g. visitor made some
# contribs as a guest, then logged in with a real acct and we want to
# Steal all the contributions of the given user (e.g. visitor made some
# contribs as a guest, then logged in with a real acct and we want to
# transfer the guest contribs to the real acct
def steal_contributions(other_user)
[:classifications, :favourites].each do |relation|
Expand Down Expand Up @@ -176,7 +185,7 @@ def self.details_from_zooniverse(access_token)
provider: access_token["provider"]
}
end

def self.create_guest_user
u = create({
name: 'Guest',
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/user_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class UserSerializer < ActiveModel::MongoidSerializer
root false

attributes :id, :guest, :name, :avatar, :tutorial_complete
attributes :id, :guest, :name, :avatar, :tutorial_complete, :subject_set_bookmarks

def id
object._id.to_s
Expand Down
13 changes: 7 additions & 6 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@

get '/current_user', to: "users#logged_in_user"
post '/tutorial_complete', to: "users#tutorial_complete"

post '/subject_set_bookmarks', to: "users#subject_set_bookmarks"

get '/projects/stats', to: 'projects#stats'

get '/workflows/:workflow_id/subjects', to: 'subjects#index'
get '/workflows/:workflow_id/subject_sets', to: 'subject_sets#index'

# Subjects
get '/subjects/:subject_id', to: 'subjects#show', defaults: { format: 'json' }
get '/subjects', to: 'subjects#index', defaults: { format: 'json' }
get '/workflows/:workflow_id/subject_sets/:subject_set_id/subjects/:subject_id', to: 'subject_sets#show', defaults: { format: 'json' }

# Subject_sets
resources :subject_sets, only: [:show, :index], :defaults => { :format => 'json' } # we are using the _url helper for show, so opting to keep this as resources for now
get '/subject_sets/terms/:field', to: 'subject_sets#name_search'

# Classifications
get '/classifications/terms/:workflow_id/:annotation_key', to: 'classifications#terms'
post '/classifications', to: 'classifications#create'
post '/classifications', to: 'classifications#create'

resources :groups, only: [:show, :index], :defaults => { :format => 'json' }

Expand All @@ -43,5 +44,5 @@
get 'signin' => 'auth#signin'
end
get 'admin' => 'admin/dashboard#index'

end
4 changes: 2 additions & 2 deletions project/whale_tales/content/help/weather.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Select the type of weather description, then draw a rectangle around each locati

Wind force (speed) and direction and an impression of the weather are found in most every log entry.

![Illustration of a compass card](assets/whale_tales/compass.jpg)
![Illustration of a compass card](images/compass.jpg)

Force descriptions are indexed to the [Beaufort Scale](http://www.spc.noaa.gov/faq/tornado/beaufort.html)
Force descriptions are indexed to the <a target="_blank" href="http://www.spc.noaa.gov/faq/tornado/beaufort.html">Beaufort Scale</a>
and direction is given in compass points (N, NW, NxW, NNW for example). Measurements of temperature and barometric pressure are rare in these logs, so please be sure to mark them if you find them!
2 changes: 1 addition & 1 deletion project/whale_tales/content/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<div class="old-weather-link">
<a href="http://www.oldweather.org">Check out other Old Weather projects &#10146;</a>
<a href="http://classic.oldweather.org">Check out other Old Weather projects &#10146;</a>
</div>

<div class="button-container">
Expand Down
20 changes: 11 additions & 9 deletions project/whale_tales/content/team.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,51 @@
<div class="selected-content">

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Rob_Allan.jpg">
<img height="200" width="200" src="images/Rob_Allan.jpg">
<p class="team-member-bio">**Rob Allan** is based at the Met Office Hadley Centre where he leads the international Atmospheric Circulation Reconstructions of the Earth (ACRE) initiative (http://www.met-acre.org). Old Weather is a part of the international outreach arm of ACRE.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Philip_Brohan.jpg">
<img height="200" width="200" src="images/Philip_Brohan.jpg">
<p class="team-member-bio">**Philip Brohan** is a climate scientist at the Met Office Hadley Centre, where he tries to combine information from old documents, tree-rings and large computers, into a clear picture of what the weather used to be like.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Gil_Compo.jpg">
<img height="200" width="200" src="images/Gil_Compo.jpg">
<p class="team-member-bio">**Gil Compo** is a climate scientist leading the 20th Century Reanalysis Project at the Cooperative Institute for Research in the Environmental Sciences of the University of Colorado at Boulder and is an affiliate of the NOAA Earth System Research Laboratory. He has a blast using supercomputers to reconstruct the weather from the surface of the earth to the level of the jet stream as far back as Old Weather can go.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Michael_Lapides.jpg">
<img height="200" width="200" src="images/Michael_Lapides.jpg">
<p class="team-member-bio">**Michael Lapides** is the Director of Digital Initiatives at the New Bedford Whaling Museum and leads the logbook digitization effort for Old Weather - Whaling.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Mark_Mollan.jpg">
<img height="200" width="200" src="images/Mark_Mollan.jpg">
<p class="team-member-bio">**Mark Mollan** is an archivist in the Navy/Maritime section of the U.S. National Archives and coordinates Old Weather project activities at the Archives.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Mark_Procknik.jpg">
<img height="200" width="200" src="images/Mark_Procknik.jpg">
<p class="team-member-bio">**Mark Procknik** is the Librarian at the New Bedford Whaling Museum and provides access to primary sources at the Research Library.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Gordon_Smith.jpg">
<img height="200" width="200" src="images/Gordon_Smith.jpg">
<p class="team-member-bio">**Gordon Smith**, a one-time engineer, military operations analyst and human relations manager, lost his father in action at sea in 1943. Wanting to discover more, he wrote a couple of naval history books in his 40's and then started Naval-History.net to help others do the same. Long-retired, he loves sailing.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Clive_Wilkinson.jpg">
<img height="200" width="200" src="images/Clive_Wilkinson.jpg">
<p class="team-member-bio">**Clive Wilkinson** is research manager for the Recovery of Logbooks and International Marine Data (RECLAIM) Project (http://icoads.noaa.gov/reclaim), a part of NOAA's Climate Database Modernisation Program. He is based at the Climatic Research Unit at the University of East Anglia.</p>
</span>

<span class="team-member">
<img height="200" width="200" src="assets/whale_tales/Kevin_Wood.jpg">
<img height="200" width="200" src="images/Kevin_Wood.jpg">
<p class="team-member-bio">**Kevin Wood**, U.S. Old Weather - Arctic lead investigator, is a climate scientist at the NOAA – University of Washington Joint Institute for the Study of the Atmosphere and Ocean.</p>
</span>

<p>This project was built by Sascha Ishikawa (Zooniverse/Adler Planetarium) using [Scribe](http://scribe.nypl.org), a framework for crowdsourcing the transcription of text-based documents.</p>

</div>
</div>
3 changes: 1 addition & 2 deletions project/whale_tales/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"feedback_form_url": "https://docs.google.com/forms/d/12FTryz5oTuzJE-UtbuMYCH5M77lLo-H74wiN35ORc8U/viewform",
"terms_map": {
"group": "ship",
"subject set": "logbook",
"subject set": "page",
"subject": "page"
}

}
Loading