diff options
| author | Alban Peignier | 2017-10-17 09:57:26 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2017-11-26 16:55:56 +0100 | 
| commit | a35fdf490b8803839d56e78029a936b541811665 (patch) | |
| tree | 5450c8c3dc0dce201346e06f850c38c13cead78c | |
| parent | 5fb6f8719231381233a3d8cc664479afdde21498 (diff) | |
| download | chouette-core-a35fdf490b8803839d56e78029a936b541811665.tar.bz2 | |
Add Organisation#custom_view and associated helper render_custom_view. Refs #4735
| -rw-r--r-- | app/controllers/application_controller.rb | 7 | ||||
| -rw-r--r-- | db/migrate/20171001100320_add_custom_view_to_organisations.rb | 5 | ||||
| -rw-r--r-- | db/schema.rb | 1 | 
3 files changed, 13 insertions, 0 deletions
| diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 853c2f715..6c83547f0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -38,6 +38,13 @@ class ApplicationController < ActionController::Base    end    helper_method :current_offer_workbench +  def render_custom_view(view) +    view_name = [view, current_organisation.custom_view].compact.join('_') +    Rails.logger.info "Render custom view #{view_name}" +    render partial: view_name +  end +  helper_method :render_custom_view +    def current_functional_scope      functional_scope = current_organisation.sso_attributes.try(:[], "functional_scope") if current_organisation      JSON.parse(functional_scope) if functional_scope diff --git a/db/migrate/20171001100320_add_custom_view_to_organisations.rb b/db/migrate/20171001100320_add_custom_view_to_organisations.rb new file mode 100644 index 000000000..bd8da50fc --- /dev/null +++ b/db/migrate/20171001100320_add_custom_view_to_organisations.rb @@ -0,0 +1,5 @@ +class AddCustomViewToOrganisations < ActiveRecord::Migration +  def change +    add_column :organisations, :custom_view, :string +  end +end diff --git a/db/schema.rb b/db/schema.rb index 21aa73cd8..48efa912e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -559,6 +559,7 @@ ActiveRecord::Schema.define(version: 20171114102438) do      t.string   "code"      t.datetime "synced_at"      t.hstore   "sso_attributes" +    t.string   "custom_view"    end    add_index "organisations", ["code"], name: "index_organisations_on_code", unique: true, using: :btree | 
