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

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Jul 24, 2015
1 parent 2b731ac commit e723440
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ GIT
rails (>= 3.1)
react-source (~> 0.13)

GIT
remote: https://github.com/zooniverse/omniauth-zooniverse
revision: d1300d7d30216a6489c7d804182719ff74990a20
specs:
omniauth-zooniverse (0.0.3)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -188,7 +194,6 @@ GEM
multi_json (~> 1.3)
oauth2 (~> 1.0)
omniauth (~> 1.2)
omniauth-zooniverse (0.0.2)
optionable (0.2.0)
origin (2.1.1)
orm_adapter (0.5.0)
Expand Down Expand Up @@ -319,7 +324,7 @@ DEPENDENCIES
moped
omniauth-facebook
omniauth-google-oauth2
omniauth-zooniverse (~> 0.0.2)
omniauth-zooniverse!
pry
quiet_assets
rack-cors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TextTool = React.createClass
getInitialState: ->
annotation: @props.annotation ? {}
viewerSize: @props.viewerSize
autocompleting: false

# this can go into a mixin? (common across all transcribe tools)
getPosition: (data) ->
Expand Down Expand Up @@ -71,6 +72,9 @@ TextTool = React.createClass
if @isMounted() && @toolConfig().suggest == 'common'
el = $(@refs.input0?.getDOMNode())
el.autocomplete
open: ( => @setState autocompleting: true )
close: => setTimeout( (=> @setState(autocompleting: false)), 1000)
select: (e, ui) => @updateValue(ui.item.value)
source: (request, response) =>
field = "#{@props.task.key}:#{@fieldKey()}"
$.ajax
Expand Down Expand Up @@ -115,18 +119,22 @@ TextTool = React.createClass
else
@props.annotation_key

handleChange: (e) ->
updateValue: (val) ->
console.log "updated val: ", val
newAnnotation = @state.annotation
newAnnotation[@fieldKey()] = e.target.value
newAnnotation[@fieldKey()] = val

# if composite-tool is used, this will be a callback to CompositeTool::handleChange()
# otherwise, it'll be a callback to Transcribe::handleDataFromTool()
@props.onChange(newAnnotation) # report updated annotation to parent

handleChange: (e) ->
@updateValue e.target.value

handleKeyPress: (e) ->
if [13].indexOf(e.keyCode) >= 0 # ENTER
if ! @state.autocompleting && [13].indexOf(e.keyCode) >= 0 # ENTER
@commitAnnotation()
e.preventDefault()
# e.preventDefault()

handleBadMark: ()->
newAnnotation = []
Expand Down
7 changes: 7 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# This file is used by Rack-based servers to start the application.

# PB: This works, but isn't very secure since it makes all project files public
# Also it conflicts with existing /project route
# use Rack::Static, :urls => ["/project"]
#
# Something like this *should* work and is preferable to above, but isn't working for some reason:
# use Rack::Static, :urls => ["/projectassets"], :root => "project/emigrant/assets"

require ::File.expand_path('../config/environment', __FILE__)

run Rails.application

0 comments on commit e723440

Please sign in to comment.