Giter VIP home page Giter VIP logo

box_of_tricks's Introduction

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 
*/

box_of_tricks's People

Contributors

bodacious avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.