Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make categories into buttons

  • Loading branch information...
commit 9a926c8d7114a3a1a73489a879a62b82be5353ff 1 parent e13e26b
@jronallo authored
View
16 app/assets/stylesheets/profiles.css.scss
@@ -3,12 +3,12 @@
// You can use Sass (SCSS) here: http://sass-lang.com/
@mixin rounded-corner {
- padding: 10px;
margin-bottom: 10px;
background-color: whiteSmoke;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
+ div{padding:10px;}
}
#main {
@@ -24,18 +24,22 @@
}
#categories{
padding: 10px;
-
+ .category{
+ margin: 5px;
+ font-weight:bold;
+ font-size: 1.2em;
+ }
}
- span.category{
- margin-right: 5px;
- a{white-space: nowrap;}
- }
+
}
#searchbox{
@include rounded-corner;
form{display:inline;}
}
+ #newprofile{
+ @include rounded-corner;
+ }
#profiles {
View
6 app/helpers/profiles_helper.rb
@@ -1,2 +1,8 @@
module ProfilesHelper
+
+ def link_to_category(category)
+ link_text = "#{category['_id']} (#{category['value'].to_i})"
+ link_to link_text, profiles_path(:category => category['_id']),
+ :class => [:btn, 'btn-small', 'btn-primary', :category]
+ end
end
View
34 app/views/profiles/_categories.html.erb
@@ -1,24 +1,26 @@
<div class="row">
<div id="above_results" class="span12">
- <h3>Categories</h3>
<div>
- <% if params[:category]%>
- <%= @profiles.length %> Collection Profiles in the <span class="current_category"><%= params[:category] %></span> category.
+ <h3>Categories</h3>
+ <div>
+ <% if params[:category]%>
+ <%= @profiles.length %> Collection Profiles in the
+ <span class="current_category"><%= params[:category] %></span>
+ category.
+ <% else %>
+ <%= @profiles.length %> total Collection Profiles.
+ <% end -%>
+ </div>
+
+ <% if @categories %>
+ <div id="categories">
+ <% @categories.each do |category| %>
+ <%= link_to_category(category) %>
+ <% end -%>
+ </div>
<% else %>
- <%= @profiles.length %> total Collection Profiles.
+ <%= link_to 'See all profiles', profiles_path %>
<% end -%>
</div>
-
- <% if @categories %>
- <div id="categories">
- <% @categories.each do |category| %>
- <span class="category">
- <%= link_to category['_id'], profiles_path(:category => category['_id']) %>&nbsp;(<%= category['value'].to_i %>)
- </span>
- <% end -%>
- </div>
- <% else %>
- <%= link_to 'See all profiles', profiles_path %>
- <% end -%>
</div>
</div>
View
49 app/views/profiles/index.html.erb
@@ -4,29 +4,40 @@
<div class="row">
<div class="span6" id="searchbox">
- <form>
- <i class="icon-search"></i>
- <input type="text" name="search" id="search"
- placeholder="Filter Profiles">
- </form>
- <span id="search_count"></span>
+ <div>
+ <form>
+ <i class="icon-search"></i>
+ <input type="text" name="search" id="search"
+ placeholder="Filter Profiles">
+ </form>
+ <span id="search_count"></span>
+ </div>
+ </div>
+
+ <div class="span6" id="newprofile">
+ <div>
+ <%= link_to 'New Profile', new_profile_path, :class => [:btn, "btn-success", "btn-large"] %>
+ </div>
</div>
+
</div>
<% if true %>
-<div id="profiles">
+<div id="profiles" class="row" >
<% @profiles.each do |profile| %>
- <div class="profile">
- <h3><%= link_to profile.name, profile %></h3>
- <div><%= link_to truncate(profile.url, :length => 50), profile.url, :title => profile.url %></div>
- <% if profile.achievement_count > 0 %>
- <div><%= profile.achievement_count %> completed <%= profile.achievement_count == 1 ? 'achievement' : 'achievements' %>.</div>
- <% end -%>
- <% if profile.categories.length > 0 %>
- <div><%= profile.categories.join(', ')%></div>
- <% end -%>
-
- <div><%= truncate(profile.description, :length => 150, :separator => ' ') %></div>
+ <div class="profile span12">
+ <div>
+ <h3><%= link_to profile.name, profile %></h3>
+ <div><%= link_to truncate(profile.url, :length => 50), profile.url, :title => profile.url %></div>
+ <% if profile.achievement_count > 0 %>
+ <div><%= profile.achievement_count %> completed <%= profile.achievement_count == 1 ? 'achievement' : 'achievements' %>.</div>
+ <% end -%>
+ <% if profile.categories.length > 0 %>
+ <div><%= profile.categories.join(', ')%></div>
+ <% end -%>
+
+ <div><%= truncate(profile.description, :length => 150, :separator => ' ') %></div>
+ </div>
</div>
<% end %>
</div>
@@ -35,4 +46,4 @@
<br />
-<%= link_to 'New Profile', new_profile_path, :class => [:btn, "btn-primary", "btn-large"] %>
+
Please sign in to comment.
Something went wrong with that request. Please try again.