• Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use CodeMirror with Rails

codemirror-rails

Wire up the CodeMirror assets for your Rails applications.

Getting Started

If you're using Bundler, you can add codemirror-rails to your Gemfile:

gem 'codemirror-rails'

Or manually install the codemirror-rails gem:

gem install codemirror-rails

CodeMirror for Rails >= 3.1

All of the assets from the most latest stable CodeMirror release are vendored so that you can use them with the asset pipeline. At a minimum, you will probably want the following in your application.js:

//= require codemirror

And in your application.css:

/*
*= require codemirror
*/

Adding a mode

Additional syntax modes can be added to your application.js:

//= require codemirror/modes/ruby

Adding an addon

Additional addons can be added in your application.js:

//= require_tree codemirror/addons/dialog

And your application.css:

/*
*= require_tree codemirror/addons/dialog
*/

Adding a keymap

Additional keymap bindings can be added to your application.js:

//= require codemirror/keymaps/vim

Adding a theme

Additional CSS themes can be added to your application.css

/*
*= require codemirror/themes/night
*/

Precompiling Codemirror

If your project is using precompiling, depending on your method of grabbing files to precompile, you might need to add the below line to your ```` application.rb```, to get rails to precompile all js, css files used by codemirror. You can also manually whitelist only the files that you use.

config.assets.precompile += ["codemirror*", "codemirror/**/*"]

CodeMirror for Rails 3

You can use the generator included with this gem to copy the CodeMirror 2 assets into your Rails 3 public directory.

rails generate codemirror:install

Contributing

Find a mistake? New version of CodeMirror? Submit a pull request!

More Repositories

1

nikeplus-ruby

Ruby interface for the nikeplus web API.
Ruby
20
star
2

wcapi

My fork of the WCAPI gem. Convenience functions for working with OCLC's WorldCat API.
Ruby
7
star
3

worldcat-api

Ruby wrapper for the Worldcat Search API
Ruby
6
star
4

music

Simple web interface for my mp3 collection
JavaScript
6
star
5

mockieminimal.adiummessagestyle

The Adium message style that I used.
CSS
4
star
6

browser_stakeout

ABANDONED: JUST GO INSTALL LIVERELOAD INSTEAD
Ruby
3
star
7

dotfiles

Everybody has one.
Shell
2
star
8

heroku-php-template

Template for PHP applications on Heroku
PHP
2
star
9

fixlr.github.com

Me.
CSS
2
star
10

textmate-bundles

Easy setup of my TextMate bundles using Git submodules
2
star
11

jquery-scrolly-bits

jQuery plugin for managing navigation elements that "follow" your scrolling on a single long (vertical) webpage.
JavaScript
2
star
12

monkeybrains

Random assortment of ruby scripts to help monkey research.
Ruby
2
star
13

cat2email

Discontinued Wordpress plugin from skippy.net (and my updates to it)
PHP
2
star
14

RandomEmoji.alfredextension

Alfred extension that generates a string of random emoji
2
star
15

flickr_set_browser

Browse Flickr photosets with JavaScript
JavaScript
2
star
16

tmc_webby

Webby project for www.themoseying.com
Ruby
2
star
17

ruby-marc

(see project name)
Ruby
1
star
18

css_box_shadow_hack

Experiment to replace "box-shadow" rules to improve maintainability at the cost of performance.
JavaScript
1
star
19

gh-preview-bug-thing

1
star
20

onejpg

JPGs. Part of a healthy design breakfast.
CoffeeScript
1
star
21

spell_checker

Programming exercise to develop a spelling corrector in Ruby.
Ruby
1
star
22

HipChat-Emoticons

HipChat emoticons for Adium
1
star
23

ti86-scripts

Some old scripts I found on my TI86 calculator. Uploaded just for fun.
1
star
24

jquery-inline-help

jQuery plugin for displaying inline help on forms unobtrusively
1
star