Skip to content

Commit

Permalink
Merge remote-tracking branch 'MarkUsProject/master' into matt-no-rege…
Browse files Browse the repository at this point in the history
…n-tokens
  • Loading branch information
MBAustin committed Dec 7, 2016
2 parents 7e7d94f + bbfb227 commit beccce2
Show file tree
Hide file tree
Showing 103 changed files with 1,156 additions and 1,389 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -39,12 +39,12 @@ before_install:
install:
- travis_wait bundle install --path=~/.bundle --jobs=3 --retry=3 --without development production console
- sudo apt-get install -y libaprutil1-dev swig
- wget http://apache.parentingamerica.com/subversion/subversion-1.9.4.tar.gz
- tar xzf subversion-1.9.4.tar.gz
- wget http://apache.parentingamerica.com/subversion/subversion-1.9.5.tar.gz
- tar xzf subversion-1.9.5.tar.gz
- wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip
- unzip sqlite-amalgamation-3071501.zip
- mv sqlite-amalgamation-3071501 subversion-1.9.4/sqlite-amalgamation
- cd subversion-1.9.4
- mv sqlite-amalgamation-3071501 subversion-1.9.5/sqlite-amalgamation
- cd subversion-1.9.5
- LDFLAGS="-L/home/travis/.rvm/rubies/ruby-2.3.1/lib/" ./configure --prefix=/home/travis/.rvm/rubies/ruby-2.3.1/
- make
- make swig-rb
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/GradeEntryForms/grades.js
@@ -1,3 +1,4 @@
jQuery(document).ready(function() {
window.modal_upload = new ModalMarkus('#upload_dialog');
window.modal_download = new ModalMarkus('#download_dialog');
});
6 changes: 6 additions & 0 deletions app/assets/javascripts/Groups/index.js
@@ -1,4 +1,10 @@
var modalCreate,
modalAddMember,
modalNotesGroup,
modalAssignmentGroupReUse = null;

jQuery(document).ready(function () {
window.modal_download = new ModalMarkus('#download_dialog');
window.modal_upload = new ModalMarkus('#upload_dialog');
window.modal_rename = new ModalMarkus('#rename_group_dialog');
modalCreate = new ModalMarkus('#create_group_dialog');
Expand Down
11 changes: 11 additions & 0 deletions app/assets/javascripts/MarksGraders/index.js
@@ -0,0 +1,11 @@
var modalCreate,
modalAssignmentGroupReUse,
modalRenameGroup,
modalAddMember,
modalNotesGroup,
modal_download,
modal_download = null;
jQuery(document).ready(function() {
modal_upload = new ModalMarkus('#upload_dialog');
modal_download = new ModalMarkus('#download_dialog');
});
43 changes: 0 additions & 43 deletions app/assets/javascripts/ReactComponents/error.js

This file was deleted.

43 changes: 0 additions & 43 deletions app/assets/javascripts/ReactComponents/success.js

This file was deleted.

1 change: 1 addition & 0 deletions app/assets/javascripts/Results/index.js
@@ -1,3 +1,4 @@
jQuery(document).ready(function () {
window.modal_download_files = new ModalMarkus('#download_files_dialog');
window.modal_download = new ModalMarkus('#download_dialog');
});
3 changes: 3 additions & 0 deletions app/assets/javascripts/Students/index.js
@@ -1,4 +1,7 @@
var modalNotesGroup = null;

jQuery(document).ready(function () {
window.modal_download = new ModalMarkus('#download_dialog');
window.modal_upload = new ModalMarkus('#upload_dialog');
modalNotesGroup = new ModalMarkus('#notes_dialog');
});
3 changes: 1 addition & 2 deletions app/assets/stylesheets/common/_markus.scss
Expand Up @@ -113,9 +113,8 @@ strong a {

.notice {
@extend .alert;
background: $light-grey;
background: $light-grey url(icons/information.png) no-repeat 5px center;
border: 1px solid $grey;
padding: 0.25em 0.5em;
}


Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/criteria.scss
Expand Up @@ -111,3 +111,9 @@
margin-top: 1em;
}
}

.scroll_content {
display: block;
height: 400px;
overflow-y: scroll;
}
13 changes: 6 additions & 7 deletions app/controllers/admins_controller.rb
Expand Up @@ -23,11 +23,11 @@ def update
@user = Admin.find(params[:id])
# update_attributes supplied by ActiveRecords
if @user.update_attributes(user_params).nil?
flash[:error] = I18n.t('admins.update.error')
flash_message(:error, I18n.t('admins.update.error'))
render :edit
else
flash[:success] = I18n.t('admins.update.success',
user_name: @user.user_name)
flash_message(:success, I18n.t('admins.update.success',
user_name: @user.user_name))
redirect_to action: 'index'
end
end
Expand All @@ -42,12 +42,11 @@ def create
# active records--creates a new record if the model is new, otherwise
# updates the existing record
if @user.save
flash[:success] = I18n.t('admins.create.success',
user_name: @user.user_name)

flash_message(:success, I18n.t('admins.create.success',
user_name: @user.user_name))
redirect_to action: 'index'
else
flash[:error] = I18n.t('admins.create.error')
flash_message(:error, I18n.t('admins.create.error'))
render 'new'
end
end
Expand Down
31 changes: 19 additions & 12 deletions app/controllers/annotation_categories_controller.rb
Expand Up @@ -21,6 +21,7 @@ def create
@annotation_category = @assignment.annotation_categories
.new(annotation_category_params)
if @annotation_category.save
flash_message(:success, I18n.t('annotations.update.annotation_category_success'))
render :insert_new_annotation_category
else
render :new_annotation_category_error
Expand All @@ -34,7 +35,9 @@ def show

def destroy
@annotation_category = AnnotationCategory.find(params[:id])
@annotation_category.destroy
if @annotation_category.destroy
flash_message(:success, I18n.t('annotations.delete.delete_message'))
end
end

def update
Expand All @@ -53,7 +56,9 @@ def update_annotation
@annotation_text = AnnotationText.find(params[:id])
@annotation_text.update_attributes(annotation_text_params)
@annotation_text.last_editor_id = current_user.id
@annotation_text.save
if @annotation_text.save
flash_now(:success, I18n.t('annotations.update.annotation_category_success'))
end
end

def add_annotation_text
Expand All @@ -69,7 +74,7 @@ def add_annotation_text
render :new_annotation_text_error
return
end
flash.now[:success] = I18n.t('annotations.update.annotation_category_success')
flash_now(:success, I18n.t('annotations.update.annotation_category_success'))
@assignment = Assignment.find(params[:assignment_id])
render :insert_new_annotation_text
end
Expand All @@ -78,7 +83,9 @@ def add_annotation_text
def delete_annotation_text
@assignment = Assignment.find(params[:assignment_id])
@annotation_text = AnnotationText.find(params[:id])
@annotation_text.destroy
if @annotation_text.destroy
flash_now(:success, I18n.t('annotations.delete.delete_message'))
end
end

def find_annotation_text
Expand Down Expand Up @@ -160,7 +167,7 @@ def csv_upload
flash_message(:success, result[:valid_lines])
end
else
flash[:error] = I18n.t('csv.invalid_csv')
flash_message(:error, I18n.t('csv.invalid_csv'))
end
redirect_to action: 'index', id: @assignment.id
end
Expand All @@ -179,15 +186,15 @@ def yml_upload
begin
annotations = YAML::load(file.utf8_encode(encoding))
rescue Psych::SyntaxError => e
flash[:error] = I18n.t('annotations.upload.syntax_error',
error: "#{e}")
flash_message(:error, I18n.t('annotations.upload.syntax_error',
error: "#{e}"))
redirect_to action: 'index', assignment_id: @assignment.id
return
end

# YAML::load returns a hash if successful
unless annotations.is_a? Hash
flash[:error] = I18n.t('annotations.upload.unparseable_yaml')
flash_message(:error, I18n.t('annotations.upload.unparseable_yaml'))
redirect_to action: 'index', assignment_id: @assignment.id
return
end
Expand All @@ -196,16 +203,16 @@ def yml_upload
result = AnnotationCategory.add_by_array(key, annotations.values_at(key), @assignment, current_user)
annotation_line += 1
if result[:annotation_upload_invalid_lines].size > 0
flash[:error] = I18n.t('annotations.upload.error',
annotation_category: key, annotation_line: annotation_line)
flash_message(:error, I18n.t('annotations.upload.error',
annotation_category: key, annotation_line: annotation_line))
break
else
annotation_category_number += 1
end
end
if annotation_category_number > 0
flash[:success] = I18n.t('annotations.upload.success',
annotation_category_number: annotation_category_number)
flash_message(:success, I18n.t('annotations.upload.success',
annotation_category_number: annotation_category_number))
end
end
redirect_to action: 'index', assignment_id: @assignment.id
Expand Down
22 changes: 11 additions & 11 deletions app/controllers/assignments_controller.rb
Expand Up @@ -257,7 +257,7 @@ def edit
@sections = Section.all

unless @past_date.nil? || @past_date.empty?
flash.now[:notice] = t('past_due_date_notice') + @past_date.join(', ')
flash_now(:notice, t('past_due_date_notice') + @past_date.join(', '))
end

# build section_due_dates for each section that doesn't already have a due date
Expand Down Expand Up @@ -285,13 +285,13 @@ def update
end
rescue SubmissionRule::InvalidRuleType => e
@assignment.errors.add(:base, t('assignment.error', message: e.message))
flash[:error] = t('assignment.error', message: e.message)
flash_message(:error, t('assignment.error', message: e.message))
render :edit, id: @assignment.id
return
end

if @assignment.save
flash[:success] = I18n.t('assignment.update_success')
flash_message(:success, I18n.t('assignment.update_success'))
redirect_to action: 'edit', id: params[:id]
else
render :edit, id: @assignment.id
Expand Down Expand Up @@ -345,7 +345,7 @@ def create
@assignment.clone_groupings_from(params[:persist_groups_assignment])
end
if @assignment.save
flash[:success] = I18n.t('assignment.create_success')
flash_message(:success, I18n.t('assignment.create_success'))
end
end
redirect_to action: 'edit', id: @assignment.id
Expand Down Expand Up @@ -448,7 +448,7 @@ def deletegroup
end

@grouping.destroy
flash[:success] = I18n.t('assignment.group.deleted')
flash_message(:success, I18n.t('assignment.group.deleted'))
m_logger.log("Student '#{current_user.user_name}' deleted group '" +
"#{@grouping.group.group_name}'.", MarkusLogger::INFO)

Expand Down Expand Up @@ -484,7 +484,7 @@ def invite_member
@grouping.invite(to_invite)
flash[:fail_notice] = @grouping.errors['base']
if flash[:fail_notice].blank?
flash[:success] = I18n.t('invite_student.success')
flash_message(:success, I18n.t('invite_student.success'))
end
redirect_to action: 'student_interface', id: @assignment.id
end
Expand All @@ -503,7 +503,7 @@ def disinvite_member
m_logger = MarkusLogger.instance
m_logger.log("Student '#{current_user.user_name}' cancelled invitation for " +
"'#{disinvited_student.user_name}'.")
flash[:success] = I18n.t('student.member_disinvited')
flash_message(:success, I18n.t('student.member_disinvited'))
redirect_to action: :student_interface, id: assignment.id
end

Expand Down Expand Up @@ -565,7 +565,7 @@ def download_assignment_list
filename: 'assignment_list.csv')
return
else
flash[:error] = t(:incorrect_format)
flash_message(:error, t(:incorrect_format))
redirect_to action: 'index'
return
end
Expand All @@ -580,7 +580,7 @@ def upload_assignment_list
assignment_list = params[:assignment_list]

if assignment_list.blank?
flash[:error] = I18n.t('csv.invalid_csv')
flash_message(:error, I18n.t('csv.invalid_csv'))
redirect_to action: 'index'
return
end
Expand Down Expand Up @@ -622,7 +622,7 @@ def upload_assignment_list
update_assignment!(row)
end
rescue ActiveRecord::ActiveRecordError, ArgumentError => e
flash[:error] = e.message
flash_message(:error, e.message)
redirect_to action: 'index'
return
end
Expand Down Expand Up @@ -900,7 +900,7 @@ def update_assignment!(map)
assignment.display_grader_names_to_students = false
end
assignment.update_attributes!(map)
flash[:success] = t('assignment.create_success')
flash_message(:success, t('assignment.create_success'))
end

def process_assignment_form(assignment)
Expand Down

0 comments on commit beccce2

Please sign in to comment.