This repository was archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Multiple free responses; image free responses #191
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
79f510d
text free response work
jpslav 46911b7
text responses mostly rockin
jpslav c98ded5
finished text free response code
jpslav 6d04cc5
really finished text responses
jpslav fb0cbc5
pulled FR form into parent
jpslav b55e300
file uploading
jpslav 3a880ce
added s3 storage for attachments
jpslav 1798e31
made free responses sortable
jpslav 6f4e789
fixed some bugs, added captions to images
jpslav 008bb59
fixed up free response edit styling
jpslav 957ce0f
viewing attachments
jpslav bc6bde6
got rid of old displays of free_response
jpslav 3b9685c
Merge branch 'master' of github.com:lml/ost into jpslav-student-work
jpslav 65c4125
fixed bugs, cleaned up SE show view, eliminated OBE files, etc
jpslav d43312f
cleanup
jpslav 69de100
fixed migration to new free response style by ignoring a validation
jpslav 4afcbde
got rid of remaining 'lock' text
jpslav ba36c8d
not migrating old blank free responses to new style
jpslav 3f5ac81
fixed bug that had broken free response sorting
jpslav bf3b04e
fixed remove_from_container in acts_as_numberable when STI is being used
jpslav 1b7de7d
made it clearer that students need to add at least one free response
jpslav 5bb1668
now remove turn in form when last free response deleted
jpslav f8cf9a7
PR comment fixes and changed 'save' button terminology
jpslav 63363c0
fixes recommend from pull request, 'attach' -> 'save draft', and bug …
jpslav dce1d3e
overlay on submitted free responses
jpslav 2d2999c
YT change
jpslav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class FileFreeResponsesController < ApplicationController | ||
|
||
def view | ||
@free_response = FreeResponse.find(params[:id]) | ||
raise SecurityTransgression unless present_user.can_read?(@free_response) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
class FreeResponsesController < ApplicationController | ||
|
||
before_filter :get_student_exercise, :only => [:new, :create, :sort] | ||
before_filter :make_free_response, :only => [:new, :create] | ||
before_filter :grab_view_helper_variables, :only => [:create, :update] | ||
|
||
def new | ||
end | ||
|
||
def edit | ||
@free_response = FreeResponse.find(params[:id]) | ||
raise SecurityTransgression unless present_user.can_update?(@free_response) | ||
end | ||
|
||
def create | ||
raise SecurityTransgression unless present_user.can_create?(@free_response) | ||
@free_response.save | ||
render :template => 'free_responses/create_or_update' | ||
end | ||
|
||
def update | ||
@free_response = FreeResponse.find(params[:id]) | ||
raise SecurityTransgression unless present_user.can_update?(@free_response) | ||
@free_response.update_attributes(params[:free_response]) | ||
render :template => 'free_responses/create_or_update' | ||
end | ||
|
||
def destroy | ||
@free_response = FreeResponse.find(params[:id]) | ||
raise SecurityTransgression unless present_user.can_destroy?(@free_response) | ||
@free_response.destroy | ||
end | ||
|
||
def sort | ||
super('free_response', FreeResponse, @student_exercise, :student_exercise) | ||
end | ||
|
||
protected | ||
|
||
def get_student_exercise | ||
@student_exercise = StudentExercise.find(params[:student_exercise_id]) | ||
end | ||
|
||
def make_free_response | ||
type = params[:type] | ||
@free_response = | ||
case type | ||
when 'TextFreeResponse' | ||
TextFreeResponse.new(params[:free_response]) | ||
when 'FileFreeResponse' | ||
FileFreeResponse.new(params[:free_response]) | ||
else | ||
raise AbstractController::ActionNotFound | ||
end | ||
@free_response.student_exercise = @student_exercise | ||
end | ||
|
||
def grab_view_helper_variables | ||
@free_response_form_id = params[:free_response_form_id] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class TextFreeResponsesController < ApplicationController | ||
|
||
def preview | ||
@text = params[:free_response][:content] | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case statement makes my spidy senses tingle, but I'm not sure what to do to fix it. It seems like we want to have a FreeResponseFactory of some sort do this work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I hear you. If it just stays as is, I'm grudgingly ok with it.