summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-26 10:48:43 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-26 10:48:43 +0100
commitececfdf24075dd4e2794734a07187750b1b33e13 (patch)
tree63538e6f6135ce031da830da0ca6e14515e776e1
parentb144a7885610d605447c80f659643524a839db0c (diff)
parentad2121462a9ea9a776756a188779a9d504f078b7 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
-rw-r--r--app/controllers/call_forwards_controller.rb14
-rw-r--r--app/controllers/intruders_controller.rb4
-rw-r--r--app/controllers/ringtones_controller.rb12
-rw-r--r--app/models/call_forward.rb3
-rw-r--r--app/models/ringtone.rb14
-rw-r--r--app/models/sip_account.rb2
-rw-r--r--app/views/call_forwards/_form_core.html.haml6
-rw-r--r--app/views/call_forwards/_index_core.html.haml23
-rw-r--r--app/views/call_forwards/show.html.haml8
-rw-r--r--app/views/groups/_index_core.html.haml8
-rw-r--r--app/views/intruders/_index_core.html.haml9
-rw-r--r--app/views/ringtones/_form_core.html.haml2
-rw-r--r--app/views/ringtones/_index_core.html.haml4
-rw-r--r--app/views/ringtones/index.html.haml4
-rw-r--r--app/views/sip_accounts/_form_core.html.haml2
-rw-r--r--app/views/sip_accounts/_index_core.html.haml4
-rw-r--r--app/views/sip_accounts/show.html.haml19
-rw-r--r--app/views/users/show.html.haml20
-rw-r--r--config/routes.rb1
-rw-r--r--db/migrate/20130225091200_add_destinationable_to_call_forward.rb21
-rw-r--r--misc/freeswitch/scripts/common/group.lua2
21 files changed, 120 insertions, 62 deletions
diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb
index cd72a38..34fb77a 100644
--- a/app/controllers/call_forwards_controller.rb
+++ b/app/controllers/call_forwards_controller.rb
@@ -48,8 +48,8 @@ class CallForwardsController < ApplicationController
@call_forward = @parent.call_forwards.build( params[:call_forward] )
if @call_forward.save
- m = method( :"#{@parent.class.name.underscore}_call_forward_path" )
- redirect_to m.( @parent, @call_forward ), :notice => t('call_forwards.controller.successfuly_created')
+ m = method( :"#{@parent.class.name.underscore}_call_forwards_url" )
+ redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_created')
else
@available_call_forward_cases = CallForwardCase.all
render :new
@@ -64,8 +64,8 @@ class CallForwardsController < ApplicationController
def update
@available_call_forward_cases = CallForwardCase.all
if @call_forward.update_attributes(params[:call_forward])
- m = method( :"#{@parent.class.name.underscore}_call_forward_path" )
- redirect_to m.( @parent, @call_forward ), :notice => t('call_forwards.controller.successfuly_updated')
+ m = method( :"#{@parent.class.name.underscore}_call_forwards_url" )
+ redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_updated')
else
@call_forwarding_destinations = call_forwarding_destination_types()
render :edit
@@ -74,7 +74,8 @@ class CallForwardsController < ApplicationController
def destroy
@call_forward.destroy
- redirect_to :root, :notice => t('call_forwards.controller.successfuly_destroyed')
+ m = method( :"#{@parent.class.name.underscore}_call_forwards_url" )
+ redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_destroyed')
end
private
@@ -110,7 +111,8 @@ class CallForwardsController < ApplicationController
add_breadcrumb @sip_account, tenant_sip_account_path(@tenant, @sip_account)
end
- add_breadcrumb t("call_forwards.index.page_title"), phone_number_call_forwards_path(@parent)
+ m = method( :"#{@parent.class.name.underscore}_call_forwards_url" )
+ add_breadcrumb t("call_forwards.index.page_title"), m.(@parent)
if @call_forward && !@call_forward.new_record?
m = method( :"#{@parent.class.name.underscore}_call_forward_path" )
add_breadcrumb @call_forward, m.(@parent, @call_forward)
diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb
index 147e06d..d3c767e 100644
--- a/app/controllers/intruders_controller.rb
+++ b/app/controllers/intruders_controller.rb
@@ -1,6 +1,8 @@
class IntrudersController < ApplicationController
+ load_and_authorize_resource :intruder
+
def index
- @intruders = Intruder.all
+ @intruders = Intruder.order('list_type ASC, contact_last DESC').all
spread_breadcrumbs
end
diff --git a/app/controllers/ringtones_controller.rb b/app/controllers/ringtones_controller.rb
index 7ffe30e..e5a4f64 100644
--- a/app/controllers/ringtones_controller.rb
+++ b/app/controllers/ringtones_controller.rb
@@ -1,7 +1,8 @@
class RingtonesController < ApplicationController
load_resource :phone_number
+ load_resource :sip_account
load_resource :boss_assistant_cooperation
- load_and_authorize_resource :ringtone, :through => [:phone_number, :boss_assistant_cooperation]
+ load_and_authorize_resource :ringtone, :through => [:phone_number, :sip_account, :boss_assistant_cooperation]
before_filter :set_parent
before_filter :spread_breadcrumbs
@@ -14,12 +15,13 @@ class RingtonesController < ApplicationController
def new
@ringtone = @parent.ringtones.build
+ @ringtone.bellcore_id = GsParameter.get('default_ringtone', 'dialplan', 'parameters')
end
def create
@ringtone = @parent.ringtones.build(params[:ringtone])
if @ringtone.save
- redirect_to phone_number_ringtone_path(@parent, @ringtone), :notice => t('ringtones.controller.successfuly_created')
+ redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_created')
else
render :new
end
@@ -30,7 +32,7 @@ class RingtonesController < ApplicationController
def update
if @ringtone.update_attributes(params[:ringtone])
- redirect_to method( :"#{@parent.class.name.underscore}_ringtone_path" ).(@ringtone.ringtoneable, @ringtone), :notice => t('ringtones.controller.successfuly_updated')
+ redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_updated')
else
render :edit
end
@@ -38,12 +40,12 @@ class RingtonesController < ApplicationController
def destroy
@ringtone.destroy
- redirect_to phone_number_ringtones_path(@parent), :notice => t('ringtones.controller.successfuly_destroyed')
+ redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_destroyed')
end
private
def set_parent
- @parent = @phone_number || @boss_assistant_cooperation
+ @parent = @phone_number || @boss_assistant_cooperation || @sip_account
end
def spread_breadcrumbs
diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb
index b304439..a932e11 100644
--- a/app/models/call_forward.rb
+++ b/app/models/call_forward.rb
@@ -24,8 +24,8 @@ class CallForward < ActiveRecord::Base
belongs_to :call_forward_case
- validates_presence_of :depth
validates_numericality_of :depth,
+ :allow_nil => true,
:only_integer => true,
:greater_than_or_equal_to => 1,
:less_than_or_equal_to => (GsParameter.get('MAX_CALL_FORWARD_DEPTH').nil? ? 0 : GsParameter.get('MAX_CALL_FORWARD_DEPTH'))
@@ -59,7 +59,6 @@ class CallForward < ActiveRecord::Base
before_save :split_and_format_destination_numbers
after_save :set_presence
after_save :deactivate_concurring_entries, :if => Proc.new { |cf| cf.active == true }
- before_destroy :check_if_other_callforward_rules_have_to_be_destroyed
before_destroy :deactivate_connected_softkeys
def case_string
diff --git a/app/models/ringtone.rb b/app/models/ringtone.rb
index 36053c0..45ecd93 100644
--- a/app/models/ringtone.rb
+++ b/app/models/ringtone.rb
@@ -1,11 +1,25 @@
class Ringtone < ActiveRecord::Base
attr_accessible :audio, :bellcore_id
+ CORE_RINGTONES_AVAILABLE = {
+ 'Silence' => 0,
+ 'Ringtone 1' => 1,
+ 'Ringtone 2' => 2,
+ 'Ringtone 3' => 3,
+ 'Ringtone 4' => 4,
+ 'Ringtone 5' => 5,
+ 'Ringtone 6' => 6,
+ 'Ringtone 7' => 7,
+ 'Ringtone 8' => 8,
+ 'Ringtone 9' => 9,
+ 'Ringtone 10' => 10,
+ }
mount_uploader :audio, AudioUploader
validates_presence_of :audio, :if => Proc.new{ |ringtone| ringtone.bellcore_id.blank? }
validates_presence_of :ringtoneable_type
validates_presence_of :ringtoneable_id
validates_presence_of :ringtoneable
+ validates_uniqueness_of :ringtoneable_id, :scope => [:ringtoneable_type]
belongs_to :ringtoneable, :polymorphic => true
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index a39982b..034af7c 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -36,6 +36,8 @@ class SipAccount < ActiveRecord::Base
has_many :group_memberships, :as => :item, :dependent => :destroy, :uniq => true
has_many :groups, :through => :group_memberships
+ has_many :ringtones, :as => :ringtoneable, :dependent => :destroy
+
# Delegations:
#
delegate :host, :to => :sip_domain, :allow_nil => true
diff --git a/app/views/call_forwards/_form_core.html.haml b/app/views/call_forwards/_form_core.html.haml
index b751fb3..83de044 100644
--- a/app/views/call_forwards/_form_core.html.haml
+++ b/app/views/call_forwards/_form_core.html.haml
@@ -1,5 +1,5 @@
.inputs
- = f.input :call_forward_case_id, :as => :select, :collection => @available_call_forward_cases.map {|x| [I18n.t("call_forward_cases.#{x.value}"), x.id] }, :label => t('call_forwards.form.call_forward_case_id.label'), :hint => conditional_hint('call_forwards.form.call_forward_case_id.hint'), :include_blank => false, :autofocus => true
+ = f.input :call_forward_case_id, :as => :select, :collection => @available_call_forward_cases.map {|x| [I18n.t("call_forward_cases.#{x.value}"), x.id] }, :label => t('call_forwards.form.call_forward_case.label'), :hint => conditional_hint('call_forwards.form.call_forward_case_id.hint'), :include_blank => false, :autofocus => true
= f.input :timeout, :label => t('call_forwards.form.timeout.label'), :hint => conditional_hint('call_forwards.form.timeout.hint')
= f.input :call_forwarding_destination , :as => :select, :collection => @call_forwarding_destinations, :label => t('call_forwards.form.call_forwarding_destination.label'), :hint => conditional_hint('call_forwards.form.call_forwarding_destination.hint'), :include_blank => false
@@ -8,8 +8,4 @@
= f.input :source, :label => t('call_forwards.form.source.label'), :hint => conditional_hint('call_forwards.form.source.hint')
- - if GuiFunction.display?('depth_field_in_call_forward_form', current_user)
- = f.input :depth, :collection => 1..GsParameter.get('MAX_CALL_FORWARD_DEPTH'), :label => t('call_forwards.form.depth.label'), :hint => conditional_hint('call_forwards.form.depth.hint')
- - else
- = f.hidden_field :depth
= f.input :active, :label => t('call_forwards.form.active.label'), :hint => conditional_hint('call_forwards.form.active.hint')
diff --git a/app/views/call_forwards/_index_core.html.haml b/app/views/call_forwards/_index_core.html.haml
index 48afa54..3c57405 100644
--- a/app/views/call_forwards/_index_core.html.haml
+++ b/app/views/call_forwards/_index_core.html.haml
@@ -1,21 +1,20 @@
%table.table.table-striped
%thead
%tr
- - if !@phone_number
- %th= t('call_forwards.index.call_forwardable')
- %th= t('call_forwards.index.call_forward_case_id')
+ %th
+ %th= t('call_forwards.index.call_forward_case')
%th= t('call_forwards.index.timeout')
%th= t('call_forwards.index.destination')
- %th= t('call_forwards.index.source')
- - if GuiFunction.display?('depth_field_value_in_index_table', current_user)
- %th= t('call_forwards.index.depth')
- %th= t('call_forwards.index.active')
+ %th= t('call_forwards.index.source')
%tbody
- for call_forward in call_forwards
%tr
- - if !@phone_number
- %td= call_forward.call_forwardable
+ %td
+ -if call_forward.active
+ %i.icon-ok
+ - else
+ %i.icon-ban-circle
%td= t("call_forward_cases.#{call_forward.call_forward_case.value}")
%td= call_forward.timeout
%td
@@ -26,7 +25,5 @@
- if call_forward.destinationable_id
= ": #{call_forward.destinationable}"
%td= call_forward.source
- - if GuiFunction.display?('depth_field_value_in_index_table', current_user)
- %td= call_forward.depth
- %td= call_forward.active
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => call_forward.call_forwardable, :child => call_forward} \ No newline at end of file
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => call_forward.call_forwardable, :child => call_forward}
+
diff --git a/app/views/call_forwards/show.html.haml b/app/views/call_forwards/show.html.haml
index 9f9d27a..ad9ab16 100644
--- a/app/views/call_forwards/show.html.haml
+++ b/app/views/call_forwards/show.html.haml
@@ -1,9 +1,6 @@
- content_for :title, t("call_forwards.show.page_title")
%p
- %strong= t('call_forwards.show.call_forwardable') + ":"
- = "#{@call_forward.call_forwardable_type}: #{@call_forward.call_forwardable}"
-%p
%strong= t('call_forwards.show.call_forward_case') + ":"
= t("call_forward_cases.#{@call_forward.call_forward_case.value}")
%p
@@ -22,10 +19,7 @@
%strong= t('call_forwards.show.source') + ":"
= @call_forward.source
%p
- %strong= t('call_forwards.show.depth') + ":"
- = @call_forward.depth
-%p
%strong= t('call_forwards.show.active') + ":"
= @call_forward.active
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @call_forward } \ No newline at end of file
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @call_forward }
diff --git a/app/views/groups/_index_core.html.haml b/app/views/groups/_index_core.html.haml
index d99874a..3a444bf 100644
--- a/app/views/groups/_index_core.html.haml
+++ b/app/views/groups/_index_core.html.haml
@@ -1,13 +1,17 @@
%table.table.table-striped
%tr
+ %th
%th= t('groups.index.name')
- %th= t('groups.index.active')
%th= t('groups.index.comment')
- for group in groups
%tr
+ %td
+ -if group.active
+ %i.icon-ok
+ - else
+ %i.icon-ban-circle
%td= group.name
- %td= group.active
%td= group.comment
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => group} \ No newline at end of file
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
index 31bbd11..63f2253 100644
--- a/app/views/intruders/_index_core.html.haml
+++ b/app/views/intruders/_index_core.html.haml
@@ -16,7 +16,14 @@
- for intruder in intruders
%tr
- %td= intruder.list_type.chars.first
+ %td
+ - if intruder.list_type == 'whitelist'
+ %i.icon-ok
+ - elsif intruder.bans > 0
+ %i.icon-fire
+ - elsif intruder.points > 0
+ %i.icon-warning-sign
+
%td= intruder.contact_ip
%td= intruder.contact_port
%td= intruder.points
diff --git a/app/views/ringtones/_form_core.html.haml b/app/views/ringtones/_form_core.html.haml
index e44c950..de1cc38 100644
--- a/app/views/ringtones/_form_core.html.haml
+++ b/app/views/ringtones/_form_core.html.haml
@@ -1,3 +1,3 @@
.inputs
/ = f.input :audio, :label => t('ringtones.form.audio.label'), :hint => conditional_hint('ringtones.form.audio.hint')
- = f.input :bellcore_id, :collection => 0..10, :label => t('ringtones.form.bellcore_id.label'), :hint => conditional_hint('ringtones.form.bellcore_id.hint'), :include_blank => true
+ = f.input :bellcore_id, :collection => Ringtone::CORE_RINGTONES_AVAILABLE, :label => t('ringtones.form.bellcore_id.label'), :hint => conditional_hint('ringtones.form.bellcore_id.hint'), :include_blank => false
diff --git a/app/views/ringtones/_index_core.html.haml b/app/views/ringtones/_index_core.html.haml
index 715db3c..51347a5 100644
--- a/app/views/ringtones/_index_core.html.haml
+++ b/app/views/ringtones/_index_core.html.haml
@@ -1,12 +1,12 @@
%table.table.table-striped
%thead
%tr
- %th= t('ringtones.index.audio')
+ /%th= t('ringtones.index.audio')
%th= t('ringtones.index.bellcore_id')
%tbody
- for ringtone in ringtones
%tr
- %td= ringtone.audio
+ /%td= ringtone.audio
%td= ringtone.bellcore_id
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => ringtone.ringtoneable, :child => ringtone} \ No newline at end of file
diff --git a/app/views/ringtones/index.html.haml b/app/views/ringtones/index.html.haml
index 2eea5fe..2e316a5 100644
--- a/app/views/ringtones/index.html.haml
+++ b/app/views/ringtones/index.html.haml
@@ -2,5 +2,5 @@
- if @ringtones.count > 0
= render "index_core", :ringtones => @ringtones
-
-= render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => Ringtone} \ No newline at end of file
+- else
+ = render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => Ringtone} \ No newline at end of file
diff --git a/app/views/sip_accounts/_form_core.html.haml b/app/views/sip_accounts/_form_core.html.haml
index 1a09912..d7c65d0 100644
--- a/app/views/sip_accounts/_form_core.html.haml
+++ b/app/views/sip_accounts/_form_core.html.haml
@@ -13,6 +13,4 @@
- if @sip_account.sip_accountable_type == 'User'
= f.input :hotdeskable, :label => t('sip_accounts.form.hotdeskable.label'), :hint => conditional_hint('sip_accounts.form.hotdeskable.hint')
= f.input :clip_no_screening, :label => t('sip_accounts.form.clip_no_screening.label'), :hint => conditional_hint('sip_accounts.form.clip_no_screening.hint')
- - if CallForward.where(:call_forwardable_id => @sip_account.phone_number_ids, :call_forwardable_type => 'PhoneNumber').count == 0 || @sip_account.callforward_rules_act_per_sip_account == true
- = f.input :callforward_rules_act_per_sip_account, :label => t('sip_accounts.form.callforward_rules_act_per_sip_account.label'), :hint => conditional_hint('sip_accounts.form.callforward_rules_act_per_sip_account.hint')
= f.input :language_code, :collection => Language.all.collect{|l| [l.to_s, l.code]}, :label => t('sip_accounts.form.language_code.label'), :hint => conditional_hint('sip_accounts.form.language_id.hint'), :include_blank => false
diff --git a/app/views/sip_accounts/_index_core.html.haml b/app/views/sip_accounts/_index_core.html.haml
index 34aac64..d98ea0a 100644
--- a/app/views/sip_accounts/_index_core.html.haml
+++ b/app/views/sip_accounts/_index_core.html.haml
@@ -20,13 +20,13 @@
- if sip_account.registration
%i.icon-ok
- else
- %i.icon-thumbs-down
+ %i.icon-ban-circle
%td
= sip_account.caller_name
- phone_numbers = sip_account.phone_numbers
%td
- if sip_account.phone_numbers.count > 0
- = render 'phone_numbers/listing', :phone_numbers => sip_account.phone_numbers.order(:number)
+ = render 'phone_numbers/listing', :phone_numbers => sip_account.phone_numbers.order(:position)
- if sip_accounts.map{ |sip_account| sip_account.phone_sip_accounts.any? }.include?(true)
%td
%span.hidden-phone
diff --git a/app/views/sip_accounts/show.html.haml b/app/views/sip_accounts/show.html.haml
index 72e10df..ede5150 100644
--- a/app/views/sip_accounts/show.html.haml
+++ b/app/views/sip_accounts/show.html.haml
@@ -37,11 +37,6 @@
%strong= t('sip_accounts.show.hotdeskable') + ":"
%td
= @sip_account.hotdeskable == true ? t('simple_form.yes') : t('simple_form.no')
- %tr
- %td
- %strong= t('sip_accounts.show.callforward_rules_act_per_sip_account') + ":"
- %td
- = @sip_account.callforward_rules_act_per_sip_account == true ? t('simple_form.yes') : t('simple_form.no')
- if @sip_account.registration.try(:network_ip) && @sip_account.registration.try(:network_port)
%tr
@@ -65,6 +60,13 @@
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @sip_account.sip_accountable, :child => @sip_account }
+%p
+ %strong= t('ringtones.name') + ':'
+ - if @sip_account.ringtones.count > 0
+ = link_to @sip_account.ringtones.first, sip_account_ringtone_path(@sip_account, @sip_account.ringtones.first)
+ - else
+ = link_to t('ringtones.set_a_ringtone'), new_sip_account_ringtone_path(@sip_account)
+
- if @sip_account.phone_numbers.count > 0 || can?(:create, @sip_account.phone_numbers.build)
%h2= t('phone_numbers.index.page_title')
- if @sip_account.phone_numbers.count > 0
@@ -72,6 +74,13 @@
%br
= render :partial => 'shared/create_link', :locals => { :parent => @sip_account, :child_class => PhoneNumber }
+- if @sip_account.call_forwards.count > 0 || can?(:create, @sip_account.call_forwards.build)
+ %h2= t('call_forwards.index.page_title')
+ - if @sip_account.call_forwards.count > 0
+ = render "call_forwards/index_core", :call_forwards => @sip_account.call_forwards
+ %br
+ = render :partial => 'shared/create_link', :locals => { :parent => @sip_account, :child_class => CallForward }
+
- if @sip_account.softkeys.count > 0 || can?(:create, @sip_account.softkeys.build)
%h2= t("softkeys.index.page_title")
- if @sip_account.softkeys.count > 0
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 0f6cc2c..8148005 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -29,22 +29,30 @@
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @tenant, :child => @user }
- @user.sip_accounts.each do |sip_account|
- - phone_number = sip_account.phone_numbers.order(:number).last
- - if phone_number && !phone_number.number.blank? && phone_number.number[0] != '+'
- %p
- %strong= sip_account.phone_numbers.order(:number).last.number
+ - phone_numbers = sip_account.phone_numbers.order(:position)
+ %p
+ - if phone_numbers[0]
+ %strong= phone_numbers[0].number
+ - else
+ %strong= sip_account.to_s
+ - if phone_numbers[1]
+ %strong= phone_numbers[1].number
+ - if phone_numbers[2]
+ %strong= phone_numbers[2].number
+ - if phone_numbers[3]
+ %strong ...
%p
=link_to t("call_histories.index.page_title"), sip_account_call_histories_path(sip_account)
%br
=link_to t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(sip_account)
%br
- =link_to t("call_forwards.index.page_title"), phone_number_call_forwards_path(phone_number)
+ =link_to t("call_forwards.index.page_title"), sip_account_call_forwards_path(sip_account)
%br
=link_to t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(sip_account)
%br
=link_to t("softkeys.index.page_title"), sip_account_softkeys_path(sip_account)
%br
- =link_to t("ringtones.show.page_title"), phone_number_ringtones_path(phone_number)
+ =link_to t("ringtones.show.page_title"), sip_account_ringtones_path(sip_account)
- if @user.conferences.any?
%p
diff --git a/config/routes.rb b/config/routes.rb
index 30a461a..87c9c66 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -256,6 +256,7 @@ Gemeinschaft42c::Application.routes.draw do
resources :phone_numbers
resources :softkeys
resources :call_forwards
+ resources :ringtones
resources :call_histories do
collection do
delete 'destroy_multiple'
diff --git a/db/migrate/20130225091200_add_destinationable_to_call_forward.rb b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
new file mode 100644
index 0000000..89e4b3b
--- /dev/null
+++ b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
@@ -0,0 +1,21 @@
+class AddDestinationableToCallForward < ActiveRecord::Migration
+ def up
+ add_column :call_forwards, :destinationable_type, :string
+ add_column :call_forwards, :destinationable_id, :integer
+
+ CallForward.all.each do |call_forward|
+ call_forward.update_attributes(:destinationable_type => call_forward.call_forwardable_type, :destinationable_id => call_forward.call_forwardable_id, :call_forwardable_type => 'PhoneNumber', :call_forwardable_id => call_forward.phone_number_id )
+ end
+
+ remove_column :call_forwards, :phone_number_id
+ end
+
+ def down
+ add_column :call_forwards, :phone_number_id, :integer
+ CallForward.where(:call_forwardable_type => 'PhoneNumber').each do |call_forward|
+ call_forward.update_attributes(:phone_number_id => call_forward.call_forwardable_id, :call_forwardable_type => call_forward.destinationable_type, :call_forwardable_id => call_forward.destinationable_id)
+ end
+ remove_column :call_forwards, :destinationable_type
+ remove_column :call_forwards, :destinationable_id
+ end
+end
diff --git a/misc/freeswitch/scripts/common/group.lua b/misc/freeswitch/scripts/common/group.lua
index 1a2d315..c4125bc 100644
--- a/misc/freeswitch/scripts/common/group.lua
+++ b/misc/freeswitch/scripts/common/group.lua
@@ -48,6 +48,7 @@ function Group.name_id_by_permission(self, member_id, member_type, permission)
WHERE `b`.`item_type` = ' .. self.database:escape(member_type, '"') .. ' \
AND `b`.`item_id` = ' .. member_id .. ' \
AND `a`.`permission` = ' .. self.database:escape(permission, '"') .. ' \
+ AND `c`.`active` IS TRUE \
GROUP BY `b`.`group_id` LIMIT ' .. MAX_GROUP_MEMBERSHIPS;
local group_names = {};
@@ -72,6 +73,7 @@ function Group.name_id_by_member(self, member_id, member_type)
JOIN `groups` `c` ON `c`.`id` = `b`.`group_id` \
WHERE `b`.`item_type` = ' .. self.database:escape(member_type, '"') .. ' \
AND `b`.`item_id` = ' .. member_id .. ' \
+ AND `c`.`active` IS TRUE \
GROUP BY `b`.`group_id` LIMIT ' .. MAX_GROUP_MEMBERSHIPS;
local group_names = {};