public
Last active

if condition doesn't catch show page.

  • Download Gist
view.layouts.tracks.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
view/layouts/tracks.html.erb
 
//according to the Layout Assignment on http://api.rubyonrails.org/classes/AbstractController/Layouts.html, I created a new layout file with the same name as the controller
 
<!DOCTYPE html>
<html>
<head>
<title><%= content_for?(:title) ? yield(:title) : "Onvard" %></title>
<!-- [if lt IE9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"
type ="text/javascript"></script>
<![endif]-->
<%= favicon_link_tag %>
<%= csrf_meta_tags %>
<meta name="viewport" content ="width=device-width, initial-scale=1.0">
<%= render 'layouts/stylesheets' %>
<script type="text/javascript">if (window.location.hash == '#_=_')window.location.hash = '';</script>
</head>
 
<body>
<%= render 'layouts/header' %>
<div class="background">
<!-- PROBLEM: if i include the show_track, then other pages dont work . -->
<%# elsif current_page?(:controller => 'tracks', :action => 'show') %>
<%#= yield :show_track %>
<%# else %>
 
<%= render 'layouts/flashes' %>
<% if current_page?(:controller => 'tracks', :action => 'show') %>
<%= yield :show_track %>
<% else %>
<div class="container_980 white shadow-horizontal">
<div class="container">
<%= render 'layouts/flashes' %>
<%= yield %>
</div>
</div>
<% end %>
<%# end %>
</div> <!-- end body class -->
 
 
<!-- FOOTER -->
<div class="footer">
Copyright &copy; 2012 Onvard |
<strong><%= link_to "About", about_path %></strong> |
<strong><%= link_to "Contact", contact_path %></strong> |
<strong><%= link_to "Leaderboard", leader_path %></strong>
<br />
<!--
<div class="fb-like" data-href="https://www.facebook.com/Onvard" data-send="false" data-width="400" data-show-faces="true" data-font="segoe ui">
</div> -->
 
</div>
</body>
 
 
<% debug(params) if Rails.env.development? %>
</html>
view.tracks.show.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
view/tracks/show.html.erb
 
<!-- stylesheet: track_show.css.scss -->
<% title @track.title %>
 
<% content_for :show_track do %>
<div class="track_header index_top_indent">
 
<div class="row container_980">
<div class="span2">
<div class="float-left">
<%= image_tag(@track.image_url(:featured), :size => "145x145") %>
</div>
</div>
<div class="">
<div class="row">
<div class="span6">
<h2><%= @track.title %></h2>
<div id="show_track_author">
<%= image_tag @profileimg unless @profileimg.blank? %>
<%= link_to @track.author.username, profile_path(@track.author) %>
</div>
</div>
<div class="span4">
<div id="track_show_info_box">
<div id="track_show_info_box_top">
<% if @track.users.include?(current_user) %>
<%= link_to 'Remove Bookmark', unbookmark_track_path(@track),
:method => :post, :class => 'btn btn-large'%>
<% else %>
<%= link_to 'Bookmark Track', bookmark_track_path(@track), :method => :post, :class => 'btn btn-success btn-large'%>
<% end %>
<%= link_to vote_for_track_track_path(@track), :method => :post, :class => 'btn' do %>
<i class="icon-thumbs-up"></i> Vote up
<% end %>
<%= link_to vote_against_track_track_path(@track), :method => :post, :class => 'btn' do %>
<i class="icon-thumbs-down"></i>
<% end %>
 
</div>
<div id="track_show_info_box_bottom">
<div id="stats">
<i class ="icon-fire"></i> <%= @track.difficulty.downcase %> level
<i class ="icon-time"></i> created <%= time_ago_in_words(@track.created_at) + " ago"%> <br />
<i class ="icon-arrow-up"></i> <%= @track.karma %> votes
<i class ="icon-star"></i> <%= @track.users.count %> bookmarked
<i class ="icon-eye-open"></i> <%= @track.hits %> views
</div>
</div>
</div>
</div>
</div> <!-- end nested row -->
<br />
<div class="row">
<div class="span12 dialog-box">
<%= @track.description %>
<b> have option to click and hide after read</b>
</div>
</div> <!-- end nested row -->
</div><!-- end right side of track pic -->
 
</div>
</div>
 
<!-- end track_header -->
<!-- MISSIONS BELOW -->
 
<div class="container_980">
<div class="container">
 
<div class="row">
<div class="span9">
<!-- this is where missions will go -->
 
 
<div class="well">
<h2> Work through the "Try Ruby" exercises</h2>
Many people give up learning RoR because they think they have to master Ruby. This is not true, so don't worry! You do not have to fully dominate the Ruby language to learn and enjoy Rails. You just need the basics to begin.
 
Go through the exercises in Try Ruby (will take roughly 30 minutes)
You'll be greeted with an interactive screen where you can follow along the few exercises. Just try it to get a sense of what the language is like and a feel for the syntax.
 
(You can also check out 'Learn Ruby the Hard Way' if you really want to master the language, but just diving into rails and learning as you go will be more fun!)
</div>
 
 
 
 
 
</div>
<div class="span3">
social media share buttons <br />
detailed author info <br />
tags
</div>
</div>
</div>
<div class="form-actions">
<%= link_to 'Back', tracks_path, class: 'btn' %>
<% if (@track.author == current_user) || ((user_signed_in?) && (current_user.admin == true)) %>
<%= link_to 'Edit', edit_track_path(@track), class: 'btn' %>
<%= link_to 'Destroy', @track, confirm: 'Are you sure?', method: :delete, class: 'btn btn-danger float-right' %>
<% end %>
</div>
</div>
 
 
 
 
<% end %>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.