Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 55 additions & 43 deletions app/views/games/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
<div class ="game-show">
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-sm-6">
<h2 style="font-weight:bold; margin-bottom: 20px; color: #EF7030;"><%= @game.title %></h2>
<p><%= @game.description %></p>
<!-- game management begins -->
<% if (user_is_dev? && @game.user_id == current_user.id ) ||
user_is_admin? %>
<p>Type:
<% @game.taggings.map do |tagging| %>
<%= Tag.find(tagging.tag_id).name %> &nbsp;|&nbsp;
<% end %>
</p>
<div class="container-fluid" style="background-color: steelblue">
<%# if can?(:manage, @game) %>
<% if user_is_admin? ||
( user_is_dev? && @game.user_id == current_user.id) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is best put in ability.rb file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a ticket to refactor all of the custom permissions methods out and use CanCanCan. Don't worry about it for this ticket. There's a lot of this to change in the entire app.

<div class="radiolist">
<%= simple_form_for(@game) do |f| %>
<%= f.error_notification %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please indent this form properly.

<p>
<%= link_to "Download Game", @game.download_button, class: "btn btn-default" %>
<% if @game.may_approve? %>
<%= f.button :submit, Game::STATE_APPROVE, value: "Approve Game" %>
<% end %>
<% if @game.may_reject? %>
<%= f.button :submit, Game::STATE_REJECT, value: "Reject Game" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Good job on using constant here!

<% end %>
</p>
<% end %>
</div>
<% end %>

<%# if (can? :manage, @game ) %>

<div>
<p>
<%= link_to "Download Pdf", game_review_path(@game.id), class:"btn btn-default" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

You may be able to use @game instead of @game.id

<%= link_to "Download Game", @game.attachment_url, class:"btn btn-default" %>
<%= link_to "Download Crash", href="#", class:"btn btn-default" %>
</p>
</div>
<% end %>
</div>
<!-- end of game management -->
</div>
<div class="col-md-6 col-sm-6">
<!-- image carousel begins -->
<div>
<div id="home-slideshow" class="carousel slide" data-ride="carousel">
<% if @game.pictures.length.zero? %>
Expand Down Expand Up @@ -29,59 +77,22 @@
<%= image_tag url, class: "carousel-image" %>
</div>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="container sentences">
<!-- -->
<h2 style="font-weight:bold; margin-bottom: 20px; color: #EF7030;"><%= @game.title %></h2>
<!-- end of image carousel -->
<div>
<!-- game stats begin -->

<p class="char1">Made by: <%= @game.user_company %></p>
<p>Date: <%= @game.formatted_created_at %></p>
<p>Type: <%= @game.type_display %></p>
<p>Last in Arcade: <%= @game.last_in_arcade %></p>
<p>Played: <%= @game.reviews_count %> times</p>
<p>Overall Rating: <%= @game.reviews_count %></p>

<%# if can?(:manage, @game) %>
<% if user_is_admin? ||
( user_is_dev? && @game.user_id == current_user.id) %>
<%= @game.download_button %>
<div class="radiolist">
<%= simple_form_for(@game) do |f| %>
<%= f.error_notification %>
<div>
<% if @game.may_approve? %>
<%= f.button :submit, Game::STATE_APPROVE %>
<% end %>
<% if @game.may_reject? %>
<%= f.button :submit, Game::STATE_REJECT %>
<% end %>
</div>
<% end %>
</div>
<% end %>

<%# if (can? :manage, @game ) %>
<% if (user_is_dev? && @game.user_id == current_user.id ) ||
user_is_admin? %>
<div>
<p>Type:
<% @game.taggings.map do |tagging| %>
<%= Tag.find(tagging.tag_id).name %> &nbsp;|&nbsp;
<% end %>
</p>
</div>

<div class="container">
<%= button_to "Download Pdf", game_review_path(@game.id), class:"orange" %>
<%= button_to "Download Game", @game.attachment_url, class:"orange" %>
<%= button_to "Download Crash", href="#", class:"orange" %>
</div>
<% end %>

<!-- end of game stats -->
<% if user_is_gamer? %>
<div>
<%= button_to "Buy", @game.link, class:"orange" %>
Expand All @@ -91,7 +102,8 @@
<div class="container">
<!-- <div class="back-btn-update"><%= button_to "Back", games_path, class:"orange" %></div> -->
</div>

</div>

</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<div class="home-map-intro">
<div class="row text-center">
<h2> <span class="glyphicon glyphicon-chevron-down pink" aria-hidden="true"> </span> Find an arcade near you</h2>
<h2 id="indie-game-heading"> <span class="glyphicon glyphicon-chevron-down pink" aria-hidden="true"> </span> Find an arcade near you</h2>
<p>
Check out the map to see the location of arcades and the games that are available.</br>
</p>
Expand Down