-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from jahseng-lee/feature/cleanup-mobile-views
Feature/cleanup mobile views
- Loading branch information
Showing
39 changed files
with
695 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
.pagination-nav-container { | ||
width: 100%; | ||
max-width: 100vw; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.review-form { | ||
.form-select { | ||
width: 4rem; | ||
min-width: 4rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class CountriesController < ApplicationController | ||
def edit | ||
@country = Country.find(params[:id]) | ||
@location = @country.locations.find(params[:location_id]) | ||
|
||
authorize(@country) | ||
end | ||
|
||
def update | ||
@country = Country.find(params[:id]) | ||
@location = @country.locations.find(params[:location_id]) | ||
|
||
authorize(@country) | ||
|
||
# NOTE this is supremely lazy | ||
# however, admin only. Fine for now | ||
@country.update!(country_params) | ||
redirect_to @location | ||
end | ||
|
||
private | ||
|
||
def country_params | ||
params.require(:country).permit( | ||
:ambulance_number, | ||
:police_number, | ||
:fire_number | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
class CountryPolicy < ApplicationPolicy | ||
def update? | ||
def edit? | ||
user.admin? | ||
end | ||
|
||
def update? | ||
edit? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%= turbo_stream.replace( | ||
"joinable-channel-list", | ||
partial: "chats/current_user_channel_list", | ||
locals: { | ||
user: current_user | ||
} | ||
) %> | ||
|
||
<%= turbo_stream.replace( | ||
"mobile-joinable-channel-list", | ||
partial: "chats/current_user_channel_list", | ||
locals: { | ||
user: current_user, | ||
turbo_id: "mobile-channel-list" | ||
} | ||
) %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<%= turbo_stream.replace( | ||
"channel-list", | ||
partial: "chats/joinable_channel_list", | ||
locals: { channels: @channels } | ||
) %> | ||
|
||
<%= turbo_stream.replace( | ||
"mobile-channel-list", | ||
partial: "chats/joinable_channel_list", | ||
locals: { | ||
channels: @channels, | ||
turbo_id: "mobile-joinable-channel-list" | ||
} | ||
) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#channelList" aria-controls="channelList"> | ||
<i class="bi bi-chevron-left"></i> | ||
<%= local_assigns[:button_label] ? button_label : "Browse" %> | ||
</button> | ||
|
||
<div class="offcanvas offcanvas-end" tabindex="-1" id="channelList" aria-labelledby="Channel list"> | ||
<div class="offcanvas-header"> | ||
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> | ||
</div> | ||
<div class="channel-list-container offcanvas-body"> | ||
<%= render partial: "chats/current_user_channel_list", | ||
locals: { | ||
user: user, | ||
turbo_id: "mobile-channel-list" | ||
} | ||
%> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="container mt-5"> | ||
<%= render partial: "locations/shared/back_link", | ||
locals: { | ||
location: @location, | ||
} | ||
%> | ||
|
||
<h1>Emergency info. for <%= @country.name %></h1> | ||
|
||
<%= form_for [@location, @country] do |f| %> | ||
<div class="mb-3"> | ||
<%= f.label( | ||
:ambulance_number, | ||
"Ambulance", | ||
class: "form-label fw-bold" | ||
) %> | ||
<%= f.text_field :ambulance_number, class: "form-control" %> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<%= f.label( | ||
:police_number, | ||
"Police", | ||
class: "form-label fw-bold" | ||
) %> | ||
<%= f.text_field :police_number, class: "form-control" %> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<%= f.label :fire_number, "Fire", class: "form-label fw-bold" %> | ||
<%= f.text_field :fire_number, class: "form-control" %> | ||
</div> | ||
|
||
<%= f.button "Save", | ||
type: :submit, | ||
class: "btn btn-primary" | ||
%> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.