imperavi-rails 0.0.2.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +72 -0
- data/Rakefile +39 -0
- data/app/assets/images/imperavi_rails/imperavi/bg.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/bg_modal.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/close.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/avi.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/csv.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/doc.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/gif.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/html.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/jpg.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/mov.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/other.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/pdf.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/png.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/ppt.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/rar.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/rtf.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/txt.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/xls.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/fileicons/zip.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/hover.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/icons.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/resizer.gif +0 -0
- data/app/assets/images/imperavi_rails/imperavi/separator.png +0 -0
- data/app/assets/images/imperavi_rails/imperavi/video_box.png +0 -0
- data/app/assets/javascripts/imperavi-rails/application.js +9 -0
- data/app/assets/javascripts/imperavi-rails/imperavi/redactor.js +1833 -0
- data/app/assets/stylesheets/imperavi-rails/application.css +7 -0
- data/app/assets/stylesheets/imperavi-rails/imperavi/imperavi-base.css.scss +150 -0
- data/app/assets/stylesheets/imperavi-rails/imperavi/imperavi.css.scss +150 -0
- data/app/assets/stylesheets/imperavi-rails/imperavi/redactor.css.scss +303 -0
- data/app/assets/stylesheets/imperavi-rails/imperavi/wym.css.scss +2 -0
- data/app/controllers/imperavi_rails/application_controller.rb +4 -0
- data/app/controllers/imperavi_rails/imperavi_controller.rb +46 -0
- data/app/helpers/imperavi_rails/imperavi_helper.rb +96 -0
- data/app/views/imperavi_rails/imperavi/file.html.erb +3 -0
- data/app/views/imperavi_rails/imperavi/file_edit.html.erb +11 -0
- data/app/views/imperavi_rails/imperavi/image.html.erb +27 -0
- data/app/views/imperavi_rails/imperavi/image_edit.html.erb +28 -0
- data/app/views/imperavi_rails/imperavi/language.js.erb +65 -0
- data/app/views/imperavi_rails/imperavi/link.html.erb +29 -0
- data/app/views/imperavi_rails/imperavi/table.html.erb +13 -0
- data/app/views/imperavi_rails/imperavi/toolbar.js.erb +69 -0
- data/app/views/imperavi_rails/imperavi/video.html.erb +13 -0
- data/app/views/imperavi_rails/layouts/imperavi-rails/application.html.erb +14 -0
- data/config/routes.rb +12 -0
- data/lib/imperavi-rails/engine.rb +5 -0
- data/lib/imperavi-rails/version.rb +3 -0
- data/lib/imperavi-rails.rb +8 -0
- data/lib/tasks/imperavi-rails_tasks.rake +4 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/pages.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +35 -0
- data/spec/dummy/app/assets/stylesheets/pages.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/images_controller.rb +40 -0
- data/spec/dummy/app/controllers/pages_controller.rb +83 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/pages_helper.rb +2 -0
- data/spec/dummy/app/models/image.rb +18 -0
- data/spec/dummy/app/models/page.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/pages/_form.html.erb +40 -0
- data/spec/dummy/app/views/pages/edit.html.erb +6 -0
- data/spec/dummy/app/views/pages/index.html.erb +25 -0
- data/spec/dummy/app/views/pages/new.html.erb +5 -0
- data/spec/dummy/app/views/pages/show.html.erb +12 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/dragonfly.rb +8 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +8 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20120202062643_create_pages.rb +10 -0
- data/spec/dummy/db/migrate/20120202074740_create_images.rb +11 -0
- data/spec/dummy/db/schema.rb +31 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +11285 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/test_helper.rb +10 -0
- metadata +281 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2012 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Imperavi for Rails 3.1+ (still under development)
|
|
2
|
+
|
|
3
|
+
What is Imperavi? Imperavi is open-source, lightweight and really pretty-looking wysiwyg editor written with JQuery. Look at the demo page: http://imperavi.com/redactor/examples/ (sorry for Russian). Like it?
|
|
4
|
+
|
|
5
|
+
I created this mountable engine with Imperavi so now you can easily integrate this editor into your app.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Put this line into your Gemfile:
|
|
10
|
+
|
|
11
|
+
gem 'imperavi-rails'
|
|
12
|
+
|
|
13
|
+
Then mount the engine in routes.rb:
|
|
14
|
+
|
|
15
|
+
mount ImperaviRails::Engine => "/imperavi"
|
|
16
|
+
|
|
17
|
+
And you're done!
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Add this helpers into the your view that contains a form:
|
|
22
|
+
|
|
23
|
+
<%= include_imperavi_stylesheet %>
|
|
24
|
+
<%= include_imperavi_javascript %>
|
|
25
|
+
<%= imperavi :page_article %>
|
|
26
|
+
|
|
27
|
+
In this example `page_article` is an id of textarea field. You can pass additional options to `imperavi` helper as second argument. See the full list of options here: https://github.com/tanraya/imperavi-rails/blob/master/app/helpers/imperavi_rails/imperavi_helper.rb#L35
|
|
28
|
+
|
|
29
|
+
You may want the text on your page to be styled the same way as it looks in the editor. To do this, add the following styles into your `application.css.scss` (provided that the text on the page is enclosed with `article` tag):
|
|
30
|
+
|
|
31
|
+
@import "imperavi-rails/imperavi/imperavi-base";
|
|
32
|
+
|
|
33
|
+
body {
|
|
34
|
+
width: 700px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
|
|
37
|
+
article {
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
@include imperavi-base;
|
|
40
|
+
|
|
41
|
+
p, div {
|
|
42
|
+
border: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
p {
|
|
46
|
+
padding: 0;
|
|
47
|
+
margin: 0 0 1.5em 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
form {
|
|
52
|
+
textarea {
|
|
53
|
+
width: 700px;
|
|
54
|
+
height: 600px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
## Deal with images: uploading, images list
|
|
60
|
+
|
|
61
|
+
For details look at the Dummy app sources: https://github.com/tanraya/imperavi-rails/tree/master/spec/dummy
|
|
62
|
+
|
|
63
|
+
# Contribute
|
|
64
|
+
|
|
65
|
+
I would appreciate any participation in the project. Any additions, fixes and ideas are welcome!
|
|
66
|
+
|
|
67
|
+
## How to contribute:
|
|
68
|
+
|
|
69
|
+
* Fork the project on Github
|
|
70
|
+
* Create a topic branch for your changes
|
|
71
|
+
* Ensure that the changes in your branch are as atomic as possible
|
|
72
|
+
* Create a pull request on Github
|
data/Rakefile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'ImperaviRails'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
|
+
load 'rails/tasks/engine.rake'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Bundler::GemHelper.install_tasks
|
|
28
|
+
|
|
29
|
+
require 'rake/testtask'
|
|
30
|
+
|
|
31
|
+
Rake::TestTask.new(:test) do |t|
|
|
32
|
+
t.libs << 'lib'
|
|
33
|
+
t.libs << 'test'
|
|
34
|
+
t.pattern = 'test/**/*_test.rb'
|
|
35
|
+
t.verbose = false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
task :default => :test
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require jquery
|
|
8
|
+
//= require jquery_ujs
|
|
9
|
+
//= require_tree .
|