diff --git a/app/classifier/drawing-tools/circle.cjsx b/app/classifier/drawing-tools/circle.cjsx index 2a8640f8c2..52ae610ec4 100644 --- a/app/classifier/drawing-tools/circle.cjsx +++ b/app/classifier/drawing-tools/circle.cjsx @@ -20,12 +20,18 @@ module.exports = React.createClass r: 0 angle: 0 + initStart: -> + _inProgress: true + initMove: ({x, y}, mark) -> distance = @getDistance mark.x, mark.y, x, y angle = @getAngle mark.x, mark.y, x, y r: distance angle: angle + initRelease: -> + _inProgress: false + initValid: (mark) -> mark.r > MINIMUM_RADIUS diff --git a/app/classifier/drawing-tools/ellipse.cjsx b/app/classifier/drawing-tools/ellipse.cjsx index 2cd0c1990c..83b2c5cba6 100644 --- a/app/classifier/drawing-tools/ellipse.cjsx +++ b/app/classifier/drawing-tools/ellipse.cjsx @@ -21,6 +21,9 @@ module.exports = React.createClass ry: 0 angle: 0 + initStart: -> + _inProgress: true + initMove: ({x, y}, mark) -> distance = @getDistance mark.x, mark.y, x, y angle = @getAngle mark.x, mark.y, x, y @@ -28,6 +31,9 @@ module.exports = React.createClass ry: distance * DEFAULT_SQUASH angle: angle + initRelease: -> + _inProgress: false + initValid: (mark) -> mark.rx > MINIMUM_RADIUS diff --git a/app/classifier/drawing-tools/line.cjsx b/app/classifier/drawing-tools/line.cjsx index 5af176980e..899d9ee72a 100644 --- a/app/classifier/drawing-tools/line.cjsx +++ b/app/classifier/drawing-tools/line.cjsx @@ -17,10 +17,16 @@ module.exports = React.createClass x2: x y2: y + initStart: -> + _inProgress: true + initMove: ({x, y}) -> x2: x y2: y + initRelease: -> + _inProgress: false + initValid: (mark) -> {x1, y1, x2, y2} = mark DrawingToolRoot.distance(x1, y1, x2, y2) > MINIMUM_LENGTH diff --git a/app/classifier/drawing-tools/point.cjsx b/app/classifier/drawing-tools/point.cjsx index a36c290cdf..de1f5fbb8c 100644 --- a/app/classifier/drawing-tools/point.cjsx +++ b/app/classifier/drawing-tools/point.cjsx @@ -16,9 +16,15 @@ module.exports = React.createClass defaultValues: ({x, y}) -> {x, y} + initStart: -> + _inProgress: true + initMove: ({x, y}) -> {x, y} + initRelease: -> + _inProgress: false + getDeleteButtonPosition: -> theta = (DELETE_BUTTON_ANGLE) * (Math.PI / 180) x: (SELECTED_RADIUS / @props.scale.horizontal) * Math.cos theta diff --git a/app/classifier/drawing-tools/polygon.cjsx b/app/classifier/drawing-tools/polygon.cjsx index 747ac394a6..8ed98a0472 100644 --- a/app/classifier/drawing-tools/polygon.cjsx +++ b/app/classifier/drawing-tools/polygon.cjsx @@ -22,6 +22,7 @@ module.exports = React.createClass initStart: ({x, y}, mark) -> mark.points.push {x, y} points: mark.points + _inProgress: true initMove: ({x, y}, mark) -> mark.points[mark.points.length - 1] = {x, y} @@ -112,6 +113,7 @@ module.exports = React.createClass document.removeEventListener 'mousemove', @handleMouseMove @props.mark.closed = true + @props.mark._inProgress = false @props.onChange() handleMainDrag: (e, d) -> diff --git a/app/classifier/drawing-tools/rectangle.cjsx b/app/classifier/drawing-tools/rectangle.cjsx index 11a3ed912e..12b8f7cbe2 100644 --- a/app/classifier/drawing-tools/rectangle.cjsx +++ b/app/classifier/drawing-tools/rectangle.cjsx @@ -21,7 +21,7 @@ module.exports = React.createClass initStart: ({x, y}, mark) -> @initCoords = {x, y} - {x, y} + {x, y, _inProgress: true} initMove: (cursor, mark) -> if cursor.x > @initCoords.x @@ -40,6 +40,9 @@ module.exports = React.createClass {x, y, width, height} + initRelease: -> + _inProgress: false + initValid: (mark) -> mark.width > MINIMUM_SIZE and mark.height > MINIMUM_SIZE diff --git a/app/classifier/drawing-tools/root.cjsx b/app/classifier/drawing-tools/root.cjsx index 2e6e73f35d..af11827549 100644 --- a/app/classifier/drawing-tools/root.cjsx +++ b/app/classifier/drawing-tools/root.cjsx @@ -52,7 +52,7 @@ module.exports = React.createClass {@props.children} - {if toolProps.selected and toolProps.details? and toolProps.details.length isnt 0 + {if toolProps.selected and not toolProps.mark._inProgress and toolProps.details? and toolProps.details.length isnt 0 tasks = require '../tasks' detailsAreComplete = toolProps.details.every (detailTask, i) => diff --git a/app/classifier/index.cjsx b/app/classifier/index.cjsx index 8c7ddc6471..c517dd88a0 100644 --- a/app/classifier/index.cjsx +++ b/app/classifier/index.cjsx @@ -8,6 +8,7 @@ tasks = require './tasks' preloadSubject = require '../lib/preload-subject' PromiseRenderer = require '../components/promise-renderer' TriggeredModalForm = require 'modal-form/triggered' +TutorialButton = require './tutorial-button' isAdmin = require '../lib/is-admin' Tutorial = require '../lib/tutorial' @@ -122,11 +123,7 @@ Classifier = React.createClass
+ Please{' '} + {' '} + to contribute to subject discussions +
+ + notSetup: -> +There are no discussion boards setup for this project yet. Check back soon!
+ + quickComment: -> + if @state.subjectDefaultBoard ++ There is no default board for subject comments setup yet, Please{' '} + {' '} + or {@linkToClassifier('return to classifying')} +
+ + startDiscussion: -> +There are no comments yet
diff --git a/app/subjects/discussion-list.cjsx b/app/subjects/discussion-list.cjsx new file mode 100644 index 0000000000..cac077f3b9 --- /dev/null +++ b/app/subjects/discussion-list.cjsx @@ -0,0 +1,42 @@ +React = require 'react' +talkClient = require '../api/talk' +DiscussionPreview = require '../talk/discussion-preview' +Loading = require '../components/loading-indicator' + +module?.exports = React.createClass + displayName: 'SubjectDiscussionList' + + componentWillMount: -> + @getDiscussions() + + getInitialState: -> + discussions: null + + getDiscussions: -> + query = + section: @props.section + focus_id: @props.subject.id + focus_type: 'Subject' + page_size: 20 + sort: '-created_at' + + talkClient.type('discussions').get(query).then (discussions) => + @setState {discussions} + + render: -> + returnThere are no discussions yet
diff --git a/app/subjects/index.cjsx b/app/subjects/index.cjsx index aaefc2072b..4d8c27c26b 100644 --- a/app/subjects/index.cjsx +++ b/app/subjects/index.cjsx @@ -1,156 +1,52 @@ React = require 'react' apiClient = require '../api/client' talkClient = require '../api/talk' -getSubjectLocation = require '../lib/get-subject-location' -FavoritesButton = require '../collections/favorites-button' -PromiseRenderer = require '../components/promise-renderer' SubjectViewer = require '../components/subject-viewer' -NewDiscussionForm = require '../talk/discussion-new-form' -CommentLink = require '../talk/comment-link' -projectSection = require '../talk/lib/project-section' -parseSection = require '../talk/lib/parse-section' -QuickSubjectCommentForm= require '../talk/quick-subject-comment-form' -{Navigation, Link} = require '@edpaget/react-router' -{Markdown} = require 'markdownz' -alert = require '../lib/alert' -SignInPrompt = require '../partials/sign-in-prompt' -Comment = require '../talk/comment' -Paginator = require '../talk/lib/paginator' PopularTags = require '../talk/popular-tags' ActiveUsers = require '../talk/active-users' ProjectLinker = require '../talk/lib/project-linker' - -indexOf = (elem) -> - (elem while elem = elem.previousSibling).length - -promptToSignIn = -> - alert (resolve) ->There are no comments focused on this subject
} - - {if @props.user - {# TODO remove subject.get('project'), replace with params but browser freezes on get to projects with slug} - project = subject.get('project') - boards = project.then (project) -> talkClient.type('boards').get(section: projectSection(project), subject_default: false) - subjectDefaultBoard = project.then (project) -> talkClient.type('boards').get(section: projectSection(project), subject_default: true) - -- There is no default board for subject comments setup yet, Please{' '} - {' '} - or {@linkToClassifier('return to classifying')} -
- else if @state.tab is 1 -There are no discussion boards setup for this project yet. Check back soon!
- }Please to contribute to subject discussions
} -