# Headmin A complete library of commonly used components to build an admin interface in your Ruby on Rails project. ## Interesting links - [Full documentation](docs/README.md) - [Rubygems](https://rubygems.org/gems/headmin) - [NPM](https://www.npmjs.com/package/headmin) ## Installation Add this line to your application's Gemfile: ```ruby gem 'headmin' ``` And then execute: ```shell $ bundle install ``` Add headmin to list of node modules ```shell $ yarn add headmin ``` ## Usage Add the Headmin helpers to the Admin helper file ```ruby module AdminHelper include Headmin::AdminHelper end ``` Import the Headmin class into your script. ```js import {Headmin} from 'headmin' document.addEventListener("DOMContentLoaded", function () { Headmin.start() }) ``` Finally import Headmin in your stylesheet. ```scss @import '~headmin/src/scss/headmin.scss'; ``` ## Development For development purposes it's helpful to have both the test project and Headmin located in the same directory. In Gemfile ```ruby gem "headmin", path: "../headmin" ``` In package.json ```json { "dependencies": { "bar": "link:../headmin" } } ``` ## Testing If you want to test a specific feature in a staging environment without releasing the gem, you can refer to the remote repo in your Gemfile and package.json. In Gemfile ```ruby gem 'headmin', git: 'git@github.com:insiting/headmin.git', branch: 'feature/test' ``` In package.json ```json { "dependencies": { "headmin": "ssh://git@github.com:insiting/headmin.git#feature\/test" } } ``` ## Releasing After integration a new feature of fixing a bug, first commit and push your changes. Build the assets for production ```shell $ nvm use $ yarn build ``` Update the version number of the gem ```shell # First bundle if new runtime dependencies were added $ bundle $ git push # Update the version number and tag the release $ gem bump -v {patch,minor,major,...} -p $ gem tag -p # Release to Rubygems $ gem release ``` Update the node module ``` # Manually update the version number in package.json $ npm publish ``` ## Deployment Update the Headmin gem to the latest version ```shell $ bundle update headmin ``` Update the Headmin node module ot the latest version ```shell $ yarn upgrade headmin ``` Deploy your app as usual ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/headmin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md). ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Headmin project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md).