From 8bfe4e07590284c5a5cc74d1d6c848dbd4c313c7 Mon Sep 17 00:00:00 2001 From: Mohd Khairi Mohd Adnan Date: Sat, 3 Feb 2024 19:44:08 +0800 Subject: [PATCH] Add bottom navigation for standalone mode --- app/controllers/users_controller.rb | 6 +- app/views/home/_homepage_actions.html.erb | 6 +- app/views/layouts/_bottom_nav.html.erb | 36 ++++++++++++ app/views/layouts/_header.html.erb | 32 +++++------ app/views/layouts/application.html.erb | 6 +- app/views/layouts/menu/_directories.html.erb | 5 +- app/views/map/index.html.erb | 8 +-- app/views/users/profile.html.erb | 60 ++++++++++++++++++++ config/routes.rb | 4 +- 9 files changed, 125 insertions(+), 38 deletions(-) create mode 100644 app/views/layouts/_bottom_nav.html.erb create mode 100644 app/views/users/profile.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0832aeff..5f546e4a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - before_action :authenticate_user!, only: [:edit, :update] + before_action :authenticate_user!, only: [:edit, :update, :profile] def show @user = User.find_by!(username: params[:id]) @@ -27,6 +27,10 @@ def show @check_in_months = check_in_range.map { |date| date.strftime("%B") }.uniq end + def profile + @user = current_user + end + def edit @user = current_user end diff --git a/app/views/home/_homepage_actions.html.erb b/app/views/home/_homepage_actions.html.erb index e44b8a80..c09ce2f7 100644 --- a/app/views/home/_homepage_actions.html.erb +++ b/app/views/home/_homepage_actions.html.erb @@ -7,7 +7,6 @@ <%= render "components/icons/filter" %> Filters - "> @@ -15,7 +14,6 @@ <% end %> - <%= button_tag type: "button", data: { @@ -30,15 +28,13 @@ Install <% end %> - - + <%= link_to map_path, "data-turbo": false, class: "inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brown-500" do %> <%= render "components/icons/map" %> Live Map <% end %> - diff --git a/app/views/layouts/_bottom_nav.html.erb b/app/views/layouts/_bottom_nav.html.erb new file mode 100644 index 00000000..856778da --- /dev/null +++ b/app/views/layouts/_bottom_nav.html.erb @@ -0,0 +1,36 @@ + diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 5988be8b..8e02f935 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,5 +1,5 @@ <% unless (controller_path == "coffee_shops" && action_name == "show") %> -
+
@@ -8,7 +8,10 @@ <%= image_tag "logo.svg", class: "h-8 w-auto sm:h-10", alt: "petakopi", width: "40px", height: "40px" %> <% end %>
-
+
+ <%= render "layouts/menu/directories" %> +
+
- -
<% else %>
@@ -64,7 +64,6 @@
-
@@ -97,24 +95,22 @@ <%= link_to "Admin", admin_coffee_shops_path, class: "rounded-md text-base font-medium text-red-500 hover:text-red-900" %> <% end %>
- <% if current_user %>
-