Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac & feat: now there is only one item details view instead of two, also design adjusted #264

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "font-awesome-sass", "~> 6.2.1"

ruby "2.7.4"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ GEM
ffi (1.15.5)
flag-icons-rails (3.4.6.1)
sass-rails
font-awesome-sass (6.2.1)
sassc (~> 2.0)
globalid (1.0.0)
activesupport (>= 5.0)
hashie (5.0.0)
Expand Down Expand Up @@ -420,6 +422,7 @@ DEPENDENCIES
devise-i18n-bootstrap
factory_bot_rails
flag-icons-rails
font-awesome-sass (~> 6.2.1)
importmap-rails
jbuilder
jquery-rails
Expand Down
6 changes: 4 additions & 2 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $warning: $hpi-orange;
$danger: $hpi-red;
$light: #BDBDBD;
$dark: black;
$lightGrey: rgb(211, 211, 211);
$lightGrey: #eee;

$btn-border-radius: 5px;
$btn-font-weight: 600; // semibold
Expand All @@ -52,6 +52,8 @@ $mobileDeviceCutoff: 992px;

@import "flag-icon";

@import "font-awesome";

@media (max-width: $mobileDeviceCutoff) {
.navbar-collapse {
position: fixed;
Expand Down Expand Up @@ -111,4 +113,4 @@ footer {
#navbarToggle {
width: auto;
padding-right: 30px;
}
}
81 changes: 78 additions & 3 deletions app/assets/stylesheets/item-show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
}
}

.item-action-button
{
.item-action-button {
position: fixed;
margin-top: auto;
bottom: 0px;
Expand All @@ -27,6 +26,82 @@
border-radius: 0px;
height: 4rem;
}
.button-blocker{
.button-blocker {
height: 4rem;
}

body {
background-color: #000;
}
.card {
border: none;
}
.product {
background-color: $lightGrey;
}
.brand {
font-size: 13px;
}
.act-price {
color: $primary;
font-weight: 700;
}
.dis-price {
text-decoration: line-through;
}
.about {
font-size: 14px;
}
.color {
margin-bottom: 10px;
}
label.radio {
cursor: pointer;
}
label.radio input {
position: absolute;
top: 0;
left: 0;
visibility: hidden;
pointer-events: none;
}
label.radio span {
padding: 2px 9px;
border: 2px solid $primary;
display: inline-block;
color: $primary;
border-radius: 3px;
text-transform: uppercase;
}
label.radio input:checked + span {
border-color: $primary;
background-color: $primary;
color: #fff;
}
.btn-danger {
background-color: $primary !important;
border-color: $primary !important;
}
.btn-danger:hover {
background-color: $primary !important;
border-color: $primary !important;
}
.btn-danger:focus {
box-shadow: none;
}
.cart i {
margin-right: 10px;
}

.btn-group-stretch {
width: 100%;
display: flex;
justify-content: space-between
}

.btn-center {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
2 changes: 1 addition & 1 deletion app/components/infobox_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="<%= "alert border border-2 #{@bootstrap_classes}" %>" style="text-align: center">
<div class="<%= "alert border border-2 #{@bootstrap_classes}" %> m-0" style="text-align: center">
<h6 class='alert-heading mb-1'>
<%= @heading %>
</h6>
Expand Down
2 changes: 1 addition & 1 deletion app/components/infobox_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class InfoboxComponent < ViewComponent::Base
def initialize(heading:, body:, bootstrap_classes:)
super()
super
@heading = heading
@body = body
@bootstrap_classes = bootstrap_classes
Expand Down
2 changes: 1 addition & 1 deletion app/components/item_availability_badge_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ItemAvailabilityBadgeComponent < ViewComponent::Base
def initialize(item:, user:)
super()
super
@item = item
@user = user
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/item_borrow_button.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ItemBorrowButton < ViewComponent::Base
def initialize(text:, action:, bootstrap_classes:)
super()
super
@text = text
@action = action
@bootstrap_classes = bootstrap_classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<% owner_groups = Group.owner_groups(@item.id) %>
<p class="card-text">
<%= I18n.t("items.card_text.owner") %>
<span class="text-primary"><%=owner_groups.map{|owner| owner.name}.join(", ").html_safe%></span>
<span class="text-primary"><%=owner_groups.map(&:name).join(", ").html_safe%></span>
</p>
</div>
6 changes: 6 additions & 0 deletions app/components/owner_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class OwnerComponent < ViewComponent::Base
def initialize(item:)
super
@item = item
end
end
2 changes: 1 addition & 1 deletion app/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Item < ApplicationRecord

validates :name, presence: true
validates :max_reservation_days, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 365 }
validates :max_borrowing_days, numericality: { greater_than_or_equal_to: 0 }
validates :max_borrowing_days, numericality: { greater_than: 0 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense.

To keep track of these "on-the-side" changes, it might be nice to give a summary of changed things (that are not obvious from the PR title) in the PR.


validates :number_of_pages, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true

Expand Down
117 changes: 0 additions & 117 deletions app/views/items/_item_largescreen.html.erb

This file was deleted.

Loading