All Projects → blocknotes → Activeadmin_trumbowyg

blocknotes / Activeadmin_trumbowyg

Licence: mit
Trumbowyg Editor for ActiveAdmin

Programming Languages

javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Activeadmin trumbowyg

Activeadmin dynamic fields
ActiveAdmin plugin to add dynamic behaviors to fields
Stars: ✭ 73 (+151.72%)
Mutual labels:  activeadmin, rails, rails5
Activeadmin blaze theme
ActiveAdmin theme based on Blaze CSS toolkit
Stars: ✭ 35 (+20.69%)
Mutual labels:  activeadmin, rails, rails5
Activeadmin froala editor
Froala WYSIWYG editor for ActiveAdmin
Stars: ✭ 30 (+3.45%)
Mutual labels:  activeadmin, rails, rails5
Activeadmin quill editor
Quill Rich Text Editor for ActiveAdmin
Stars: ✭ 76 (+162.07%)
Mutual labels:  activeadmin, rails, rails5
Spina
Spina CMS
Stars: ✭ 1,926 (+6541.38%)
Mutual labels:  rails, rails5
Vuejs Rails Starterkit
Vue.js + Rails Starting Kit GitHub Template to develop Hybrid Mobile Application: https://vuejs-rails-starterkit.herokuapp.com
Stars: ✭ 205 (+606.9%)
Mutual labels:  rails, rails5
Activeadmin settings cached
UI interface for rails-settings-cached in active admin
Stars: ✭ 51 (+75.86%)
Mutual labels:  activeadmin, rails
Activeadmin Themes
Awesome themes for ActiveAdmin.
Stars: ✭ 141 (+386.21%)
Mutual labels:  activeadmin, rails
Activerecord where assoc
Make ActiveRecord do conditions on your associations
Stars: ✭ 126 (+334.48%)
Mutual labels:  rails, rails5
Formadmin
Modern and responsive theme for Active Admin used by Formaweb.
Stars: ✭ 79 (+172.41%)
Mutual labels:  activeadmin, rails
Arctic admin
Responsive Theme for ActiveAdmin
Stars: ✭ 201 (+593.1%)
Mutual labels:  activeadmin, rails
Pluck to hash
Extend ActiveRecord pluck to return array of hashes
Stars: ✭ 275 (+848.28%)
Mutual labels:  rails, rails5
activeadmin active resource
Active Admin + Active Resource: to use a REST API in place of a local database as data source
Stars: ✭ 20 (-31.03%)
Mutual labels:  activeadmin, rails5
Second level cache
Write Through and Read Through caching library inspired by CacheMoney and cache_fu, support ActiveRecord 4, 5 and 6.
Stars: ✭ 380 (+1210.34%)
Mutual labels:  rails, rails5
Arbre
An Object Oriented DOM Tree in Ruby
Stars: ✭ 610 (+2003.45%)
Mutual labels:  activeadmin, rails
Activeadmin
The administration framework for Ruby on Rails applications.
Stars: ✭ 9,096 (+31265.52%)
Mutual labels:  activeadmin, rails
Reactchat
A chat app built with React.js and ActionCable in Ruby on Rails 5.1
Stars: ✭ 90 (+210.34%)
Mutual labels:  rails, rails5
Action Cable Signaling Server
🤝Rails implementation of a WebRTC Signaling Server
Stars: ✭ 118 (+306.9%)
Mutual labels:  rails, rails5
Demo.activeadmin.info
A store application to use in tutorials for Active Admin
Stars: ✭ 253 (+772.41%)
Mutual labels:  activeadmin, rails
Activeadmin addons
Extends ActiveAdmin to enable a set of great optional UX improving add-ons
Stars: ✭ 574 (+1879.31%)
Mutual labels:  activeadmin, rails

Active Admin Trumbowyg Gem Version CircleCI

An Active Admin plugin to use Trumbowyg as WYSIWYG editor in form inputs.

Features:

  • automatically includes a fast & lightweight rich editor in Active Admin;
  • customizable options via data attributes in the form input;
  • plugins included, like images upload.

screenshot

Install

  • After installing Active Admin, add to your Gemfile: gem 'activeadmin_trumbowyg' (and execute bundle)
  • Add at the end of your Active Admin styles (app/assets/stylesheets/active_admin.scss):
@import 'activeadmin/trumbowyg/trumbowyg';
@import 'activeadmin/trumbowyg_input';
  • Add at the end of your Active Admin javascripts (app/assets/javascripts/active_admin.js):
//= require activeadmin/trumbowyg/trumbowyg
//= require activeadmin/trumbowyg_input
  • Use the input with as: :trumbowyg in Active Admin model conf
  • To fix icons in production environment execute the task: rails trumbowyg:nondigest

UPDATE FROM VERSION < 2.0: please change the Trumbowyg line in your app/assets/stylesheets/active_admin.scss to: @import 'activeadmin/trumbowyg/trumbowyg';

Usage

Form config (example model Article):

form do |f|
  f.inputs 'Article' do
    f.input :title
    f.input :description, as: :trumbowyg
    f.input :published
  end
  f.actions
end

Notes

  • data-options permits to set Trumbowyg editor options directly; some examples below. For reference see options list.
  • Why 2 separated scripts/style files? To allow to include different versions of Trumbowyg editor if needed.
  • To use this plugins with Active Admin 1.x please use the version 0.1.8

Examples

Toolbar buttons configuration

f.input :description, as: :trumbowyg, input_html: { data: { options: { btns: [['bold', 'italic'], ['superscript', 'subscript'], ['link'], ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'], ['unorderedList', 'orderedList'], ['horizontalRule'], ['removeformat']] } } }

Trumbowyg upload plugin

Plugin reference here.

Add to active_admin.js (after trumbowyg require):

//= require activeadmin/trumbowyg/plugins/upload/trumbowyg.upload

Form field config (example model Article):

unless resource.new_record?
  f.input :description, as: :trumbowyg, input_html: { data: { options: { btns: [['bold', 'italic'], ['link'], ['upload']], plugins: { upload: { serverPath: upload_admin_post_path(resource.id), fileFieldName: 'file_upload' } } } } }
end

Upload method (using ActiveStorage):

member_action :upload, method: [:post] do
  result = { success: resource.images.attach(params[:file_upload]) }
  result[:file] = url_for(resource.images.last) if result[:success]
  render json: result
end

For the relevant files of this upload example see here. Consider that this is just a basic example: images are uploaded as soon as they are attached to the editor (regardless of the form submit), it shows the editor only for an existing record (because of the upload_admin_post_path) and it doesn't provide a way to remove images (just deleting them from the editor will not destroy them, you'll need to implement a purge logic for that).

Do you like it? Star it!

If you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other Active Admin components.

Or consider offering me a coffee, it's a small thing but it is greatly appreciated: about me.

Contributors

  • Mattia Roccoberton: author
  • The good guys that opened issues and pull requests from time to time

License

The gem is available as open-source under the terms of the MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].