Skip to content

Commit

Permalink
Merge pull request #5842 from pretendWhale/2.0.6
Browse files Browse the repository at this point in the history
2.0.6
  • Loading branch information
pretendWhale authored Feb 14, 2022
2 parents 346a77c + 18ef13f commit 8a19115
Show file tree
Hide file tree
Showing 43 changed files with 430 additions and 57 deletions.
12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [unreleased]
- Remove unmaintained locales (#5727)
- Added the ability to submit URLs (#5822)

## [v2.0.6]
- Fix bug for menu icon not working on mobile devices / smaller screens (#5818)
- Fix bug for "Delete Group" button generating an invalid path (#5768)
- When role switched, 403 errors are displayed as flash messages after redirecting back to the previous page (#5785)
- Update wiki urls to point to https://github.com/MarkUsProject/Wiki (#5781)
- Fix bugs when submitting and cancelling remark requests (#5838)
- Do not trigger starter file changed timestamp when only starter_files_after_due assignment setting is changed (#5845)

## [v2.0.5]
- Add ability to annotate notebook (jupyter and Rmd) submissions (#5749)

Expand Down
7 changes: 1 addition & 6 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@

Thanks for using MarkUs!

Installation instructions have moved to the MarkUs wiki.

For production installation instructions: https://github.com/MarkUsProject/Markus/wiki/Installation
For development installation instruction:
- with Docker: https://github.com/MarkUsProject/Markus/wiki/Developer-Guide--Set-Up-With-Docker
- with Vagrant: https://github.com/MarkUsProject/Markus/wiki/Developer-Guide--Set-Up-With-Vagrant
Installation instructions have moved to the MarkUs wiki: https://github.com/MarkUsProject/Wiki
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ MarkUs is a Ruby on Rails and React web application for the submission and gradi
- Graders can easily annotate students' code
- Instructors can form groups or students can form groups on their own
- Web-based course administration
- [RESTful API](https://github.com/MarkUsProject/Markus/wiki/RESTful-API)
- See the [Wiki pages](https://github.com/MarkUsProject/Markus/wiki) for more features
- See the [Wiki pages](https://github.com/MarkUsProject/Wiki) for more features

## 2. Installation

To install MarkUs for production, see the [Installation Guide](https://github.com/MarkUsProject/Markus/wiki/Installation) for details and step by step instructions.
To install MarkUs for production, see the [Installation Guide](https://github.com/MarkUsProject/Wiki/blob/release/Installation.md) for details and step by step instructions.

To install MarkUs for development, see either of the [docker installation](https://github.com/MarkUsProject/Markus/wiki/Developer-Guide--Set-Up-With-Docker) or [vagrant installation](https://github.com/MarkUsProject/Markus/wiki/Developer-Guide--Set-Up-With-Vagrant) guides.
To install MarkUs for development, see either of the [docker installation](https://github.com/MarkUsProject/Wiki/blob/master/Developer-Guide--Set-Up-With-Docker.md) or [vagrant installation](https://github.com/MarkUsProject/Wiki/blob/master/Developer-Guide--Set-Up-With-Vagrant) guides.

## 3. Who is Using MarkUs?

Expand Down
2 changes: 1 addition & 1 deletion app/MARKUS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=2.0.5,PATCH_LEVEL=DEV
VERSION=2.0.6,PATCH_LEVEL=DEV
7 changes: 4 additions & 3 deletions app/assets/javascripts/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function initMenu() {
}
};
}

window.onload = () => {
// using addEventListener as opposed to direct assignment so that event listeners added elsewhere
// don't get overridden
window.addEventListener("DOMContentLoaded", () => {
initMenu();
};
});
7 changes: 5 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def set_markus_version
k,v = token.split('=')
version_info[k.downcase] = v
end
@markus_version = "#{version_info['version']}.#{version_info['patch_level']}"
@markus_version = version_info['version']
end

# Set locale according to URL parameter. If unknown parameter is
Expand Down Expand Up @@ -127,7 +127,10 @@ def user_not_authorized

# Render 403 if the current user is switching roles and they try to view a route for a different course
def check_course_switch
user_not_authorized if session[:role_switch_course_id] && current_course&.id != session[:role_switch_course_id]
if session[:role_switch_course_id] && current_course&.id != session[:role_switch_course_id]
flash_message(:error, I18n.t('main.role_switch.forbidden_warning'))
redirect_back(fallback_location: course_assignments_path(session[:role_switch_course_id]))
end
end

def implicit_authorization_target
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/assignments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,19 @@ def update_starter_file
success = true
ApplicationRecord.transaction do
assignment.assignment_properties.update!(starter_file_assignment_params)
all_changed = assignment.assignment_properties.saved_changes?
params[:sections].each do |section_params|
all_changed =
assignment.assignment_properties.saved_change_to_starter_file_type? ||
assignment.assignment_properties.saved_change_to_default_starter_file_group_id?
params[:sections]&.each do |section_params|
Section.find_by(id: section_params[:section_id])
&.update_starter_file_group(assignment.id, section_params[:group_id])
end
starter_file_group_params.each do |group_params|
starter_file_group = assignment.starter_file_groups.find_by(id: group_params[:id])
starter_file_group.update!(group_params)
all_changed ||= starter_file_group.saved_changes? || assignment.assignment_properties.saved_changes?
all_changed ||= starter_file_group.saved_changes?
end
assignment.assignment_properties.update!(starter_file_updated_at: Time.current)
assignment.assignment_properties.update!(starter_file_updated_at: Time.current) if all_changed
rescue ActiveRecord::RecordInvalid => e
flash_message(:error, e.message)
success = false
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/grade_entry_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def populate_grades_table
.pluck_to_hash(*student_pluck_attrs)
grades = current_role.grade_entry_students
.where(grade_entry_form: grade_entry_form)
.joins(role: :end_user)
.joins(:grades)
.pluck(:id, 'grades.grade_entry_item_id', 'grades.grade')
.group_by { |x| x[0] }
end
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/main_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class MainController < ApplicationController
def login
# redirect to main page if user is already logged in.
if logged_in? && !request.post?
redirect_to controller: 'courses', action: 'index'
if allowed_to?(:role_is_switched?)
redirect_to course_assignments_path(session[:role_switch_course_id])
else
redirect_to controller: 'courses', action: 'index'
end
return
end
unless Settings.remote_auth_login_url || Settings.validate_file
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/results_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def update_overall_comment

def update_remark_request
@submission = Submission.find(params[:submission_id])
@assignment = submission.grouping.assignment
@assignment = @submission.grouping.assignment
if @assignment.past_remark_due_date?
head :bad_request
else
Expand Down Expand Up @@ -684,7 +684,8 @@ def cancel_remark_request

redirect_to controller: 'results',
action: 'view_marks',
id: params[:id]
course_id: current_course.id,
id: submission.get_original_result.id
end

def delete_grace_period_deduction
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ def update_files

upload_files_helper(new_folders, new_files, unzip: unzip) do |f|
if f.is_a?(String) # is a directory
success, msgs = add_folder(f, current_role, repo, path: path, txn: txn)
authorize! to: :manage_subdirectories? # ensure user is authorized for directories in zip files
success, msgs = add_folder(f, current_role, repo, path: path, txn: txn, required_files: required_files)
should_commit &&= success
messages = messages.concat msgs
else
Expand Down
12 changes: 11 additions & 1 deletion app/helpers/repository_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def remove_files(files, user, repo, path: '/', txn: nil, keep_folder: true)
end
end

def add_folder(folder_path, user, repo, path: '/', txn: nil)
def add_folder(folder_path, user, repo, path: '/', txn: nil, required_files: nil)
messages = []

if txn.nil?
Expand All @@ -132,6 +132,14 @@ def add_folder(folder_path, user, repo, path: '/', txn: nil)

folder_path = current_path.join(folder_path)
folder_path = folder_path.to_s

# check if only required files are allowed for a submission
# allowed folders = paths in required files
if required_files.present? && required_files.none? { |file| file.starts_with?(folder_path) }
messages << [:invalid_folder_name, folder_path]
return false, messages
end

txn.add_path(folder_path)

if commit_txn
Expand Down Expand Up @@ -225,6 +233,8 @@ def flash_repository_messages(messages, course, suppress: nil)
flash_message(:warning, I18n.t('student.submission.no_action_detected'))
when :txn_conflicts
flash_message(:error, partial: 'submissions/file_conflicts_list', locals: { conflicts: other_info })
when :invalid_folder_name
flash_message(:error, I18n.t('student.submission.invalid_folder_name'))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/starter_file_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def update_default
end

def update_timestamp
assignment.assignment_properties.update(starter_file_updated_at: Time.current)
assignment.assignment_properties.update(starter_file_updated_at: Time.current) if saved_changes?
end

def set_name
Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def admin_user?
self.class == AdminUser
end

def end_user?
self.instance_of?(EndUser)
end

def set_display_name
strip_name
self.display_name ||= "#{self.first_name} #{self.last_name}"
Expand Down
2 changes: 1 addition & 1 deletion app/policies/submission_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def manage_files?
end

def manage_subdirectories?
role.instructor? || role.ta?
user.end_user?
end

def view_files?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<%= content_for :modal_content do %>

<%= t('upload_help_html', section_id: AnnotationCategory.name.pluralize.underscore.dasherize) %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: AnnotationCategory.name.pluralize.underscore.dasherize) %>
<%= form_tag({ action: 'upload' },
{ multipart: true }) do %>
<!-- Script for disabling upload button. -->
Expand Down
2 changes: 1 addition & 1 deletion app/views/assignments/_assignment_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
upload_id: 'upload_file',
button_id: 'submit_upload', nonce: true %>

<%= t('upload_help_html', section_id: Assignment.name.pluralize.underscore.dasherize) %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: Assignment.name.pluralize.underscore.dasherize) %>

<%= form_tag upload_assignments_course_path(@current_course),
{ multipart: true } do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/assignments/_cp_assignment_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<%= content_for :modal_content do %>

<%= t('assignments.upload_config_help_html', section_id: 'assignment-configuration') %>
<%= t('assignments.upload_config_help_html', markus_version: @markus_version, section_id: 'assignment-configuration') %>

<!-- Script for disabling upload buttons. -->
<%= javascript_include_tag 'upload_button_control.js',
Expand Down
2 changes: 1 addition & 1 deletion app/views/assignments/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
@grouping.accepted_students.size == 1 &&
@grouping.extension.nil? %>
<%= button_to t('helpers.submit.delete', model: Group.model_name.human),
course_assignment_group_path(@current_course.id, @assignment.id),
course_assignment_group_path(@current_course.id, @assignment.id, @grouping.id),
method: :delete,
data: { confirm: t('groups.student_interface.confirm_delete_group') }
%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/criteria/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<p><%= t('assignments.due_date.marking_overwrite_warning_html') %></p>
</div>
<% end %>
<%= t('upload_help_html', section_id: Criterion.name.pluralize.underscore.dasherize) %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: Criterion.name.pluralize.underscore.dasherize) %>
<%= form_tag upload_course_assignment_criteria_path(@current_course, @assignment),
multipart: true, size: 1 do %>
<p><%= file_field_tag :upload_file, required: true %></p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/grade_entry_forms/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= content_for :modal_open_link, '#uploadModal' %>

<%= content_for :modal_content do %>
<%= t('upload_help_html', section_id: 'marks-spreadsheet-grades') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'marks-spreadsheet-grades') %>

<%= form_tag upload_course_grade_entry_form_path(@current_course, @grade_entry_form),
{ multipart: true, size: 1 } do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/graders/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
upload_id: 'upload_file',
button_id: 'upload-groupings', nonce: true %>

<%= t('upload_help_html', section_id: 'graders') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'graders') %>

<%= form_tag upload_course_assignment_graders_path(@current_course, @assignment),
{ multipart: true } do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/groups/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
button_id: 'upload', nonce: true %>

<p>
<%= t('upload_help_html', section_id: 'groups') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'groups') %>
</p>
<%= form_tag upload_course_assignment_groups_path(@current_course, @assignment),
{ multipart: true } do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/marks_graders/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
button_id: 'upload',
nonce: true %>

<%= t('upload_help_html', section_id: 'graders') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'graders') %>

<%= form_tag({ controller: 'marks_graders',
action: 'upload' },
Expand Down
2 changes: 1 addition & 1 deletion app/views/peer_reviews/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
upload_id: 'upload_file',
button_id: 'upload', nonce: true %>

<%= t('upload_help_html', section_id: 'peer-reviews') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'peer-reviews') %>

<%= form_tag({ controller: 'peer_reviews',
action: 'upload' },
Expand Down
6 changes: 4 additions & 2 deletions app/views/shared/_flash_message.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
<% end %>
<% end %>
<%= javascript_tag nonce: true do %>
window.onload = function () {
// using addEventListener as opposed to direct assignment so that event listeners added elsewhere
// don't get overridden
window.addEventListener("DOMContentLoaded", function () {
Array.from(document.getElementsByClassName('hide-flash')).forEach(function (elem) {
elem.addEventListener("click", function(e) {
e.target.parentElement.style.display = 'none';
})
})
}
})
<% end %>
2 changes: 1 addition & 1 deletion app/views/students/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
nonce: true %>

<p>
<%= t('upload_help_html', section_id: 'students') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'students') %>
</p>
<%= form_tag upload_course_students_path(@current_course), { multipart: true } do %>
<div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tags/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
button_id: 'submit_upload',
nonce: true %>

<%= t('upload_help_html', section_id: 'tags') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'tags') %>

<%= form_tag upload_course_tags_path(@current_course, assignment_id: @assignment.id),
{ multipart: true, size: 1 } do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tas/_upload_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
nonce: true %>

<p>
<%= t('upload_help_html', section_id: 'students') %>
<%= t('upload_help_html', markus_version: @markus_version, section_id: 'students') %>
</p>
<%= form_tag upload_course_tas_path(@current_course), { multipart: true } do %>
<div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_key_display.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= User.human_attribute_name(:api_key) %>
<div class='help'>
<p>
<%= t('users.api_key.help_html') %>
<%= t('users.api_key.help_html', markus_version: @markus_version,) %>
</p>
</div>
</h2>
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
<hr>
<h3><%= t('help') %></h3>
<p>
<a href="https://github.com/MarkUsProject/Markus/wiki/SSH_Keypair_Instructions_Windows" target="_blank">
<a href="https://github.com/MarkUsProject/Wiki/blob/<%= @markus_version %>/SSH_Keypair_Instructions_Windows.md" target="_blank">
<%= t('key_pairs.help.windows') %>
</a>
</p>
<p>
<a href="https://github.com/MarkUsProject/Markus/wiki/SSH_Keypair_Instructions_Linux-OSX" target="_blank">
<a href="https://github.com/MarkUsProject/Wiki/blob/<%= @markus_version %>/SSH_Keypair_Instructions_Linux-OSX.md" target="_blank">
<%= t('key_pairs.help.macOS_linux') %>
</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The "main" locale.
base_locale: en
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
# locales: [en]
locales: [en]
## Reporting locale, default: en. Available: en, ru.
# internal_locale: en

Expand Down
2 changes: 1 addition & 1 deletion config/locales/defaults/download_upload/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ en:
malformed_csv: The selected file was improperly formed. Please ensure the file meets MarkUs specifications.
syntax_error: 'There is an error in the file you uploaded: %{error}'
unparseable_csv: The selected file is not a CSV file (even though it may have a .csv extension).
upload_help_html: ' For information about the file format(s) supported, please visit <a href="https://github.com/MarkUsProject/Markus/wiki/Instructor-Guide--Importing-and-Exporting-Data#%{section_id}">this page</a>.'
upload_help_html: ' For information about the file format(s) supported, please visit <a href="https://github.com/MarkUsProject/Wiki/blob/%{markus_version}/Instructor-Guide--Importing-and-Exporting-Data.md#%{section_id}">this page</a>.'
upload_success:
one: "%{count} object successfully uploaded."
other: "%{count} objects successfully uploaded."
Expand Down
Loading

0 comments on commit 8a19115

Please sign in to comment.