thecore 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a90a9790b6fe194f9f61f804e7935306a3e55641
4
- data.tar.gz: 96f7883e46029239ee41d71ab968f99cd9a20f00
3
+ metadata.gz: e7ecde420b6b5ee531fdce52a2844be50f3282a0
4
+ data.tar.gz: 37c593961d4a52ef7c7538f3f8b231de186a7a22
5
5
  SHA512:
6
- metadata.gz: 880eeef4a2596e491555f0c8f22c08dada463630813d5b373bb7039af0672e8ad91ac95be78d2b36c2a5b1343c1c60142a7887154b0dfedaf1f6a00543642b2b
7
- data.tar.gz: 55aee12e48f4bd8b33e12717158d1387be5e625d0f64b5b800b1e2d36d8831308bdc84efd7aed5edb81e6c3e8b9be44c477e8bfbe07cd1ad3ecb72c1c44be58c
6
+ metadata.gz: fb708a135202e921aae325a3bb0f0ea5bda62021468f20585bd3ee861a1f45170d52a4af51802bff1a1a68086c38c76c32426c145140baa7f7da181529ecf862
7
+ data.tar.gz: f1d340c79e8c0c8e7afff359258f1756ffd7e3c1684300c0b4bc908d68544156d1931165165921c23ac575c30ede9a110680b3a68d03338b96a10a66403dc329
@@ -0,0 +1,4 @@
1
+ class Ckeditor::Asset < ActiveRecord::Base
2
+ include Ckeditor::Orm::ActiveRecord::AssetBase
3
+ include Ckeditor::Backend::Paperclip
4
+ end
@@ -0,0 +1,13 @@
1
+ class Ckeditor::AttachmentFile < Ckeditor::Asset
2
+ has_attached_file :data,
3
+ url: '/ckeditor_assets/attachments/:id/:filename',
4
+ path: ':rails_root/public/ckeditor_assets/attachments/:id/:filename'
5
+
6
+ validates_attachment_presence :data
7
+ validates_attachment_size :data, less_than: 100.megabytes
8
+ do_not_validate_attachment_file_type :data
9
+
10
+ def url_thumb
11
+ @url_thumb ||= Ckeditor::Utils.filethumb(filename)
12
+ end
13
+ end
@@ -0,0 +1,20 @@
1
+ class Ckeditor::Picture < Ckeditor::Asset
2
+ has_attached_file :data,
3
+ url: '/ckeditor_assets/pictures/:id/:style_:basename.:extension',
4
+ path: ':rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension',
5
+ styles: { content: '800>', thumb: '118x100#' }
6
+
7
+ validates_attachment_presence :data
8
+ validates_attachment_size :data, less_than: 2.megabytes
9
+ validates_attachment_content_type :data, content_type: /\Aimage/
10
+
11
+ def url_content
12
+ # url(:content)
13
+ url = if ENV['RAILS_URL'].blank? || ENV['RAILS_RELATIVE_URL_ROOT'].blank?
14
+ "http://localhost:3000"
15
+ else
16
+ "#{ENV['RAILS_URL']}#{ENV['RAILS_RELATIVE_URL_ROOT']}"
17
+ end
18
+ "#{url}#{url(:content)}"
19
+ end
20
+ end
@@ -17,6 +17,7 @@ Rails.application.configure do
17
17
  config.assets.precompile += %w( ie.js )
18
18
  config.assets.precompile += %w( manifest.json )
19
19
  config.assets.precompile += %w( browserconfig.xml )
20
+ config.assets.precompile += %w( ckeditor/* )
20
21
 
21
22
  config.filter_parameters += [:password]
22
23
 
@@ -1,6 +1,7 @@
1
1
  Rails.application.routes.draw do
2
2
  # mount RailsAdminSelectize::Engine => '/rails-admin-selectize', as: 'rails_admin_selectize'
3
3
  mount RailsAdmin::Engine => '/app', as: 'rails_admin'
4
+ mount Ckeditor::Engine => '/ckeditor'
4
5
 
5
6
  get "home", to: "pages#home", as: "home"
6
7
  get "inside", to: "pages#inside", as: "inside"
@@ -0,0 +1,23 @@
1
+ class CreateCkeditorAssets < ActiveRecord::Migration[4.2]
2
+ def self.up
3
+ create_table :ckeditor_assets do |t|
4
+ t.string :data_file_name, null: false
5
+ t.string :data_content_type
6
+ t.integer :data_file_size
7
+ t.string :data_fingerprint
8
+ t.string :type, limit: 30
9
+
10
+ # Uncomment it to save images dimensions, if your need it
11
+ t.integer :width
12
+ t.integer :height
13
+
14
+ t.timestamps null: false
15
+ end
16
+
17
+ add_index :ckeditor_assets, :type
18
+ end
19
+
20
+ def self.down
21
+ drop_table :ckeditor_assets
22
+ end
23
+ end
@@ -39,6 +39,8 @@ require 'thecore_rails_admin_bulk_delete_concern'
39
39
  require 'oj'
40
40
  require 'multi_json'
41
41
  require 'date_validator'
42
+ require 'ckeditor'
43
+ require "ckeditor/orm/active_record"
42
44
 
43
45
  require 'thecore/engine'
44
46
 
@@ -1,3 +1,3 @@
1
1
  module Thecore
2
- VERSION = '1.5.3'.freeze
2
+ VERSION = '1.5.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-09 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -276,6 +276,20 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0.9'
279
+ - !ruby/object:Gem::Dependency
280
+ name: ckeditor
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '4.2'
286
+ type: :runtime
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '4.2'
279
293
  description: Start from here and build whatever you want to.
280
294
  email:
281
295
  - gabriele.tassoni@gmail.com
@@ -289,6 +303,9 @@ files:
289
303
  - app/controllers/pages_controller.rb
290
304
  - app/jobs/application_job.rb
291
305
  - app/models/ability.rb
306
+ - app/models/ckeditor/asset.rb
307
+ - app/models/ckeditor/attachment_file.rb
308
+ - app/models/ckeditor/picture.rb
292
309
  - app/models/user.rb
293
310
  - app/uploaders/attachment_uploader.rb
294
311
  - app/uploaders/image_uploader.rb
@@ -318,6 +335,7 @@ files:
318
335
  - db/migrate/20161029154134_remove_friendly_id_slugs.rb
319
336
  - db/migrate/20180410134659_create_active_storage_tables.active_storage.rb
320
337
  - db/migrate/20180612075225_add_lock_version_to_users.rb
338
+ - db/migrate/20181119152033_create_ckeditor_assets.rb
321
339
  - db/seeds.rb
322
340
  - lib/abilities.rb
323
341
  - lib/active_record_extension.rb