This gem helps you providing whitelabel functionality in your application.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install whitelabel
You can start with a pretty simple, file driven whitelabel configuration.
All you need is a config file:
# config/whitelabel.yaml --- - !ruby/struct:YourLabelClass label_id: "white" some_config: "for your application"
and an initializer:
# config/initializers/whitelabel.rb YourLabelClass = Struct.new :label_id, :some_config . Rails.root.join("config/whitelabel.yml")
Whitelabel works the same way I18n does, just set it up in your ApplicationController:
# app/controllers/application_controller.rb before_filter :switch_label def switch_label unless .(request.subdomains.first) redirect_to(labels_url(subdomain: false), alert: "Please select a Label!") end end
This example uses the subdomain to determine which label should be active, but you can implement whatever you like here.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request