Skip to content

Commit

Permalink
initial commit v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rorlab committed Aug 8, 2013
0 parents commit e73f2b8
Show file tree
Hide file tree
Showing 11 changed files with 5,639 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in summernote-rails.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2013 Hyo Seong Choi

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Summernote::Rails

To gemify Super Simple WYSIWYG Editor on Bootstrap for Ruby on Rails version 4.0

Website of Summernote, https://github.com/hackerwins/summernote

The version of summernote-rails is matched for the summernote editor.

## Installation

Add the following gems to your application's Gemfile:

gem 'simple_form', github: 'plataformatec/simple_form', tag: 'v3.0.0.beta1'
gem 'bootstrap-sass'
gem 'font-awesome-rails'
gem 'summernote-rails', github: 'rorlab/summernote-rails'

And then execute:

$ bundle

## Usage

First of all, the summernote editor works on Bootstrap and so it is assumed that you have already set it up.

In app/assets/javascripts/application.js, you should added the following:

```
//= require summernote.min
```

In app/assets/stylesheets/application.css, you should added the following:

```
*= require font-awesome
*= require summernote
```

For example, if you have a post form, in app/assets/javascripts/posts.js.coffee, you should add the following code:

```
$ ->
# to set summernote object
# You should change '#post_content' to your textarea input id
summer_note = $('#post_content')
# to call summernote editor
summer_note.summernote
# to set options
height:300
# to set code for summernote
summer_note.code summer_note.val()
# to get code for summernote
summer_note.closest('form').submit ->
# alert $('#post_content').code()[0]
summer_note.val summer_note.code()[0]
true
```

In app/views/posts/_form.html.erb, you should add 'summernote' class name to the textarea input as the following:

```
<%= simple_form_for(@post) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :title %>
<%= f.input :content, class:'summernote' %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
```

That's it.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "bundler/gem_tasks"
8 changes: 8 additions & 0 deletions lib/summernote/rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "summernote/rails/version"

module Summernote
module Rails
class Engine < ::Rails::Engine
end
end
end
5 changes: 5 additions & 0 deletions lib/summernote/rails/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Summernote
module Rails
VERSION = "0.2.0"
end
end
25 changes: 25 additions & 0 deletions summernote-rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'summernote/rails/version'

Gem::Specification.new do |spec|
spec.name = "summernote-rails"
spec.version = Summernote::Rails::VERSION
spec.authors = ["Hyo Seong Choi"]
spec.email = ["[email protected]"]
spec.description = %q{Super Simple WYSIWYG Editor on Bootstrap}
spec.summary = %q{Gemify Summernote for Ruby on Rails}
spec.homepage = "http://gihub.com/rorlab/summernote-rails"
spec.license = "MIT"

# spec.files = `git ls-files`.split($/)
spec.files = Dir["{lib,vendor}/**/*"] + ["LICENSE.txt", "README.md"]
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
# spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "railties", "~> 4.0"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end
1 change: 1 addition & 0 deletions vendor/assets/javascripts/summernote.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit e73f2b8

Please sign in to comment.