0.0
No commit activity in last 3 years
No release in over 3 years
A collection of CSS classes and Rails helper methods. View the README for more info
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.1.1
 Project Readme

This gem contains a bunch of CSS classes and Rails helper methods that we rely upon regularly

View Helpers

BoxOfTricks#title

Sets the page title if passed an argument, otherwise returns the page title.

 
# layouts/application.html.erb
 <!DOCTYPE>
 <html>
 <head>
   <title><%= title %></title>
 </head>
 <body>
   <%= yield %>
 </body>
 </html>
 
 # users/show.hmtl.erb
 <% title @user.username %>

BoxOfTricks#field

<%= field id: "my_field", class: "user_form" do %>
  <%= text_field_tag :user, :username %>
<% end %>
<!-- generates: -->
<div class="field user_form" id="my_field">
  <input type="text" name="user[username]" id="user_username">
</div>

BoxOfTricks#actions

<%= actions id: "my_actions", class: "user_form" do %>
  <%= submit_tag("Save") %>
<% end %>
<!-- generates: -->
<div class="actions user_form" id="my_actions">
  <input type="submit" value="Save" id="user_submit">
</div>

BoxOfTricks#div

<%= div id: "some_div", class: "vague_class" do %>
  <%= link_to("Click here", "#") %>
<% end %>
<!-- generates: -->
<div id="some_div" class="vague_class">
  <a href="#">Click here</a>
</div>

CSS

HTML5 Reset Sheet

To include an HTML reset to your CSS, simply add the following to your application.css file:

/* 
*= require html5reset 
*/

There's also a file named box_of_tricks.css.scss which comes with a bunch of CSS classes that I constantly rely on.

/* 
*= require box_of_tricks 
*/