Skip to content

Commit

Permalink
Shop Item implementation (#960)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasia Ivanyshak <ivanyshak.vasia@gmail.com>
  • Loading branch information
sveredyuk and ivanyshak committed Jun 10, 2021
1 parent 911cd8e commit 9e877b6
Show file tree
Hide file tree
Showing 46 changed files with 839 additions and 58 deletions.
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ruby File.open('.ruby-version').readline.chomp
#=== CORE =====================================================================
gem 'acts-as-taggable-on', git: 'https://github.com/Fodoj/acts-as-taggable-on', ref: 'rails-5.2'
gem 'carrierwave', '~> 1.2'
gem "mini_magick"
gem 'rmagick'
gem 'devise', '~> 4.7.1'
gem 'friendly_id', '~> 5.1'
gem 'kaminari'
Expand Down Expand Up @@ -39,8 +41,8 @@ gem 'autoprefixer-rails', '~> 7.1.6'
gem 'coffee-rails', '~> 4.2.1'
gem 'jquery-rails', '~> 4.2.2'
gem 'premailer-rails' # email inline styling
gem 'rails-assets-semantic-ui-calendar', source: 'https://rails-assets.org'
gem 'rails-assets-svgxuse', source: 'https://rails-assets.org'
gem 'rails-assets-semantic-ui-calendar', source: 'http://insecure.rails-assets.org'
gem 'rails-assets-svgxuse', source: 'http://insecure.rails-assets.org'
gem 'sass-rails', '~> 5.0'
gem 'semantic-ui-sass', '~> 2.2'
gem 'slim-rails'
Expand Down
13 changes: 11 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ PATH
courses (0.1.0)
friendly_id
kaminari
rails
rails (~> 5.2.2, >= 5.2.2.1)
simple_form
slim-rails

PATH
remote: components/shop
specs:
shop (0.1.0)
carrierwave (~> 1.2)
friendly_id
kaminari
rails (~> 5.2.2, >= 5.2.2.1)
simple_form
slim-rails

GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
remote: http://insecure.rails-assets.org/
specs:
Ascii85 (1.0.3)
actioncable (5.2.5)
Expand Down Expand Up @@ -308,6 +313,7 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mini_magick (4.11.0)
mini_mime (1.1.0)
mini_portile2 (2.5.1)
minitest (5.14.4)
Expand Down Expand Up @@ -455,6 +461,7 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
rmagick (4.2.2)
rollbar (2.19.4)
multi_json
rqrcode (1.1.2)
Expand Down Expand Up @@ -657,6 +664,7 @@ DEPENDENCIES
letter_opener
listen
meta_request
mini_magick
newrelic_rpm (~> 5.4)
oj (~> 3.7.11)
omniauth-facebook (~> 5.0)
Expand All @@ -679,6 +687,7 @@ DEPENDENCIES
recaptcha
redcarpet (~> 3.4.0)
redis (~> 3.2)
rmagick
rollbar (~> 2.19.3)
rspec
rspec-activemodel-mocks
Expand Down
2 changes: 2 additions & 0 deletions app/assets/stylesheets/app/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
@import "pages/courses/form";
@import "pages/courses/seasons";

@import "pages/shop/items";

@import "pages/donate/form";

@import "pages/agenda/agenda";
Expand Down
89 changes: 89 additions & 0 deletions app/assets/stylesheets/app/pages/shop/_items.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.main{
max-width: 1200px;
margin: 0 auto;
}

h1 {
font-size: 24px;
font-weight: 400;
text-align: center;
}

img {
height: auto;
max-width: 100%;
vertical-align: middle;
}

.btn {
color: #ffffff;
padding: 0.8rem;
font-size: 14px;
text-transform: uppercase;
border-radius: 4px;
font-weight: 400;
display: block;
width: 100%;
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0.2);
background: transparent;
}

.btn:hover {
background-color: rgba(255, 255, 255, 0.12);
}

.cards {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 0;
}

.cards_item {
display: flex;
padding: 1rem;
}

@media (min-width: 40rem) {
.cards_item {
width: 50%;
}
}

@media (min-width: 56rem) {
.cards_item {
width: 33.3333%;
}
}

.card {
background-color: white;
border-radius: 0.25rem;
box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.25);
display: flex;
flex-direction: column;
overflow: hidden;
}

.card_content {
padding: 1rem;
background: linear-gradient(to bottom left, #ce5739 40%, #FFC39E 100%);
}

.card_title {
color: #ffffff;
font-size: 1.1rem;
font-weight: 700;
letter-spacing: 1px;
text-transform: capitalize;
margin: 0px;
}

.card_text {
color: #ffffff;
font-size: 0.875rem;
line-height: 1.5;
margin-bottom: 1.25rem;
font-weight: 400;
}
14 changes: 13 additions & 1 deletion app/uploaders/default_image_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
class DefaultImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
include CarrierWave::MiniMagick

version :small do
process resize_to_fill: [60, 60]
end

version :middle do
process resize_to_fill: [295, 295]
end

version :large do
process resize_to_fill: [1200, 1200]
end

# Choose what kind of storage to use for this uploader:
storage :file
Expand Down
4 changes: 4 additions & 0 deletions app/uploaders/item_image_uploader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class ItemImageUploader < DefaultImageUploader
end
50 changes: 26 additions & 24 deletions components/courses/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PATH
courses (0.1.0)
friendly_id
kaminari
rails
rails (~> 5.2.2, >= 5.2.2.1)
simple_form
slim-rails

Expand Down Expand Up @@ -79,7 +79,7 @@ GEM
i18n (>= 0.7)
ffi (1.10.0)
formatador (0.2.5)
friendly_id (5.2.5)
friendly_id (5.4.2)
activerecord (>= 4.0.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
Expand All @@ -100,18 +100,18 @@ GEM
i18n (1.6.0)
concurrent-ruby (~> 1.0)
json (2.2.0)
kaminari (1.1.1)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
launchy (2.4.3)
addressable (~> 2.3)
listen (3.1.5)
Expand All @@ -127,12 +127,14 @@ GEM
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
nenv (0.3.0)
nio4r (2.3.1)
nio4r (2.5.7)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
notiffany (0.1.1)
Expand Down Expand Up @@ -199,38 +201,38 @@ GEM
rspec-support (3.8.0)
ruby_dep (1.5.0)
shellany (0.0.1)
simple_form (4.1.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
simple_form (5.1.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
slim (4.0.1)
slim (4.1.0)
temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1)
slim-rails (3.2.0)
actionpack (>= 3.1)
railties (>= 3.1)
slim (>= 3.0, < 5.0)
sprockets (3.7.2)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
temple (0.8.1)
temple (0.8.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tilt (2.0.10)
tzinfo (1.2.5)
thread_safe (~> 0.1)
websocket-driver (0.7.0)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)

Expand All @@ -250,4 +252,4 @@ DEPENDENCIES
sqlite3 (~> 1.3.6)

BUNDLED WITH
1.16.1
1.17.2
2 changes: 1 addition & 1 deletion components/courses/courses.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|

s.add_dependency 'friendly_id'
s.add_dependency 'kaminari'
s.add_dependency 'rails'
s.add_dependency 'rails', '~> 5.2.2', '>= 5.2.2.1'
s.add_dependency 'simple_form'
s.add_dependency 'slim-rails'

Expand Down
1 change: 0 additions & 1 deletion components/shop/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ gemspec

# To use a debugger
# gem 'byebug', group: [:development, :test]
gem 'pry'
Loading

0 comments on commit 9e877b6

Please sign in to comment.