Your cart is empty, please add somthing to make a purchase.
@@ -28,19 +28,18 @@
-
+
<% total += quantity * item.price %>
-
+
<% end %>
-
- Grand Total: <%= number_to_currency(total, :unit => "€") %>
+
+ Grand Total: <%= number_to_currency(total, :unit => "€") %>
-
@@ -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
+
+
+
+
+ Title
+ Description
+ Image
+
+
+
+
+
+ <% @consoles.each do |console| %>
+
+ <%= console.title %>
+ <%= console.description %>
+ <%= console.image %>
+ <% if user_signed_in? %>
+ <% if current_user.admin? %>
+ <%= 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?' } %>
+ <% else %>
+ <%= link_to 'Details', console, :class => "button", :role => "button" %>
+ <% end %>
+ <% else %>
+ <%= link_to 'Details', console, :class => "button", :role => "button" %>
+ <% end %>
+
+ <% end %>
+
+ <% if user_signed_in? %>
+ <% if current_user.admin? %>
+ <%= link_to 'New Console', new_console_path, :class => "button", :role => "button" %>
+ <% end %>
+ <% end %>
+
+
+
+
+
\ 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:
+
+
+ <% genre.errors.full_messages.each do |message| %>
+ <%= message %>
+ <% end %>
+
+
+ <% 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
+
+
+
+
+ Title
+ Description
+ Image
+
+
+
+
+
+ <% @genres.each do |genre| %>
+
+ <%= genre.title %>
+ <%= genre.description %>
+ <%= genre.image %>
+ <% if user_signed_in? %>
+ <% if current_user.admin? %>
+ <%= 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?' } %>
+ <% else %>
+ <%= link_to 'Details', genre, :class => "button", :role => "button" %>
+ <% end %>
+ <% else %>
+ <%= link_to 'Details', genre, :class => "button", :role => "button" %>
+ <% end %>
+
+ <% end %>
+
+ <% if user_signed_in? %>
+ <% if current_user.admin? %>
+ <%= link_to 'New Genre', new_genre_path, :class => "button", :role => "button" %>
+ <% end %>
+ <% end %>
+
+
+
+
+
\ 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| %>
+
+
+ <% 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| %>
+
+ <% 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 @@
\ 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 @@
+
\ 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:
+
+
+ <% order.errors.full_messages.each do |message| %>
+ <%= message %>
+ <% end %>
+
+
+ <% 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
+
+
+
+
+ Order date
+ Username
+ Status
+
+
+
+
+
+ <% @orders.each do |order| %>
+
+ <%= order.order_date.strftime("%d-%m-%Y at %H:%M:%S UTC") %>
+ <%= order.user.username %>
+ <%= order.status %>
+
+ <% if user_signed_in? %>
+
+ <% if current_user.admin? %>
+
+ <%= 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?' } %>
+ <% else %>
+ <%= link_to 'Details', order, :class => 'button', :role => 'button' %>
+
+ <% end %>
+
+ <% end %>
+
+ <% end %>
+
+ <% if user_signed_in? %>
+ <% if current_user.admin? %>
+ <%= link_to 'New Order', new_order_path, :class => "button new-order", :role => "button" %>
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
\ 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
+
+
+
+
+
+ Order date
+ Order by
+ Order status
+
+
+
+
+
+ <%= @order.order_date.strftime("%d-%m-%Y at %H:%M:%S UTC") %>
+ <%= @order.user.username %>
+ <%= @order.status %>
+
+
+
+
+ <% if user_signed_in? %>
+
+ <% if current_user.admin? %>
+
+ <%= link_to 'Edit Order', edit_order_path(@order), :class =>"button" %>
+ <%= link_to 'Back to Orders', orders_path, :class =>"button" %>
+ <% else %>
+ <%= link_to 'Back to Orders', orders_path, :class =>"button" %>
+ <% end %>
+ <% end %>
+
+
+
+
+
Order Details
+
+
+
+
+ <% @orderitems.each do |orderitem| %>
+
+
+
+ <%= orderitem.title %>
+ Quantity ordered: <%= orderitem.quantity %>
+
+ <% end %>
+
+
+
+
+
\ 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...
+
+
+
+
+
+
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...
+
+
+
+
+
+
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/search' %>
+
+
+ <%= 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