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

Refactor layouts #323

Merged
merged 1 commit into from
Apr 2, 2015
Merged
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/assets/stylesheets/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
line-height: 1;
margin: 10px auto;
}
.buffer {
margin: 30px auto;
}
h2 {
margin: 0 auto 20px 0;
}
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
class PagesController < ApplicationController

layout 'home'

def index
@repos = Repo.repos_needing_help_for_user(current_user)
@repos_subs = current_user.repo_subscriptions.page(params[:page]||1).per_page(params[:per_page]||50) if user_signed_in?
end

end
8 changes: 8 additions & 0 deletions app/views/application/_flashes.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% [:notice, :error, :alert, :success].each do |level| %>
<% unless flash[level].blank? %>
<div class='alert alert-block <%="alert-#{level}" %>'>
<a class="close" data-dismiss="alert" href="#">&times;</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
22 changes: 22 additions & 0 deletions app/views/application/_head.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<head>
<meta charset="utf-8">
<title>Code Triage</title>

<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= csrf_meta_tags %>

<%= stylesheet_link_tag "application", media: "all" %>

<script src="http://heroku.github.com/template-app-bootstrap/jquery-1.7.1.min.js"></script>
<script src="http://heroku.github.com/template-app-bootstrap/jquery.replacetext.min.js"></script>
<%= javascript_include_tag "application" %>

<!--
IMPORTANT:
This is Heroku specific styling. Remove to customize.
-->
<link href="http://heroku.github.com/template-app-bootstrap/heroku.css" rel="stylesheet">
<!-- /// -->

</head>
14 changes: 14 additions & 0 deletions app/views/application/_nav.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="masthead">
<ul class="nav nav-pills pull-right">
<%- if user_signed_in? -%>
<li><%= image_tag current_user.avatar_url, class: 'img-rounded', height: 30, width: 30 %></li>
<li><%= link_to "Home", root_path %></li>
<li><%= link_to current_user.github, current_user %></li>
<li><%= link_to "Sign Out", destroy_user_session_path, method: :delete %></li>
<%- else -%>
<li><%= link_to "Home", root_path %></li>
<li class="active"><%= link_to 'Sign in', new_user_registration_path %></li>
<%- end -%>
</ul>
<h3 class="muted"><%= link_to "CodeTriage", root_path %></h3>
</div>
28 changes: 0 additions & 28 deletions app/views/layouts/_footer.html.erb

This file was deleted.

55 changes: 0 additions & 55 deletions app/views/layouts/_head.html.erb

This file was deleted.

41 changes: 37 additions & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
<%= render 'layouts/head' %>
<div class="row-fluid marketing buffer">
<%= yield %>
<!doctype html>
<html>
<%= render "head" %>
<body>
<a class="hidden-xs" href="https://github.com/codetriage/codetriage"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div class="container-narrow">

<div class="row-fluid">
<%= render "nav" %>
<%= render "flashes" %>
<%= yield %>
</div>

<div class="footer">
<p><a href="/" class="brand" id="heroku">by <strong>heroku</strong></a></p>
</div>

</div>
<%= render 'layouts/footer' %>

<%= yield :js %>

<% if Rails.env.production? %>
<!-- google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2989055-1']);
_gaq.push(['_setDomainName', '.heroku.com']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<% end -%>
</body>
</html>
20 changes: 0 additions & 20 deletions app/views/layouts/home.html.erb

This file was deleted.

13 changes: 13 additions & 0 deletions app/views/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<% unless user_signed_in? %>
<div class="jumbotron">
<h1>Help your favorite open source projects</h1>
<p class="lead">Sign up to receive a different open issue in your inbox every day from your favorite GitHub repos</p>
<a class="btn btn-large btn-success" href="<%= new_user_registration_path %>">Sign up today</a>
</div>

<div class="jumbotron">
<h2></h2>
<p class="lead"><%= number_with_delimiter(User.count, delimiter: ',') %> developers are working on <%= Repo.count %> open source repos</p>
</div>
<% end -%>

<hr />

<% if @repos_subs.present? %>
Expand Down
1 change: 0 additions & 1 deletion test/functional/pages_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class PagesControllerTest < ActionController::TestCase
assert_not_nil assigns(:repos), 'assigns to repos'
assert_not_nil assigns(:repos_subs), 'assigns to repos_subs'
assert_template :index, 'render index template'
assert_template({layout: 'home'}, 'render home layout')
end

test "not signed in user" do
Expand Down