From 32f9b2ab1fde4a01b73cd86fdbf2acf44de50596 Mon Sep 17 00:00:00 2001 From: aksafan Date: Tue, 7 Jan 2025 00:13:58 -0600 Subject: [PATCH 1/2] Get rid of Bootstrap --- Gemfile | 1 - Gemfile.lock | 8 -- README.md | 8 +- app/assets/stylesheets/application.scss | 1 - .../stylesheets/application.tailwind.css | 44 ++++++++++ app/controllers/lab_tests_controller.rb | 1 - app/javascript/application.js | 2 - app/views/admin/users/_form.html.erb | 15 ++-- .../admin/users/_index_table_body.html.erb | 16 ++-- .../admin/users/_index_table_head.html.erb | 16 ++-- app/views/admin/users/_user.html.erb | 18 ++-- app/views/admin/users/edit.html.erb | 14 ++- .../admin/users/edit_assigned_users.html.erb | 29 +++--- app/views/admin/users/edit_roles.html.erb | 29 +++--- app/views/admin/users/index.html.erb | 8 +- app/views/admin/users/show.html.erb | 26 ++++-- app/views/biomarkers/_biomarker.html.erb | 12 +-- .../_detail_view_biomarker.html.erb | 12 +-- app/views/biomarkers/_form.html.erb | 15 ++-- app/views/biomarkers/edit.html.erb | 20 ++++- app/views/biomarkers/index.html.erb | 22 ++--- app/views/biomarkers/new.html.erb | 8 +- app/views/biomarkers/show.html.erb | 14 ++- app/views/devise/confirmations/new.html.erb | 14 +-- app/views/devise/passwords/edit.html.erb | 22 ++--- app/views/devise/passwords/new.html.erb | 14 +-- app/views/devise/registrations/edit.html.erb | 57 ++++++------ app/views/devise/registrations/new.html.erb | 40 ++++----- app/views/devise/sessions/new.html.erb | 26 +++--- .../devise/shared/_error_messages.html.erb | 11 ++- app/views/devise/unlocks/new.html.erb | 16 ++-- .../_detail_view_lab_tests.html.erb | 6 +- .../_detail_view_measurements.html.erb | 6 +- app/views/health_records/_form.html.erb | 15 ++-- .../health_records/_health_record.html.erb | 14 +-- app/views/health_records/edit.html.erb | 14 ++- app/views/health_records/index.html.erb | 24 ++--- app/views/health_records/new.html.erb | 8 +- app/views/health_records/show.html.erb | 28 +++--- app/views/home/index.html.erb | 38 +++++++- app/views/lab_tests/_form.html.erb | 10 +-- app/views/lab_tests/_index_table.html.erb | 4 +- .../lab_tests/_index_table_body.html.erb | 14 +-- .../lab_tests/_index_table_head.html.erb | 8 +- app/views/lab_tests/_lab_test.html.erb | 16 ++-- app/views/lab_tests/edit.html.erb | 14 ++- app/views/lab_tests/index.html.erb | 6 +- app/views/lab_tests/new.html.erb | 70 +++++++-------- app/views/lab_tests/show.html.erb | 14 ++- app/views/layouts/_error_flash.html.erb | 17 ++++ app/views/layouts/_flash.html.erb | 8 +- app/views/layouts/_navbar.html.erb | 88 ++++++++----------- app/views/layouts/application.html.erb | 4 +- .../_detail_view_measurement.html.erb | 20 ++--- app/views/measurements/_form.html.erb | 15 ++-- app/views/measurements/_measurement.html.erb | 18 ++-- app/views/measurements/edit.html.erb | 14 ++- app/views/measurements/index.html.erb | 28 +++--- app/views/measurements/new.html.erb | 9 +- app/views/measurements/show.html.erb | 14 ++- app/views/reference_ranges/_form.html.erb | 15 ++-- app/views/reference_ranges/edit.html.erb | 14 ++- app/views/reference_ranges/index.html.erb | 8 +- app/views/reference_ranges/new.html.erb | 8 +- app/views/reference_ranges/show.html.erb | 14 ++- config/importmap.rb | 2 - config/initializers/assets.rb | 1 - config/tailwind.config.js | 1 - 68 files changed, 658 insertions(+), 488 deletions(-) create mode 100644 app/views/layouts/_error_flash.html.erb diff --git a/Gemfile b/Gemfile index e23b1de..ffeb943 100644 --- a/Gemfile +++ b/Gemfile @@ -57,7 +57,6 @@ gem 'rolify' gem 'email_validator' # Styling -gem 'bootstrap' gem 'sassc', '~> 2.4' gem 'sassc-rails', '~> 2.1.2' gem 'tailwindcss-rails', '~> 3.1' diff --git a/Gemfile.lock b/Gemfile.lock index 4516e92..e9e3c79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,8 +81,6 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) - autoprefixer-rails (10.4.19.0) - execjs (~> 2) base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) @@ -90,9 +88,6 @@ GEM bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) - bootstrap (5.3.3) - autoprefixer-rails (>= 9.1.0) - popper_js (>= 2.11.8, < 3) builder (3.3.0) capybara (3.40.0) addressable @@ -125,7 +120,6 @@ GEM email_validator (2.2.4) activemodel erubi (1.13.0) - execjs (2.10.0) factory_bot (6.5.0) activesupport (>= 5.0.0) factory_bot_rails (6.4.4) @@ -201,7 +195,6 @@ GEM ast (~> 2.4.1) racc pg (1.5.9) - popper_js (2.11.8) psych (5.2.1) date stringio @@ -386,7 +379,6 @@ DEPENDENCIES actionpack (>= 7.1.5.1) actiontext (>= 7.1.4.1) bootsnap - bootstrap capybara debug devise diff --git a/README.md b/README.md index f337e3c..a5fe4d6 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,6 @@ The most efficient way to set up dev env is to utilize [docker and docker compos ### Legacy approach with manual installation Also, there is an old less efficient way to set up everything by [manually installing all dependencies](docs/ManualInstallation.md). -### Bootstrap and TailwindCSS -As we have both Bootstrap and TailwindCSS installed inside the project we need to split them somehow. -> Thus, to utilize TailwindCSS make sure that you use the classes with the prefix. -If you want to add a `p-1` class then it should be `tw-p-1` now. -But it does not apply to the states, for example, if you want to add a `p-2` on hover, then your class should be `hover:tw-p-2`. - ## Useful commands - In order to reinit everything run `make reinit`. It will drop all containers and recreate everything from the scratch. ### DB management: @@ -69,7 +63,7 @@ while running `make` command - you [need to install](https://apple.stackexchange ### **High Priority** 1. [ ] **Health Data Management** - - [ ] User Story 1: Manual input of blood test results. + - [x] User Story 1: Manual input of blood test results. - [ ] User Story 2: Import health data from PDF files. - [x] User Story 4: Display health data with color-coded references. 2. [ ] **User Interface and Experience** diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index ebae84f..6b06e1b 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -13,7 +13,6 @@ *= require_tree . *= require_self */ -@import "bootstrap"; .sign-out-button { margin-left: 0.5rem; diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index b5c61c9..28cafb9 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -1,3 +1,47 @@ @tailwind base; @tailwind components; @tailwind utilities; + +.button { + @apply inline-block text-center px-4 py-2 rounded; +} + +.primary-button { + @apply inline-block text-center px-4 py-2 rounded bg-blue-600 text-white hover:bg-blue-700; +} + +.secondary-button { + @apply inline-block text-center px-4 py-2 rounded bg-gray-600 text-white hover:bg-gray-700; +} + +.outline-secondary-button { + @apply inline-block text-center px-4 py-2 rounded border border-gray-600 text-gray-600 hover:bg-gray-100; +} + +.create-button { + @apply inline-block text-center px-4 py-2 rounded bg-green-600 text-white hover:bg-green-700; +} + +.outline-create-button { + @apply inline-block text-center px-4 py-2 rounded border border-green-600 text-green-600 hover:bg-green-100; +} + +.edit-button { + @apply inline-block text-center px-4 py-2 rounded bg-yellow-500 text-white hover:bg-yellow-600; +} + +.delete-button { + @apply mt-6 mr-6 mb-6 font-bold py-2 px-4 rounded bg-red-500 text-white hover:bg-red-700; +} + +.outline-primary-button { + @apply inline-block text-center px-4 py-2 rounded border border-blue-600 text-blue-600 hover:bg-blue-100; +} + +.large-button { + @apply text-lg px-6 py-3; +} + +.small-button { + @apply text-sm px-3 py-1; +} diff --git a/app/controllers/lab_tests_controller.rb b/app/controllers/lab_tests_controller.rb index ff2b440..094e16d 100644 --- a/app/controllers/lab_tests_controller.rb +++ b/app/controllers/lab_tests_controller.rb @@ -29,7 +29,6 @@ def show def new @lab_test = LabTest.new authorize @lab_test - # @biomarkers = Biomarker.all @users = User.all if current_user.full_access_roles_can? respond_to do |format| diff --git a/app/javascript/application.js b/app/javascript/application.js index 9bb6d6d..0d7b494 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,5 +1,3 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" import "controllers" -import "popper" -import "bootstrap" \ No newline at end of file diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index 10b2950..dc4677c 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -1,14 +1,9 @@ <%= form_with model: @user, url: admin_user_path(@user), method: :patch do |form| %> <% if @user.errors.any? %> -
-

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

- - -
+ <%= render "layouts/error_flash", + header: "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:", + errors: @user.errors.full_messages + %> <% end %>
@@ -27,6 +22,6 @@
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit class: "my-4 edit-button" %>
<% end %> diff --git a/app/views/admin/users/_index_table_body.html.erb b/app/views/admin/users/_index_table_body.html.erb index 01ea578..4094c46 100644 --- a/app/views/admin/users/_index_table_body.html.erb +++ b/app/views/admin/users/_index_table_body.html.erb @@ -1,23 +1,23 @@ <% @users.each do |user| %> - - + + <%= user.full_name %> - + <%= user.email %> - + <%= user_roles_list_as_string user %> - + <%= format_date_with_time user.created_at %> - + <%= format_date_with_time user.updated_at %> - - <%= link_to "Show details", admin_user_url(user), class: "tw-font-medium tw-text-blue-600 tw-dark:tw-text-blue-500 tw-hover:tw-underline" %> + + <%= link_to "Show details", admin_user_url(user), class: "font-medium text-blue-600 dark:text-blue-500 hover:underline" %> <% end %> diff --git a/app/views/admin/users/_index_table_head.html.erb b/app/views/admin/users/_index_table_head.html.erb index a2dc70b..4e385f1 100644 --- a/app/views/admin/users/_index_table_head.html.erb +++ b/app/views/admin/users/_index_table_head.html.erb @@ -1,23 +1,23 @@ - + - + User - + Email - + Role - + Created date - + Updated date - - Show + + Show diff --git a/app/views/admin/users/_user.html.erb b/app/views/admin/users/_user.html.erb index 8813ef5..b05cf39 100644 --- a/app/views/admin/users/_user.html.erb +++ b/app/views/admin/users/_user.html.erb @@ -1,41 +1,41 @@ -
-
+
+
-

+

User Name: <%= user.full_name %>

-

+

Email: <%= user.email %>

-

+

Role: <%= user_roles_list_as_string(user) %>

<% if current_user.full_access_roles_can? && assigned?(user) %> -

+

Assigned users: <%= assigned_user_list_as_string user %>

<% end %> <% if assignees? user %> -

+

Expert you are assigned to: <%= assignees_list_as_string(user) %>

<% end %> -

+

Created at: <%= format_date_with_time user.created_at %>

-

+

Updated at: <%= format_date_with_time user.updated_at %>

diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb index c6cda3f..005bd8a 100644 --- a/app/views/admin/users/edit.html.erb +++ b/app/views/admin/users/edit.html.erb @@ -1,8 +1,16 @@ -

Editing user

+

Editing user

<%= render "form", user: @user %>
- <%= link_to "Show this user", admin_user_url(@user) %> | - <%= link_to "Back to users", admin_users_path %> + <%= link_to "Show this user", + admin_user_url(@user), + method: :get, + class: "primary-button" + %> + <%= link_to "Back to users", + admin_users_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/admin/users/edit_assigned_users.html.erb b/app/views/admin/users/edit_assigned_users.html.erb index ffc9ccf..1e41d4d 100644 --- a/app/views/admin/users/edit_assigned_users.html.erb +++ b/app/views/admin/users/edit_assigned_users.html.erb @@ -1,16 +1,11 @@ -

Editing assigned users

+

Editing assigned users

<%= form_with model: @user, url: update_assigned_users_admin_user_path(@user), method: :post do |form| %> <% if @user.errors.any? %> -
-

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

- -
    - <% @user.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
+ <%= render "layouts/error_flash", + header: "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:", + errors: @user.errors.full_messages + %> <% end %>
@@ -22,12 +17,20 @@
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit "Update assignment users", class: "my-4 edit-button" %>
<% end %>
- <%= link_to "Show this user", admin_user_url(@user) %> | - <%= link_to "Back to users", admin_users_path %> + <%= link_to "Show this user", + admin_user_url(@user), + method: :get, + class: "primary-button" + %> + <%= link_to "Back to users", + admin_users_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/admin/users/edit_roles.html.erb b/app/views/admin/users/edit_roles.html.erb index 0b6cdca..152e2ff 100644 --- a/app/views/admin/users/edit_roles.html.erb +++ b/app/views/admin/users/edit_roles.html.erb @@ -1,16 +1,11 @@ -

Editing user roles

+

Editing user roles

<%= form_with model: @user, url: update_roles_admin_user_path(@user), method: :post do |form| %> <% if @user.errors.any? %> -
-

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

- -
    - <% @user.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
+ <%= render "layouts/error_flash", + header: "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:", + errors: @user.errors.full_messages + %> <% end %>
@@ -22,12 +17,20 @@
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit "Update role", class: "my-4 edit-button" %>
<% end %>
- <%= link_to "Show this user", admin_user_url(@user) %> | - <%= link_to "Back to users", admin_users_path %> + <%= link_to "Show this user", + admin_user_url(@user), + method: :get, + class: "primary-button" + %> + <%= link_to "Back to users", + admin_users_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 0b04feb..658a320 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,10 +1,10 @@
-
-

Users

+
+

Users

-
- +
+
<%= render "index_table_head" %> <%= render "index_table_body", users: @users %>
diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 9325173..9efb235 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -1,18 +1,34 @@ <%= render "user", user: @user %>
- <%= link_to "Edit this user", edit_admin_user_path(@user) %> | - <%= link_to "Change this user roles", edit_roles_admin_user_path(@user) %> | + <%= link_to "Edit this user", + edit_admin_user_path(@user), + method: :get, + class: "edit-button" + %> + <%= link_to "Change this user roles", + edit_roles_admin_user_path(@user), + method: :get, + class: "outline-secondary-button" + %> <% if @user.full_access_roles_can? %> - <%= link_to "Update assigned users", edit_assigned_users_admin_user_path(@user) %> | + <%= link_to "Update assigned users", + edit_assigned_users_admin_user_path(@user), + method: :get, + class: "outline-secondary-button" + %> <% end %> - <%= link_to "Back to users", admin_users_path %> + <%= link_to "Back to users", + admin_users_path, + method: :get, + class: "secondary-button" + %> <%= button_to( "Remove this user", edit_admin_user_path(@user), method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-mt-6 tw-mr-6 tw-mb-6 tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button" ) %>
diff --git a/app/views/biomarkers/_biomarker.html.erb b/app/views/biomarkers/_biomarker.html.erb index 491d519..567c8d9 100644 --- a/app/views/biomarkers/_biomarker.html.erb +++ b/app/views/biomarkers/_biomarker.html.erb @@ -1,14 +1,14 @@ - - + + <%= biomarker.name %> - + <%= format_date_with_time biomarker.created_at %> - + <%= format_date_with_time biomarker.updated_at %> - - <%= link_to "Show details", biomarker, class: "tw-font-medium tw-text-blue-600 tw-dark:tw-text-blue-500 tw-hover:tw-underline" %> + + <%= link_to "Show details", biomarker, class: "font-medium text-blue-600 dark:text-blue-500 hover:underline" %> \ No newline at end of file diff --git a/app/views/biomarkers/_detail_view_biomarker.html.erb b/app/views/biomarkers/_detail_view_biomarker.html.erb index fae8cf1..6f59ee8 100644 --- a/app/views/biomarkers/_detail_view_biomarker.html.erb +++ b/app/views/biomarkers/_detail_view_biomarker.html.erb @@ -1,14 +1,14 @@ -
-
+
+
-

+

Name: <%= biomarker.name %>

-
+
<% biomarker.reference_ranges.each do |reference_range| %> -
+

Min value: <%= format_biomarker_value(reference_range.min_value, reference_range.unit) %> @@ -40,7 +40,7 @@ reference_range, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button font-bold py-2 px-4 rounded" ) %> <% end %> diff --git a/app/views/biomarkers/_form.html.erb b/app/views/biomarkers/_form.html.erb index eaf424d..730b36d 100644 --- a/app/views/biomarkers/_form.html.erb +++ b/app/views/biomarkers/_form.html.erb @@ -1,14 +1,9 @@ <%= form_with(model: biomarker) do |form| %> <% if biomarker.errors.any? %> -

-

<%= pluralize(biomarker.errors.count, "error") %> prohibited this biomarker from being saved:

- -
    - <% biomarker.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
+ <%= render "layouts/error_flash", + header: "#{pluralize(biomarker.errors.count, "error")} prohibited this biomarker from being saved:", + errors: biomarker.errors.full_messages + %> <% end %>
@@ -24,6 +19,6 @@ <%= render "reference_ranges_form", form: form %>
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit class: "my-4 edit-button" %>
<% end %> diff --git a/app/views/biomarkers/edit.html.erb b/app/views/biomarkers/edit.html.erb index 53286bc..f55bb08 100644 --- a/app/views/biomarkers/edit.html.erb +++ b/app/views/biomarkers/edit.html.erb @@ -1,12 +1,24 @@ -

Editing biomarker

+

Editing biomarker

<%= render "form", biomarker: @biomarker %>
- <%= link_to "Add Reference Range", new_biomarker_reference_range_path(@biomarker) %> + <%= link_to "Add Reference Range", + new_biomarker_reference_range_path(@biomarker), + method: :get, + class: "mb-4 create-button" + %>
- <%= link_to "Show this biomarker", @biomarker %> | - <%= link_to "Back to biomarkers", biomarkers_path %> + <%= link_to "Show this biomarker", + @biomarker, + method: :get, + class: "primary-button" + %> + <%= link_to "Back to biomarkers", + biomarkers_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/biomarkers/index.html.erb b/app/views/biomarkers/index.html.erb index f7a489b..67543c0 100644 --- a/app/views/biomarkers/index.html.erb +++ b/app/views/biomarkers/index.html.erb @@ -1,28 +1,28 @@
-
-

Biomarkers

- <%= link_to "New biomarker", new_biomarker_path, class: "btn btn-primary" %> +
+

Biomarkers

+ <%= link_to "New biomarker", new_biomarker_path, class: "create-button" %>
-
+
- +
- + - - - - diff --git a/app/views/biomarkers/new.html.erb b/app/views/biomarkers/new.html.erb index 9303138..e67eadf 100644 --- a/app/views/biomarkers/new.html.erb +++ b/app/views/biomarkers/new.html.erb @@ -1,7 +1,11 @@ -

New biomarker

+

New biomarker

<%= render "form", biomarker: @biomarker %>
- <%= link_to "Back to biomarkers", biomarkers_path %> + <%= link_to "Back to biomarkers", + biomarkers_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/biomarkers/show.html.erb b/app/views/biomarkers/show.html.erb index 640c83b..d0582cd 100644 --- a/app/views/biomarkers/show.html.erb +++ b/app/views/biomarkers/show.html.erb @@ -2,9 +2,17 @@
<% if policy(@biomarker).edit? %> - <%= link_to "Edit this biomarker", edit_biomarker_path(@biomarker) %> | + <%= link_to "Edit this biomarker", + edit_biomarker_path(@biomarker), + method: :get, + class: "edit-button" + %> <% end %> - <%= link_to "Back to biomarkers", biomarkers_path %> + <%= link_to "Back to biomarkers", + biomarkers_path, + method: :get, + class: "secondary-button" + %> <% if policy(@biomarker).destroy? %> <%= button_to( @@ -12,7 +20,7 @@ @biomarker, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-mt-6 tw-mr-6 tw-mb-6 tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button" ) %> <% end %>
diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index f102f8b..f75a4d6 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,17 +1,17 @@ -

Resend confirmation instructions

+

Resend confirmation instructions

<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> -
+
-
- <%= f.label :email, class:"form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class:"form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Resend confirmation instructions", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Resend confirmation instructions", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 5312899..3eba3d5 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,26 +1,26 @@ -

Change your password

+

Change your password

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> <%= f.hidden_field :reset_password_token %> -
+
-
- <%= f.label :password, "New password", class:"form-label" %> +
+ <%= f.label :password, "New password", class: "block text-sm font-medium text-gray-700" %> <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) + (<%= @minimum_password_length %> characters minimum) <% end %> - <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class:"form-control" %> + <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :password_confirmation, "Confirm new password", class:"form-label" %> - <%= f.password_field :password_confirmation, autocomplete: "new-password", class:"form-control" %> +
+ <%= f.label :password_confirmation, "Confirm new password", class: "block text-sm font-medium text-gray-700" %> + <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Change my password", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Change my password", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 3dce184..e95794e 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,17 +1,17 @@ -

Forgot your password?

+

Forgot your password?

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> -
+
-
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Send me reset password instructions", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Send me reset password instructions", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 2efb63f..4e8efca 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,58 +1,59 @@ -

Edit <%= resource_name.to_s.humanize %>

+

Edit <%= resource_name.to_s.humanize %>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> -
+
-
- <%= f.label :email, class:"form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class:"form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :first_name, class:"form-label" %>
- <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class:"form-control" %> +
+ <%= f.label :first_name, class: "block text-sm font-medium text-gray-700" %> + <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :last_name, class:"form-label" %>
- <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class:"form-control" %> +
+ <%= f.label :last_name, class: "block text-sm font-medium text-gray-700" %> + <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
<% end %> -
- <%= f.label :password, class:"form-label" %> (leave blank if you don't want to change it) - <%= f.password_field :password, autocomplete: "new-password", class:"form-control" %> +
+ <%= f.label :password, class: "block text-sm font-medium text-gray-700" %> + (leave blank if you don't want to change it) + <%= f.password_field :password, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %> <% if @minimum_password_length %> - <%= @minimum_password_length %> characters minimum + <%= @minimum_password_length %> characters minimum <% end %>
-
- <%= f.label :password_confirmation, class:"form-label" %> - <%= f.password_field :password_confirmation, autocomplete: "new-password", class:"form-control" %> +
+ <%= f.label :password_confirmation, class: "block text-sm font-medium text-gray-700" %> + <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :current_password, class:"form-label" %> (we need your current password to confirm your changes) - <%= f.password_field :current_password, autocomplete: "current-password", class:"form-control" %> +
+ <%= f.label :current_password, class: "block text-sm font-medium text-gray-700" %> + (we need your current password to confirm your changes) + <%= f.password_field :current_password, autocomplete: "current-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Update", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Update", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
-
<% end %> -
-

Cancel my account

+
+

Cancel my account

- <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class:"btn btn-lg btn-danger" %> + <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "inline-block text-center px-6 py-3 rounded text-lg bg-red-600 text-white hover:bg-red-700" %> - <%= link_to "Back", :back %> + <%= link_to "Back", :back, class: "mt-3 text-blue-600 hover:underline" %>
\ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index b2501dc..e5bd017 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,40 +1,40 @@ -

Sign up

+

Sign up

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> -
+
-
- <%= f.label :email, class: "form-label"%> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :first_name, class:"form-label" %>
- <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class:"form-control" %> +
+ <%= f.label :first_name, class: "block text-sm font-medium text-gray-700" %> + <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :last_name, class:"form-label" %>
- <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class:"form-control" %> +
+ <%= f.label :last_name, class: "block text-sm font-medium text-gray-700" %> + <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :password, class:"form-label" %> +
+ <%= f.label :password, class: "block text-sm font-medium text-gray-700" %> <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) + (<%= @minimum_password_length %> characters minimum) <% end %> - <%= f.password_field :password, autocomplete: "new-password", class:"form-control" %> + <%= f.password_field :password, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :password_confirmation, class:"form-label" %> - <%= f.password_field :password_confirmation, autocomplete: "new-password", class:"form-control" %> +
+ <%= f.label :password_confirmation, class: "block text-sm font-medium text-gray-700" %> + <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Sign up", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Sign up", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index c1cbbdc..1ee9840 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,28 +1,28 @@ -

Log in

+

Log in

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
+
-
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class:"form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.label :password, class: "form-label" %> - <%= f.password_field :password, autocomplete: "current-password", class:"form-control" %> +
+ <%= f.label :password, class: "block text-sm font-medium text-gray-700" %> + <%= f.password_field :password, autocomplete: "current-password", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
<% if devise_mapping.rememberable? %> -
- <%= f.check_box :remember_me, class:"form-check-input" %> - <%= f.label :remember_me, class:"form-check-label" %> +
+ <%= f.check_box :remember_me, class: "h-4 w-4 text-blue-600 focus:ring focus:ring-blue-500 focus:ring-opacity-50 border-gray-300 rounded" %> + <%= f.label :remember_me, class: "ml-2 block text-sm text-gray-700" %>
<% end %> -
- <%= f.submit "Log in", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Log in", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
<%= render "devise/shared/links" %> diff --git a/app/views/devise/shared/_error_messages.html.erb b/app/views/devise/shared/_error_messages.html.erb index cabfe30..de7d2e4 100644 --- a/app/views/devise/shared/_error_messages.html.erb +++ b/app/views/devise/shared/_error_messages.html.erb @@ -1,15 +1,20 @@ <% if resource.errors.any? %> -
-

+
+

<%= I18n.t("errors.messages.not_saved", count: resource.errors.count, resource: resource.class.model_name.human.downcase) %>

-
    +
      <% resource.errors.full_messages.each do |message| %>
    • <%= message %>
    • <% end %>
    +
<% end %> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index 98ddad5..fd68d01 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -1,19 +1,19 @@ -

Resend unlock instructions

+

Resend unlock instructions

<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> <%= render "devise/shared/error_messages", resource: resource %> -
+
-
- <%= f.label :email, class:"form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class:"form-control" %> +
+ <%= f.label :email, class: "block text-sm font-medium text-gray-700" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50" %>
-
- <%= f.submit "Resend unlock instructions", class:"btn btn-lg btn-primary" %> +
+ <%= f.submit "Resend unlock instructions", class: "inline-block text-center px-6 py-3 rounded text-lg bg-blue-600 text-white hover:bg-blue-700" %>
- <%= render "devise/shared/links" %>` + <%= render "devise/shared/links" %>
<% end %> \ No newline at end of file diff --git a/app/views/health_records/_detail_view_lab_tests.html.erb b/app/views/health_records/_detail_view_lab_tests.html.erb index 1a7385f..c1e7b6f 100644 --- a/app/views/health_records/_detail_view_lab_tests.html.erb +++ b/app/views/health_records/_detail_view_lab_tests.html.erb @@ -1,6 +1,6 @@ -
+
<% health_record.lab_tests.each do |lab_test| %> -
+

Biomarker Name: @@ -38,7 +38,7 @@ lab_test, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button font-bold py-2 px-4 rounded" ) %> <% end %> diff --git a/app/views/health_records/_detail_view_measurements.html.erb b/app/views/health_records/_detail_view_measurements.html.erb index 1ee89dc..267c043 100644 --- a/app/views/health_records/_detail_view_measurements.html.erb +++ b/app/views/health_records/_detail_view_measurements.html.erb @@ -1,6 +1,6 @@ -

+
<% health_record.measurements.each do |measurement| %> -
+

Measurement Type: @@ -38,7 +38,7 @@ measurement, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button font-bold py-2 px-4 rounded" ) %> <% end %> diff --git a/app/views/health_records/_form.html.erb b/app/views/health_records/_form.html.erb index 9e76443..905710d 100644 --- a/app/views/health_records/_form.html.erb +++ b/app/views/health_records/_form.html.erb @@ -1,14 +1,9 @@ <%= form_with(model: health_record) do |form| %> <% if health_record.errors.any? %> -

-

<%= pluralize(health_record.errors.count, "error") %> prohibited this health_record from being saved:

- -
    - <% health_record.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
-
+ <%= render "layouts/error_flash", + header: "#{pluralize(health_record.errors.count, "error")} prohibited this health record from being saved:", + errors: health_record.errors.full_messages + %> <% end %>
@@ -17,6 +12,6 @@
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit class: "my-4 edit-button" %>
<% end %> diff --git a/app/views/health_records/_health_record.html.erb b/app/views/health_records/_health_record.html.erb index 2fed44b..0fd7ea9 100644 --- a/app/views/health_records/_health_record.html.erb +++ b/app/views/health_records/_health_record.html.erb @@ -1,17 +1,17 @@ -
- + - - - - \ No newline at end of file diff --git a/app/views/health_records/edit.html.erb b/app/views/health_records/edit.html.erb index 99c3bae..3841258 100644 --- a/app/views/health_records/edit.html.erb +++ b/app/views/health_records/edit.html.erb @@ -1,8 +1,16 @@ -

Editing health record

+

Editing health record

<%= render "form", health_record: @health_record %>
- <%= link_to "Show this health record", @health_record %> | - <%= link_to "Back to health records", health_records_path %> + <%= link_to "Show this health record", + @health_record, + method: :get, + class: "primary-button" + %> + <%= link_to "Back to health records", + health_records_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/health_records/index.html.erb b/app/views/health_records/index.html.erb index 545b3fe..0680e08 100644 --- a/app/views/health_records/index.html.erb +++ b/app/views/health_records/index.html.erb @@ -1,31 +1,31 @@
-
-

Health records

- <%= link_to "New health record", new_health_record_path, class: "btn btn-primary" %> +
+

Health records

+ <%= link_to "New health record", new_health_record_path, class: "create-button" %>
-
+
-
+ Name + Created date + Updated date - Show + + Show
+
<%= health_record.user.full_name %> + <%= health_record.notes %> + <%= format_date_with_time health_record.created_at %> + <%= format_date_with_time health_record.updated_at %> - <%= link_to "Show details", health_record, class: "tw-font-medium tw-text-blue-600 tw-dark:tw-text-blue-500 tw-hover:tw-underline" %> + + <%= link_to "Show details", health_record, class: "font-medium text-blue-600 dark:text-blue-500 hover:underline" %>
+
- + - - - - - diff --git a/app/views/health_records/new.html.erb b/app/views/health_records/new.html.erb index fb2228e..5bf8d49 100644 --- a/app/views/health_records/new.html.erb +++ b/app/views/health_records/new.html.erb @@ -1,7 +1,11 @@ -

New health record

+

New health record

<%= render "form", health_record: @health_record %>
- <%= link_to "Back to health records", health_records_path %> + <%= link_to "Back to health records", + health_records_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/health_records/show.html.erb b/app/views/health_records/show.html.erb index 4db59fc..742fe6b 100644 --- a/app/views/health_records/show.html.erb +++ b/app/views/health_records/show.html.erb @@ -1,36 +1,44 @@ -
-
+
+
-

+

Full Name: <%= @health_record.user.full_name %>

-

+

Notes: <%= @health_record.notes %>

-

+

Created at: <%= format_date_with_time @health_record.created_at %>

-

+

Updated at: <%= format_date_with_time @health_record.updated_at %>

-
- <%= link_to "Edit this health record", edit_health_record_path(@health_record) %> | - <%= link_to "Back to health records", health_records_path %> +
+ <%= link_to "Edit this health record", + edit_health_record_path(@health_record), + method: :get, + class: "edit-button" + %> + <%= link_to "Back to health records", + health_records_path, + method: :get, + class: "secondary-button" + %> <%= button_to( "Remove this Health Record", @health_record, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-mt-6 tw-mr-6 tw-mb-6 tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button" ) %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 6e572ec..40cf874 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,3 +1,37 @@ -

+

Welcome to Health Keeper -

\ No newline at end of file + +
    +
  • + <%= link_to "My health records", + health_records_path, + method: :get, + class: "text-bold underline" + %> +

    Look at all records about your health

    +
  • +
  • + <%= link_to "My Lab tests", + lab_tests_path, + method: :get, + class: "text-bold underline" + %> +

    Look at results of your lab tests

    +
  • +
  • + <%= link_to "My Measurements", + measurements_path, + method: :get, + class: "text-bold underline" + %> +

    Store all data about your body measurements

    +
  • +
  • + <%= link_to "My biomarkers", + biomarkers_path, + method: :get, + class: "text-bold underline" + %> +

    All available biomarkers data

    +
  • +
\ No newline at end of file diff --git a/app/views/lab_tests/_form.html.erb b/app/views/lab_tests/_form.html.erb index 220b37b..c5eb88b 100644 --- a/app/views/lab_tests/_form.html.erb +++ b/app/views/lab_tests/_form.html.erb @@ -1,10 +1,10 @@ -<%= form_with(model: lab_test) do |form| %> -<% if lab_test.errors.any? %> +<%= form_with(model: @lab_test) do |form| %> +<% if @lab_test.errors.any? %>
-

<%= pluralize(lab_test.errors.count, "error") %> prohibited this lab_test from being saved:

+

<%= pluralize(@lab_test.errors.count, "error") %> prohibited this @lab_test from being saved:

    - <% lab_test.errors.each do |error| %> + <% @lab_test.errors.each do |error| %>
  • <%= error.full_message %>
  • <% end %>
@@ -37,6 +37,6 @@
- <%= form.submit class: "tw-my-4 tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + <%= form.submit class: "my-4 edit-button" %>
<% end %> \ No newline at end of file diff --git a/app/views/lab_tests/_index_table.html.erb b/app/views/lab_tests/_index_table.html.erb index e54ad64..27130b5 100644 --- a/app/views/lab_tests/_index_table.html.erb +++ b/app/views/lab_tests/_index_table.html.erb @@ -1,5 +1,5 @@ -
-
+ User + Notes + Created date + Updated date - Show + + Show
+
+
<%= render "index_table_head", recordables: @recordables %> <%= render "index_table_body", recordables: @recordables, biomarkers: @biomarkers %>
diff --git a/app/views/lab_tests/_index_table_body.html.erb b/app/views/lab_tests/_index_table_body.html.erb index 689a5cd..5a15313 100644 --- a/app/views/lab_tests/_index_table_body.html.erb +++ b/app/views/lab_tests/_index_table_body.html.erb @@ -1,27 +1,27 @@ <% biomarkers.each do |biomarker| %> - - + + <%= biomarker.name %> - + <%= format_reference_range(biomarker.reference_ranges.first.min_value, biomarker.reference_ranges.first.max_value, biomarker.reference_ranges.first.unit) %> <% recordables.each do |recordable| %> <% lab_test = biomarker.lab_tests.find { |lt| lt.recordable_id == recordable.recordable_id } %> <% if lab_test %> - "> -
+ "> +
<%= format_biomarker_value lab_test.value, lab_test.unit %> <%= link_to lab_test, data: { turbo: "false" } do %> - + <% end %>
<% else %> - + <% end %> <% end %> diff --git a/app/views/lab_tests/_index_table_head.html.erb b/app/views/lab_tests/_index_table_head.html.erb index baebd5a..e1ec2fb 100644 --- a/app/views/lab_tests/_index_table_head.html.erb +++ b/app/views/lab_tests/_index_table_head.html.erb @@ -1,14 +1,14 @@ - + - + Biomarker - + Reference range <% recordables.each do |recordable| %> - + <%= format_date recordable.created_at %> <% end %> diff --git a/app/views/lab_tests/_lab_test.html.erb b/app/views/lab_tests/_lab_test.html.erb index afdc44f..215114b 100644 --- a/app/views/lab_tests/_lab_test.html.erb +++ b/app/views/lab_tests/_lab_test.html.erb @@ -1,32 +1,32 @@ -
-
+
+
-

+

Biomarker Name: <%= lab_test.biomarker.name %>

-

+

Value: <%= format_biomarker_value(lab_test.value, lab_test.unit) %>

-

+

Reference range: <%= format_reference_range(lab_test.reference_range.min_value, lab_test.reference_range.max_value, lab_test.reference_range.unit) %>

-

+

Notes: <%= lab_test.notes %>

-

+

Created at: <%= format_date_with_time lab_test.created_at %>

-

+

Updated at: <%= format_date_with_time lab_test.updated_at %>

diff --git a/app/views/lab_tests/edit.html.erb b/app/views/lab_tests/edit.html.erb index 770e603..1a40876 100644 --- a/app/views/lab_tests/edit.html.erb +++ b/app/views/lab_tests/edit.html.erb @@ -1,8 +1,16 @@ -

Editing lab test

+

Editing lab test

<%= render "form", lab_test: @lab_test %>
- <%= link_to "Show this lab test", @lab_test %> | - <%= link_to "Back to lab tests", lab_tests_path %> + <%= link_to "Show this lab test", + @lab_test, + method: :get, + class: "primary-button" + %> + <%= link_to "Back to lab tests", + lab_tests_path, + method: :get, + class: "secondary-button" + %>
diff --git a/app/views/lab_tests/index.html.erb b/app/views/lab_tests/index.html.erb index bb7fbbc..6a8c2c1 100644 --- a/app/views/lab_tests/index.html.erb +++ b/app/views/lab_tests/index.html.erb @@ -1,10 +1,10 @@
-
-

Lab Tests

+
+

Lab Tests

<%= link_to "New Lab Test", new_lab_test_path, method: :get, - class: "btn btn-primary", + class: "create-button", data: { turbo_frame: "_top" } %>
diff --git a/app/views/lab_tests/new.html.erb b/app/views/lab_tests/new.html.erb index 2f0170e..7ae3a78 100644 --- a/app/views/lab_tests/new.html.erb +++ b/app/views/lab_tests/new.html.erb @@ -1,30 +1,18 @@ -
-

New <%= params[:test_type]&.titleize || 'Lab' %> Test

+
+

New <%= params[:test_type]&.titleize || 'Lab' %> Test

+ + <%= form_with(model: @lab_test, local: true, class: "space-y-4") do |form| %> <% if @lab_test.errors.any? %> - - <% elsif flash.present? %> - + <%= render "layouts/error_flash", + header: "#{pluralize(@lab_test.errors.count, "error")} prohibited this lab test from being saved:", + errors: @lab_test.errors.full_messages + %> <% end %> - <%= form_with(model: @lab_test, local: true, class: "tw-space-y-4") do |form| %> - <% if assigned_users? %> -
- <%= label_tag :user_id, "Select Patient", class: "tw-block tw-text-sm tw-font-medium tw-text-gray-700" %> +
+ <%= label_tag :user_id, "Select Patient", class: "block text-sm font-medium text-gray-700" %> <%= form.select :user_id, options_for_select( assigned_users_list_for_select(current_user, current_user) @@ -37,14 +25,14 @@ <%= form.hidden_field :user_id, value: current_user.id %> <% end %> -
- <%= form.label :biomarker_id, class: "tw-block tw-text-sm tw-font-medium tw-text-gray-700" %> +
+ <%= form.label :biomarker_id, class: "block text-sm font-medium text-gray-700" %> <%= form.collection_select :biomarker_id, @biomarkers, :id, :name, { prompt: "Select biomarker", required: true }, - { class: "tw-mt-1 tw-block tw-w-full tw-rounded-md #{@lab_test.errors[:biomarker_id].present? ? 'tw-border-red-500' : 'tw-border-gray-300'}", + { class: "mt-1 block w-full rounded-md #{@lab_test.errors[:biomarker_id].present? ? 'border-red-500' : 'border-gray-300'}", data: { biomarker_select_target: "select", action: "change->biomarker-select#updateReferenceRange" @@ -52,11 +40,11 @@ } %> <% if @lab_test.errors[:biomarker_id].any? %> -

<%= @lab_test.errors[:biomarker_id].join(', ') %>

+

<%= @lab_test.errors[:biomarker_id].join(', ') %>

<% end %> -
-

+

+

Reference Range: <%= @selected_biomarker&.reference_ranges&.first ? @@ -64,7 +52,7 @@ "Select biomarker first" %>

-

+

Unit: <%= @selected_biomarker&.reference_ranges&.first&.unit || '-' %> @@ -80,28 +68,32 @@ data: { biomarker_select_target: "unitField" } %>

-
- <%= form.label :value, class: "tw-block tw-text-sm tw-font-medium tw-text-gray-700" %> -
+
+ <%= form.label :value, class: "block text-sm font-medium text-gray-700" %> +
<%= form.number_field :value, step: :any, required: true, - class: "tw-mt-1 tw-block tw-w-full tw-rounded-md #{@lab_test.errors[:value].present? ? 'tw-border-red-500' : 'tw-border-gray-300'}" + class: "mt-1 block w-full rounded-md #{@lab_test.errors[:value].present? ? 'border-red-500' : 'border-gray-300'}" %>
-
- <%= form.label :notes, class: "tw-block tw-text-sm tw-font-medium tw-text-gray-700" %> - <%= form.text_area :notes, class: "tw-mt-1 tw-block tw-w-full tw-rounded-md tw-border-gray-300" %> +
+ <%= form.label :notes, class: "block text-sm font-medium text-gray-700" %> + <%= form.text_area :notes, class: "mt-1 block w-full rounded-md border-gray-300" %>
<%= form.submit "Create #{params[:test_type]&.titleize || 'Lab'} Test", - class: "tw-bg-blue-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" %> + class: "edit-button" %> <% end %> -
- <%= link_to "Back to lab tests", lab_tests_path, class: "tw-text-blue-500 hover:tw-text-blue-700" %> +
+ <%= link_to "Back to lab tests", + lab_tests_path, + method: :get, + class: "secondary-button" + %>
\ No newline at end of file diff --git a/app/views/lab_tests/show.html.erb b/app/views/lab_tests/show.html.erb index e8b8c82..c82d8a1 100644 --- a/app/views/lab_tests/show.html.erb +++ b/app/views/lab_tests/show.html.erb @@ -1,14 +1,22 @@ <%= render "lab_test", lab_test: @lab_test %>
- <%= link_to "Edit this lab test", edit_lab_test_path(@lab_test) %> | - <%= link_to "Back to lab tests", lab_tests_path %> + <%= link_to "Edit this lab test", + edit_lab_test_path(@lab_test), + method: :get, + class: "edit-button" + %> + <%= link_to "Back to lab tests", + lab_tests_path, + method: :get, + class: "secondary-button" + %> <%= button_to( "Remove this lab test", @lab_test, method: :delete, data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, - class: "tw-mt-6 tw-mr-6 tw-mb-6 tw-bg-red-500 tw-hover:bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded" + class: "delete-button" ) %>
diff --git a/app/views/layouts/_error_flash.html.erb b/app/views/layouts/_error_flash.html.erb new file mode 100644 index 0000000..b63f16a --- /dev/null +++ b/app/views/layouts/_error_flash.html.erb @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index 6dc3c6c..fd8311f 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,6 +1,10 @@ <% if flash.present? %> -