xmt_froala 0.3.1
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/xmt_froala.js +31 -0
- data/app/assets/stylesheets/xmt_froala.css +17 -0
- data/app/controllers/xmt_froala/application_controller.rb +5 -0
- data/app/controllers/xmt_froala/assets_controller.rb +94 -0
- data/app/models/xmt_froala/asset_uploader.rb +107 -0
- data/app/models/xmt_froala/file_uploader.rb +10 -0
- data/app/models/xmt_froala/flash_uploader.rb +10 -0
- data/app/models/xmt_froala/image_uploader.rb +10 -0
- data/app/models/xmt_froala/media_uploader.rb +10 -0
- data/config/routes.rb +6 -0
- data/lib/generators/xmt_froala/install/USAGE +10 -0
- data/lib/generators/xmt_froala/install/install_generator.rb +23 -0
- data/lib/generators/xmt_froala/install/templates/application.js +17 -0
- data/lib/generators/xmt_froala/install/templates/xmt_froala.rb +29 -0
- data/lib/generators/xmt_froala/migration/USAGE +14 -0
- data/lib/generators/xmt_froala/migration/migration_generator.rb +36 -0
- data/lib/generators/xmt_froala/migration/templates/migration/migration.rb +18 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/asset.rb +14 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/media.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/asset.rb +27 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/media.rb +3 -0
- data/lib/tasks/xmt_froala_tasks.rake +9 -0
- data/lib/xmt_froala.rb +65 -0
- data/lib/xmt_froala/active_record.rb +14 -0
- data/lib/xmt_froala/engine.rb +32 -0
- data/lib/xmt_froala/formtastic.rb +12 -0
- data/lib/xmt_froala/helper.rb +105 -0
- data/lib/xmt_froala/simple_form.rb +11 -0
- data/lib/xmt_froala/version.rb +3 -0
- data/vendor/assets/javascripts/xmt_froala/froala_editor.js +0 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ar.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/bs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/cs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/da.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/de.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_ca.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_gb.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/es.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/et.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fa.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fi.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/he.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hu.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/id.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/it.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ja.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ko.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/me.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nb.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_br.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_pt.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ro.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ru.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sv.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/th.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/tr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/uk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/vi.js +258 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_cn.js +320 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_tw.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.js +139 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.js +154 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.js +3270 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.js +393 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.js +492 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.js +459 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.js +509 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.js +121 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.js +736 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.min.js +239 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.js +182 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.js +118 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.js +430 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.js +274 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.js +216 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.js +3323 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.js +1056 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.js +94 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.js +537 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.js +1157 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.js +462 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.js +290 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.js +144 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/plain_paste.js +96 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.js +137 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_format.js +89 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.js +478 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.js +141 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.js +189 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.js +781 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.js +4194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.js +194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.js +2342 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.js +1403 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.js +543 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.js +163 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.js +222 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/xmt_froala.js +15172 -0
- data/vendor/assets/stylesheets/xmt_froala/css/font-awesome.css +2546 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.css +2902 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.css +413 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.css +57 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.css +112 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.css +155 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.css +43 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.css +42 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.css +146 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.css +28 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.css +52 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.css +244 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.css +266 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.css +37 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.css +70 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.css +51 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.css +181 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.css +231 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.css +64 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.css +72 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/xmt_froala.css +1423 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff2 +0 -0
- metadata +273 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fd543fe3b4d6320feefc7c485dcadc249e841ecd2da59fde69af32cb4766c0ad
|
|
4
|
+
data.tar.gz: 133ac5f7bb7d7e6fae0f849a89599217c3b30ed1c1932ba06db081a77db14d31
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9bdc9d5219225d6730aaa6432d83d5dca175b0a6ff5915634e7a7afbf8dfc93f9d67629bb53a7c218ffdb3c7845c1d3a43df93e4fb1fcb466c49c9013a8c64eb
|
|
7
|
+
data.tar.gz: 2b20566faa719798062d028a5812285ef5ba3a15d6704eb0f6cf1f52bdc1f7aa1be72cbae794e7937c2b6709d2ce29be0d5c8a5af9bfe13c2bb533459b61766c
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2018 sgzhe
|
|
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,28 @@
|
|
|
1
|
+
# XmtFroala
|
|
2
|
+
Short description and motivation.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
How to use my plugin.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'xmt_froala'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
```bash
|
|
21
|
+
$ gem install xmt_froala
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contribution directions go here.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//= require xmt_froala/xmt_froala.js
|
|
2
|
+
//= require xmt_froala/plugins/align.min.js
|
|
3
|
+
//= require xmt_froala/plugins/char_counter.min.js
|
|
4
|
+
//= require xmt_froala/plugins/code_beautifier.min.js
|
|
5
|
+
//= require xmt_froala/plugins/code_view.min.js
|
|
6
|
+
//= require xmt_froala/plugins/colors.min.js
|
|
7
|
+
//= require xmt_froala/plugins/draggable.min.js
|
|
8
|
+
//= require xmt_froala/plugins/emoticons.min.js
|
|
9
|
+
//= require xmt_froala/plugins/entities.min.js
|
|
10
|
+
//= require xmt_froala/plugins/file.min.js
|
|
11
|
+
//= require xmt_froala/plugins/font_size.min.js
|
|
12
|
+
//= require xmt_froala/plugins/font_family.min.js
|
|
13
|
+
//= require xmt_froala/plugins/fullscreen.min.js
|
|
14
|
+
//= require xmt_froala/plugins/image.min.js
|
|
15
|
+
//= require xmt_froala/plugins/image_manager.js
|
|
16
|
+
//= require xmt_froala/plugins/line_breaker.js
|
|
17
|
+
//= require xmt_froala/plugins/inline_style.js
|
|
18
|
+
//= require xmt_froala/plugins/link.min.js
|
|
19
|
+
//= require xmt_froala/plugins/lists.min.js
|
|
20
|
+
//= require xmt_froala/plugins/paragraph_format.min.js
|
|
21
|
+
//= require xmt_froala/plugins/paragraph_style.min.js
|
|
22
|
+
//= require xmt_froala/plugins/quick_insert.min.js
|
|
23
|
+
//= require xmt_froala/plugins/quote.min.js
|
|
24
|
+
//= require xmt_froala/plugins/table.min.js
|
|
25
|
+
//= require xmt_froala/plugins/save.min.js
|
|
26
|
+
//= require xmt_froala/plugins/url.min.js
|
|
27
|
+
//= require xmt_froala/plugins/video.js
|
|
28
|
+
//= require xmt_froala/languages/zh_cn.js
|
|
29
|
+
//= require xmt_froala/froala_editor.js
|
|
30
|
+
//= require xmt_froala/plugins/plain_paste.js
|
|
31
|
+
//= require xmt_froala/plugins/quick_format.js
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*= require xmt_froala/css/font-awesome.css
|
|
3
|
+
*= require xmt_froala/css/xmt_froala.css
|
|
4
|
+
*= require xmt_froala/css/froala_style.css
|
|
5
|
+
*= require xmt_froala/css/plugins/code_view.css
|
|
6
|
+
*= require xmt_froala/css/plugins/colors.css
|
|
7
|
+
*= require xmt_froala/css/plugins/emoticons.css
|
|
8
|
+
*= require xmt_froala/css/plugins/image_manager.css
|
|
9
|
+
*= require xmt_froala/css/plugins/image.css
|
|
10
|
+
*= require xmt_froala/css/plugins/line_breaker.css
|
|
11
|
+
*= require xmt_froala/css/plugins/table.css
|
|
12
|
+
*= require xmt_froala/css/plugins/video.css
|
|
13
|
+
*= require xmt_froala/css/plugins/char_counter.css
|
|
14
|
+
*= require xmt_froala/css/plugins/quick_insert.css
|
|
15
|
+
*= require xmt_froala/css/plugins/fullscreen.css
|
|
16
|
+
*= require xmt_froala/css/plugins/file.css
|
|
17
|
+
*/
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
class XmtFroala::AssetsController < ApplicationController
|
|
2
|
+
skip_before_action :verify_authenticity_token
|
|
3
|
+
def create
|
|
4
|
+
cls = XmtFroala::AssetUploader.create_asset_model(params[:dir])
|
|
5
|
+
if cls
|
|
6
|
+
options = {
|
|
7
|
+
asset: params[:file],
|
|
8
|
+
owner_id: params[:owner_id],
|
|
9
|
+
owner_type: params[:owner_type],
|
|
10
|
+
asset_type: params[:dir]
|
|
11
|
+
}.delete_if {|k,v| v.blank?}
|
|
12
|
+
asset = cls.new(options)
|
|
13
|
+
if asset.save
|
|
14
|
+
#render json: {error: 0, url: asset.asset.url}
|
|
15
|
+
render json: {link: asset.asset.url}
|
|
16
|
+
else
|
|
17
|
+
render json: {error: 1, message: asset.errors.full_messages}
|
|
18
|
+
end
|
|
19
|
+
else
|
|
20
|
+
cls = XmtFroala::AssetUploader.create_uploader(params[:dir])
|
|
21
|
+
if cls
|
|
22
|
+
uploader = cls.new()
|
|
23
|
+
uploader.store!(params[:file])
|
|
24
|
+
#render json: {:error => 0, :url => uploader.url}
|
|
25
|
+
render json: {:link => uploader.url}
|
|
26
|
+
else
|
|
27
|
+
render json: {:error => 1, :message => "can't upload the file for #{params[:dir]} type!"}
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def list
|
|
33
|
+
root_url = File.join('/', XmtFroala.upload_store_dir)
|
|
34
|
+
root_url = File.join(root_url, params[:dir]) unless params[:dir].blank?
|
|
35
|
+
root_url.split('/').each do |dir|
|
|
36
|
+
path ||= Rails.public_path
|
|
37
|
+
path = File.join(path, dir)
|
|
38
|
+
Dir.mkdir(path) unless Dir.exist?(path)
|
|
39
|
+
end
|
|
40
|
+
root_url = File.join(root_url, params[:path]) unless params[:path].blank?
|
|
41
|
+
|
|
42
|
+
root_path = File.join( Rails.public_path, root_url)
|
|
43
|
+
file_list = []
|
|
44
|
+
Dir.foreach(root_path) do |entry|
|
|
45
|
+
next if (entry == '..' || entry == '.')
|
|
46
|
+
full_path = File.join(root_path, entry)
|
|
47
|
+
file_ext = File.extname(full_path).gsub(/\./,"")
|
|
48
|
+
info = {
|
|
49
|
+
filename: entry,
|
|
50
|
+
datetime: File.mtime(full_path).to_s(:db)
|
|
51
|
+
}
|
|
52
|
+
if File.directory?(full_path)
|
|
53
|
+
info[:is_dir] = true
|
|
54
|
+
info[:has_file] = Dir.entries(full_path).size > 0
|
|
55
|
+
info[:filesize] = 0
|
|
56
|
+
info[:is_photo] = false
|
|
57
|
+
info[:filetype] = ""
|
|
58
|
+
else
|
|
59
|
+
info[:is_dir] = false
|
|
60
|
+
info[:has_file] = false
|
|
61
|
+
info[:filesize] = File.size(full_path)
|
|
62
|
+
info[:dir_path] = ""
|
|
63
|
+
info[:is_photo] = XmtFroala::AssetUploader.is_image?(file_ext)
|
|
64
|
+
info[:filetype] = file_ext
|
|
65
|
+
end
|
|
66
|
+
file_list << info
|
|
67
|
+
end
|
|
68
|
+
order = "filename"
|
|
69
|
+
unless params[:order].blank?
|
|
70
|
+
order = params[:order].downcase if %w(filename filesize filetype datetime).include?(params[:order].downcase)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if order=='datetime'
|
|
74
|
+
file_list.sort! {|a, b| b["#{order}".to_sym] <=> a["#{order}".to_sym]}
|
|
75
|
+
else
|
|
76
|
+
file_list.sort! {|a, b| a["#{order}".to_sym] <=> b["#{order}".to_sym]}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
result = {
|
|
80
|
+
moveup_dir_path: params[:path].gsub(/(.*?)[^\/]+\/$/, ""),
|
|
81
|
+
current_dir_path: params[:path],
|
|
82
|
+
current_url: root_url,
|
|
83
|
+
total_count: file_list.count,
|
|
84
|
+
file_list: file_list
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
render json: result
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
class XmtFroala::AssetUploader < CarrierWave::Uploader::Base
|
|
2
|
+
|
|
3
|
+
EXT_NAMES = {:image => XmtFroala.upload_image_ext,
|
|
4
|
+
:flash => XmtFroala.upload_flash_ext,
|
|
5
|
+
:media => XmtFroala.upload_media_ext,
|
|
6
|
+
:file => XmtFroala.upload_file_ext}
|
|
7
|
+
|
|
8
|
+
# Include RMagick or ImageScience support:
|
|
9
|
+
# include CarrierWave::RMagick
|
|
10
|
+
# include CarrierWave::ImageScience
|
|
11
|
+
# include CarrierWave::MiniMagick
|
|
12
|
+
|
|
13
|
+
# Choose what kind of storage to use for this uploader:
|
|
14
|
+
storage :file
|
|
15
|
+
# storage :fog
|
|
16
|
+
|
|
17
|
+
# Override the directory where uploaded files will be stored.
|
|
18
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
|
19
|
+
def store_dir
|
|
20
|
+
if model
|
|
21
|
+
"#{XmtFroala.upload_store_dir}/#{model.asset_type.to_s.underscore.gsub(/(xmt_froala\/)|(_uploader)/, '')}/#{model.created_at.strftime("%Y%m")}"
|
|
22
|
+
else
|
|
23
|
+
"#{XmtFroala.upload_store_dir}/#{self.class.to_s.underscore.gsub(/(xmt_froala\/)|(_uploader)/, '')}/#{Time.now.strftime("%Y%m")}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def cache_dir
|
|
28
|
+
"#{Rails.root}/tmp/uploads"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
|
32
|
+
# def default_url
|
|
33
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
|
34
|
+
# end
|
|
35
|
+
|
|
36
|
+
# Process files as they are uploaded:
|
|
37
|
+
# process :scale => [200, 300]
|
|
38
|
+
#
|
|
39
|
+
# def scale(width, height)
|
|
40
|
+
# # do something
|
|
41
|
+
# end
|
|
42
|
+
|
|
43
|
+
# Create different versions of your uploaded files:
|
|
44
|
+
# version :thumb do
|
|
45
|
+
# process :scale => [50, 50]
|
|
46
|
+
# end
|
|
47
|
+
|
|
48
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
|
49
|
+
# For images you might use something like this:
|
|
50
|
+
|
|
51
|
+
# Override the filename of the uploaded files:
|
|
52
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
|
53
|
+
before :store, :remember_cache_id
|
|
54
|
+
after :store, :delete_tmp_dir
|
|
55
|
+
|
|
56
|
+
# store! nil's the cache_id after it finishes so we need to remember it for deletition
|
|
57
|
+
def remember_cache_id(new_file)
|
|
58
|
+
@cache_id_was = cache_id
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def delete_tmp_dir(new_file)
|
|
62
|
+
# make sure we don't delete other things accidentally by checking the name pattern
|
|
63
|
+
if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
|
|
64
|
+
FileUtils.rm_rf(File.join(cache_dir, @cache_id_was))
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def filename
|
|
69
|
+
if original_filename
|
|
70
|
+
@name ||= Digest::MD5.hexdigest(current_path)
|
|
71
|
+
"#{@name}.#{file.extension}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def move_to_cache
|
|
76
|
+
false
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def move_to_store
|
|
80
|
+
true
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def self.has_asset?(name)
|
|
84
|
+
EXT_NAMES.keys.include?(name.to_sym)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def self.is_image?(extname)
|
|
88
|
+
EXT_NAMES[:image].include?(extname)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def self.create_asset_model(name)
|
|
93
|
+
return nil unless %w(asset file flash image media).include?(name.to_s)
|
|
94
|
+
class_name = "XmtFroala::#{name.camelize}"
|
|
95
|
+
return Object.const_get(class_name) if Object.const_defined?(class_name)
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.create_uploader(name)
|
|
100
|
+
return nil unless %w(asset file flash image media).include?(name.to_s)
|
|
101
|
+
class_name = "XmtFroala::#{name.camelize}Uploader"
|
|
102
|
+
return Object.const_get(class_name) if Object.const_defined?(class_name)
|
|
103
|
+
nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
end
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module XmtFroala
|
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
4
|
+
desc "Install xmt_froala for your application."
|
|
5
|
+
|
|
6
|
+
def copy_kindeditor_files
|
|
7
|
+
if ::Rails.version < "3.1.0"
|
|
8
|
+
warn "Warning: xmt_froala ~> v0.3.0 only support Rails3.1+!"
|
|
9
|
+
warn "If you're using rails3.0.x, please check xmt_froala v0.2.8"
|
|
10
|
+
else
|
|
11
|
+
template "xmt_froala.rb", "config/initializers/xmt_froala.rb"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def insert_or_copy_js_files
|
|
16
|
+
if File.exist?('app/assets/javascripts/application.js')
|
|
17
|
+
insert_into_file "app/assets/javascripts/application.js", "//= require xmt_froala\n", :after => "jquery_ujs\n"
|
|
18
|
+
else
|
|
19
|
+
copy_file "application.js", "app/assets/javascripts/application.js"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require xmt_froala
|
|
16
|
+
//= require_tree .
|
|
17
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
XmtFroala.setup do |config|
|
|
2
|
+
|
|
3
|
+
# Specify the subfolders in public directory.
|
|
4
|
+
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
|
|
5
|
+
config.upload_dir = 'uploads'
|
|
6
|
+
|
|
7
|
+
# Allowed file types for upload.
|
|
8
|
+
config.upload_image_ext = %w[gif jpg jpeg png bmp]
|
|
9
|
+
config.upload_flash_ext = %w[swf flv]
|
|
10
|
+
config.upload_media_ext = %w[swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb]
|
|
11
|
+
config.upload_file_ext = %w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]
|
|
12
|
+
|
|
13
|
+
# Porcess upload image size
|
|
14
|
+
# eg: 1600x1600 => 800x800
|
|
15
|
+
# 1600x800 => 800x400
|
|
16
|
+
# 400x400 => 400x400 # No Change
|
|
17
|
+
# config.image_resize_to_limit = [800, 800]
|
|
18
|
+
|
|
19
|
+
# if you have config in your rails application like this:
|
|
20
|
+
# /config/enviroments/production.rb
|
|
21
|
+
# # config.action_controller.asset_host = "http://asset.example.com"
|
|
22
|
+
# # config.assets.prefix = "assets_prefx"
|
|
23
|
+
# then you should:
|
|
24
|
+
#
|
|
25
|
+
# config.asset_url_prefix = "http://asset.example.com/assets_prefx/" if Rails.env.production?
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
end
|