README.md in maily_herald-webui-0.8.0 vs README.md in maily_herald-webui-0.9.0

- old
+ new

@@ -1,44 +1,44 @@ # MailyHerald Web UI -Web interface for Ruby on Rails email marketing solution - [MailyHerald](https://github.com/Sology/maily_herald). +Web interface for [MailyHerald](https://github.com/Sology/maily_herald) - Ruby on Rails email marketing solution. ## Requirements Both Ruby on Rails 3.2 and 4 are supported. ## Installation -Simply just +Simply just run gem install maily_herald-webui or put in your Gemfile gem "maily_herald-webui" ## Usage -Mount WebUI in your application: +Mount the WebUI in your application: ```ruby # config/routes.rb mount MailyHerald::Webui::Engine => "/maily_webui" ``` ## Customizing ### Restricting access -The simplest way to restrict access to Maily WebUI is to use Rails routing constraints: +The simplest way to restrict access to the Maily WebUI is to use Rails routing constraints: ```ruby # config/routes.rb mount MailyHerald::Webui::Engine => "/maily_webui", :constraints => MailyAccessConstraint.new ``` -Sample `MailyAccessConstraint` implementation might look like this: +A sample `MailyAccessConstraint` implementation might look like this: ```ruby class MailyAccessConstraint def matches?(request) return false unless request.session[:user_id] @@ -46,14 +46,40 @@ return user && user.admin? end end ``` +HTTP Basic auth can be used too: + +```ruby +# config/routes.rb +MailyHerald::Webui::Engine.middleware.use Rack::Auth::Basic do |username, password| + username == ENV["MAILY_USERNAME"] && password == ENV["MAILY_PASSWORD"] +end if Rails.env.production? + +mount MailyHerald::Webui::Engine => "/maily_webui" +``` + +### Entity names + +By default the WebUI displays entities (i.e. your users) using the `to_s` method. You can easily overwrite this method in your model to see your user names in the WebUI. Example below: + +```ruby +class User < ActiveRecord::Base + + # ... + + def to_s + "#{self.firstname} #{self.lastname}" + end +end +``` + ## More Information -* [Home Page](http://www.mailyherald.org) +* [Home Page](http://mailyherald.org) * [API Docs](http://www.rubydoc.info/gems/maily_herald) -* Showcase (_coming soon_) +* [Showcase](http://showcase.sology.eu/maily_herald) * [Sample application](https://github.com/Sology/maily_testapp) For bug reports or feature requests see the [issues on Github](https://github.com/Sology/maily_herald-webui/issues). ## License