rails_admin_redactor 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02180c9807493c98970d40a971f2f4d1e0439943
4
+ data.tar.gz: 725b790523cf51fb412385d0bf4558324968ddfc
5
+ SHA512:
6
+ metadata.gz: fb0e0d5a035c5f38b2ed60a0f40f71ca348ed1bbcb84ca20b352e59c6d0333ec154830cb48d500461c0e9517544d3f4059519c4a1cc603b615a33549ccbf0688
7
+ data.tar.gz: 9c1dc811138b729c7a1be6111bdc993c1b1ff9d2b8fe44275ce32f6ce2f3963a14d75103b444288fe1da90f9671f34746586d121a9b610002e4c618dacffe2ba
@@ -0,0 +1,32 @@
1
+ = form.text_area field.method_name, { :'data-richtext' => 'redactor', :'data-options' => field.options.to_json, value: field.form_value }.merge(field.html_attributes)
2
+
3
+ :javascript
4
+ (function() {
5
+ $(document).on('rails_admin.dom_ready', function() {
6
+ var $redactorTextareas = $('textarea[data-richtext=redactor]:not(.redactor-initialized)');
7
+
8
+ if($redactorTextareas.length > 0) {
9
+ var jsPath = (#{field.js_location.to_json});
10
+ var cssPath = (#{field.css_location.to_json});
11
+
12
+ if($('link[href="' + cssPath + '"]').length === 0) {
13
+ $('head').append('<link href="' + cssPath + '" rel="stylesheet" media="all" type="text/css">');
14
+ }
15
+
16
+ if($.fn.redactor) {
17
+ onRedactorReady();
18
+ }else{
19
+ $.getScript(jsPath, onRedactorReady);
20
+ }
21
+ }
22
+ });
23
+
24
+ var onRedactorReady = function() {
25
+ $('textarea[data-richtext=redactor]:not(.redactor-initialized)').each(function() {
26
+ var $redactorTextarea = $(this);
27
+ var options = $redactorTextarea.data('options');
28
+
29
+ $redactorTextarea.addClass('redactor-initialized').redactor(options);
30
+ });
31
+ };
32
+ })();
@@ -0,0 +1,24 @@
1
+ require 'rails_admin/config/fields/types'
2
+ require 'rails_admin/config/fields/types/text'
3
+
4
+ module RailsAdminRedactor
5
+ class Redactor < RailsAdmin::Config::Fields::Types::Text
6
+ RailsAdmin::Config::Fields::Types.register(self)
7
+
8
+ register_instance_option :options do
9
+ nil
10
+ end
11
+
12
+ register_instance_option :css_location do
13
+ ActionController::Base.helpers.asset_path('redactor.css')
14
+ end
15
+
16
+ register_instance_option :js_location do
17
+ ActionController::Base.helpers.asset_path('redactor.js')
18
+ end
19
+
20
+ register_instance_option :partial do
21
+ :form_redactor
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module RailsAdminRedactor
2
+ VERSION = '0.0.2'.freeze
3
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails_admin_redactor/version'
2
+ require 'rails_admin_redactor/redactor'
3
+ require 'action_controller/base'
4
+
5
+ module RailsAdminRedactor
6
+
7
+ end
8
+
9
+ ActionController::Base.prepend_view_path(File.expand_path('../app/views', File.dirname(__FILE__)))
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_admin_redactor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - anarchocurious
8
+ - jenhomann
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-09-04 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Rails Admin Redactor
15
+ email:
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - "./app/views/rails_admin/main/_form_redactor.haml"
21
+ - "./lib/rails_admin_redactor.rb"
22
+ - "./lib/rails_admin_redactor/redactor.rb"
23
+ - "./lib/rails_admin_redactor/version.rb"
24
+ homepage: https://github.com/anarchocurious/rails_admin_redactor
25
+ licenses: []
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.4.6
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Rails Admin Redactor
47
+ test_files: []
48
+ has_rdoc: