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
154 changes: 81 additions & 73 deletions app/views/games/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,97 +1,105 @@
<div class ="game-show">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the space between class =? Bridge the divide! ✊

<div>
<div id="home-slideshow" class="carousel slide" data-ride="carousel">
<% if @game.pictures.length.zero? %>
<div class="carousel-inner" role="listbox">
<%= image_tag "fallback/default.png", class: "carousel-image" %>
</div>
<% else %>
<ol class="carousel-indicators">
<% @game.pictures.each_with_index do |pic, i| %>
<li data-target="#home-slideshow" data-slide-to= <%= "#{i}" %>
<% if i == 0 %>
class="active">
<% else %>
class="">
<% end %>
</li>
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid inlining styles. Can put this in a class? You could use a selector such as .game-show h2 if it makes sense for the page seeing how this h2 is inside div.game-show.

<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) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you delete this line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you delete this line?

<% if user_is_admin? ||
( user_is_dev? && @game.user_id == current_user.id) %>
<div class="radiolist">
<%= simple_form_for(@game) do |f| %>
<%= f.error_notification %>
<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" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be indented one more level.

<% 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.

One more indent.

<% end %>
</ol>
<div class="carousel-inner" role="listbox">
<% @game.pictures.each_with_index do |picture, index| %>
<% url = picture.url %>
<% if index == 0 %>
<div class="item active">
<%= image_tag url, class: "carousel-image" %>
</div>
<% else %>
<div class="item">
<%= image_tag url, class: "carousel-image" %>
</div>
<% end %>
<% end %>
</p>
<% end %>
</div>
<% end %>
<%# if (can? :manage, @game ) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this one too. It's not used 😎

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete me! I no longer have purpose in life. 😨


<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.

@game.id isn't required here. Just use @game

<%= link_to "Download Game", @game.attachment_url, class:"btn btn-default" %>
<%= link_to "Download Crash", href="#", class:"btn btn-default" %>
</p>
</div>
</div>
<% end %>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The indent level on this closing div isn't quite right.

<!-- end of game management -->
<div class="col-md-6 col-sm-6">
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this div used at all? Please fix the indenting. 🤓

<!-- image carousel begins -->
<div>
<div id="home-slideshow" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">

<% @game.pictures.each_with_index do |pic, i| %>
<li data-target="#home-slideshow" data-slide-to= <%= "#{i}" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the space after data-slide-to=

<% if i == 0 %>
class="active">
<% else %>
>
<% end %>
</li>
<% end %>
</ol>
<div class="carousel-inner" role="listbox">
<% @game.pictures.each_with_index do |picture, index| %>
<% url = picture.carousel.url %>
<% if index == 0 %>
<div class="item active">
Copy link
Contributor

Choose a reason for hiding this comment

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

Indenting should be two spaces

<%= image_tag url, class: "carousel-image" %>
</div>
<% else %>
<div class="item">
<%= image_tag url, class: "carousel-image" %>
</div>
<% end %>
<% end %>
</div>
</div>
<div class="container sentences">
<!-- -->
<h2 style="font-weight:bold; margin-bottom: 20px; color: #EF7030;"><%= @game.title %></h2>

</div>

<!-- 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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Too much indenting here.

<%= button_to "Buy", @game.link, class:"orange" %>
<%= button_to "Buy", @game.link, class:"btn btn-default" %>
</div>
<% end %>

<div class="container">
<!-- <div class="back-btn-update"><%= button_to "Back", games_path, class:"orange" %></div> -->
</div>

</div>

</div>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
<%= f.button :submit, value: "Signup", class: "btn btn-default register-button" %>
</div>
<% end %>
Contact GitHub API Training Shop Blog About