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

fatcow

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fatcow

  • 0.1.9
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Fatcow

This adds some basic helpers to rails that let you use the Fatcow icon set in all of it's early-2010s glory.

You can browse the icons via wikimedia.

Installation

To install, simply add it to your gemfile,

gem 'fatcow'

then add the (optional) stylesheet to your template:

<%= stylesheet_link_tag 'fatcow/application', "data-turbo-track": "reload" %>

and you're good to go!

How to use

In any view, just use the fci helper to place an arbitrary icon.

<%= fci :note %>

You can also include a status, which is a small icon placed in the bottom left hand corner of the icon.

<%= fci :note, :add %>

Use with models

You can also assign an icon to a model, which will then be displayable with a status reflecting the current state of the record. Add the has_icon macro into your model definition, and you're good to go.


class Alert < ActiveRecord
  has_icon :bell
end

There are some default statuses (:add for new records, :edit for persisted records in a form, etc.) but you can include + overwrite statues using the same macro. Provide show statuses to be used with record.show_icon and form statuses to be used with record.form_icon. Include the name of the status as the key, and the value should be a Proc that returns true/false, and is executed in the context of the record instance.


class Alert < ActiveRecord
  has_icon :bell, show: { attach: -> { has_attachment? } }, form: { warning: -> { invalid? } }
end

Then, to show your icon in a view, just call either #show_icon (when showing the resource) or #form_icon (when displaying a form) on a record instance, and pass it to fci. You cannot do this on collections, though that may be coming later.

<%= fci @alert.show_icon %>

All Icons

a big list of icons

Licensing

FatCow web icons are licensed under a Creative Commons Attribution 3.0 License. This library has opted to do the same because I'm not a lawyer and I have no idea what I'm doing.

All icons are attributed to FatCow, who formerly hosted the icons at http://www.fatcow.com/free-icons. (Archive)

FAQs

Package last updated on 08 Dec 2024

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