Giter VIP home page Giter VIP logo

djangocms-icon's Introduction

django CMS Icon

pypi build coverage

django CMS Icon is a plugin for django CMS that allows you to insert an icon (font or svg) into your project.

This addon is compatible with Divio Cloud and is also available on the django CMS Marketplace for easy installation.

preview.gif

Contributing

This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

One of the easiest contributions you can make is helping to translate this addon on Transifex.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

  • Python 2.7, 3.3 or higher
  • Django 1.8 or higher

Installation

For a manual install:

  • run pip install djangocms-icon
  • add djangocms_icon to your INSTALLED_APPS
  • run python manage.py migrate djangocms_icon

Configuration

The django CMS Icon plugin ships with Font Awesome as default. You can configure this through:

DJANGOCMS_ICON_SETS = [
    ('fontawesome', 'fa', 'Font Awesome'),
    (ICONSET, 'icon', 'SVG icons'),
]

In this example we keep the Font Awesome default and add our own SVG icon set on top of it. ICONSET is an external reference to a JSON file at the root of your project setting up your custom SVG icon set:

with open('iconset.json') as fh:
    ICONSET = fh.read()

Here an example of its content:

{
    "svg": true,
    "spritePath": "sprites/icons.svg",
    "iconClass": "icon",
    "iconClassFix": "icon-",
    "icons": [
        "icon-icon1",
        "icon-icon2",
        "..."
    ]
}

svg and spritePath are only required when using an SVG set. You can also use this to generate your own icon font definitions or add them straight to the DJANGOCMS_ICON_SETS setting.

djangocms-boilerplate-webpack can generate the iconset.json automatically for you through gulp icons.

In addition you need to load the resources for your fonts in /admin/djangocms_icon/includes/assets.html through your project in order for the icon picker to pick up your custom icons.

Make sure the icons names contain the iconset prefix as shown in the example, the widget will determine the iconset based on that. They can be omitted if only one iconset is used.

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

djangocms-icon's People

Contributors

finalangel avatar vxsx avatar

Watchers

 avatar

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.