activeadmin_tinymce 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/active_admin/tinymce/application_controller.rb +6 -0
- data/app/controllers/active_admin/tinymce/modal_controller.rb +13 -0
- data/app/helpers/active_admin/tinymce/application_helper.rb +6 -0
- data/app/views/{active_admin_tinymce → active_admin/tinymce}/modal/_modal.slim +2 -2
- data/config/routes.rb +1 -1
- data/lib/active_admin/tinymce/engine.rb +7 -0
- data/lib/active_admin/tinymce/version.rb +5 -0
- data/lib/active_admin_tinymce.rb +11 -6
- data/lib/activeadmin_tinymce.rb +1 -0
- data/lib/generators/{active_admin_tinymce → active_admin/tinymce}/install/install_generator.rb +5 -4
- data/lib/generators/active_admin/tinymce/install/templates/active_admin_tinymce.rb +17 -0
- data/test/active_admin_tinymce_test.rb +1 -1
- data/test/dummy/app/models/image.rb +3 -0
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/initializers/active_admin_tinymce.rb +3 -0
- data/test/dummy/config/routes.rb +1 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20131206060659_create_images.rb +8 -0
- data/test/dummy/db/schema.rb +21 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +59 -0
- data/test/dummy/test/fixtures/images.yml +11 -0
- data/test/dummy/test/unit/image_test.rb +7 -0
- data/test/functional/modal_controller_test.rb +12 -0
- data/test/unit/active_admin_tinymce_test.rb +8 -6
- metadata +73 -17
- data/app/controllers/active_admin_tinymce/application_controller.rb +0 -4
- data/app/controllers/active_admin_tinymce/modal_controller.rb +0 -11
- data/app/helpers/active_admin_tinymce/application_helper.rb +0 -4
- data/lib/active_admin_tinymce/engine.rb +0 -5
- data/lib/active_admin_tinymce/version.rb +0 -3
- data/lib/generators/active_admin_tinymce/install/USAGE +0 -8
- data/lib/generators/active_admin_tinymce/install/templates/active_admin_tinymce.rb +0 -3
- data/test/controllers/active_admin_tinymce/modal_controller_test.rb +0 -10
@@ -0,0 +1,13 @@
|
|
1
|
+
require_dependency 'application_controller'
|
2
|
+
|
3
|
+
module ActiveAdmin
|
4
|
+
module Tinymce
|
5
|
+
class ModalController < ApplicationController
|
6
|
+
def index
|
7
|
+
model = ActiveAdmin::Tinymce.model_class
|
8
|
+
@images = model.all
|
9
|
+
render partial: 'active_admin_tinymce/modal/modal'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -5,8 +5,8 @@
|
|
5
5
|
h3 Выберете изображение
|
6
6
|
div class="modal-body form-horizontal"
|
7
7
|
- @images.each do |image|
|
8
|
-
a.collection-image data-original="#{image.
|
9
|
-
img src="#{image.
|
8
|
+
a.collection-image data-original="#{image.send(ActiveAdmin::Tinymce.attachment_attr_name).url(:original)}"
|
9
|
+
img src="#{image.send(ActiveAdmin::Tinymce.attachment_attr_name).url(:thumb)}"
|
10
10
|
div class="modal-footer"
|
11
11
|
button type="button" class="btn btn-primary action-ok" Ok
|
12
12
|
button type="button" data-dismiss="modal" class="btn close" Cancel
|
data/config/routes.rb
CHANGED
data/lib/active_admin_tinymce.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require 'active_admin/tinymce/engine'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
3
|
+
module ActiveAdmin
|
4
|
+
module Tinymce
|
5
|
+
mattr_accessor :model_class
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
mattr_accessor :attachment_attr_name
|
8
|
+
@@attachment_attr_name = 'attachment'
|
9
|
+
|
10
|
+
def self.setup
|
11
|
+
yield self
|
12
|
+
end
|
9
13
|
|
14
|
+
end
|
10
15
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'active_admin_tinymce'
|
data/lib/generators/{active_admin_tinymce → active_admin/tinymce}/install/install_generator.rb
RENAMED
@@ -1,15 +1,16 @@
|
|
1
|
-
module
|
1
|
+
module ActiveAdmin
|
2
|
+
module Tinymce
|
2
3
|
class InstallGenerator < Rails::Generators::NamedBase
|
3
4
|
source_root File.expand_path('../templates', __FILE__)
|
4
5
|
|
5
6
|
def create_initializer
|
6
|
-
template '
|
7
|
+
template 'tinymce.rb', 'config/initializers/tinymce.rb'
|
7
8
|
end
|
8
9
|
|
9
10
|
def create_routes
|
10
|
-
insert_into_file 'config/routes.rb', "\n mount
|
11
|
+
insert_into_file 'config/routes.rb', "\n mount ActiveAdmin::Tinymce::Engine => '/', as: 'admin_editor'",
|
11
12
|
after: 'ActiveAdmin.routes(self)'
|
12
13
|
end
|
13
14
|
end
|
14
|
-
|
15
|
+
end
|
15
16
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ActiveAdmin::Tinymce.setup do |config|
|
2
|
+
|
3
|
+
# == Images
|
4
|
+
#
|
5
|
+
# Your model for images. Editor use this class for insert images into text
|
6
|
+
#
|
7
|
+
config.model_class = <%= name.nil? ? Image : name%>
|
8
|
+
|
9
|
+
# == Attachment
|
10
|
+
#
|
11
|
+
# Name of the method for get paperclip's attached files
|
12
|
+
#
|
13
|
+
# Defaults:
|
14
|
+
# config.attachment_attr_name = 'attachment'
|
15
|
+
|
16
|
+
|
17
|
+
end
|
data/test/dummy/config/routes.rb
CHANGED
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20131206060659) do
|
15
|
+
|
16
|
+
create_table "images", :force => true do |t|
|
17
|
+
t.datetime "created_at", :null => false
|
18
|
+
t.datetime "updated_at", :null => false
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
Binary file
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
Connecting to database specified by database.yml
|
2
|
+
Connecting to database specified by database.yml
|
3
|
+
Connecting to database specified by database.yml
|
4
|
+
Connecting to database specified by database.yml
|
5
|
+
Connecting to database specified by database.yml
|
6
|
+
Connecting to database specified by database.yml
|
7
|
+
Connecting to database specified by database.yml
|
8
|
+
[1m[36m (21.8ms)[0m [1mbegin transaction[0m
|
9
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
10
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
11
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
12
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
13
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
14
|
+
Connecting to database specified by database.yml
|
15
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
16
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
17
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
18
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
19
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
20
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
21
|
+
Connecting to database specified by database.yml
|
22
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
23
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
24
|
+
Connecting to database specified by database.yml
|
25
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
26
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
27
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
28
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
29
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
30
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
31
|
+
Connecting to database specified by database.yml
|
32
|
+
Connecting to database specified by database.yml
|
33
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
34
|
+
[1m[35m (162.6ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
35
|
+
[1m[36m (185.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
36
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
37
|
+
Migrating to CreateImages (20131206060659)
|
38
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
39
|
+
[1m[35m (1.1ms)[0m CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
40
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20131206060659')[0m
|
41
|
+
[1m[35m (248.6ms)[0m commit transaction
|
42
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
43
|
+
Connecting to database specified by database.yml
|
44
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
45
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
46
|
+
Connecting to database specified by database.yml
|
47
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
48
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
49
|
+
Connecting to database specified by database.yml
|
50
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
51
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
52
|
+
Connecting to database specified by database.yml
|
53
|
+
Connecting to database specified by database.yml
|
54
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
55
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
56
|
+
Connecting to database specified by database.yml
|
57
|
+
Connecting to database specified by database.yml
|
58
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
59
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
|
+
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
+
# below each fixture, per the syntax in the comments below
|
6
|
+
#
|
7
|
+
one: {}
|
8
|
+
# column: value
|
9
|
+
#
|
10
|
+
two: {}
|
11
|
+
# column: value
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module ActiveAdmin
|
4
|
+
module Tinymce
|
5
|
+
class ActiveAdminTinymceTest < ActiveSupport::TestCase
|
6
|
+
test "setup" do
|
7
|
+
ActiveAdmin::Tinymce.setup do |config|
|
8
|
+
config.model_class = String
|
9
|
+
end
|
10
|
+
assert_equal ActiveAdmin::Tinymce.model_class, String
|
8
11
|
end
|
9
|
-
assert_equal ActiveAdminTinymce.model_class, String
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_tinymce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-12-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &75382050 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,39 +21,75 @@ dependencies:
|
|
21
21
|
version: 3.2.13
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
|
24
|
+
version_requirements: *75382050
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: slim-rails
|
27
|
+
requirement: &75381770 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.3
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *75381770
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: tinymce-rails
|
38
|
+
requirement: &75381570 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *75381570
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: activeadmin
|
49
|
+
requirement: &75381280 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *75381280
|
58
|
+
description: ! 'This is a wysiwyg html editor for the Active Admin interface using
|
59
|
+
TinyMCE. Editor supports
|
60
|
+
|
61
|
+
inserting images. To upload files used Active Admin Images.'
|
26
62
|
email:
|
27
63
|
- mk@kernel-corp.com
|
28
64
|
executables: []
|
29
65
|
extensions: []
|
30
66
|
extra_rdoc_files: []
|
31
67
|
files:
|
32
|
-
- app/controllers/
|
33
|
-
- app/controllers/
|
68
|
+
- app/controllers/active_admin/tinymce/modal_controller.rb
|
69
|
+
- app/controllers/active_admin/tinymce/application_controller.rb
|
34
70
|
- app/assets/javascripts/active_admin_tinymce/application.js
|
35
71
|
- app/assets/stylesheets/active_admin_tinymce/application.css
|
36
|
-
- app/views/
|
72
|
+
- app/views/active_admin/tinymce/modal/_modal.slim
|
37
73
|
- app/views/layouts/active_admin_tinymce/application.html.erb
|
38
|
-
- app/helpers/
|
74
|
+
- app/helpers/active_admin/tinymce/application_helper.rb
|
39
75
|
- config/routes.rb
|
40
|
-
- lib/
|
41
|
-
- lib/
|
76
|
+
- lib/active_admin/tinymce/version.rb
|
77
|
+
- lib/active_admin/tinymce/engine.rb
|
42
78
|
- lib/active_admin_tinymce.rb
|
43
79
|
- lib/tasks/active_admin_tinymce_tasks.rake
|
44
80
|
- lib/assets/javascripts/admin_lib/modal_controller.js.coffee
|
45
81
|
- lib/assets/javascripts/admin_lib/modal.js.coffee
|
46
82
|
- lib/assets/javascripts/admin_lib/init_tinymce.js
|
47
83
|
- lib/assets/stylesheets/admin_lib/modal.css.scss
|
48
|
-
- lib/
|
49
|
-
- lib/generators/
|
50
|
-
- lib/generators/
|
84
|
+
- lib/activeadmin_tinymce.rb
|
85
|
+
- lib/generators/active_admin/tinymce/install/install_generator.rb
|
86
|
+
- lib/generators/active_admin/tinymce/install/templates/active_admin_tinymce.rb
|
51
87
|
- MIT-LICENSE
|
52
88
|
- Rakefile
|
53
89
|
- README.rdoc
|
54
90
|
- test/unit/active_admin_tinymce_test.rb
|
55
91
|
- test/test_helper.rb
|
56
|
-
- test/
|
92
|
+
- test/functional/modal_controller_test.rb
|
57
93
|
- test/dummy/config.ru
|
58
94
|
- test/dummy/config/routes.rb
|
59
95
|
- test/dummy/config/locales/en.yml
|
@@ -66,6 +102,7 @@ files:
|
|
66
102
|
- test/dummy/config/initializers/mime_types.rb
|
67
103
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
68
104
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
105
|
+
- test/dummy/config/initializers/active_admin_tinymce.rb
|
69
106
|
- test/dummy/config/initializers/inflections.rb
|
70
107
|
- test/dummy/config/initializers/secret_token.rb
|
71
108
|
- test/dummy/config/initializers/session_store.rb
|
@@ -76,10 +113,19 @@ files:
|
|
76
113
|
- test/dummy/public/404.html
|
77
114
|
- test/dummy/public/500.html
|
78
115
|
- test/dummy/public/favicon.ico
|
116
|
+
- test/dummy/log/development.log
|
117
|
+
- test/dummy/log/test.log
|
79
118
|
- test/dummy/README.rdoc
|
80
119
|
- test/dummy/bin/bundle
|
81
120
|
- test/dummy/bin/rake
|
82
121
|
- test/dummy/bin/rails
|
122
|
+
- test/dummy/test/unit/image_test.rb
|
123
|
+
- test/dummy/test/fixtures/images.yml
|
124
|
+
- test/dummy/db/test.sqlite3
|
125
|
+
- test/dummy/db/schema.rb
|
126
|
+
- test/dummy/db/migrate/20131206060659_create_images.rb
|
127
|
+
- test/dummy/db/development.sqlite3
|
128
|
+
- test/dummy/app/models/image.rb
|
83
129
|
- test/dummy/app/controllers/application_controller.rb
|
84
130
|
- test/dummy/app/assets/javascripts/application.js
|
85
131
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -87,7 +133,7 @@ files:
|
|
87
133
|
- test/dummy/app/helpers/application_helper.rb
|
88
134
|
- test/integration/navigation_test.rb
|
89
135
|
- test/active_admin_tinymce_test.rb
|
90
|
-
homepage: https://github.com/KernelCorp/
|
136
|
+
homepage: https://github.com/KernelCorp/tinymce
|
91
137
|
licenses: []
|
92
138
|
post_install_message:
|
93
139
|
rdoc_options: []
|
@@ -110,11 +156,11 @@ rubyforge_project:
|
|
110
156
|
rubygems_version: 1.8.11
|
111
157
|
signing_key:
|
112
158
|
specification_version: 3
|
113
|
-
summary:
|
159
|
+
summary: TinyMCE for Active Admin
|
114
160
|
test_files:
|
115
161
|
- test/unit/active_admin_tinymce_test.rb
|
116
162
|
- test/test_helper.rb
|
117
|
-
- test/
|
163
|
+
- test/functional/modal_controller_test.rb
|
118
164
|
- test/dummy/config.ru
|
119
165
|
- test/dummy/config/routes.rb
|
120
166
|
- test/dummy/config/locales/en.yml
|
@@ -127,6 +173,7 @@ test_files:
|
|
127
173
|
- test/dummy/config/initializers/mime_types.rb
|
128
174
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
129
175
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
176
|
+
- test/dummy/config/initializers/active_admin_tinymce.rb
|
130
177
|
- test/dummy/config/initializers/inflections.rb
|
131
178
|
- test/dummy/config/initializers/secret_token.rb
|
132
179
|
- test/dummy/config/initializers/session_store.rb
|
@@ -137,10 +184,19 @@ test_files:
|
|
137
184
|
- test/dummy/public/404.html
|
138
185
|
- test/dummy/public/500.html
|
139
186
|
- test/dummy/public/favicon.ico
|
187
|
+
- test/dummy/log/development.log
|
188
|
+
- test/dummy/log/test.log
|
140
189
|
- test/dummy/README.rdoc
|
141
190
|
- test/dummy/bin/bundle
|
142
191
|
- test/dummy/bin/rake
|
143
192
|
- test/dummy/bin/rails
|
193
|
+
- test/dummy/test/unit/image_test.rb
|
194
|
+
- test/dummy/test/fixtures/images.yml
|
195
|
+
- test/dummy/db/test.sqlite3
|
196
|
+
- test/dummy/db/schema.rb
|
197
|
+
- test/dummy/db/migrate/20131206060659_create_images.rb
|
198
|
+
- test/dummy/db/development.sqlite3
|
199
|
+
- test/dummy/app/models/image.rb
|
144
200
|
- test/dummy/app/controllers/application_controller.rb
|
145
201
|
- test/dummy/app/assets/javascripts/application.js
|
146
202
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require_dependency 'application_controller'
|
2
|
-
|
3
|
-
module ActiveAdminTinymce
|
4
|
-
class ModalController < ApplicationController
|
5
|
-
def index
|
6
|
-
model = ActiveAdminTinymce.model_class
|
7
|
-
@images = model.all
|
8
|
-
render partial: 'active_admin_tinymce/modal/modal'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|