Skip to content

Commit

Permalink
Merge pull request #2 from drskinner/TCS-0125
Browse files Browse the repository at this point in the history
Add Bootstrap and layouts
  • Loading branch information
Myles Skinner committed Feb 27, 2019
2 parents 7cc8eff + 3bd50fa commit 7bdd6e5
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

gem 'bootstrap', '~> 4.0.0'
gem 'jquery-rails'

# Authentication and Authorization
gem 'devise'

Expand Down
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ GEM
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (9.0.0)
autoprefixer-rails (9.4.9)
execjs
bcrypt (3.1.12)
bindex (0.5.0)
bootsnap (1.4.0)
msgpack (~> 1.0)
bootstrap (4.0.0)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.9, < 2)
sass (>= 3.5.2)
builder (3.2.3)
byebug (11.0.0)
capybara (3.13.2)
Expand Down Expand Up @@ -92,6 +98,10 @@ GEM
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand All @@ -115,6 +125,7 @@ GEM
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pg (1.1.4)
popper_js (1.14.5)
public_suffix (3.0.3)
puma (3.12.0)
rack (2.0.6)
Expand Down Expand Up @@ -208,12 +219,14 @@ PLATFORMS

DEPENDENCIES
bootsnap (>= 1.1.0)
bootstrap (~> 4.0.0)
byebug
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
devise
jbuilder (~> 2.5)
jquery-rails
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
puma (~> 3.11)
Expand Down
Binary file added app/assets/images/mudlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
//= require activestorage
//= require turbolinks
//= require_tree .

//= require jquery3
//= require popper
//= require bootstrap

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/

@import 'bootstrap';
@import 'layout';
26 changes: 26 additions & 0 deletions app/assets/stylesheets/layout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
div#welcome {
text-align: right;
padding-top: 15px;
}

.alert-error, .alert-alert {
background-color: #f2dede;
border-color: #ebccd1;
color: #a94442;
}

.alert-notice {
background-color: #fcf8e3;
border-color: #faf2cc;
color: #8a6d3b;
}

footer {
background: #585858;
color: white;
height: auto;
margin-top: 20px;
padding: 10px 20px 10px 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ class User < ApplicationRecord
def set_default_role
self.role_id = Role.find_by(name: 'guest').id if self.new_record?
end

def name_display
last_name.blank? ? first_name : "#{first_name} #{last_name}"
end
end
2 changes: 1 addition & 1 deletion app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<h2>Edit <%= resource_name.to_s.humanize %></h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
Expand Down
43 changes: 33 additions & 10 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>TierceronConstructionSet</title>
<title>Tierceron Construction Set</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -10,15 +10,38 @@
</head>

<body>
<% if user_signed_in? %>
Welcome, <strong><%= current_user.first_name %> (<%= current_user.email %>)</strong>!<br />
<%= link_to 'Edit profile', edit_user_registration_path, class: 'navbar-link' %> |
<%= link_to "Logout", destroy_user_session_path, method: :delete, class: 'navbar-link' %>
<% end %>
<div class="container">
<header class="row">
<div id="mudlogo" class="col-md-8">
<%= image_tag('mudlogo.png', class: 'img-fluid', alt: 'Covenant MUD') %>
</div>
<div id="welcome" class="col-md-4">
<% if user_signed_in? %>
Welcome, <b><%= current_user.name_display %> (<%= current_user.email %>)</b>!<br>
<%= link_to 'Edit profile', edit_user_registration_path, class: 'navbar-link' %> |
<%= link_to "Logout", destroy_user_session_path, method: :delete, class: 'navbar-link' %>
<% end %>
</div>
</header>

<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<%= yield %>
<% if user_signed_in? %>
<nav id="top-nav" class="row">
Navigation Goes Here
</nav>
<% end %>

<!-- breadcrumbs and actions -->

<section id="main-content" class="row">
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %> w-100"><%= value %></div>
<% end %>
<%= yield %>
</section>

<footer class="row">
<span>Covenant MUD Building Tools Copyright &copy; <%= Time.now.year %> Myles L. Skinner&mdash;All Rights Reserved.</span>
</footer>
</div>
</body>
</html>

0 comments on commit 7bdd6e5

Please sign in to comment.