Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic edits to clean code #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

require 'nokogiri'
require 'open-uri'

end
1 change: 0 additions & 1 deletion app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class WelcomeController < ApplicationController

def index
@group = Welcome.new.sort
end
Expand Down
3 changes: 1 addition & 2 deletions app/models/welcome.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Welcome

def initialize
@urls =["https://github.com/bad6e",
"https://github.com/roseak",
Expand Down Expand Up @@ -43,4 +42,4 @@ def get_count
def open_url(url)
Nokogiri::HTML(open(url))
end
end
end
142 changes: 70 additions & 72 deletions app/views/welcome/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,92 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>1507 Git Commit Race</title>

<title>1507 Git Commit Race</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<style>
body {
padding-top: 70px;
/* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
}
</style>

<!-- Custom CSS -->
<style>
body {
padding-top: 70px;
/* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

</head>
<body>

<body>

<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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="#">1507 Git Commit</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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="#">1507 Git Commit</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h1>1507 Git Commit Race</h1>
<p class="lead">Compete with the best - who will have the most commits when Turing is over?</p>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h1>1507 Git Commit Race</h1>
<p class="lead">Compete with the best - who will have the most commits when Turing is over?</p>
</div>
</div>
</div>
</div>
</div>

<div class="container">
<div class="row well">
<div class="col-md-offset-4 col-md-4 ">
<h3 id="leaderboard">Leaderboard</h3>
<table class="table">
<tr>
<td>Place</td>
<td>Name</td>
</tr>
<tr>
<div class="container">
<div class="row well">
<div class="col-md-offset-4 col-md-4 ">
<h3 id="leaderboard">Leaderboard</h3>
<table class="table">
<tr>
<th>Place</th>
<th>Name</th>
</tr>
<% n = 0 %>
<% @group.each do |css| %>
<td><%= n = n + 1 %></td>
<td><%= css.join("- ") %> commits</td>
</tr>
<% end %>
<table>
<tr>
<td><%= n = n + 1 %></td>
<td><%= css.join("- ") %> commits</td>
</tr>
<% end %>
<table>
</div>
</div>
</div>
</div>
</body>

</body>
</html>