From 11710bfb68ffbd21b9cfb3b1e371e4d245621c88 Mon Sep 17 00:00:00 2001 From: maddiebaka Date: Sun, 22 Oct 2023 15:03:45 -0400 Subject: [PATCH] Add bootstrap and main application template --- Gemfile | 2 + Gemfile.lock | 18 +++++++++ .../{application.css => application.scss} | 2 + app/views/dictionary/index.html.erb | 3 -- app/views/layouts/application.html.erb | 37 +++++++++++++------ spec/requests/root_spec.rb | 5 +++ 6 files changed, 53 insertions(+), 14 deletions(-) rename app/assets/stylesheets/{application.css => application.scss} (97%) diff --git a/Gemfile b/Gemfile index a0876a1..eaa60ad 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,8 @@ ruby "3.2.2" gem "devise" gem "http" +gem "bootstrap" +#gem "dartsass-sprockets" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 7.1.1" diff --git a/Gemfile.lock b/Gemfile.lock index 4bc781b..e249ea6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,12 +76,18 @@ GEM tzinfo (~> 2.0) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) + autoprefixer-rails (10.4.15.0) + execjs (~> 2) base64 (0.1.1) bcrypt (3.1.19) bigdecimal (3.1.4) bindex (0.8.1) bootsnap (1.16.0) msgpack (~> 1.2) + bootstrap (5.3.1) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 2.11.8, < 3) + sassc-rails (>= 2.0.0) builder (3.2.4) capybara (3.39.2) addressable @@ -111,6 +117,7 @@ GEM drb (2.1.1) ruby2_keywords erubi (1.12.0) + execjs (2.9.1) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) @@ -176,6 +183,7 @@ GEM nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) + popper_js (2.11.8) psych (5.1.1) stringio public_suffix (5.0.3) @@ -250,6 +258,14 @@ GEM rspec-support (~> 3.12) rspec-support (3.12.1) ruby2_keywords (0.0.5) + 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 sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -264,6 +280,7 @@ GEM railties (>= 6.0.0) stringio (3.0.8) thor (1.2.2) + tilt (2.3.0) timeout (0.4.0) turbo-rails (1.5.0) actionpack (>= 6.0.0) @@ -296,6 +313,7 @@ PLATFORMS DEPENDENCIES bootsnap + bootstrap capybara debug devise diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss similarity index 97% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index 288b9ab..6ff3a50 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ + +@import "bootstrap"; diff --git a/app/views/dictionary/index.html.erb b/app/views/dictionary/index.html.erb index 9210983..72ff185 100644 --- a/app/views/dictionary/index.html.erb +++ b/app/views/dictionary/index.html.erb @@ -1,6 +1,3 @@ -
-
- <%= sanitize alphabetical_links, tags: ["a"] %>

<%= @parts_of_speech.count %> parts of speech entries in database

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 328b654..2612ff8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,16 +11,31 @@ -

<%= notice %>

-

<%= alert %>

-
- <% if user_signed_in? %> -

Welcome <%= current_user.username %>

- <%= link_to "Sign Out", destroy_user_session_path, data: { turbo_method: :delete } %> - <% else %> - <%= link_to "Sign In", new_user_session_path %> - <%= link_to "Register", new_user_registration_path %> - <% end %> - <%= yield %> +
+
+
+ <%= link_to "Dictionary", dictionary_index_path %> +
+
+ <% if user_signed_in? %> +

Welcome <%= current_user.username %>

+ <%= link_to "Sign Out", destroy_user_session_path, data: { turbo_method: :delete } %> + <% else %> + <%= link_to "Sign In", new_user_session_path %> +
|
+ <%= link_to "Register", new_user_registration_path %> + <% end %> +
+
+
+
+
+
+

<%= notice %>

+

<%= alert %>

+ <%= yield %> +
+
+
diff --git a/spec/requests/root_spec.rb b/spec/requests/root_spec.rb index 88bebfa..a6dee99 100644 --- a/spec/requests/root_spec.rb +++ b/spec/requests/root_spec.rb @@ -6,6 +6,11 @@ RSpec.describe "Root path", type: :request do get root_path expect(response).to have_http_status(200) end + + it "should have a link to the dictionary" do + get root_path + expect(response.body).to have_selector(%(a[href="#{dictionary_index_path}"])) + end end describe "logged out" do