Skip to content
This gem is no longer maintained http://katanacode.github.com/box_of_tricks
Ruby JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.yardoc
app
config
doc
lib
script
spec
.gitignore
Gemfile moved tests to MiniTest::Spec
Guardfile
MIT-LICENSE
README.md
Rakefile
box_of_tricks-0.2.0.gem
box_of_tricks.gemspec

README.md

Box of Tricks

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 
*/
Something went wrong with that request. Please try again.