Skip to content

Commit

Permalink
Merge 615d2a1 into 4c3174c
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhimes committed May 1, 2022
2 parents 4c3174c + 615d2a1 commit 3c8adb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 53 deletions.
43 changes: 2 additions & 41 deletions app/views/assignments/edit/_general.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function autogenerate_submission(){

<tr>
<td style='padding:5px' id='assignment_team_assignment_field'>

<div class="form-inline">
<span style='padding:5px' class="form-inline" id='assignment_team_count_field' <%= 'hidden' unless @assignment_form.assignment.team_assignment?%>>
<!--Teammate reviews fields-->
Expand All @@ -101,7 +100,7 @@ function autogenerate_submission(){
<%= text_field_tag('assignment_form[assignment][max_team_size]', @assignment_form.assignment.max_team_size, {:style => 'width:50px;', class: 'form-control'}) %>
</span>
</div>
<span id='assignment_show_teammate_reviews' class="form-inline" <%= 'hidden' unless @assignment_form.assignment.team_assignment?%>>
<span id='assignment_show_teammate_reviews' class="form-inline" <%= 'hidden' unless @assignment_form.assignment.team_assignment?%>>
<%= check_box_tag('assignment_form[assignment][show_teammate_reviews]', 'true', @assignment_form.assignment.show_teammate_reviews) %>
<%= label_tag('assignment_form[assignment][show_teammate_reviews]', 'Show teammate reviews?') %>
</span>
Expand Down Expand Up @@ -299,45 +298,6 @@ function autogenerate_submission(){
}
<% end %>

<!-- Violation of DRY principle, adds input field and handles checkboxes hidden states in other views -->
function hasTeamsChanged() {
var msg = 'Warning! Unchecking this box will hide teams that already exist.';
var checkbox = jQuery('#team_assignment');
var team_count_field = jQuery('#assignment_team_count_field');
var teammate_reviews_field = jQuery('#assignment_show_teammate_reviews');
var team_formation_due_date_checkbox = jQuery('#team_formation_due_date_checkbox');
var autoAssignMentorCheckbox = jQuery('#auto_assign_mentor_checkbox');

jQuery("#questionnaire_table_TeammateReviewQuestionnaire").remove()
if (checkbox.is(':checked')) {
team_count_field.removeAttr('hidden');
team_formation_due_date_checkbox.removeAttr('hidden')
jQuery('#assignment_form_assignment_max_team_size').val('2');
teammate_reviews_field.removeAttr('hidden');
// E2115 hide auto assign mentor checkbox when an
// an assignment does not have teams
// what would the mentor be assigned to if there are no teams?
autoAssignMentorCheckbox.hide();
addDueDateTableElement(<%= @due_date_nameurl_not_empty==nil ? false:@due_date_nameurl_not_empty %>,'team_formation', 0,<%= due_date(@assignment_form.assignment, 'team_formation').to_json.html_safe %>);
} else {
if (confirm(msg)) {
team_count_field.attr('hidden', true);
team_formation_due_date_checkbox.attr('hidden', true)
teammate_reviews_field.attr('hidden', true);
// E2115 show auto assign mentor checkbox when an
// an assignment has teams
autoAssignMentorCheckbox.show();
document.getElementById('assignment_form_assignment_max_team_size').value = '1';
removeDueDateTableElement('team_formation', 0);
} else {
checkbox.prop('checked', true);
}
if (<%= !@assignment_form.assignment.team_assignment?%>){
team_count_field.attr('hidden', true);
}
}
}

function staggeredDeadlineChanged() {
var msg = 'Warning! Unchecking all topics for this assignment will now have the same deadline.'
if (!jQuery('#assignment_staggered_deadline').is(':checked')) {
Expand Down Expand Up @@ -378,6 +338,7 @@ function autogenerate_submission(){
}

jQuery(document).ready(function() {
addDueDateTableElement(<%= @due_date_nameurl_not_empty==nil ? false:@due_date_nameurl_not_empty %>,'team_formation', 0,<%= due_date(@assignment_form.assignment, 'team_formation').to_json.html_safe %>);
jQuery('input[type=radio][name=num_reviews]').change(function(){
if (this.value == 'student'){
jQuery('#num_reviews_per_student_threshold').removeAttr('hidden');
Expand Down
29 changes: 17 additions & 12 deletions app/views/student_task/view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,27 @@ to display the label "Your team" in the student assignment tasks-->
<%end%>

<!--Your work-->
<% if @authorization == 'participant' or @can_submit == true %>
<% if @authorization == 'participant' || @can_submit == true %>
<li>
<% if @topics.size > 0 %>
<% if @topic_id and @assignment.submission_allowed(@topic_id) %>
<%= link_to t(".your_work"), :controller => 'submitted_content', :action => 'edit', :id => @participant.id %> <%=t ".submit_work" %>
<% if @team %>
<% if @topics.size > 0 %>
<% if @topic_id and @assignment.submission_allowed(@topic_id) %>
<%= link_to t(".your_work"), :controller => 'submitted_content', :action => 'edit', :id => @participant.id %> <%=t ".submit_work" %>
<% else %>
<!--if one team do not hold a topic (still in waitlist), they cannot submit their work.-->
<font color="gray"><%=t ".your_work" %></font> <%=t ".choose_topic" %>
<% end %>
<% else %>
<!--if one team do not hold a topic (still in waitlist), they cannot submit their work.-->
<font color="gray"><%=t ".your_work" %></font> <%=t ".choose_topic" %>
<% if @assignment.submission_allowed(@topic_id) %>
<%= link_to t(".your_work"), :controller => 'submitted_content', :action => 'edit', :id => @participant.id %> <%=t ".submit_work" %>
<% else %>
<font color="gray"><%=t ".your_work" %></font> <%=t ".not_allowed" %>
<% end %>
<% end %>
<% else %>
<% if @assignment.submission_allowed(@topic_id) %>
<%= link_to t(".your_work"), :controller => 'submitted_content', :action => 'edit', :id => @participant.id %> <%=t ".submit_work" %>
<% else %>
<font color="gray"><%=t ".your_work" %></font> <%=t ".not_allowed" %>
<% end %>
<% end %>
<!-- Must be on a team to click "Your Work" -->
<font color="gray"><%=t ".your_work" %></font> <%=t ".not_allowed" %>
<% end%>
</li>
<% end %>
Expand Down

0 comments on commit 3c8adb9

Please sign in to comment.