diff --git a/Gemfile b/Gemfile index a37c305..1456583 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +ruby '2.4.1' source 'https://rubygems.org' git_source(:github) do |repo_name| @@ -7,11 +8,16 @@ end gem 'devise', '4.3.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.1.6' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' +gem 'rails', '~> 5.1.5' +# Use postgres as the database for Active Record +gem 'pg', '>= 0.18', '< 2.0' +gem 'unicorn' # Use Puma as the app server gem 'puma', '~> 3.7' +# Use jQuery rails +gem 'jquery-rails' +# Use jQuery UI rails +gem 'jquery-ui-rails' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -50,5 +56,9 @@ group :development do gem 'spring-watcher-listen', '~> 2.0.0' end +group :production do + gem 'rails_12factor' +end + # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 827d33b..5a6fd3e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,50 +1,50 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.1.6) - actionpack (= 5.1.6) + actioncable (5.1.7) + actionpack (= 5.1.7) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.6) - actionpack (= 5.1.6) - actionview (= 5.1.6) - activejob (= 5.1.6) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.6) - actionview (= 5.1.6) - activesupport (= 5.1.6) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.6) - activesupport (= 5.1.6) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.6) - activesupport (= 5.1.6) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.1.6) - activesupport (= 5.1.6) - activerecord (5.1.6) - activemodel (= 5.1.6) - activesupport (= 5.1.6) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) arel (~> 8.0) - activesupport (5.1.6) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.5.2) + addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) arel (8.0.0) - bcrypt (3.1.11) - bindex (0.5.0) + bcrypt (3.1.12) + bindex (0.6.0) builder (3.2.3) - byebug (10.0.2) + byebug (11.0.1) capybara (2.18.0) addressable mini_mime (>= 0.1.3) @@ -61,80 +61,94 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.0.5) - crass (1.0.3) + concurrent-ruby (1.1.5) + crass (1.0.4) devise (4.3.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 5.2) responders warden (~> 1.2.3) - erubi (1.7.1) + erubi (1.8.0) execjs (2.7.0) - ffi (1.9.23) - globalid (0.4.1) + ffi (1.10.0) + globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.0.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) - jbuilder (2.7.0) + jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) + jquery-rails (4.3.3) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + kgio (2.11.2) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.2.2) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.0) + mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.9.0) - mini_mime (1.0.0) - mini_portile2 (2.3.0) + method_source (0.9.2) + mini_mime (1.0.1) + mini_portile2 (2.4.0) minitest (5.11.3) multi_json (1.13.1) - nio4r (2.3.0) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) + nio4r (2.3.1) + nokogiri (1.10.2) + mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - public_suffix (3.0.2) - puma (3.11.3) - rack (2.0.4) - rack-test (1.0.0) + pg (1.1.4) + public_suffix (3.0.3) + puma (3.12.1) + rack (2.0.7) + rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.1.6) - actioncable (= 5.1.6) - actionmailer (= 5.1.6) - actionpack (= 5.1.6) - actionview (= 5.1.6) - activejob (= 5.1.6) - activemodel (= 5.1.6) - activerecord (= 5.1.6) - activesupport (= 5.1.6) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.1.6) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (5.1.6) - actionpack (= 5.1.6) - activesupport (= 5.1.6) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.1) + raindrops (0.19.0) + rake (12.3.2) rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) ruby_dep (1.5.0) - rubyzip (1.2.1) - sass (3.5.6) + rubyzip (1.2.2) + sass (3.7.3) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -145,35 +159,37 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - selenium-webdriver (3.11.0) + selenium-webdriver (3.141.0) childprocess (~> 0.5) - rubyzip (~> 1.2) + rubyzip (~> 1.2, >= 1.2.2) spring (2.0.2) activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.1) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.13) - thor (0.20.0) + thor (0.20.3) thread_safe (0.3.6) - tilt (2.0.8) - turbolinks (5.1.0) - turbolinks-source (~> 5.1) - turbolinks-source (5.1.0) + tilt (2.0.9) + turbolinks (5.2.0) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.8) + uglifier (4.1.20) execjs (>= 0.3.0, < 3) - warden (1.2.7) - rack (>= 1.0) - web-console (3.5.1) + unicorn (5.5.0) + kgio (~> 2.6) + raindrops (~> 0.7) + warden (1.2.8) + rack (>= 2.0.6) + web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) @@ -181,7 +197,7 @@ GEM websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) - xpath (3.0.0) + xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS @@ -193,18 +209,25 @@ DEPENDENCIES coffee-rails (~> 4.2) devise (= 4.3.0) jbuilder (~> 2.5) + jquery-rails + jquery-ui-rails listen (>= 3.0.5, < 3.2) + pg (>= 0.18, < 2.0) puma (~> 3.7) - rails (~> 5.1.6) + rails (~> 5.1.5) + rails_12factor sass-rails (~> 5.0) selenium-webdriver spring spring-watcher-listen (~> 2.0.0) - sqlite3 turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) + unicorn web-console (>= 3.3.0) +RUBY VERSION + ruby 2.4.1p111 + BUNDLED WITH - 1.16.1 + 2.0.1 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..9e10c0c --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development} \ No newline at end of file diff --git a/app/assets/images/Site/faq.jpg b/app/assets/images/Site/faq.jpg new file mode 100644 index 0000000..038bdac Binary files /dev/null and b/app/assets/images/Site/faq.jpg differ diff --git a/app/assets/images/Site/game-land-logo-white.png b/app/assets/images/Site/game-land-logo-white.png new file mode 100644 index 0000000..97815a3 Binary files /dev/null and b/app/assets/images/Site/game-land-logo-white.png differ diff --git a/app/assets/images/Site/game-land-logo.png b/app/assets/images/Site/game-land-logo.png new file mode 100644 index 0000000..78bb325 Binary files /dev/null and b/app/assets/images/Site/game-land-logo.png differ diff --git a/app/assets/images/Site/gameland.jpg b/app/assets/images/Site/gameland.jpg index b7edf3f..707da66 100644 Binary files a/app/assets/images/Site/gameland.jpg and b/app/assets/images/Site/gameland.jpg differ diff --git a/app/assets/images/Site/support.png b/app/assets/images/Site/support.png new file mode 100644 index 0000000..6e0877c Binary files /dev/null and b/app/assets/images/Site/support.png differ diff --git a/app/assets/images/Site/video-game-wallpapers.jpg b/app/assets/images/Site/video-game-wallpapers.jpg new file mode 100644 index 0000000..b4a1060 Binary files /dev/null and b/app/assets/images/Site/video-game-wallpapers.jpg differ diff --git a/app/assets/images/action.png b/app/assets/images/action.png new file mode 100644 index 0000000..1027f60 Binary files /dev/null and b/app/assets/images/action.png differ diff --git a/app/assets/images/gamepad.png b/app/assets/images/gamepad.png new file mode 100644 index 0000000..d2a1443 Binary files /dev/null and b/app/assets/images/gamepad.png differ diff --git a/app/assets/images/gamepadP.png b/app/assets/images/gamepadP.png new file mode 100644 index 0000000..61c5e43 Binary files /dev/null and b/app/assets/images/gamepadP.png differ diff --git a/app/assets/images/hiker.png b/app/assets/images/hiker.png new file mode 100644 index 0000000..75f8a13 Binary files /dev/null and b/app/assets/images/hiker.png differ diff --git a/app/assets/images/logo-back.png b/app/assets/images/logo-back.png new file mode 100644 index 0000000..753437b Binary files /dev/null and b/app/assets/images/logo-back.png differ diff --git a/app/assets/images/nintendo.png b/app/assets/images/nintendo.png new file mode 100644 index 0000000..593f064 Binary files /dev/null and b/app/assets/images/nintendo.png differ diff --git a/app/assets/images/pc.png b/app/assets/images/pc.png new file mode 100644 index 0000000..fa87777 Binary files /dev/null and b/app/assets/images/pc.png differ diff --git a/app/assets/images/racing.png b/app/assets/images/racing.png new file mode 100644 index 0000000..10b87d1 Binary files /dev/null and b/app/assets/images/racing.png differ diff --git a/app/assets/images/sports.png b/app/assets/images/sports.png new file mode 100644 index 0000000..69956d1 Binary files /dev/null and b/app/assets/images/sports.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 46b2035..8e3b067 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,3 +13,33 @@ //= require rails-ujs //= require turbolinks //= require_tree . +//= require jquery3 +//= require jquery_ujs + +document.addEventListener("turbolinks:load", function() { + // whatever you want to make sure is loaded on each page + + // Footer fix + // function to set the height on fly + function autoHeight() { + $('.mainCont').css('min-height', 0); + $('.mainCont').css('min-height', ( + $(document).height() - + $('.header').height() - + $('.foot').height() + )); + } + + // onDocumentReady function bind + $(document).ready(function() { + autoHeight(); + }); + + // onResize bind of the function + $(window).resize(function() { + autoHeight(); + }); + + // End Footer fix + +}) diff --git a/app/assets/javascripts/consoles.coffee b/app/assets/javascripts/consoles.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/consoles.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/genres.coffee b/app/assets/javascripts/genres.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/genres.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/orderitems.coffee b/app/assets/javascripts/orderitems.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/orderitems.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/orders.coffee b/app/assets/javascripts/orders.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/orders.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index ca351e2..bacf8d9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,14 +1,49 @@ /* General */ +@import url('https://fonts.googleapis.com/css?family=Roboto:400,700'); + html, body { margin: 0; padding: 0; - background-color: rgba(100, 68, 100, 0.1) + font-family: 'Roboto', sans-serif; + background-color: rgba(100, 68, 100, 0.1); +} + +.mainCont { + margin-left: auto; + margin-right: auto; + max-width: 100%; + text-align: center; + padding-left: 0; + padding-right: 0; + min-height: 100%; } .button { - background-color: rgba(100, 68, 100, 0.7); + background-color: rgb(222, 62, 62); + border: none; + color: white; + padding: 10px 10px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; + min-width: 5em; +} + +.button:hover { + background-color: #000; + border: none; + color: white; + text-decoration: none; + min-width: 5em; +} + +.buttonfull { + background-color: rgb(222, 62, 62); border: none; color: white; padding: 10px 10px; @@ -19,6 +54,26 @@ body { margin: 4px 2px; cursor: pointer; min-width: 5em; + width: 100%; +} + +.buttonfull:hover { + background-color: #000; + border: none; + color: white; + padding: 10px 10px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; + min-width: 5em; + width: 100%; +} + +#notice { + padding-left: 2%; } /* Header */ @@ -42,6 +97,12 @@ body { text-align: center; } +.header ul { + list-style-type: none; + overflow: hidden; + background-color: rgba(0, 0, 0, .9); +} + .header li { float: left; } @@ -54,35 +115,123 @@ body { padding: 14px 16px; } -.header ul { - list-style-type: none; - overflow: hidden; - background-color: rgba(100, 68, 100, 0.3); +.header li a:hover { + color: rgb(222, 62, 62); +} + +.isAdminLi { + color: red; + padding-top: 13px; + font-size: 18px; + margin-left: 20px; } /* Footer */ .foot { - min-height: 4em; + min-height: 100px; background: url("/assets/Site/gameland.jpg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; width: 100%; - margin-bottom: 0em; - overflow: auto; + overflow: hidden; + bottom: 0; } +.footer-buttons { + padding-left: 20px; + padding-right: 20px; + padding-top: 10px; + text-align: center; +} -.mainCont { - margin: auto; - width: 80%; - border: solid 3px #b3200f; +.team { text-align: center; - padding: 10px; + padding-top: 10px; + width: 100%; + margin-bottom: 20px; + font-size: 18px; + font-weight: 700; + color: white; +} + +#freeIconsCredits { + color: grey; + font-size: 0.4em; + width: 100%; + padding-bottom: 15px; +} + +.credit { + text-align: center; +} + +/* Home */ + +.search { + padding-top: 10px; + margin-right: 30px; + margin-bottom: 30px; + text-align: right; +} + +.icon { + width: 5em; + opacity: 0.9; } +.iconsdiv { + width: 23%; + text-align: center; + display: block; + background-color: transparent; + border: 1px solid transparent; + margin-right: 0; + margin-bottom: 1px; + float: left; + padding: 2em; + padding-left: 0; +} + +.home-catButton { + width: 25%; + margin-right: auto; + margin-left: auto; +} + +@media only screen and (max-width: 1440px) { + .icon { + padding-left: 1.5em; + } + + .iconsdiv { + width: 22%; + } +} + +@media only screen and (max-width: 1024px) { + .icon { + padding-left: 3.2em; + } + + .iconsdiv { + width: 20%; + } +} + +/* Details(Show)*/ + +.details { + text-align: left; + padding: 2%; + padding-top: .5%; + font-size: 18px; +} + +/* Games(Items)*/ + #itemsContainer { width: 100%; text-align: center; @@ -96,8 +245,6 @@ h1 { text-decoration: none; } -/* Item */ - .item { margin-left: auto; margin-right: auto; @@ -131,43 +278,91 @@ h1 { display: block; } - +@media only screen and (max-width: 768px) { + .item { + width: 80%; + } +} #itemsContainer h2 { - display: block; + display: block; color: #555; text-align: justify; padding: 14px 16px; text-decoration: none; font-size: 20px - } .itemhols p { - display: block; + display: block; color: #4CAF50; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 16px - } - - .itemholsIm { - width: 30%; - margin-left: auto; - margin-right: auto; + width: 30%; + margin-left: auto; + margin-right: auto; display: block; - + } +.item-new { + text-align: left; + padding: 1% 2%; +} + + +/* Devise */ + +.devise-new { + text-align: left; + padding: 1% 2%; +} + +.field { + margin-top: .8%; +} +.actions { + margin-top: .8%; + margin-bottom: .8%; +} +/* Orders and Consoles*/ +.orders, +.consoles { + text-align: left; + margin-right: auto; + margin-left: auto; +} +.orders-table, +.consoles-table { + margin-left: auto; + margin-right: auto; + width: 60%; + padding-left: 1%; + padding-right: 1%; +} + +.new-order { + margin-left: 2%; + margin-bottom: 2%; +} + +@media only screen and (max-width: 1024px) { + .orders-table { + width: 100%; + } +} + +/* Cart and Checkout */ #customers { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; @@ -176,14 +371,19 @@ h1 { width: 100%; } -#customers td, #customers th { +#customers td, +#customers th { border: 1px solid #ddd; padding: 8px; } -#customers tr:nth-child(even){background-color: rgba(100, 68, 100, 0.1);} +#customers tr:nth-child(even) { + background-color: rgba(100, 68, 100, 0.1); +} -#customers tr:hover {background-color:rgba(100, 68, 100, 0.3);} +#customers tr:hover { + background-color: rgba(100, 68, 100, 0.3); +} #customers th { padding-top: 12px; @@ -200,3 +400,18 @@ h1 { padding: 2em; } } + +.bodyback { + background: url("logo-back.png"); + background-repeat: no-repeat; + background-attachment: fixed; +} + +.edit-button { + width: 100%; + margin-right: auto; + margin-left: auto; + text-align: center; + padding-top: 2%; + padding-bottom: 2%; +} diff --git a/app/assets/stylesheets/consoles.scss b/app/assets/stylesheets/consoles.scss new file mode 100644 index 0000000..11dd094 --- /dev/null +++ b/app/assets/stylesheets/consoles.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the consoles controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/genres.scss b/app/assets/stylesheets/genres.scss new file mode 100644 index 0000000..430a043 --- /dev/null +++ b/app/assets/stylesheets/genres.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the genres controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/orderitems.scss b/app/assets/stylesheets/orderitems.scss new file mode 100644 index 0000000..3ae284d --- /dev/null +++ b/app/assets/stylesheets/orderitems.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the orderitems controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/orders.scss b/app/assets/stylesheets/orders.scss new file mode 100644 index 0000000..3b0428a --- /dev/null +++ b/app/assets/stylesheets/orders.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the orders controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c07694..3917c80 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,11 @@ class ApplicationController < ActionController::Base - protect_from_forgery with: :exception -end + before_action :configure_permitted_parameters, if: :devise_controller? + + protected + + def configure_permitted_parameters + added_attrs = [:username, :email, :password, :password_confirmation, :remember_me] + devise_parameter_sanitizer.permit :sign_up, keys: added_attrs + devise_parameter_sanitizer.permit :account_update, keys: added_attrs + end +end \ No newline at end of file diff --git a/app/controllers/cart_controller.rb b/app/controllers/cart_controller.rb index f0182ef..d6d0305 100644 --- a/app/controllers/cart_controller.rb +++ b/app/controllers/cart_controller.rb @@ -56,6 +56,29 @@ def clearCart redirect_to :action => :index end + def createOrder + + # get current user id + @user = User.find(current_user.id) + # create an order for the user + @order = @user.orders.build(:order_date => DateTime.now, :status => 'Pending') + + @order.save + + # put items currently in the cart + @cart = session[:cart] || {} # get content of current cart + + @cart.each do | id, quantity | + item = Item.find_by_id(id) + + @orderitem = @order.orderitems.build(:item_id => item.id, :title => item.title, :description => item.description, :quantity => quantity, :price => item.price) + @orderitem.save + end + @orders = Order.all + @orderitems = Orderitem.where(order_id: Order.last) + #session[:cart] = nil + end + end \ No newline at end of file diff --git a/app/controllers/consoles_controller.rb b/app/controllers/consoles_controller.rb new file mode 100644 index 0000000..b101b3f --- /dev/null +++ b/app/controllers/consoles_controller.rb @@ -0,0 +1,74 @@ +class ConsolesController < ApplicationController + before_action :set_console, only: [:show, :edit, :update, :destroy] + + # GET /consoles + # GET /consoles.json + def index + @consoles = Console.all + end + + # GET /consoles/1 + # GET /consoles/1.json + def show + end + + # GET /consoles/new + def new + @console = Console.new + end + + # GET /consoles/1/edit + def edit + end + + # POST /consoles + # POST /consoles.json + def create + @console = Console.new(console_params) + + respond_to do |format| + if @console.save + format.html { redirect_to @console, notice: 'Console was successfully created.' } + format.json { render :show, status: :created, location: @console } + else + format.html { render :new } + format.json { render json: @console.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /consoles/1 + # PATCH/PUT /consoles/1.json + def update + respond_to do |format| + if @console.update(console_params) + format.html { redirect_to @console, notice: 'Console was successfully updated.' } + format.json { render :show, status: :ok, location: @console } + else + format.html { render :edit } + format.json { render json: @console.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /consoles/1 + # DELETE /consoles/1.json + def destroy + @console.destroy + respond_to do |format| + format.html { redirect_to consoles_url, notice: 'Console was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_console + @console = Console.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def console_params + params.require(:console).permit(:title, :description, :image) + end +end diff --git a/app/controllers/genres_controller.rb b/app/controllers/genres_controller.rb new file mode 100644 index 0000000..62e2833 --- /dev/null +++ b/app/controllers/genres_controller.rb @@ -0,0 +1,74 @@ +class GenresController < ApplicationController + before_action :set_genre, only: [:show, :edit, :update, :destroy] + + # GET /genres + # GET /genres.json + def index + @genres = Genre.all + end + + # GET /genres/1 + # GET /genres/1.json + def show + end + + # GET /genres/new + def new + @genre = Genre.new + end + + # GET /genres/1/edit + def edit + end + + # POST /genres + # POST /genres.json + def create + @genre = Genre.new(genre_params) + + respond_to do |format| + if @genre.save + format.html { redirect_to @genre, notice: 'Genre was successfully created.' } + format.json { render :show, status: :created, location: @genre } + else + format.html { render :new } + format.json { render json: @genre.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /genres/1 + # PATCH/PUT /genres/1.json + def update + respond_to do |format| + if @genre.update(genre_params) + format.html { redirect_to @genre, notice: 'Genre was successfully updated.' } + format.json { render :show, status: :ok, location: @genre } + else + format.html { render :edit } + format.json { render json: @genre.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /genres/1 + # DELETE /genres/1.json + def destroy + @genre.destroy + respond_to do |format| + format.html { redirect_to genres_url, notice: 'Genre was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_genre + @genre = Genre.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def genre_params + params.require(:genre).permit(:title, :description, :image) + end +end diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 49523d5..ab3275b 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -6,6 +6,12 @@ class ItemsController < ApplicationController def index @items = Item.all end + + def search + @search_term = params[:q] + st = "%#{params[:q]}%" + @items = Item.where("title like ?", st) + end # GET /items/1 # GET /items/1.json @@ -15,10 +21,14 @@ def show # GET /items/new def new @item = Item.new + @consoles = Console.all + @genres = Genre.all end # GET /items/1/edit def edit + @consoles = Console.all + @genres = Genre.all end # POST /items diff --git a/app/controllers/orderitems_controller.rb b/app/controllers/orderitems_controller.rb new file mode 100644 index 0000000..1f9cb6f --- /dev/null +++ b/app/controllers/orderitems_controller.rb @@ -0,0 +1,13 @@ +class OrderitemsController < ApplicationController + def index + end + + def show + end + + def new + end + + def edit + end +end diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb new file mode 100644 index 0000000..de792e9 --- /dev/null +++ b/app/controllers/orders_controller.rb @@ -0,0 +1,91 @@ +class OrdersController < ApplicationController + before_action :set_order, only: [:show, :edit, :update, :destroy] + + # GET /orders + # GET /orders.json + def index + # filtering information according to current user + + @user = User.find(current_user.id) + + if @user.admin? + + @orders = Order.all + + else + + @orders = @user.orders.all + + end + + #@orders = Order.all + end + + # GET /orders/1 + # GET /orders/1.json + def show + + + @orderitems = Orderitem.where(order_id: params[:id]) + end + + # GET /orders/new + def new + @order = Order.new + end + + # GET /orders/1/edit + def edit + end + + # POST /orders + # POST /orders.json + def create + @order = Order.new(order_params) + + respond_to do |format| + if @order.save + format.html { redirect_to @order, notice: 'Order was successfully created.' } + format.json { render :show, status: :created, location: @order } + else + format.html { render :new } + format.json { render json: @order.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /orders/1 + # PATCH/PUT /orders/1.json + def update + respond_to do |format| + if @order.update(order_params) + format.html { redirect_to @order, notice: 'Order was successfully updated.' } + format.json { render :show, status: :ok, location: @order } + else + format.html { render :edit } + format.json { render json: @order.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /orders/1 + # DELETE /orders/1.json + def destroy + @order.destroy + respond_to do |format| + format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_order + @order = Order.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def order_params + params.require(:order).permit(:order_date, :user_id, :status) + end +end diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 94f0ca9..89f834c 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -1,5 +1,8 @@ class StaticPagesController < ApplicationController def home + + @genres = Genre.all + @consoles = Console.all end def about @@ -7,4 +10,26 @@ def about def help end + + def paid + flash[:notice] = "Transaction successfully complete." + @order = Order.last + @order.update_attribute(:status, "Paid by #{current_user.email}") + session[:cart] = nil + + end + + def console + consoleName = params[:title] + @consoleName = consoleName + @items= Item.where("console like ?", consoleName) + end + + def genre + genreName = params[:title] + @genreName = genreName + @items = Item.where("genre like ?", genreName) + #@items= Item.all + end + end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 54d2f90..1962847 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -2,9 +2,11 @@ class UserController < ApplicationController def login session[:login] = 1 - flash[:notice] = "you are logged in" + flash[:notice] = "You are logged in!" redirect_to :controller => :items #session[:cart] = nil + + current_user.update_attribute :admin, true end def logout #in case things go crazy and impossible to understand uncomment the line below and logout /login diff --git a/app/helpers/consoles_helper.rb b/app/helpers/consoles_helper.rb new file mode 100644 index 0000000..2c80777 --- /dev/null +++ b/app/helpers/consoles_helper.rb @@ -0,0 +1,2 @@ +module ConsolesHelper +end diff --git a/app/helpers/genres_helper.rb b/app/helpers/genres_helper.rb new file mode 100644 index 0000000..1288fa5 --- /dev/null +++ b/app/helpers/genres_helper.rb @@ -0,0 +1,2 @@ +module GenresHelper +end diff --git a/app/helpers/orderitems_helper.rb b/app/helpers/orderitems_helper.rb new file mode 100644 index 0000000..c74e407 --- /dev/null +++ b/app/helpers/orderitems_helper.rb @@ -0,0 +1,2 @@ +module OrderitemsHelper +end diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb new file mode 100644 index 0000000..443227f --- /dev/null +++ b/app/helpers/orders_helper.rb @@ -0,0 +1,2 @@ +module OrdersHelper +end diff --git a/app/models/console.rb b/app/models/console.rb new file mode 100644 index 0000000..da5e96f --- /dev/null +++ b/app/models/console.rb @@ -0,0 +1,2 @@ +class Console < ApplicationRecord +end diff --git a/app/models/genre.rb b/app/models/genre.rb new file mode 100644 index 0000000..940a922 --- /dev/null +++ b/app/models/genre.rb @@ -0,0 +1,2 @@ +class Genre < ApplicationRecord +end diff --git a/app/models/order.rb b/app/models/order.rb new file mode 100644 index 0000000..65a44ba --- /dev/null +++ b/app/models/order.rb @@ -0,0 +1,8 @@ +class Order < ApplicationRecord + belongs_to :user + + def order_params + params.require(:order).permit(:order_date, :user_id, :status) + end + has_many:orderitems , dependent: :destroy +end diff --git a/app/models/orderitem.rb b/app/models/orderitem.rb new file mode 100644 index 0000000..a918491 --- /dev/null +++ b/app/models/orderitem.rb @@ -0,0 +1,3 @@ +class Orderitem < ApplicationRecord + belongs_to :order +end diff --git a/app/models/user.rb b/app/models/user.rb index b2091f9..ae09450 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,5 +2,39 @@ class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable + :recoverable, :rememberable, :trackable, :validatable, authentication_keys: [:login] + + validates :username, presence: :true, uniqueness: { case_sensitive: false } + # Only allow letter, number, underscore and punctuation. + validate :validate_username + + def validate_username + if User.where(email: username).exists? + errors.add(:username, :invalid) + end + end + + + def user_params + params.require(:user).permit(:email,:password_confirmation,:remember_me) + end + + def login=(login) + @login = login + end + + def login + @login || self.username || self.email + end + + def self.find_for_database_authentication(warden_conditions) + conditions = warden_conditions.dup + if login = conditions.delete(:login) + where(conditions.to_h).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first + elsif conditions.has_key?(:username) || conditions.has_key?(:email) + where(conditions.to_h).first + end + end + + has_many:orders end diff --git a/app/views/cart/createOrder.html.erb b/app/views/cart/createOrder.html.erb new file mode 100644 index 0000000..094b380 --- /dev/null +++ b/app/views/cart/createOrder.html.erb @@ -0,0 +1,72 @@ +
+ + + + + +
+ + + + + <% @orders.limit(1).order(id: :desc).each do |order| %> + + + <% end %> + + + + +
+ +

Order reference: <%= order.id %>

+ +
+ + + + <% @total = 0 %> + <% @orderitems.each do |id, quantity| %> + + + <% item = Orderitem.find_by_id(id) %> + + + + + + + + <% timx = (item.quantity * item.price) %> + <% @total += timx %> + + + + + + <% end %> + + + + + + +<% shipping = 10 %> +<% @overall = shipping + @total %> + + + + + + + + + + + + + + + + +
Product: <%= item.title %><%= item.quantity %><%= number_to_currency(item.price, :unit => "€") %><%= number_to_currency(item.quantity * item.price, :unit => "€") %>
Order Total: € <%= @total %>
Shipping € 10.00

You pay: € <%= @overall %>

Submit payment
\ No newline at end of file diff --git a/app/views/cart/index.html.erb b/app/views/cart/index.html.erb index 2c79b92..a15baff 100644 --- a/app/views/cart/index.html.erb +++ b/app/views/cart/index.html.erb @@ -1,9 +1,9 @@

<%= notice %>

-
+
<% if@cart.empty? %> -

Your cart is empty, please add somthing to make a purchase

+

Your cart is empty, please add somthing to make a purchase.

<% end %> @@ -28,19 +28,18 @@ - + <% total += quantity * item.price %> - + <% end %> - - @@ -48,7 +47,8 @@

Continue Shopping - Clear Cart + Clear Cart + Checkout

diff --git a/app/views/consoles/_console.json.jbuilder b/app/views/consoles/_console.json.jbuilder new file mode 100644 index 0000000..65080c5 --- /dev/null +++ b/app/views/consoles/_console.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! console, :id, :title, :description, :image, :created_at, :updated_at +json.url console_url(console, format: :json) diff --git a/app/views/consoles/_form.html.erb b/app/views/consoles/_form.html.erb new file mode 100644 index 0000000..385fc0d --- /dev/null +++ b/app/views/consoles/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_with(model: console, local: true) do |form| %> + <% if console.errors.any? %> +
+

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

+ +
    + <% console.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form.label :title %> + <%= form.text_field :title, id: :console_title %> +
+ +
+ <%= form.label :description %> + <%= form.text_area :description, id: :console_description %> +
+ +
+ <%= form.label :image %> + <%= form.text_field :image, id: :console_image %> +
+ +
+ <%= form.submit :class => 'button', :role => 'button' %> +
+<% end %> diff --git a/app/views/consoles/edit.html.erb b/app/views/consoles/edit.html.erb new file mode 100644 index 0000000..9001ce1 --- /dev/null +++ b/app/views/consoles/edit.html.erb @@ -0,0 +1,10 @@ +

Editing Console

+ +
+ +<%= render 'form', console: @console %> + +<%= link_to 'Details', @console, :class => "button", :role => "button" %> +<%= link_to 'Back', consoles_path, :class => "button", :role => "button" %> + +
diff --git a/app/views/consoles/index.html.erb b/app/views/consoles/index.html.erb new file mode 100644 index 0000000..ee460b2 --- /dev/null +++ b/app/views/consoles/index.html.erb @@ -0,0 +1,46 @@ +

<%= notice %>

+ +
+ +

Consoles

+ +
- Grand Total: <%= number_to_currency(total, :unit => "€") %> + +

Grand Total: <%= number_to_currency(total, :unit => "€") %>

+ + + + + + + + + + + <% @consoles.each do |console| %> + + + + + <% if user_signed_in? %> + <% if current_user.admin? %> + + + + <% else %> + + <% end %> + <% else %> + + <% end %> + + <% end %> + + <% if user_signed_in? %> + <% if current_user.admin? %> + + <% end %> + <% end %> + + +
TitleDescriptionImage
<%= console.title %><%= console.description %><%= console.image %><%= link_to 'Details', console, :class => "button", :role => "button" %><%= link_to 'Edit', edit_console_path(console), :class => "button", :role => "button" %><%= link_to 'Destroy', console, :class => "button", :role => "button", method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to 'Details', console, :class => "button", :role => "button" %><%= link_to 'Details', console, :class => "button", :role => "button" %>
<%= link_to 'New Console', new_console_path, :class => "button", :role => "button" %>
+ +
\ No newline at end of file diff --git a/app/views/consoles/index.json.jbuilder b/app/views/consoles/index.json.jbuilder new file mode 100644 index 0000000..ccbeee7 --- /dev/null +++ b/app/views/consoles/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @consoles, partial: 'consoles/console', as: :console diff --git a/app/views/consoles/new.html.erb b/app/views/consoles/new.html.erb new file mode 100644 index 0000000..cfd3e0d --- /dev/null +++ b/app/views/consoles/new.html.erb @@ -0,0 +1,12 @@ +

New Console

+ +
+ +<%= render 'form', console: @console %> + +<%= link_to 'Back', consoles_path, :class => "button", :role => "button" %> + +
+
+ +
diff --git a/app/views/consoles/show.html.erb b/app/views/consoles/show.html.erb new file mode 100644 index 0000000..cd8db15 --- /dev/null +++ b/app/views/consoles/show.html.erb @@ -0,0 +1,31 @@ +

<%= notice %>

+ +
+ +

+ Title: + <%= @console.title %> +

+ +

+ Description: + <%= @console.description %> +

+ +

+ Image: + <%= @console.image %> +

+ +<% if user_signed_in? %> + <% if current_user.admin? %> +<%= link_to 'Edit', edit_console_path(@console), :class => "button", :role => "button" %> +<%= link_to 'Back', consoles_path, :class => "button", :role => "button" %> +<% else %> +<%= link_to 'Back', consoles_path, :class => "button", :role => "button" %> +<% end %> +<% else %> +<%= link_to 'Back', consoles_path, :class => "button", :role => "button" %> +<% end %> + +
\ No newline at end of file diff --git a/app/views/consoles/show.json.jbuilder b/app/views/consoles/show.json.jbuilder new file mode 100644 index 0000000..3488e31 --- /dev/null +++ b/app/views/consoles/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "consoles/console", console: @console diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..e5a2406 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,20 @@ +
+ +

Resend confirmation instructions

+ +<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> +
+ +
+ <%= f.submit "Resend confirmation instructions", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @email %>!

+ +<% if @resource.try(:unconfirmed_email?) %> +

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

+<% else %> +

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

+<% end %> diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +

Hello <%= @resource.email %>!

+ +

We're contacting you to notify you that your password has been changed.

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..12f9614 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,29 @@ +
+ +

Change your password

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +
+ <%= f.label :password, "New password" %>
+ <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum)
+ <% end %> + <%= f.password_field :password, autofocus: true, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Change my password", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
\ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..f059d42 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,20 @@ +
+ +

Forgot your password?

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Send me reset password instructions", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..5bcad95 --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,52 @@ +
+ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :username %>
+ <%= f.text_field :username %> +
+ +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + +
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "off" %> + <% if @minimum_password_length %> +
+ <%= @minimum_password_length %> characters minimum + <% end %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "off" %> +
+ +
+ <%= f.submit "Update", :class => "button", :role => "button" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :class => "button", :role => "button", data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back, :class => "button", :role => "button" %> + +
\ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..23e7be7 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,38 @@ +
+ +

Sign up

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :username %>
+ <%= f.text_field :username %> +
+ +
+ <%= f.label :email %>
+ <%= f.email_field :email %> +
+ +
+ <%= f.label :password %> + <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Sign up", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
\ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..98b7e9f --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,30 @@ +
+ +

Log in

+ +<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.label :login %>
+ <%= f.text_field :login %> +
+ +
+ <%= f.label :password %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ + <% if devise_mapping.rememberable? -%> +
+ <%= f.check_box :remember_me %> + <%= f.label :remember_me %> +
+ <% end -%> + +
+ <%= f.submit "Log in", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 0000000..5ff4a41 --- /dev/null +++ b/app/views/devise/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name), :class => "button", :role => "button" %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name), :class => "button", :role => "button" %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name), :class => "button", :role => "button" %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..b417678 --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,20 @@ +
+ +

Resend unlock instructions

+ +<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Resend unlock instructions", :class => "button", :role => "button" %> +
+<% end %> + +<%= render "devise/shared/links" %> + +
\ No newline at end of file diff --git a/app/views/genres/_form.html.erb b/app/views/genres/_form.html.erb new file mode 100644 index 0000000..70e41ad --- /dev/null +++ b/app/views/genres/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_with(model: genre, local: true) do |form| %> + <% if genre.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= form.label :title %> + <%= form.text_field :title, id: :genre_title %> +
+ +
+ <%= form.label :description %> + <%= form.text_area :description, id: :genre_description %> +
+ +
+ <%= form.label :image %> + <%= form.text_field :image, id: :genre_image %> +
+ +
+ <%= form.submit :class => 'button', :role => 'button' %> +
+<% end %> diff --git a/app/views/genres/_genre.json.jbuilder b/app/views/genres/_genre.json.jbuilder new file mode 100644 index 0000000..f63d73a --- /dev/null +++ b/app/views/genres/_genre.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! genre, :id, :title, :description, :image, :created_at, :updated_at +json.url genre_url(genre, format: :json) diff --git a/app/views/genres/edit.html.erb b/app/views/genres/edit.html.erb new file mode 100644 index 0000000..34f8117 --- /dev/null +++ b/app/views/genres/edit.html.erb @@ -0,0 +1,10 @@ +

Editing Genre

+ +
+ +<%= render 'form', genre: @genre %> + +<%= link_to 'Details', @genre, :class => "button", :role => "button" %> +<%= link_to 'Back', genres_path, :class => "button", :role => "button" %> + +
diff --git a/app/views/genres/index.html.erb b/app/views/genres/index.html.erb new file mode 100644 index 0000000..12f3b05 --- /dev/null +++ b/app/views/genres/index.html.erb @@ -0,0 +1,46 @@ +

<%= notice %>

+ +
+ +

Genres

+ + + + + + + + + + + + + <% @genres.each do |genre| %> + + + + + <% if user_signed_in? %> + <% if current_user.admin? %> + + + + <% else %> + + <% end %> + <% else %> + + <% end %> + + <% end %> + + <% if user_signed_in? %> + <% if current_user.admin? %> + + <% end %> + <% end %> + + +
TitleDescriptionImage
<%= genre.title %><%= genre.description %><%= genre.image %><%= link_to 'Details', genre, :class => "button", :role => "button" %><%= link_to 'Edit', edit_genre_path(genre), :class => "button", :role => "button" %><%= link_to 'Destroy', genre, :class => "button", :role => "button", method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to 'Details', genre, :class => "button", :role => "button" %><%= link_to 'Details', genre, :class => "button", :role => "button" %>
<%= link_to 'New Genre', new_genre_path, :class => "button", :role => "button" %>
+ +
\ No newline at end of file diff --git a/app/views/genres/index.json.jbuilder b/app/views/genres/index.json.jbuilder new file mode 100644 index 0000000..284656b --- /dev/null +++ b/app/views/genres/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @genres, partial: 'genres/genre', as: :genre diff --git a/app/views/genres/new.html.erb b/app/views/genres/new.html.erb new file mode 100644 index 0000000..fa2f859 --- /dev/null +++ b/app/views/genres/new.html.erb @@ -0,0 +1,12 @@ +

New Genre

+ +
+ +<%= render 'form', genre: @genre %> + +<%= link_to 'Back', genres_path, :class =>"button", :role=>"button" %> + +
+
+ +
\ No newline at end of file diff --git a/app/views/genres/show.html.erb b/app/views/genres/show.html.erb new file mode 100644 index 0000000..8efd596 --- /dev/null +++ b/app/views/genres/show.html.erb @@ -0,0 +1,31 @@ +

<%= notice %>

+ +
+ +

+ Title: + <%= @genre.title %> +

+ +

+ Description: + <%= @genre.description %> +

+ +

+ Image: + <%= @genre.image %> +

+ + <% if user_signed_in? %> + <% if current_user.admin? %> +<%= link_to 'Edit', edit_genre_path(@genre), :class => "button", :role => "button" %> +<%= link_to 'Back', genres_path, :class => "button", :role => "button" %> +<% else %> +<%= link_to 'Back', genres_path, :class => "button", :role => "button" %> +<% end %> +<% else %> +<%= link_to 'Back', genres_path, :class => "button", :role => "button" %> +<% end %> + +
\ No newline at end of file diff --git a/app/views/genres/show.json.jbuilder b/app/views/genres/show.json.jbuilder new file mode 100644 index 0000000..dc7a610 --- /dev/null +++ b/app/views/genres/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "genres/genre", genre: @genre diff --git a/app/views/items/_form.html.erb b/app/views/items/_form.html.erb index f1f66cb..fa53113 100644 --- a/app/views/items/_form.html.erb +++ b/app/views/items/_form.html.erb @@ -12,13 +12,26 @@ <% end %>
- <%= form.label :title %> + <%= form.label :title%> <%= form.text_field :title, id: :item_title %>
+ + + + + + + + + + + + +
<%= form.label :console %> - <%= form.text_field :console, id: :item_console %> + <%= form.select :console, ['Playstation 4', 'Xbox One', 'PC', 'Nintendo Switch'], id: :item_console %>
@@ -26,9 +39,21 @@ <%= form.text_field :brand, id: :item_brand %>
+ + + + + + + + + + + +
<%= form.label :genre %> - <%= form.text_field :genre, id: :item_genre %> + <%= form.select :genre, ['Adventure', 'Racing', 'Sports', 'Action'], id: :item_console %>
@@ -46,7 +71,8 @@ <%= form.text_field :image_url, id: :item_image_url %>
-
- <%= form.submit %> +
+ <%= form.submit :class => 'button', :role => 'button' %>
+ <% end %> diff --git a/app/views/items/edit.html.erb b/app/views/items/edit.html.erb index 151333f..bcef268 100644 --- a/app/views/items/edit.html.erb +++ b/app/views/items/edit.html.erb @@ -1,6 +1,10 @@

Editing Item

+
+ <%= render 'form', item: @item %> -<%= link_to 'Show', @item %> | -<%= link_to 'Back', items_path %> +<%= link_to 'Details', @item, :class => "button", :role => "button" %> +<%= link_to 'Back', items_path, :class => "button", :role => "button" %> + +
\ No newline at end of file diff --git a/app/views/items/index.html.erb b/app/views/items/index.html.erb index 295f9b1..3d2b92b 100644 --- a/app/views/items/index.html.erb +++ b/app/views/items/index.html.erb @@ -1,7 +1,7 @@

<%= notice %>

-

Games

+

All Games

<% @items.each do |item| %>
@@ -15,30 +15,29 @@ Brand: <%= item.brand %>
Genre: <%= item.genre %> -

- -

<%= item.description %>

- -

<%= item.price %>

+
+
+ € <%= item.price %>

- Add to cart - <%= link_to 'Show', item, :class => "button", :role => "button" %> - <% if user_signed_in? %> - <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> - <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> + <% if user_signed_in? %> + <% if current_user.admin? %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> + <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> <% end %> - - - + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <% end %> +

-
+
<% end %> - -
- - -
diff --git a/app/views/items/new.html.erb b/app/views/items/new.html.erb index a1c35fe..4a94d80 100644 --- a/app/views/items/new.html.erb +++ b/app/views/items/new.html.erb @@ -1,5 +1,9 @@

New Item

+
+ <%= render 'form', item: @item %> -<%= link_to 'Back', items_path %> +<%= link_to 'Back', items_path, :class => 'button', :role => 'button' %> + +
diff --git a/app/views/items/search.html.erb b/app/views/items/search.html.erb new file mode 100644 index 0000000..4727a87 --- /dev/null +++ b/app/views/items/search.html.erb @@ -0,0 +1,50 @@ +

<%= notice %>

+
+ +

You search our product catalog for: <%= @search_term %>

+ +<% if @items.length == 0 %> +
+

No products were found to match your search

+<% end %> + + + <% @items.each do |item| %> +
+

<%= item.title %>

+ + <%= link_to (image_tag item.image_url, :class => "itemImage"), item %> + +

+ Console: <%= item.console %> +
+ Brand: <%= item.brand %> +
+ Genre: <%= item.genre %> +

+ +

<%= item.description %>

+ +

€ <%= item.price %>

+ +

+ Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + + <% if user_signed_in? %> + <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> + <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> + <% end %> + + + +

+
+ <% end %> + + +
+ + + +
diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb index e4d1174..fae49d4 100644 --- a/app/views/items/show.html.erb +++ b/app/views/items/show.html.erb @@ -1,5 +1,7 @@

<%= notice %>

+
+

Title: <%= @item.title %> @@ -27,7 +29,7 @@

Price: - <%= @item.price %> + € <%= @item.price %>

@@ -35,5 +37,15 @@ <%= @item.image_url %>

-<%= link_to 'Edit', edit_item_path(@item) %> | -<%= link_to 'Back', items_path %> + <% if user_signed_in? %> + <% if current_user.admin? %> +<%= link_to 'Edit', edit_item_path(@item), :class => "button", :role => "button" %> +<%= link_to 'Back', items_path, :class => "button", :role => "button" %> +<% else %> +<%= link_to 'Back', items_path, :class => "button", :role => "button" %> +<% end %> +<% else %> +<%= link_to 'Back', items_path, :class => "button", :role => "button" %> +<% end %> + +
\ No newline at end of file diff --git a/app/views/layouts/_consoles.html.erb b/app/views/layouts/_consoles.html.erb new file mode 100644 index 0000000..1805abf --- /dev/null +++ b/app/views/layouts/_consoles.html.erb @@ -0,0 +1,16 @@ + + + + <% @consoles.each do |console| %> + +
+ + <%= image_tag console.image, :class=>"icon" %> + + +

<%= console.title %>

+ +
+ <% end %> + + \ No newline at end of file diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 4393e8a..7b14e2a 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,8 +1,29 @@ \ No newline at end of file diff --git a/app/views/layouts/_genres.html.erb b/app/views/layouts/_genres.html.erb new file mode 100644 index 0000000..2af946f --- /dev/null +++ b/app/views/layouts/_genres.html.erb @@ -0,0 +1,11 @@ + + + <% @genres.each do |genre| %> +
+ + <%= image_tag genre.image, :class=>"icon" %> +

<%= genre.title %>

+ +
+ <% end %> + diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index ebc6143..0997222 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,24 +1,33 @@
-

GameLand

+ <%= image_tag("Site/game-land-logo.png") %>
\ No newline at end of file diff --git a/app/views/layouts/_iconscredit.html.erb b/app/views/layouts/_iconscredit.html.erb new file mode 100644 index 0000000..735db37 --- /dev/null +++ b/app/views/layouts/_iconscredit.html.erb @@ -0,0 +1,12 @@ +
+

+
+
+Icons made by Sergiu Bagrin from www.flaticon.com is licensed by CC 3.0 BY +Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY +Icons made by Those Icons from www.flaticon.com is licensed by CC 3.0 BY +Icons made by Google from www.flaticon.com is licensed by CC 3.0 BY +

+ + +
\ No newline at end of file diff --git a/app/views/layouts/_search.html.erb b/app/views/layouts/_search.html.erb new file mode 100644 index 0000000..a2b1a8a --- /dev/null +++ b/app/views/layouts/_search.html.erb @@ -0,0 +1,5 @@ +<%= form_tag("/search", :method => "post") do %> + <%= label_tag(:q, "Search game:") %> + <%= text_field_tag(:q) %> + <%= submit_tag("Search") %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a9012f2..02f9f28 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,11 +1,11 @@ - Gamestore + GameLand <%= csrf_meta_tags %> - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'default', 'data-turbolinks-track': 'reload' %> diff --git a/app/views/orderitems/edit.html.erb b/app/views/orderitems/edit.html.erb new file mode 100644 index 0000000..1eec54d --- /dev/null +++ b/app/views/orderitems/edit.html.erb @@ -0,0 +1,2 @@ +

Orderitems#edit

+

Find me in app/views/orderitems/edit.html.erb

diff --git a/app/views/orderitems/index.html.erb b/app/views/orderitems/index.html.erb new file mode 100644 index 0000000..04d2135 --- /dev/null +++ b/app/views/orderitems/index.html.erb @@ -0,0 +1,2 @@ +

Orderitems#index

+

Find me in app/views/orderitems/index.html.erb

diff --git a/app/views/orderitems/new.html.erb b/app/views/orderitems/new.html.erb new file mode 100644 index 0000000..9d28d17 --- /dev/null +++ b/app/views/orderitems/new.html.erb @@ -0,0 +1,2 @@ +

Orderitems#new

+

Find me in app/views/orderitems/new.html.erb

diff --git a/app/views/orderitems/show.html.erb b/app/views/orderitems/show.html.erb new file mode 100644 index 0000000..e8ef659 --- /dev/null +++ b/app/views/orderitems/show.html.erb @@ -0,0 +1,2 @@ +

Orderitems#show

+

Find me in app/views/orderitems/show.html.erb

diff --git a/app/views/orders/_form.html.erb b/app/views/orders/_form.html.erb new file mode 100644 index 0000000..f988494 --- /dev/null +++ b/app/views/orders/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_with(model: order, local: true) do |form| %> + <% if order.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= form.label :order_date %> + <%= form.datetime_select :order_date, id: :order_order_date %> +
+ +
+ <%= form.label :user_id %> + <%= form.text_field :user_id, id: :order_user_id %> +
+ +
+ <%= form.label :status %> + <%= form.text_field :status, id: :order_status %> +
+ +
+ <%= form.submit :class => "button", :role => "button"%> +
+<% end %> diff --git a/app/views/orders/_order.json.jbuilder b/app/views/orders/_order.json.jbuilder new file mode 100644 index 0000000..26e781c --- /dev/null +++ b/app/views/orders/_order.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! order, :id, :order_date, :user_id, :status, :created_at, :updated_at +json.url order_url(order, format: :json) diff --git a/app/views/orders/edit.html.erb b/app/views/orders/edit.html.erb new file mode 100644 index 0000000..83927f1 --- /dev/null +++ b/app/views/orders/edit.html.erb @@ -0,0 +1,13 @@ +
+ +

Editing Order

+ +<%= render 'form', order: @order %> + +<%= link_to 'Details', @order, :class => "button", :role => "button" %> +<%= link_to 'Back', orders_path, :class => "button", :role => "button" %> + +
+
+ +
\ No newline at end of file diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb new file mode 100644 index 0000000..c6d6509 --- /dev/null +++ b/app/views/orders/index.html.erb @@ -0,0 +1,52 @@ +

<%= notice %>

+ +
+ +

Orders

+ + + + + + + + + + + + + <% @orders.each do |order| %> + + + + + + <% if user_signed_in? %> + + <% if current_user.admin? %> + + + + + <% else %> + + + <% end %> + + <% end %> + + <% end %> + + <% if user_signed_in? %> + <% if current_user.admin? %> + + <% end %> + <% end %> + + +
Order dateUsernameStatus
<%= order.order_date.strftime("%d-%m-%Y at %H:%M:%S UTC") %><%= order.user.username %><%= order.status %><%= link_to 'Details', order, :class => 'button', :role => 'button' %><%= link_to 'Edit', edit_order_path(order), :class => 'button', :role => 'button' %><%= link_to 'Destroy', order, :class => 'button', :role => 'button', method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to 'Details', order, :class => 'button', :role => 'button' %>
<%= link_to 'New Order', new_order_path, :class => "button new-order", :role => "button" %>
+ +
+
+ +
\ No newline at end of file diff --git a/app/views/orders/index.json.jbuilder b/app/views/orders/index.json.jbuilder new file mode 100644 index 0000000..9916098 --- /dev/null +++ b/app/views/orders/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @orders, partial: 'orders/order', as: :order diff --git a/app/views/orders/new.html.erb b/app/views/orders/new.html.erb new file mode 100644 index 0000000..c111058 --- /dev/null +++ b/app/views/orders/new.html.erb @@ -0,0 +1,12 @@ +
+ +

New Order

+ +<%= render 'form', order: @order %> + +<%= link_to 'Back', orders_path, :class => "button", :role => "button" %> + +
+
+ +
\ No newline at end of file diff --git a/app/views/orders/show.html.erb b/app/views/orders/show.html.erb new file mode 100644 index 0000000..2a423bb --- /dev/null +++ b/app/views/orders/show.html.erb @@ -0,0 +1,57 @@ +

<%= notice %>

+ +
+ +

Order Details

+ + + + + + + + + + + + + + + + + + + + + <% if user_signed_in? %> + + <% if current_user.admin? %> + + + + <% else %> + + <% end %> + <% end %> + +

Order date

Order by

Order status

<%= @order.order_date.strftime("%d-%m-%Y at %H:%M:%S UTC") %><%= @order.user.username %> <%= @order.status %>
<%= link_to 'Edit Order', edit_order_path(@order), :class =>"button" %><%= link_to 'Back to Orders', orders_path, :class =>"button" %><%= link_to 'Back to Orders', orders_path, :class =>"button" %>
+ + +

Order Details

+ + + + + <% @orderitems.each do |orderitem| %> + + + + + + + <% end %> + +
<%= orderitem.title %>Quantity ordered: <%= orderitem.quantity %>
+ + +
\ No newline at end of file diff --git a/app/views/orders/show.json.jbuilder b/app/views/orders/show.json.jbuilder new file mode 100644 index 0000000..2ddef40 --- /dev/null +++ b/app/views/orders/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "orders/order", order: @order diff --git a/app/views/static_pages/about.html.erb b/app/views/static_pages/about.html.erb index be7cbc1..17bf788 100644 --- a/app/views/static_pages/about.html.erb +++ b/app/views/static_pages/about.html.erb @@ -1,2 +1,47 @@ -

StaticPages#about

-

Find me in app/views/static_pages/about.html.erb

+ + + + GameLand | About + + + + + + + + +
+
+

<%=image_tag("Site/game-land-logo.png") %>
ABOUT GAME LAND

+

GAME LAND is the leading digital distribution platform for PC and Mac games creating easily accessible gaming experiences for gamers worldwide – anytime, anywhere. Offering a “client-free” experience that eliminates the need for a bulky client interface, gamers anywhere can now access their games without any third party involvement.

+

With the largest catalog of games available for download on the web (currently over 6000), GAME LAND offers a strong selection of AAA publishers and a dynamic variety of niche and indie publishers.

+

To serve the growing community, GAME LAND rolled out the industry's most robust loyalty program with the launch of Blue Coins. Blue Coins are earned through various kinds of user activity on the site, but can also be purchased directly with cash. Users can earn Blue Coins by writing reviews, ranking games, and participating in the Game Tutor program.

+
+ +

<%=image_tag("Site/video-game-wallpapers.jpg", class: "img-responsive")%>

+ +
+ +
+
+

Consoles

+

We have a huge range of consoles on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+

Activities

+

We have a huge range of activity games on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+

Genres

+

We have a huge range of different games on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+
+
+

Continue Shopping

+
+ + diff --git a/app/views/static_pages/console.html.erb b/app/views/static_pages/console.html.erb new file mode 100644 index 0000000..2964cd4 --- /dev/null +++ b/app/views/static_pages/console.html.erb @@ -0,0 +1,47 @@ +
+ +

<%= @consoleName %>

+ + + <% if @items.length ==0 %> +

no items

+ <% end %> + + + <% @items.each do |item| %> + +
+ +

<%= item.title %>

+ + <%= image_tag item.image_url, :class=>"itemImage" %> +

+ Console: <%= item.console %> +
+ Brand: <%= item.brand %> +
+ Genre: <%= item.genre %> +

+ +

€ <%= item.price %>

+ +

+ <% if user_signed_in? %> + <% if current_user.admin? %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> + <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <% end %> + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <% end %> + + +

+ <% end %> +
\ No newline at end of file diff --git a/app/views/static_pages/genre.html.erb b/app/views/static_pages/genre.html.erb new file mode 100644 index 0000000..49d4437 --- /dev/null +++ b/app/views/static_pages/genre.html.erb @@ -0,0 +1,47 @@ +
+ +

Showing: <%= @genreName%>

+ + <% if @items.length ==0 %> +

no items

+ <% end %> + + <% @items.each do |item| %> + +
+ +

<%= item.title %>

+ + + + <%= image_tag item.image_url, :class=>"itemImage" %> +

+ Console: <%= item.console %> +
+ Brand: <%= item.brand %> +
+ Genre: <%= item.genre %> +

+ +

€ <%= item.price %>

+ +

+ <% if user_signed_in? %> + <% if current_user.admin? %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> + <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <% end %> + <% else %> + Add to cart + <%= link_to 'Details', item, :class => "button", :role => "button" %> + <% end %> + + +

+ <% end %> +
\ No newline at end of file diff --git a/app/views/static_pages/help.html.erb b/app/views/static_pages/help.html.erb index 61896f5..2ceb7f3 100644 --- a/app/views/static_pages/help.html.erb +++ b/app/views/static_pages/help.html.erb @@ -1,2 +1,90 @@ -

StaticPages#help

-

Find me in app/views/static_pages/help.html.erb

+ + + + GameLand | Help + + + + + + + + +
+
+

<%=image_tag("Site/game-land-logo.png") %>
We're Here To Help!!

+

How do I contact Game World?

+You can contact Game Online via the following methods: + +  +

Black Friday Online Support

+Thank you for your support during the Black Friday trading period. We have experienced a large volume of queries which has impacted our online call centre ability to answer all your calls. + +Please can we ask that you email your query to websupport@gameworld.com and we will aim to respond on the same business day. + +A few tips to assist you: +
    +
  • Any challenges with payment via Credit Card or Instant EFT please contact our payment partner PayU on 086 111 7298
  • +
  • If you have placed a TV order and need to supply your ID copy in order to release the order, please send this to websupport@gameworld.com with your order number in the subject line
  • +
  • For any other queries call Game Online Support: 0861 426 333
  • +
+  + +  + +General Game Customer Support + +Customer Call Centre: 0861 426 322 73 + +Open: 8am-5pm weekdays: Saturdays 9am–4pm : Sundays 9am–1pm + +Customer Service Email: service@gameworld.com + +  + +  + +Game Store Card / RCS Enquiries: 0861 0022 33 + +Game Store Card / RCS Email: contactus@gameworld.com + +Vodacom Contracts Call Centre: 082 111 + +  + +  +

Where do you deliver?

+We now deliver to the majority of South African addresses. +We do not currently deliver internationally. +If your suburb is not currently covered by us, please don’t hesitate to contact our Call Centre on 0861 426 322, for further assistance. + +  +
+ +

<%=image_tag("Site/support.png", class: "img-responsive")%>

+ +
+ +
+
+

Tech Support

+

We have a huge range of consoles on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+

Customer Care

+

We have a huge range of activity games on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+

Enquiries

+

We have a huge range of different games on offer...

+

Feel free to browse through our website and see what fantastic deals we have on offer...

+
+
+
+
+

Continue Shopping

+
+ + diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index af94c7f..a068418 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -1,2 +1,16 @@ -

StaticPages#home

-

Find me in app/views/static_pages/home.html.erb

+<% provide(:title, 'Home') %> + +
+ + + + <%= render 'layouts/genres' %> + + <%= render 'layouts/consoles' %> + +
+ + + diff --git a/app/views/static_pages/paid.html.erb b/app/views/static_pages/paid.html.erb new file mode 100644 index 0000000..3ff2d8f --- /dev/null +++ b/app/views/static_pages/paid.html.erb @@ -0,0 +1,11 @@ +
+ +
+ <%= image_tag("Site/game-land-logo.png") %> + +

Thank you for shopping!

+
+ +

You want to buy more

+
+
\ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 0d02f24..303fb71 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,25 +1,85 @@ -# SQLite version 3.x -# gem install sqlite3 +# PostgreSQL. Versions 9.1 and up are supported. # -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' +# Install the pg driver: +# gem install pg +# On OS X with Homebrew: +# gem install pg -- --with-pg-config=/usr/local/bin/pg_config +# On OS X with MacPorts: +# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config +# On Windows: +# gem install pg +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +# +# Configure Using Gemfile +# gem 'pg' # default: &default - adapter: sqlite3 + adapter: postgresql + encoding: unicode + # For details on connection pooling, see Rails configuration guide + # http://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 development: <<: *default - database: db/development.sqlite3 + database: POSTGRES_development + + # The specified database role being used to connect to postgres. + # To create additional roles in postgres see `$ createuser --help`. + # When left blank, postgres will use the default role. This is + # the same name as the operating system user that initialized the database. + #username: POSTGRES + + # The password associated with the postgres role (username). + #password: + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + + # The TCP port the server listens on. Defaults to 5432. + # If your server runs on a different port number, change accordingly. + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # Defaults to warning. + #min_messages: notice # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: db/test.sqlite3 + database: POSTGRES_test +# As with config/secrets.yml, you never want to store sensitive information, +# like your database password, in your source code. If your source code is +# ever seen by anyone, they now have access to your database. +# +# Instead, provide the password as a unix environment variable when you boot +# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database +# for a full rundown on how to provide these environment variables in a +# production deployment. +# +# On Heroku and other platform providers, you may have a full connection URL +# available as an environment variable. For example: +# +# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" +# +# You can use this database configuration with: +# +# production: +# url: <%= ENV['DATABASE_URL'] %> +# production: <<: *default - database: db/production.sqlite3 + database: POSTGRES_production + username: POSTGRES + password: <%= ENV['POSTGRES_DATABASE_PASSWORD'] %> \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 832308b..1c6119c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -28,7 +28,8 @@ # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + config.assets.compile = true + config.serve_statisc_assets = true # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index ee75591..d7a68dc 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -223,7 +223,7 @@ # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. - # config.scoped_views = false + config.scoped_views = true # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). @@ -274,4 +274,7 @@ # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' + + #adding username functionality to devise + config.authentication_keys = [ :login ] end diff --git a/config/routes.rb b/config/routes.rb index d0bf08f..600c725 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,37 @@ Rails.application.routes.draw do - devise_for :users + get 'orderitems/index' + + get 'orderitems/show' + + get 'orderitems/new' + + get 'orderitems/edit' + + resources :orders do + resources:orderitems + end + + resources :consoles + resources :genres + + + devise_for :users do + + resources:orders +end + + + get '/checkout' , to: 'cart#createOrder' + get '/paid', to: 'static_pages#paid' + + post '/search', to: 'items#search' + get 'cart/index' resources :items + root 'static_pages#home' get 'static_pages/home' @@ -23,6 +50,9 @@ root :to => 'site#home' + get 'genre/:title', to:'static_pages#genre' + get 'console/:title', to:'static_pages#console' + diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 007cc6e..a0ff40b 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/db/migrate/20180416103110_create_genres.rb b/db/migrate/20180416103110_create_genres.rb new file mode 100644 index 0000000..4543d54 --- /dev/null +++ b/db/migrate/20180416103110_create_genres.rb @@ -0,0 +1,11 @@ +class CreateGenres < ActiveRecord::Migration[5.1] + def change + create_table :genres do |t| + t.string :title + t.text :description + t.string :image + + t.timestamps + end + end +end diff --git a/db/migrate/20180418112508_create_orders.rb b/db/migrate/20180418112508_create_orders.rb new file mode 100644 index 0000000..775ac4a --- /dev/null +++ b/db/migrate/20180418112508_create_orders.rb @@ -0,0 +1,11 @@ +class CreateOrders < ActiveRecord::Migration[5.1] + def change + create_table :orders do |t| + t.datetime :order_date + t.references :user, foreign_key: true + t.string :status + + t.timestamps + end + end +end diff --git a/db/migrate/20180418113405_create_orderitems.rb b/db/migrate/20180418113405_create_orderitems.rb new file mode 100644 index 0000000..359468b --- /dev/null +++ b/db/migrate/20180418113405_create_orderitems.rb @@ -0,0 +1,14 @@ +class CreateOrderitems < ActiveRecord::Migration[5.1] + def change + create_table :orderitems do |t| + t.integer :item_id + t.string :title + t.text :description + t.integer :quantity + t.decimal :price + t.references :order, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20180421092309_add_admin_to_users.rb b/db/migrate/20180421092309_add_admin_to_users.rb new file mode 100644 index 0000000..79116a7 --- /dev/null +++ b/db/migrate/20180421092309_add_admin_to_users.rb @@ -0,0 +1,5 @@ +class AddAdminToUsers < ActiveRecord::Migration[5.1] + def change + add_column :users, :admin, :boolean, default: false + end +end diff --git a/db/migrate/20180422000125_add_username_to_users.rb b/db/migrate/20180422000125_add_username_to_users.rb new file mode 100644 index 0000000..c9b3c3f --- /dev/null +++ b/db/migrate/20180422000125_add_username_to_users.rb @@ -0,0 +1,6 @@ +class AddUsernameToUsers < ActiveRecord::Migration[5.1] + def change + add_column :users, :username, :string + add_index :users, :username, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 9d11c97..5705b2e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,35 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180414133034) do +ActiveRecord::Schema.define(version: 20180422000125) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "brands", force: :cascade do |t| + t.string "title" + t.text "description" + t.string "image" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "consoles", force: :cascade do |t| + t.string "title" + t.text "description" + t.string "image" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "genres", force: :cascade do |t| + t.string "title" + t.text "description" + t.string "image" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end - create_table "items", force: :cascade do |t| t.string "title" t.string "console" @@ -25,21 +51,47 @@ t.datetime "updated_at", null: false end + create_table "orderitems", force: :cascade do |t| + t.bigint "item_id" + t.string "title" + t.text "description" + t.bigint "quantity" + t.decimal "price" + t.bigint "order_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["order_id"], name: "index_orderitems_on_order_id" + end + + create_table "orders", force: :cascade do |t| + t.datetime "order_date" + t.bigint "user_id" + t.string "status" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_orders_on_user_id" + end + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.bigint "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "admin", default: false + t.string "username" t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["username"], name: "index_users_on_username", unique: true end - + + add_foreign_key "orderitems", "orders" + add_foreign_key "orders", "users" end diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2a..a2cc9c4 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,9 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) + + + + +User.create(email: "info@gameland.com", admin:"true", password: "1234567", password_confirmation: "1234567") + diff --git a/test/controllers/consoles_controller_test.rb b/test/controllers/consoles_controller_test.rb new file mode 100644 index 0000000..9afda21 --- /dev/null +++ b/test/controllers/consoles_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class ConsolesControllerTest < ActionDispatch::IntegrationTest + setup do + @console = consoles(:one) + end + + test "should get index" do + get consoles_url + assert_response :success + end + + test "should get new" do + get new_console_url + assert_response :success + end + + test "should create console" do + assert_difference('Console.count') do + post consoles_url, params: { console: { description: @console.description, image: @console.image, title: @console.title } } + end + + assert_redirected_to console_url(Console.last) + end + + test "should show console" do + get console_url(@console) + assert_response :success + end + + test "should get edit" do + get edit_console_url(@console) + assert_response :success + end + + test "should update console" do + patch console_url(@console), params: { console: { description: @console.description, image: @console.image, title: @console.title } } + assert_redirected_to console_url(@console) + end + + test "should destroy console" do + assert_difference('Console.count', -1) do + delete console_url(@console) + end + + assert_redirected_to consoles_url + end +end diff --git a/test/controllers/genres_controller_test.rb b/test/controllers/genres_controller_test.rb new file mode 100644 index 0000000..213d2b2 --- /dev/null +++ b/test/controllers/genres_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class GenresControllerTest < ActionDispatch::IntegrationTest + setup do + @genre = genres(:one) + end + + test "should get index" do + get genres_url + assert_response :success + end + + test "should get new" do + get new_genre_url + assert_response :success + end + + test "should create genre" do + assert_difference('Genre.count') do + post genres_url, params: { genre: { description: @genre.description, image: @genre.image, title: @genre.title } } + end + + assert_redirected_to genre_url(Genre.last) + end + + test "should show genre" do + get genre_url(@genre) + assert_response :success + end + + test "should get edit" do + get edit_genre_url(@genre) + assert_response :success + end + + test "should update genre" do + patch genre_url(@genre), params: { genre: { description: @genre.description, image: @genre.image, title: @genre.title } } + assert_redirected_to genre_url(@genre) + end + + test "should destroy genre" do + assert_difference('Genre.count', -1) do + delete genre_url(@genre) + end + + assert_redirected_to genres_url + end +end diff --git a/test/controllers/orderitems_controller_test.rb b/test/controllers/orderitems_controller_test.rb new file mode 100644 index 0000000..3234264 --- /dev/null +++ b/test/controllers/orderitems_controller_test.rb @@ -0,0 +1,24 @@ +require 'test_helper' + +class OrderitemsControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get orderitems_index_url + assert_response :success + end + + test "should get show" do + get orderitems_show_url + assert_response :success + end + + test "should get new" do + get orderitems_new_url + assert_response :success + end + + test "should get edit" do + get orderitems_edit_url + assert_response :success + end + +end diff --git a/test/controllers/orders_controller_test.rb b/test/controllers/orders_controller_test.rb new file mode 100644 index 0000000..e748d10 --- /dev/null +++ b/test/controllers/orders_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class OrdersControllerTest < ActionDispatch::IntegrationTest + setup do + @order = orders(:one) + end + + test "should get index" do + get orders_url + assert_response :success + end + + test "should get new" do + get new_order_url + assert_response :success + end + + test "should create order" do + assert_difference('Order.count') do + post orders_url, params: { order: { order_date: @order.order_date, status: @order.status, user_id: @order.user_id } } + end + + assert_redirected_to order_url(Order.last) + end + + test "should show order" do + get order_url(@order) + assert_response :success + end + + test "should get edit" do + get edit_order_url(@order) + assert_response :success + end + + test "should update order" do + patch order_url(@order), params: { order: { order_date: @order.order_date, status: @order.status, user_id: @order.user_id } } + assert_redirected_to order_url(@order) + end + + test "should destroy order" do + assert_difference('Order.count', -1) do + delete order_url(@order) + end + + assert_redirected_to orders_url + end +end diff --git a/test/fixtures/consoles.yml b/test/fixtures/consoles.yml new file mode 100644 index 0000000..193fcee --- /dev/null +++ b/test/fixtures/consoles.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyText + image: MyString + +two: + title: MyString + description: MyText + image: MyString diff --git a/test/fixtures/genres.yml b/test/fixtures/genres.yml new file mode 100644 index 0000000..193fcee --- /dev/null +++ b/test/fixtures/genres.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyText + image: MyString + +two: + title: MyString + description: MyText + image: MyString diff --git a/test/fixtures/orderitems.yml b/test/fixtures/orderitems.yml new file mode 100644 index 0000000..4d69634 --- /dev/null +++ b/test/fixtures/orderitems.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + item_id: 1 + title: MyString + description: MyText + quantity: 1 + price: 9.99 + order: one + +two: + item_id: 1 + title: MyString + description: MyText + quantity: 1 + price: 9.99 + order: two diff --git a/test/fixtures/orders.yml b/test/fixtures/orders.yml new file mode 100644 index 0000000..e54c7e1 --- /dev/null +++ b/test/fixtures/orders.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + order_date: 2018-04-18 11:25:08 + user: one + status: MyString + +two: + order_date: 2018-04-18 11:25:08 + user: two + status: MyString diff --git a/test/models/console_test.rb b/test/models/console_test.rb new file mode 100644 index 0000000..1af8118 --- /dev/null +++ b/test/models/console_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ConsoleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/genre_test.rb b/test/models/genre_test.rb new file mode 100644 index 0000000..95ccc5c --- /dev/null +++ b/test/models/genre_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GenreTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/order_test.rb b/test/models/order_test.rb new file mode 100644 index 0000000..15b8ed1 --- /dev/null +++ b/test/models/order_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class OrderTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/orderitem_test.rb b/test/models/orderitem_test.rb new file mode 100644 index 0000000..b98b8cd --- /dev/null +++ b/test/models/orderitem_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class OrderitemTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/system/consoles_test.rb b/test/system/consoles_test.rb new file mode 100644 index 0000000..64ab11f --- /dev/null +++ b/test/system/consoles_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class ConsolesTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit consoles_url + # + # assert_selector "h1", text: "Console" + # end +end diff --git a/test/system/genres_test.rb b/test/system/genres_test.rb new file mode 100644 index 0000000..a60fbb1 --- /dev/null +++ b/test/system/genres_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class GenresTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit genres_url + # + # assert_selector "h1", text: "Genre" + # end +end diff --git a/test/system/orders_test.rb b/test/system/orders_test.rb new file mode 100644 index 0000000..6146812 --- /dev/null +++ b/test/system/orders_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class OrdersTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit orders_url + # + # assert_selector "h1", text: "Order" + # end +end