InSTEDD Platform Common Rails

This gem makes it easy to apply the look and feel found in InSTEDD applications.


gem install instedd-rails


gem 'instedd-rails'


Your application layout in app/views/layouts/application.html.erb should look something like this:

<% content_for :navigation do %>
  <%= section "Home", root_path, :home %>
  <%= section "Tour", tour_path, :tour %>
  <%= section "Community", community_path, :community %>
  <%= section "Help", help_path, :help %>
<% end %>
<% content_for :right_menu do %>
  <ul class="RightMenu">
    <%- if user_signed_in? %>
      <div id="User">
        <div class="container">
            <li><%= link_to 'Settings', edit_user_registration_path %></li>
            <li><a href="[<%= application_name.underscore %>-bug]">Report a bug</a></li>
            <li><%= link_to "Sign Out", destroy_user_session_path, :method => :delete %></li>
        <%= link_to '', edit_user_registration_path, :class => 'fsettings' %>
      <% else %>
        <%= link_to "Create account", new_user_registration_path, :class => 'fedit' %>
        <%= link_to "Log in", new_user_session_path, :class => 'fuser' %>
    <% end %>
<% end %>
<% content_for :footer_links do %>
  <a href="<%= root_path %>">Home</a>
<% end %>
<%= render :file => 'layouts/instedd_application' %>


To specify the breadcrumbs, in your controller:

class YourController < ApplicationController
  def index
    @show_breadcrumb = true
    add_breadcrumb 'Home', home_path

Read more about the breadcrumbs_on_rails gem.


To render tabs in the view:

<ul class="tabs top">
  <%= tab "Overview", overview_path %>
  <%= tab "Settings", settings_path %>

Using a different URL for the theme

You can use the INSTEDD_THEME environment variable to use a different url for the theme. For example:

INSTEDD_THEME=http://localhost rails s

If you have the platform-common project checkout out locally you can serve it with this command line:

sudo python -m SimpleHTTPServer 80

(be sure to run rake in that project before serving it)

How to develop

To make a change to the project without having to commit to check the results, you must tell your application to get the gem from your local hard drive. This can be done modifying your app's Gemfile to point to where you have this gem:

gem 'instedd-rails', :path => /path/to/this/gem

and then running bundle install.