GithubHelp home page GithubHelp logo

foshow-gem's Introduction

Foshow

Foshow allows you to display the application code in your rails application.

I use it for presentations where I don't want to make slides and or switch back and forth between my application and my code. This allows me to have a working app, and display the code it took to create it, right next to it. It can be very usefull for introducing new ideas to people.

Installation

Add this line to your application's Gemfile:

gem 'foshow'

And then execute:

$ bundle

Or install it yourself as:

$ gem install foshow

Then install the javascript and css files to make it look a little better:

$ rails generate foshow:install

Usage

###Default - Rails conventions This gem only works with rails apps and assumes you are following rails basic MVC naming conventions. For example, a model named "user" has a controller named "app/controllers/users_controller.rb" and a view directory called "app/views/users/"

All you have to do is add this to (the bottom of) your application layout ('apps/views/layouts/application.html.haml').

# Add to 'app/views/layouts/application.haml'

Foshow.render(self)

This, by default, displays the code for the model, view, and controller of the resource you're viewing so long as they exist.

###Configurating beyond the defaults If you want to display more code for a page, do it here: 'config/initializers/foshow.rb'

To display more code for a resource(page) configure Foshow with a block.

It's kinda like your routes file. Observe:

# Use a Hash to specify what controller#action will display the files given.
# Use just an Array to make the files display on all controller#actions.

Foshow.configure do |config|
	config.views = { 'controller#action_name' => ['app/views/controller/other_file_name.html.erb']}
	config.javascripts = ['app/assets/javascripts/global.js']
end

# the methods called on config will become links to display that section in your application layout.

note: The file paths must always be in an array. They will not render otherwise.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

##To do

  • Add more tests

##Thank you shayarnett

foshow-gem's People

Contributors

mrmicahcooper avatar

Stargazers

 avatar Matthew Conway avatar JT Marino avatar

Watchers

James Cloos 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.