Coder Social home page Coder Social logo

jemcode / rails_admin_actiontext Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 3.0 15 KB

ActionText (Trix editor) support for rails_admin

Home Page: https://rubygems.org/gems/rails_admin_actiontext

License: MIT License

Ruby 92.10% JavaScript 0.87% CSS 1.62% HTML 5.40%
rails actiontext rails-admin rails6 trix-editor trix

rails_admin_actiontext's Introduction

RailsAdminActiontext

Gem Version Code Climate

RailsAdmin extension for enabling the Rails 6 ActionText editor.

Installation

To enable rails_admin_actiontext, add the following to your Gemfile:

gem 'rails_admin'
gem 'rails_admin_actiontext'

Configuration

To use ActionText follow the Rails installation instructions (don't forget ActiveStorage if you want to allow drag and drop images).

RailsAdmin.config do |config|
  config.model Team do
    edit do
      field :description, :actiontext
    end
  end
end

About Jemcode

Jemcode

This repository is maintained and funded by Jemcode Limited. We are available for hire.

rails_admin_actiontext's People

Contributors

rikkipitt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rails_admin_actiontext's Issues

couldn't find file 'trix/dist/trix' with type 'text/css'

Hi there,

After setting up actiontext and activestorage, I added this gem to our app. However, when adding :actiontext to our :body attribute, I get this error:

couldn't find file 'trix/dist/trix' with type 'text/css'
Checked in these paths: 
  /Users/vnguyen/git/Oumuamua/app/assets/config
  /Users/vnguyen/git/Oumuamua/app/assets/images
  /Users/vnguyen/git/Oumuamua/app/assets/stylesheets
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin_actiontext-0.0.3/app/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin_actiontext-0.0.3/app/assets/stylesheets
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/app/assets/images
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/app/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/app/assets/stylesheets
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/vendor/assets/fonts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/vendor/assets/images
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/vendor/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/rails_admin-2.0.2/vendor/assets/stylesheets
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/remotipart-1.4.4/vendor/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/nested_form-0.3.2/vendor/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/jquery-ui-rails-6.0.1/app/assets/images
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/jquery-ui-rails-6.0.1/app/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/jquery-ui-rails-6.0.1/app/assets/stylesheets
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/jquery-rails-4.4.0/vendor/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/actioncable-6.0.3.1/app/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/activestorage-6.0.3.1/app/assets/javascripts
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/actionview-6.0.3.1/lib/assets/compiled
  /Users/vnguyen/.rvm/gems/ruby-2.7.1/gems/turbolinks-source-5.2.0/lib/assets/javascripts

Extracted source (around line #1):

//= require trix/dist/trix
//= require actiontext

I found this article:
rails/actiontext#40 (comment)

So I tried to add the following file (config/assets.rb):

# config/initializers/assets.rb

Rails.application.config.assets.paths << Rails.root.join('node_modules')

I've tried just manually installing actiontext to rails_admin without the gem, and can't quite figure out how to get it to load into a text field.

Any help on why it can't find the trix file?

couldn't find file 'trix/dist/trix' with type 'text/css'

Showing /Users/nikodemgorak/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rails_admin_actiontext-0.0.3/app/views/rails_admin/main/_form_actiontext.html.haml where line #1 raised:

couldn't find file 'trix/dist/trix' with type 'text/css'

I was trying to add the editor to rails admin.
package.json

{
  "license": "UNLICENSED",
  "dependencies": {
    "@babel/preset-react": "^7.13.13",
    "@hookform/error-message": "^2.0.0",
    "@popperjs/core": "^2.9.1",
    "@rails/actiontext": "^6.0.3-7",
    "@rails/activestorage": "^6.1.3-1",
    "@rails/ujs": "^6.1.3-1",
    "@rails/webpacker": "5.3.0",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
    "bootstrap": "^5.0.0-beta3",
    "bootstrap-icons": "^1.8.1",
    "channels": "^0.0.4",
    "jquery": "^3.6.0",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-hook-form": "^7.6.4",
    "react_ujs": "^2.6.1",
    "trix": "^1.2.0",
    "turbolinks": "^5.2.0"
  },
  "devDependencies": {
    "webpack-dev-server": "^3.11.2"
  }
}

Trace of template inclusion: #<ActionView::Template /Users/nikodemgorak/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/bundler/gems/rails_admin-7962a19469a7/app/views/rails_admin/main/new.html.haml locals=[]>

I've added assets.rb in the initializers folder with
Rails.application.config.assets.paths << Rails.root.join('node_modules')
Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.