diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-07 15:57:02 -0500 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-07 15:57:02 -0500 |
commit | 2abc9cfb22e55b709a21b041e04a8221f605e9d7 (patch) | |
tree | 7f4c56abc3f38740790d0ce5fe5dcb94ba26c0fe | |
parent | 800cf2f11ab5d7f03a52d5ca35e893654ef520ab (diff) |
call forwards view added
-rw-r--r-- | app/models/automatic_call_distributor.rb | 2 | ||||
-rw-r--r-- | app/views/automatic_call_distributors/show.html.haml | 7 | ||||
-rw-r--r-- | config/routes.rb | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/app/models/automatic_call_distributor.rb b/app/models/automatic_call_distributor.rb index 5807757..b9d7c51 100644 --- a/app/models/automatic_call_distributor.rb +++ b/app/models/automatic_call_distributor.rb @@ -5,6 +5,8 @@ class AutomaticCallDistributor < ActiveRecord::Base has_many :acd_agents, :dependent => :destroy has_many :phone_numbers, :as => :phone_numberable, :dependent => :destroy + has_many :call_forwards, :as => :call_forwardable, :dependent => :destroy + accepts_nested_attributes_for :phone_numbers, :reject_if => lambda { |phone_number| phone_number[:number].blank? }, :allow_destroy => true diff --git a/app/views/automatic_call_distributors/show.html.haml b/app/views/automatic_call_distributors/show.html.haml index a461652..18fd8b8 100644 --- a/app/views/automatic_call_distributors/show.html.haml +++ b/app/views/automatic_call_distributors/show.html.haml @@ -63,6 +63,13 @@ = render 'phone_numbers/index_core', :phone_numbers => @automatic_call_distributor.phone_numbers = render :partial => 'shared/create_link', :locals => {:parent => @automatic_call_distributor, :child_class => PhoneNumber, :short_link => true} +- if @automatic_call_distributor.call_forwards.count > 0 || can?(:create, @automatic_call_distributor.call_forwards.build) + %h3= t('call_forwards.index.page_title') + - if @automatic_call_distributor.call_forwards.count > 0 + = render "call_forwards/index_core", :call_forwards => @automatic_call_distributor.call_forwards + %br + = render :partial => 'shared/create_link', :locals => { :parent => @automatic_call_distributor, :child_class => CallForward } + - if can?( :index, @automatic_call_distributor.acd_agents ) %h3= t('automatic_call_distributors.index.acd_agents') = render 'acd_agents/index_core', :acd_agents => @automatic_call_distributor.acd_agents diff --git a/config/routes.rb b/config/routes.rb index 0a3c6a1..0b953ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -64,6 +64,7 @@ Gemeinschaft42c::Application.routes.draw do resources :automatic_call_distributors, :only => [] do resources :acd_agents resources :phone_numbers + resources :call_forwards end resources :hunt_group_members, :only => [] do |