Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails_admin_tag_list

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_admin_tag_list

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

DEPRECATED

This plugin is no longer supported.

Introduction

Greate rails_admin gem does not work with another great gem - acts_as_taggable_on, because rails_admin knows nothing about the virtual attributes *_list (tag_list, skill_list etc.), which created by acts_as_taggable_on for display and edit tags.

This problem is solved with rails_admin_tag_list gem.

Installation

In your Gemfile:

gem 'rails_admin'
gem 'rails_admin_tag_list'

and run:

$ bundle install

Check acts_as_taggable_on docs in order to install it properly.

Usage and Configuration

rails_admin_tag_list by default does the following:

  1. Register new field type TagList for rails_admin
  2. Finds acts_as_taggable_on virtual attributes (*_list - tag_list, skill_list etc.) and adds them to RailsAdmin.config

There is your model:

class Player < ActiveRecord::Base
  acts_as_taggable
  acts_as_taggable_on :skills
end

Note that tag_list (skill_list, etc.) attribute should be available for mass-assignment by rails_admin users.

Since Rails 3.2.3 config.active_record.whitelist_attributes option is true by default; this means that you should put tag_list (skill_list, etc.) attribute in the white list, like in example above:

attr_accessible :tag_list, :skill_list

edit field view

In addition to default field view (named form_tag_list) this gem provides two custom views tag_list_with_suggestions and tag_list_with_autocomplete. To enable any of them specify partial name:

RailsAdmin.config do |config|
  config.model Player do
    edit do
      fields_of_type :tag_list do
        partial 'tag_list_with_suggestions'

        # the option sets max count of suggestions (default is 100); set -1 to abolish the limit
        ratl_max_suggestions -1
      end
    end
  end
end

You can do with tag_list fields whatever what allows to do rails_admin:

rename label

RailsAdmin.config do |config|
  config.model Player do
    edit do
      field :tag_list do
        label "Tags"
      end
      field :skill_list
    end
  end
end

hide all tag_list fields

RailsAdmin.config do |config|
  config.model Player do
    edit do
      fields_of_type :tag_list do
        hide
      end
    end
  end
end

reassing partial

RailsAdmin.config do |config|
  config.model Player do
    edit do
      fields_of_type :tag_list do
        partial 'awesome_tag_list'
      end
    end
  end
end

Create you custom partial and put it to app/views/rails_admin/main/ in your own project folder. Check an example

FAQs

Package last updated on 19 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc