forked from expertiza/expertiza
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring the teams rendering in /views/student_teams/view.html.erb
- Loading branch information
root
committed
Mar 24, 2024
1 parent
73dc777
commit 146ad3f
Showing
11 changed files
with
103 additions
and
302 deletions.
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
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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
<!-- Partial to display people who have been invited to collaborate --> | ||
<tr> | ||
<td><%= inv.to_user.name(session[:ip]) %></td> | ||
<td><%= inv.to_user.fullname(session[:ip]) %></td> | ||
<td><%= inv.to_user.email(session[:ip]) %></td> | ||
<% if inv.reply_status == 'A' %> | ||
<td align = "center"><%=t ".accepted"%></td> | ||
<% elsif inv.reply_status == 'D' %> | ||
<td align = "center"><%=t ".declined"%></td> | ||
<% else %> | ||
<td align = "center">Waiting for reply | ||
<%= link_to "Retract", {:controller => 'invitations', :action => 'cancel', :inv_id => inv.id, :student_id => @student.id} %></td> | ||
<% end %> | ||
<tr> | ||
<td align="center"> | ||
<% case inv.reply_status %> | ||
<% when 'A' %> | ||
<%= t(".accepted") %> | ||
<% when 'D' %> | ||
<%= t(".declined") %> | ||
<% else %> | ||
Waiting for reply | ||
<%= link_to "Retract", {controller: 'invitations', action: 'cancel', inv_id: inv.id, student_id: @student.id}, method: :post %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
|
||
</tr> |
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 |
---|---|---|
@@ -1,28 +1,20 @@ | ||
<!-- Partial for invitations received for collaboration on an assignment --> | ||
<% if inv.reply_status == 'W' %> | ||
<tr> | ||
<td><%= inv.from_user.name(session[:ip]) %></td> | ||
<td> | ||
<% teams_users = TeamsUser.where(['user_id = ?', inv.from_id]) %> | ||
<% teams_users.each do |teams_user| %> | ||
<% current_team = Team.where(['id = ? and parent_id = ?', teams_user.team_id, @student.assignment.id]).first %> | ||
<%= Team.find(current_team.id).name unless current_team.nil?%> | ||
<% Team.includes(:teams_participants) | ||
.where(teams_participants: { user_id: inv.from_id }, parent_id: @student.assignment.id) | ||
.each do |team| %> | ||
<%= team.name %> | ||
<% end %> | ||
</td> | ||
<td> | ||
<%if @student.team.nil? | ||
@team_id = 0 | ||
else | ||
@team_id = @student.team.id | ||
end %> | ||
<%= link_to "Accept", | ||
{:controller => 'invitations', :action => 'accept', :inv_id => inv.id, :student_id => @student.id, :team_id => @team_id}, | ||
{:onClick => "javascript: return confirm('Your topic (or place on waiting lists) will be relinquished if you accept the invitation. Do you want to continue?');"} | ||
%> | ||
| | ||
<%= link_to "Decline", | ||
{:controller => 'invitations', :action => 'decline', :inv_id => inv.id, :student_id => @student.id} | ||
%> | ||
<% team_id = @student.team&.id || 0 %> | ||
<%= link_to 'Accept', accept_invitations_path(inv_id: inv.id, student_id: @student.id, team_id: team_id), | ||
data: { confirm: 'Accepting this invitation will relinquish your current topic or waiting list spot. Continue?' } %> | ||
| | ||
<%= link_to 'Decline', decline_invitations_path(inv_id: inv.id, student_id: @student.id), method: :get %> | ||
|
||
</td> | ||
</tr> | ||
<% 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<%= form_tag :controller => 'teams_users', :action => 'update_duties' do %> | ||
<%= hidden_field_tag 'participant_id', participant_id %> | ||
<%= hidden_field_tag 'teams_user_id', teams_user_id %> | ||
<%= collection_select(:teams_user, :duty_id, Duty.where("assignment_id = ?", assignment_id).select{|duty| duty.can_be_assigned?(@student.team)} , :id, :name, {:prompt => 'Please select a role'}) %> | ||
<%= form_tag controller: 'teams_participants', action: 'update_duties' do %> | ||
<%= hidden_field_tag :participant_id, participant_id %> | ||
<%= hidden_field_tag :teams_user_id, teams_user_id %> | ||
<%= collection_select(:teams_participant, :duty_id, Duty.where(assignment_id: assignment_id).select { |duty| duty.can_be_assigned?(@student.team) }, :id, :name, prompt: 'Please select a role') %> | ||
<%= submit_tag "Save", data: { disable_with: "Submitting..." } %> | ||
<% 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 |
---|---|---|
@@ -1,44 +1,13 @@ | ||
<!-- Partial for sending invitations --> | ||
<% if @student.team.nil? %> <!--dead code--> | ||
<h3><%=t ".name_team"%></h3> | ||
<%= form_tag :controller => 'student_teams', :action => 'create' do %> | ||
<%= hidden_field_tag 'student_id', @student.id %> | ||
<label for="team_name"><%=t ".team_name"%></label> | ||
<%= text_field 'team', 'name' %> | ||
<%= submit_tag t(".name_team") %> | ||
<% if @student.team.present? && !@student.team.full? %> | ||
<strong><%= t("student_teams.view.send_invite") %></strong> | ||
<%= form_tag(invitations_path, method: :post) do %> | ||
<%= hidden_field_tag :team_id, @student.team.id %> | ||
<%= hidden_field_tag :student_id, @student.id %> | ||
<%= hidden_field_tag :assignment_id, @student.assignment.id %> | ||
<div style="width:80%; margin: auto;"> | ||
<%= t("student_teams.view.enter_user") %> | ||
<%= text_field_tag 'user[name]', nil, size: 41 %> | ||
<%= submit_tag t("student_teams.view.invite_button") %> | ||
</div> | ||
<% end %> | ||
<% elsif !@student.team.full?%> | ||
<b><%=t ".invite_people"%></b> | ||
<%= form_tag :controller => 'invitations', :action => 'create' do %> | ||
<%= hidden_field_tag 'team_id', @student.team.id %> | ||
<%= hidden_field_tag 'student_id', @student.id %> | ||
<%= hidden_field_tag 'session[:dummy][:assignment_id]', @student.parent_id %> | ||
<table style="width:80%" align="center" > | ||
<tr> | ||
<td> | ||
<%=t ".enter_user"%><%= text_field_with_auto_complete :user, :name, {:size => 41} %> | ||
<input type='submit' value='Invite'/> | ||
</td> | ||
</tr> | ||
</table> | ||
<% end %> | ||
<% end %> | ||
|
||
<!--waiting listed users on the same topic--> | ||
<% if @users_on_waiting_list && @users_on_waiting_list.count>0%> | ||
<h3><%=t ".users_waiting"%></h3> | ||
<table> | ||
<tr> | ||
<td><b> <%=t ".user_id"%> </b></td> | ||
<td><b> <%=t ".fullname"%> </b></td> | ||
<td><b> <%=t ".email"%> </b></td> | ||
</tr> | ||
<% @users_on_waiting_list.each do |user|%> | ||
<tr> | ||
<td> <%=user.name(session[:ip])%> </td> | ||
<td> <%=user.fullname(session[:ip])%> </td> | ||
<td> <%=user.email(session[:ip])%> </td> | ||
</tr> | ||
<% end%> | ||
</table> | ||
<% 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<H1><%=t ".edit_team"%></H1> | ||
<%= form_for '/student_teams/update', method: :put do %> | ||
<%= hidden_field_tag 'team_id', @team.id %> | ||
<%= hidden_field_tag 'student_id', @student.id %> | ||
<label for="team_name"><%=t ".team_name"%></label> | ||
<%= text_field 'team', 'name'%> | ||
<h1><%= t ".edit_team" %></h1> | ||
<%= form_with url: '/student_teams/update', method: :put, local: true do %> | ||
<%= hidden_field_tag :team_id, @team.id %> | ||
<%= hidden_field_tag :student_id, @student.id %> | ||
<label for="team_name"><%= t ".team_name" %></label> | ||
<%= text_field :team, :name %> | ||
<br> | ||
<br> | ||
<%= submit_tag "Save" %> | ||
<%= submit_tag t("Save") %> | ||
<% end %> | ||
<br/> | ||
<a href="javascript:window.history.back()"><%=t ".back"%></a> | ||
<%= link_to t(".back"), 'javascript:window.history.back()' %> |
Oops, something went wrong.