Commit f44fffa6 authored by Raymond Evaristo's avatar Raymond Evaristo

final update

parent 3b3146ce
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Development: labwork2" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="labwork2" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Production: labwork2" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="labwork2" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spec: labwork2" type="RakeRunConfigurationType" factoryName="Rake">
<module name="labwork2" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="test: labwork2" type="RakeRunConfigurationType" factoryName="Rake">
<module name="labwork2" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs>
<env name="RAILS_ENV" value="test" />
</envs>
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
...@@ -13,6 +13,7 @@ class StudentGradesController < ApplicationController ...@@ -13,6 +13,7 @@ class StudentGradesController < ApplicationController
def edit def edit
@StudentGrade = StudentGrade.find(params[:id]) @StudentGrade = StudentGrade.find(params[:id])
@StudentGrade.destroy
end end
def create def create
......
<%= form_for @StudentGrade do |c| %> <style>
p {
font-size: 16px;
}
th {
text-align: center;
}
.container{
text-align: center;
width: 50%;
}
a:link {
color: white;
}
</style>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Student Grades</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/home/">Home<span class="sr-only">(current)</span></a></li>
<li class="active"><a href="/home/new">New Student<span class="sr-only">(current)</span></a></li>
</ul>
</div>
</div>
</nav>
<br>
<%= form_for @StudentGrade, method: :post do |c| %>
<div class="container">
<table class="table table-bordered">
<thead>
<tr><th><h2>Please enter student details below:</h2></th></tr>
</thead>
<tbody>
<tr><td>
<p> <p>
<%= c.label :last_name %> <%= c.label :first_name %>: &nbsp
<%= c.text_field :last_name%> <%= c.text_field :first_name%>
</p> </p>
</td></tr>
<tr><td>
<p> <p>
<%= c.label :first_name %> <%= c.label :last_name %>: &nbsp
<%= c.text_field :first_name %> <%= c.text_field :last_name %>
</p> </p>
</tr></td>
<tr><td>
<p> <p>
<%= c.label :english_grade %> <%= c.label :english_grade %>: &nbsp
<%= c.number_field :english_grade, within: 50...100 %> <%= c.number_field :english_grade, within: 50...100 %>
</p> </p>
</tr></td>
<tr><td>
<p> <p>
<%= c.label :math_grade %> <%= c.label :math_grade %>: &nbsp
<%= c.number_field :math_grade, within: 50...100 %> <%= c.number_field :math_grade, within: 50...100 %>
</p> </p>
</tr></td>
<tr><td>
<p> <p>
<%= c.label :science_grade %> <%= c.label :science_grade %>: &nbsp
<%= c.number_field :science_grade, within: 50...100 %> <%= c.number_field :science_grade, within: 50...100 %>
</p> </p>
</tr></td>
<tr><td>
<p> <p>
<%= c.label :history_grade %> <%= c.label :history_grade %>: &nbsp
<%= c.number_field :history_grade, within: 50...100 %> <%= c.number_field :history_grade, within: 50...100 %>
</p> </p>
<br> </tr></td>
<tr><td>
<%= c.submit 'Submit Student Details', data: { confirm: 'Are the details correct?'} %> <%= c.submit 'Submit Student Details', class: 'btn btn-success', data: { confirm: 'Are the details correct?'} %>
</tr></td>
<% end %> <% end %>
<style>
p {
font-size: 16px;
}
th {
text-align: center;
}
.container{
text-align: center;
width: 50%;
}
a:link {
color: white;
}
</style>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Student Grades</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/home/">Home<span class="sr-only">(current)</span></a></li>
<li class="active"><a href="">Edit Student<span class="sr-only">(current)</span></a></li>
</ul>
</div>
</div>
</nav>
<br>
<%= form_for @StudentGrade, method: :post do |c| %>
<div class="container">
<table class="table table-bordered">
<thead>
<tr><th><h2>Please edit student details below:</h2></th></tr>
</thead>
<tbody>
<tr><td>
<p>
<%= c.label :first_name %>: &nbsp
<%= c.text_field :first_name%>
</p>
</td></tr>
<tr><td>
<p>
<%= c.label :last_name %>: &nbsp
<%= c.text_field :last_name %>
</p>
</tr></td>
<tr><td>
<p>
<%= c.label :english_grade %>: &nbsp
<%= c.number_field :english_grade, within: 50...100 %>
</p>
</tr></td>
<tr><td>
<p>
<%= c.label :math_grade %>: &nbsp
<%= c.number_field :math_grade, within: 50...100 %>
</p>
</tr></td>
<tr><td>
<p>
<%= c.label :science_grade %>: &nbsp
<%= c.number_field :science_grade, within: 50...100 %>
</p>
</tr></td>
<tr><td>
<p>
<%= c.label :history_grade %>: &nbsp
<%= c.number_field :history_grade, within: 50...100 %>
</p>
</tr></td>
<tr><td>
<%= c.submit 'Submit Edited Student Details', class: 'btn btn-success', data: { confirm: 'Are the details correct?'} %>
</tr></td>
<% end %>
<h1>Edit Student Information</h1> <%= render 'update' %>
\ No newline at end of file
<%= render 'form' %>
\ No newline at end of file
<table> <style>
h1 {
text-align: center;
}
text {
display: block;
margin: auto;
width: 10%;
}
table {
width: 80%;
}
th,td {
text-align: center;
}
a {
color: white;
}
</style>
<h1>Simple Student Information System</h1>
<text><button type="button" class="btn btn-primary"><%= link_to 'New Student Info', new_student_grade_path , data: { confirm: 'Create new student information?' } %></button></text>
<div class= "container">
<table class= "table table-bordered">
<thead> <thead>
<th>Unique ID</th> <th style="display:none;">Unique ID</th>
<th>First Name</th> <th>First Name</th>
<th>Last Name</th> <th>Last Name</th>
<th>English Grade</th> <th>English Grade</th>
...@@ -8,23 +48,28 @@ ...@@ -8,23 +48,28 @@
<th>Science Grade</th> <th>Science Grade</th>
<th>History Grade</th> <th>History Grade</th>
<th>Average</th> <th>Average</th>
<th colspan="3">Functions</th>
</thead> </thead>
<tbody> <tbody>
<br> <br>
<% @StudentGrades.each do |g| %> <% @StudentGrades.each do |g| %>
<tr> <tr>
<td><%= g.id %></td> <td style="display:none;"><%= g.id %></td>
<td><%= g.first_name %></td> <td><%= g.first_name %></td>
<td><%= g.last_name %></td> <td><%= g.last_name %></td>
<td><%= g.english_grade %></td> <td><%= g.english_grade %></td>
<td><%= g.math_grade %></td> <td><%= g.math_grade %></td>
<td><%= g.science_grade %></td> <td><%= g.science_grade %></td>
<td><%= g.history_grade %></td> <td><%= g.history_grade %></td>
<td><button type="button" class="btn btn-success"><%= link_to 'Show', show_student_grade_path(g.id) , data: { confirm: 'Are you sure you want to show?' } %></button></td> <td><%= ((g.english_grade + g.math_grade + g.science_grade + g.history_grade)/ 4 ) %></td>
<td><button type="button" class="btn btn-success"><%= link_to 'Show', show_student_grade_path(g.id) %></button></td>
<td><button type="button" class="btn btn-warning"><%= link_to 'Edit', edit_student_grade_path(g.id) %></button></td>
<td><button type="button" class="btn btn-danger"><%= link_to 'Destroy', destroy_student_grade_path(g.id) , data: { confirm: 'Are you sure you want to delete?' } %></button></td> <td><button type="button" class="btn btn-danger"><%= link_to 'Destroy', destroy_student_grade_path(g.id) , data: { confirm: 'Are you sure you want to delete?' } %></button></td>
<td><%= link_to 'Edit', edit_student_grade_path(g.id) %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
</div>
\ No newline at end of file
<h2>Please enter student details below:</h2>
<br>
<%= render 'form' %> <%= render 'form' %>
\ No newline at end of file
...@@ -2,10 +2,33 @@ ...@@ -2,10 +2,33 @@
label { label {
font-size: 20px; font-size: 16px;
} }
line {
font-size: 16px;
}
th {
text-align: center;
}
.container{
text-align: center;
width: 50%;
}
a:link {
color: white;
}
</style> </style>
...@@ -27,20 +50,34 @@ ...@@ -27,20 +50,34 @@
</nav> </nav>
<h1>Student #<%= @StudentGrade.id %></h1>
<label>First Name: </label><%= @StudentGrade[:first_name] %>
<br><br>
<label>Last Name: </label><%= @StudentGrade[:last_name] %>
<br><br>
<label>English Grade: </label><%= @StudentGrade[:english_grade] %>
<br><br>
<label>Math Grade: </label><%= @StudentGrade[:math_grade] %>
<br><br>
<label>Science Grade: </label><%= @StudentGrade[:science_grade] %>
<br><br>
<label>History Grade: </label><%= @StudentGrade[:history_grade] %>
<br><br>
<%= link_to 'Edit', edit_student_grade_path(@StudentGrade) %> <div class="container">
<%= link_to 'Back', student_grades_path(@StudentGrade) %>
\ No newline at end of file <table class="table table-bordered">
<thead>
<tr><th><h1><%= @StudentGrade.first_name %>'s Student Information</h1></th></tr>
</thead>
<tbody>
<tr>
<td><label>First Name:</label>&nbsp;<line><%= @StudentGrade[:first_name] %></line></td></tr>
<tr><td><label>Last Name:</label>&nbsp;<line><%= @StudentGrade[:last_name] %></line></td></tr>
<tr><td><label>English Grade:</label>&nbsp;<line><%= @StudentGrade[:english_grade] %></line></td></tr>
<tr><td><label>Math Grade:</label>&nbsp;<line><%= @StudentGrade[:math_grade] %></line></td></tr>
<tr><td><label>Science Grade:</label>&nbsp;<line><%= @StudentGrade[:science_grade] %></line></td></tr>
<tr><td><label>History Grade:</label>&nbsp;<line><%= @StudentGrade[:history_grade] %></line></td></tr>
<tr><td><button type="button" class="btn btn-warning"><%= link_to 'Edit', edit_student_grade_path(@StudentGrade) %></button>
<button type="button" class="btn btn-info"><%= link_to 'Back', student_grades_path(@StudentGrade) %></button></td></tr>
</tr>
</tbody>
</table>
</div>
\ No newline at end of file
...@@ -11,9 +11,12 @@ Rails.application.routes.draw do ...@@ -11,9 +11,12 @@ Rails.application.routes.draw do
get '/home/destroy/:id', to: 'student_grades#destroy', as: :destroy_student_grade get '/home/destroy/:id', to: 'student_grades#destroy', as: :destroy_student_grade
resources :student_grades resources :student_grades
get 'student_grades/index'
root 'student_grades#index' root 'student_grades#index'
end end
class StudentGrades < ActiveRecord::Migration
def change
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160706065349) do ActiveRecord::Schema.define(version: 20160706183956) do
create_table "student_grades", force: :cascade do |t| create_table "student_grades", force: :cascade do |t|
t.string "last_name" t.string "last_name"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment