added bootstrap to project and changed notifications to layout

This commit is contained in:
Aaro Koivukangas
2023-12-14 15:23:31 +02:00
parent 2dceeb4d61
commit be89f46335
19 changed files with 112 additions and 54 deletions
+4
View File
@@ -52,6 +52,10 @@ gem "bootsnap", require: false
# used to make http requests # used to make http requests
gem 'httparty' gem 'httparty'
gem 'bootstrap', '~> 5.2.0'
gem 'jquery-rails'
gem 'mini_racer'
group :development, :test do group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ] gem "debug", platforms: %i[ mri mingw x64_mingw ]
+28
View File
@@ -69,10 +69,16 @@ GEM
addressable (2.8.5) addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2) ast (2.4.2)
autoprefixer-rails (10.4.16.0)
execjs (~> 2)
bcrypt (3.1.19) bcrypt (3.1.19)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.17.0) bootsnap (1.17.0)
msgpack (~> 1.2) msgpack (~> 1.2)
bootstrap (5.2.3)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 2.11.6, < 3)
sassc-rails (>= 2.0.0)
builder (3.2.4) builder (3.2.4)
byebug (11.1.3) byebug (11.1.3)
capybara (3.39.2) capybara (3.39.2)
@@ -98,11 +104,13 @@ GEM
dockerfile-rails (1.5.12) dockerfile-rails (1.5.12)
rails (>= 3.0.0) rails (>= 3.0.0)
erubi (1.12.0) erubi (1.12.0)
execjs (2.9.1)
factory_bot (6.2.1) factory_bot (6.2.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.2.0) factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0) factory_bot (~> 6.2.0)
railties (>= 5.0.0) railties (>= 5.0.0)
ffi (1.16.3)
globalid (1.2.1) globalid (1.2.1)
activesupport (>= 6.1) activesupport (>= 6.1)
hashdiff (1.0.1) hashdiff (1.0.1)
@@ -122,10 +130,15 @@ GEM
jbuilder (2.11.5) jbuilder (2.11.5)
actionview (>= 5.0.0) actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.6.3) json (2.6.3)
language_server-protocol (3.17.0.3) language_server-protocol (3.17.0.3)
launchy (2.5.2) launchy (2.5.2)
addressable (~> 2.8) addressable (~> 2.8)
libv8-node (18.16.0.0-x86_64-linux)
loofah (2.21.4) loofah (2.21.4)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
@@ -138,6 +151,8 @@ GEM
matrix (0.4.2) matrix (0.4.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.5) mini_mime (1.1.5)
mini_racer (0.8.0)
libv8-node (~> 18.16.0.0)
minitest (5.20.0) minitest (5.20.0)
msgpack (1.7.2) msgpack (1.7.2)
multi_xml (0.6.0) multi_xml (0.6.0)
@@ -158,6 +173,7 @@ GEM
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
pg (1.5.4) pg (1.5.4)
popper_js (2.11.8)
pry (0.14.2) pry (0.14.2)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
@@ -241,6 +257,14 @@ GEM
parser (>= 3.2.1.0) parser (>= 3.2.1.0)
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
rubyzip (2.3.2) rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (4.10.0) selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0) rubyzip (>= 1.2.2, < 3.0)
@@ -268,6 +292,7 @@ GEM
railties (>= 6.0.0) railties (>= 6.0.0)
stringio (3.0.9) stringio (3.0.9)
thor (1.3.0) thor (1.3.0)
tilt (2.3.0)
timeout (0.4.1) timeout (0.4.1)
turbo-rails (1.5.0) turbo-rails (1.5.0)
actionpack (>= 6.0.0) actionpack (>= 6.0.0)
@@ -303,6 +328,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
bcrypt (~> 3.1.7) bcrypt (~> 3.1.7)
bootsnap bootsnap
bootstrap (~> 5.2.0)
capybara capybara
debug debug
dockerfile-rails (>= 1.5) dockerfile-rails (>= 1.5)
@@ -310,7 +336,9 @@ DEPENDENCIES
httparty httparty
importmap-rails importmap-rails
jbuilder jbuilder
jquery-rails
launchy launchy
mini_racer
pg pg
pry-byebug pry-byebug
puma (~> 5.0) puma (~> 5.0)
@@ -13,3 +13,4 @@
*= require_tree . *= require_tree .
*= require_self *= require_self
*/ */
@import "bootstrap";
+3
View File
@@ -1,3 +1,6 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
//= require jquery3
//= require popper
//= require bootstrap-sprockets
import "@hotwired/turbo-rails" import "@hotwired/turbo-rails"
import "controllers" import "controllers"
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Beerclubs</h1> <h1>Beerclubs</h1>
<div id="beerclubs"> <div id="beerclubs">
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<%= render @beerclub %> <%= render @beerclub %>
<div> <div>
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Beers</h1> <h1>Beers</h1>
<div id="beers"> <div id="beers">
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<%= render @beer %> <%= render @beer %>
<div> <div>
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Breweries</h1> <h1>Breweries</h1>
<div id="breweries"> <div id="breweries">
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<%= render @brewery %> <%= render @brewery %>
<div> <div>
+76 -27
View File
@@ -11,32 +11,81 @@
</head> </head>
<body> <body>
<p> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<%= link_to "breweries", breweries_path %> <div class="container-fluid">
<%= link_to "beers", beers_path %> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<%= link_to "ratings", ratings_path %> <span class="navbar-toggler-icon"></span>
<%= link_to "users", users_path %> </button>
<%= link_to "clubs", beerclubs_path %> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<%= link_to "places", places_path %> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<%= link_to "styles", styles_path %> <li class="nav-item">
| <%= link_to 'breweries', breweries_path, { class: "nav-link" } %>
<% if current_user.nil? %> </li>
<%= link_to "Sign up", new_user_path %> <li class="nav-item">
<%= link_to "Sign in", new_session_path %> <%= link_to 'beers', beers_path , { class: "nav-link" } %>
<% else %> </li>
<%= link_to current_user.username, user_path(current_user.id) %> <li class="nav-item">
<%= link_to "Rate a new beer", new_rating_path %> <%= link_to 'ratings', ratings_path , { class: "nav-link" } %>
<%= link_to "Join a beer club", new_membership_path %> </li>
<%= link_to "signout", signout_path, data: { "turbo-method": :delete } %> <li class="nav-item">
<% end %> <%= link_to 'users', users_path , { class: "nav-link" } %>
</p> </li>
<%= yield %> <li class="nav-item">
<% if false %> <%= link_to 'clubs', beerclubs_path , { class: "nav-link" } %>
<% if session[:last_rating].nil? %> </li>
<p>no ratings given</p> <li class="nav-item">
<% else %> <%= link_to 'places', places_path, { class: "nav-link" } %>
<p>previous rating: <%= session[:last_rating] %></p> </li>
<% end %> <li class="nav-item">
<% end %> <%= link_to 'styles', styles_path , { class: "nav-link" } %>
</li>
|
<% if current_user %>
<li class="nav-item">
<%= link_to "#{current_user.username}", current_user , { class: "nav-link" } %>
</li>
<li class="nav-item">
<%= link_to "Rate a beer", new_rating_path , { class: "nav-link" } %>
</li>
<li class="nav-item">
<%= link_to "Join a club", new_membership_path , { class: "nav-link" } %>
</li>
<li class="nav-item">
<%= link_to "Sign out", signout_path, class: "nav-link", data: {turbo_method: :delete} %>
</li>
<% else %>
<li class="nav-item">
<%= link_to "Sign up", signup_path , { class: "nav-link" } %>
</li>
<li class="nav-item">
<%= link_to "Sign in", signin_path , { class: "nav-link" } %>
</li>
<% end %>
</ul>
</div>
</div>
</nav>
<div class="container">
<% if notice %>
<div class="alert alert-primary" role="alert">
<%= notice %>
</div>
<% end %>
<div class="row">
<div class="col-sm-8">
<%= yield %>
</div>
<div class="col-sm-4">
<img
src="http://www.cs.helsinki.fi/u/mluukkai/wadror/pint.jpg"
width="200"
style="padding-top:30px"
>
</div>
</div>
</div>
</body> </body>
</html> </html>
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Memberships</h1> <h1>Memberships</h1>
<div id="memberships"> <div id="memberships">
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<%= render @membership %> <%= render @membership %>
<div> <div>
-2
View File
@@ -5,8 +5,6 @@
<%= form.submit "Search" %> <%= form.submit "Search" %>
<% end %> <% end %>
<%= notice %>
<% if @weather %> <% if @weather %>
<div> <div>
<strong> <strong>
-2
View File
@@ -1,7 +1,5 @@
<h1>Sign in</h1> <h1>Sign in</h1>
<p style="color: red"><%= notice %></p>
<%= form_with url: session_path, method: :post do |form| %> <%= form_with url: session_path, method: :post do |form| %>
<div> <div>
<%= form.label :username, style: "display: block" %> <%= form.label :username, style: "display: block" %>
-1
View File
@@ -1,6 +1,5 @@
<h1>Styles</h1> <h1>Styles</h1>
<%= notice %>
<% if @styles %> <% if @styles %>
<% @styles.each do |style|%> <% @styles.each do |style|%>
<%= render style %> <%= render style %>
-2
View File
@@ -1,5 +1,3 @@
<%= notice %>
<%= render @style%> <%= render @style%>
<div> <div>
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Users</h1> <h1>Users</h1>
<div id="users"> <div id="users">
-2
View File
@@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<div> <div>
<p> <p>
<strong>Username:</strong> <strong>Username:</strong>