Commit 8aceeebd authored by Owen Ilagan's avatar Owen Ilagan

Update

parent 84ee7000
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
......@@ -10,6 +10,8 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require bootstrap
*= require bootstrap-theme
*= require_tree .
*= require_self
*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */
body {
padding-bottom: 40px;
color: #5a5a5a;
}
/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */
/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 20;
}
/* Flip around the padding for proper display in narrow viewports */
.navbar-wrapper > .container {
padding-right: 0;
padding-left: 0;
}
.navbar-wrapper .navbar {
padding-right: 15px;
padding-left: 15px;
}
.navbar-wrapper .navbar .container {
width: auto;
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* Carousel base class */
.carousel {
height: 500px;
margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
z-index: 10;
}
/* Declare heights because of positioning of img element */
.carousel .item {
height: 500px;
background-color: #777;
}
.carousel-inner > .item > img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
/* MARKETING CONTENT
-------------------------------------------------- */
/* Center align the text within the three columns below the carousel */
.marketing .col-lg-4 {
margin-bottom: 20px;
text-align: center;
}
.marketing h2 {
font-weight: normal;
}
.marketing .col-lg-4 p {
margin-right: 10px;
margin-left: 10px;
}
/* Featurettes
------------------------- */
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
/* Thin out the marketing headings */
.featurette-heading {
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
-------------------------------------------------- */
@media (min-width: 768px) {
/* Navbar positioning foo */
.navbar-wrapper {
margin-top: 20px;
}
.navbar-wrapper .container {
padding-right: 15px;
padding-left: 15px;
}
.navbar-wrapper .navbar {
padding-right: 0;
padding-left: 0;
}
/* The navbar becomes detached from the top, so we round the corners */
.navbar-wrapper .navbar {
border-radius: 4px;
}
/* Bump up size of carousel content */
.carousel-caption p {
margin-bottom: 20px;
font-size: 21px;
line-height: 1.4;
}
.featurette-heading {
font-size: 50px;
}
}
@media (min-width: 992px) {
.featurette-heading {
margin-top: 120px;
}
}
// Place all the styles related to the welcome controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class WelcomeController < ApplicationController
@@rnd = Random.new
def index
@students = getStudents
end
def random
is_post = params[:is_post]
if !is_post.nil? && is_post == 'Yes'
length = getStudents.size
@name = getStudents[@@rnd.rand(length)][1]
end
end
def signin
email = params[:inputEmail]
password = params[:inputPassword]
if !email.nil? && !password.nil?
@error = 'yes'
end
end
def quiz
@score = params[:score]
if @score.nil? || @score.empty?
@score = '0'
end
@question = params[:question]
if !@question.nil?
if @question.empty?
@question = '0'
end
if @question.to_i > 0
correct_answer = getQuestions[@question.to_i-1][1]
@answer = params[:answer]
if !@answer.nil? && @answer.to_i == correct_answer
@score = (@score.to_i + 1).to_s
end
end
length = getQuestions.size
if @question.to_i == length
@question_text = 'End of the quiz. You scored ' + @score + ' out of ' + length.to_s
@question = '0'
@score = nil
else
@question_text = getQuestions[@question.to_i][0]
@answers = getQuestions[@question.to_i][2]
@question = (@question.to_i + 1).to_s
end
else
@question = ''
end
end
private
def getStudents
return [
['140036','ABRIGO, ANGELU BIANCA CO','3 BS MIS'],
['145028','ANGELO, APRIL HANN PINILI','3 BS MIS'],
['140261','ARAOS, MARY GABRIELLE MYCEL RAMOS','3 BSMIS-MSCS'],
['140347','BACOY, JEREMIAH NOGRA','3 BS MIS'],
['140485','BEASCA, JOHN LORENZ MARTIN','3 BS MIS'],
['140709','CANALES, MOULDER VON LUCAS','3 BS MIS'],
['140737','CARBALLO, JAMES DAVID BRADLY RUEDA','3 BS MIS'],
['140906','CHUA, ELDRIC BRICE ONG','3 BS MIS'],
['131205','DE GUZMAN, JOSE GAVINO TAMAYO','4 BSM AMF'],
['141392','DUMALIANG, DONNA LIZA GUEVARA','3 BS MIS'],
['131547','EVARISTO, RAYMOND MICHAEL PONAYO','4 BS COMTECH'],
['132397','LOPEZ, JAIME LORENZO JOAQUIN RIVERA','4 BS MIS'],
['142637','MAÑOSCA, JOHN REINER GUTIERREZ','3 BS MIS'],
['142649','MEJIA, CZAR EMMANUEL RAÑOLA','3 BS MIS'],
['142708','MIRALLES, MA. JOHANNAH PAULA ISIP','3 BS MIS'],
['142991','PABALAN, JOSHUA MANALOTO','3 BS MIS'],
['143155','PILARCA, NEICY MARIE FERNANDO','3 BS MIS'],
['133300','PUALENGCO, CARL JOSH SAN LUIS','4 BS ME'],
['143617','SANTOS, JAMIE LEE LOUIS LAIGO','3 BS MIS'],
['145246','URQUICO, JOHN LORENZ RODRILLO','3 BS MIS'],
['144236','VANTA, ANFERNY JOHN BESIN','3 BS MIS'],
['145262','VERDEY, JOSHUA VINCENT JOHN SICAM','3 BS MIS'],
['144287','VIALU, NINNA PATRICIA LINGATONG','3 BS MIS']
]
end
def getQuestions
return [
['What makes the color of the sky during sunset dusk reddish?',
0,
['Dust',
'The Rainbow Effect',
'Northern Lights',
'Gravity']],
['How do fish breathe underwater?',
1,
['Hold their breath',
'Gills extract oxygen from water',
'They make their own oxygen',
'Aliens made them that way']],
['Next line in a song: "Why do birds suddenly appear..."',
2,
['"when you come over here?"',
'"at dawn this time of year?"',
'"every time you are near?"',
'"after you drink rootbeer?"']]
]
end
end
module WelcomeHelper
end
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MIS21</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">List of Students</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/random">Random Name</a></li>
<li><a href="/signin">Sign In</a></li>
<li><a href="/quiz">Take a Quiz</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div style="padding-bottom: 50px;"></div>
<%= yield %>
</body>
</html>
<div class="container">
<div class="page-header">
<h1>List of Students</h1>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th>ID No</th>
<th>Name</th>
<th>Year/Course</th>
</tr>
</thead>
<tbody>
<%@students.each do |item|%>
<tr>
<td><%=item[0]%></td>
<td><%=item[1]%></td>
<td><%=item[2]%></td>
</tr>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
<div class="jumbotron">
<div class="container">
<h1>Take a Quiz!</h1>
<% if @question.empty? %>
<p>Test your general knowledge! Click START to begin the quiz.</p>
<% else %>
<%if @question == '0'%>
<h2><%=@question_text%></h2>
<% else %>
<h2>Question #<%=@question%></h2>
<p><%=@question_text%></p>
<% end %>
<% end %>
<p>
<%= form_tag("/quiz", method: "post") do %>
<%= hidden_field( nil, :question, value: @question)%>
<%= hidden_field( nil, :score, value: @score)%>
<% if @question.empty? %>
<input class="btn btn-primary btn-lg" type="submit" value="Start »"></input>
<% else %>
<%if @question != '0'%>
<ul class="list-group">
<% @answers.each_with_index do |item, index| %>
<li class="list-group-item">
<%= radio_button_tag(:answer, index.to_s) %>
<%= label_tag(:question_text, item) %>
</li>
<% end %>
</ul>
<% end %>
<%if @question == '0'%>
<input class="btn btn-primary btn-lg" type="submit" value="Try Again »"></input>
<% else %>
<input class="btn btn-primary btn-lg" type="submit" value="Answer »"></input>
<% end %>
<% end %>
<% end %>
</p>
</div>
</div>
\ No newline at end of file
<div class="jumbotron">
<div class="container">
<h1>Generate a Random Name!</h1>
<p>Click the button below to generate a completely random name! Any similarities to persons either living or deceased is purely coincidental.</p>
<p>
<%= form_tag("/random", method: "post") do %>
<%= hidden_field( nil, :is_post, value: 'Yes')%>
<input class="btn btn-primary btn-lg" type="submit" value="Click Me »"></input>
<% end %>
</p>
</div>
</div>
<div class="container">
<% if !@name.nil? %>
<h3>I am <%=@name%></h3>
<% end %>
</div>
<div class="container">
<div class="page-header">
<h1>Sign In</h1>
</div>
<% if !@error.nil? %>
<div class="row">
<div class="col-md-6">
<div class="alert alert-danger" role="alert">
<strong>Invalid email/password</strong> Change a few things up and try again.
</div>
</div>
</div>
<% end %>
<div class="row">
<div class="col-md-4">
<%= form_tag("/signin", method: "post", class: 'form-signin') do %>
<h2 class="form-signin-heading">Please sign in</h2>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" name="inputEmail" id="inputEmail" class="form-control" placeholder="Email address">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Password">
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<input class="btn btn-lg btn-primary btn-block" type="submit" value="Sign in"></input>
<% end %>
</div>
</div>
</div>
......@@ -3,10 +3,15 @@ Rails.application.routes.draw do
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
get 'signin' => 'welcome#signin'
post 'signin' => 'welcome#signin'
get 'random' => 'welcome#random'
post 'random' => 'welcome#random'
get 'quiz' => 'welcome#quiz'
post 'quiz' => 'welcome#quiz'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
......
require 'test_helper'
class WelcomeControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
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