• This repository has been archived on 01/Aug/2018
  • Stars
    star
    184
  • Rank 209,187 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rich text editor for Active Admin using wysihtml5.

Active Admin Editor

Build Status Code Climate

This is a wysiwyg html editor for the Active Admin interface using wysihtml5.

screenshot

Demo

Installation

Add the following to your Gemfile:

gem 'active_admin_editor'

And include the wysiwyg styles in your application.css:

//= require active_admin/editor/wysiwyg

Then run the following to install the default intializer:

$ rails g active_admin:editor

Usage

This gem provides you with a custom formtastic input called :html_editor to build out a wysihtml5 enabled input. All you have to do is specify the :as option for your inputs.

Example

ActiveAdmin.register Page do
  form do |f|
    f.inputs do
      f.input :title
      f.input :content, as: :html_editor
    end

    f.buttons
  end
end

Uploads

The editor supports uploading of assets directly to an S3 bucket. Edit the initializer that was installed when you ran rails g active_admin:editor.

ActiveAdmin::Editor.configure do |config|
  config.s3_bucket = '<your bucket>'
  config.aws_access_key_id = '<your aws access key>'
  config.aws_access_secret = '<your aws secret>'
  # config.storage_dir = 'uploads'
end

Then add the following CORS configuration to the S3 bucket:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>Location</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Configuration

You can configure the editor in the initializer installed with rails g active_admin:editor or you can configure the editor during ActiveAdmin.setup:

ActiveAdmin.setup do |config|
  # ...
  config.editor.aws_access_key_id = '<your aws access key>'
  config.editor.s3_bucket = 'bucket'
end

Parser Rules

Parser rules can be configured through the initializer:

ActiveAdmin::Editor.configure do |config|
  config.parser_rules['tags']['strike'] = {
    'remove' => 0
  }
end

Be sure to clear your rails cache after changing the config:

rm -rf tmp/cache

Heroku

Since some of the javascript files need to be compiled with access to the env vars, it's recommended that you add the user-env-compile labs feature to your app.

  1. Tell your rails app to run initializers on asset compilation

    # config/environments/production.rb
    config.initialize_on_precompile = true
  2. Add the labs feature

    heroku labs:enable user-env-compile -a myapp

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Tests

Run RSpec tests with bundle exec rake. Run JavaScript specs with bundle exec rake konacha:serve.

More Repositories

1

vagrant-heroku

A Vagrant base box that closely mirrors the Celadon Cedar stack on heroku
Shell
244
star
2

walk

A fast, general purpose, graph based build and task execution utility.
Go
137
star
3

metaforce

A ruby client for interacting with the Salesforce Metadata and Services API's.
Ruby
66
star
4

cloudwatch

Treat cloudwatch log streams as io.Reader and io.Writers.
Go
32
star
5

animate.scss

animate.css for the rails asset pipeline.
Ruby
29
star
6

chip8

CHIP-8 emulator in Go
Go
27
star
7

vim-forcedotcom

Force.com syntax highlighting in vim.
Vim Script
22
star
8

uTorrent-Notifier

An application that runs in the system tray and notifies you when a download finishes
C#
17
star
9

exsidekiq

Sidekiq client for Elixir.
Elixir
14
star
10

elusive-iconfont-sass-rails

Elusive Iconfont for Rails 3.1+ asset pipeline.
Ruby
10
star
11

openssag

Mac/Linux driver for the Orion StarShoot Autoguider
C++
10
star
12

slash

A framework for Slack slash commands with Go
Go
9
star
13

Arduino-Focuser

Project for the Arduino Focuser
C#
9
star
14

Arduino-Telescope--ASCOM-Driver-

ASCOM Driver for the Arduino Telescope
C#
8
star
15

heroku-buildpack-bower

Heroku buildpack to run bower.
8
star
16

octopart

Ruby gem for the Octopart API v2.
Ruby
8
star
17

mockjax

Define ajax stubs in your request specs.
JavaScript
8
star
18

hookshot

A Go http router that de-multiplexes and authorizes GitHub Webhooks.
Go
8
star
19

empire-demo

Ruby
7
star
20

darkmatter

YAML Front Matter for Rails
Ruby
6
star
21

metaforce-demo

Demo of how to use Metaforce and Rake for Force.com migrations.
Ruby
5
star
22

coreos-graphite

A set of unit files for running graphite under cores.
5
star
23

Arduino.NET-DLL

COM library for using the Arduino.NET library for simple serial communication
C#
4
star
24

dotfiles

My dotfiles
Vim Script
3
star
25

12factor

Run 12factor applications
Go
3
star
26

dressing

A Capybara driver for Sauce Labs.
Ruby
3
star
27

Arduino.NET

This is an Arduino library for a flexible serial protocol.
C++
3
star
28

plextrics

Metrics from heroku logs
Ruby
3
star
29

sinatra-template

Sinatra template app with sprockets support and RSpec/Capybara.
Ruby
2
star
30

Synodic-Solutions-Code-Scraps

Ahhh, the good old days.
PHP
2
star
31

forem-active-admin-test

Testing forem with acive admin
Ruby
2
star
32

buble

Go
2
star
33

restangular-collections

Collections for restangular
JavaScript
2
star
34

metaforce-delivery_method

Delivery method for sending emails from Ruby using Salesforce
Ruby
2
star
35

Arduino-Focuser--ASCOM-Driver-

ASCOM Driver for the Arduino Focuser
C#
2
star
36

sigp

Debug unix signals
Go
2
star
37

flock

Go sync.Locker backed by flock(2)
Go
2
star
38

swarm-ecs

Generate a text file from ECS container hosts for Docker Swarm
Go
1
star
39

openfocus-updater

C++
1
star
40

rabbitmq-clusterctl

A Go command for common operations tasks in HA rabbitmq.
Go
1
star
41

openfocus

An open source implementation of a motorized telescope focuser
C#
1
star
42

raggity

Raggity is a locally hosted sinatra application for serving and browsing git repositories.
Ruby
1
star
43

rally

An API for tying cloud services together
Ruby
1
star
44

docker-collectd

Docker container for running collectd configured via confd + etcd.
Shell
1
star
45

octopart-js

JavaScript library for the Octopart API.
Ruby
1
star
46

ejholmes.github.io

My blog.
CSS
1
star
47

Arduino-Dome--ASCOM-Driver-

Arduino dome ASCOM driver
C#
1
star
48

robut-shipr

A Robut plugin for shipr
Ruby
1
star
49

shipit

Continuous delivery made easy(er)
Ruby
1
star
50

jwplayer-ember-conflicts

JavaScript playlists don't work with jwplayer when emberjs is loaded.
1
star
51

dbdc

A Ruby gem for the Force.com REST API. Coming soon...
Ruby
1
star
52

docker-carbon

Docker container for running carbon.
Shell
1
star
53

exercism.io

Exercism.io solutions with elixir
Elixir
1
star
54

utorrent-notifier-daemon

Linux daemon for sending notifications when events happen in utorrent.
C
1
star
55

vpce-nlb-alb

Experiments with issues using VPCe/NLB/ALB together
HCL
1
star
56

pgstream

Log streaming library for Go
Go
1
star
57

Arduino-Telescope--Embedded-

Arduino telescope embedded software
C++
1
star
58

libopenfocus

C/C++ library for OpenFocus
C++
1
star
59

inspector

Inspect http requests
Go
1
star
60

Arduino-Dome--Embedded-

Arduino dome embedded software
C++
1
star
61

asset-sync-sinatra

Super small sinatra app that utilizes the asset_sync gem to sync assets to S3.
Ruby
1
star
62

nginx

Nginx for Empire
HTML
1
star
63

Arduino-Focuser--Embedded-

Arduino focuser firmware
C++
1
star
64

heroku-buildpack-sshkey

A heroku buildpack for using an ssh key for pulling in private GitHub dependencies.
Shell
1
star
65

databasedotlocal

A Rack application to mock the Database.com/Salesforce.com REST API.
Ruby
1
star