ashirahattia/cs169-pgm

View on GitHub
app/views/groups/show.html.erb

Summary

Maintainability
Test Coverage
<%= render "layouts/sidebar.html.erb" %>

<div class="content-container">
    <div class="content">
        <h1>Prefrences for Group <%= @group.id %></h1>
        
        <% if flash.notice %>
            <div class="alert-container">
               <p><%= flash.notice %></p> 
            </div>
        <% end %>
        
        <%= form_tag("/groups/" + params[:id], method: "put") do %>
        
            <h3>Force Assignment to Project:</h3>
            <p>Currently <%= current_force_matched_project %></p>
            <select name="force_choice">
                <option value="None">None</option>
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project, @group.force_matched_project) %>>
                             <%= project[:project_name] %></option>
                <% end %>
            </select>
        
        
            <h3>First project choice</h3>
            <p>Currently <%= choice_str :first_choice %></p>
            <select name="first_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:first_choice]) %>>
                             <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Second project choice</h3>
            <p>Currently <%= choice_str :second_choice %></p>
            <select name="second_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:second_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Third project choice</h3>
            <p>Currently <%= choice_str :third_choice %></p>
            <select name="third_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:third_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Fourth project choice</h3>
            <p>Currently <%= choice_str :fourth_choice %></p>
            <select name="fourth_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:fourth_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Fifth project choice</h3>
            <p>Currently <%= choice_str :fifth_choice %></p>
            <select name="fifth_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:fifth_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Sixth project choice</h3>
            <p>Currently <%= choice_str :sixth_choice %></p>
            <select name="sixth_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:sixth_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            
            <h3>Seventh project choice</h3>
            <p>Currently <%= choice_str :seventh_choice %></p>
            <select name="seventh_choice">
                <% @projects.each do |project| %>
                    <option value=<%= project[:id] %> <%= select_if_needed(project[:id], @group[:seventh_choice]) %>>
                        <%= project[:project_name] %></option>
                <% end %>
            </select>
            <br>
            <br>
            <input type="submit" class="button" value="submit"/>
        <% end %>
        <div class="action-container">
            <%= form_tag("/groups/" + params[:id], method: "DELETE") do %>
                <input type="submit" class="button red" value="delete group"/>
            <% end %>
        </div>
    </div>
</div>