summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/application.js1
-rw-r--r--app/assets/javascripts/switchboard_entry.js.coffee6
-rw-r--r--app/assets/stylesheets/application.css1
-rw-r--r--app/assets/stylesheets/switchboard_entries.css.scss5
-rw-r--r--app/controllers/switchboard_entries_controller.rb74
-rw-r--r--app/controllers/switchboards_controller.rb66
-rw-r--r--app/controllers/trigger_controller.rb4
-rw-r--r--app/helpers/switchboard_entries_helper.rb2
-rw-r--r--app/helpers/switchboards_helper.rb2
-rw-r--r--app/models/ability.rb5
-rw-r--r--app/models/call_route.rb2
-rw-r--r--app/models/sip_account.rb6
-rw-r--r--app/models/switchboard.rb16
-rw-r--r--app/models/switchboard_entry.rb31
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/layouts/_navbar.html.haml4
-rw-r--r--app/views/layouts/application.html.haml1
-rw-r--r--app/views/switchboard_entries/_form.html.haml7
-rw-r--r--app/views/switchboard_entries/_form_core.html.haml3
-rw-r--r--app/views/switchboard_entries/_index_core.html.haml17
-rw-r--r--app/views/switchboard_entries/_switchboard_entry.html.haml27
-rw-r--r--app/views/switchboard_entries/edit.html.haml3
-rw-r--r--app/views/switchboard_entries/index.html.haml6
-rw-r--r--app/views/switchboard_entries/new.html.haml3
-rw-r--r--app/views/switchboard_entries/show.html.haml22
-rw-r--r--app/views/switchboards/_form.html.haml7
-rw-r--r--app/views/switchboards/_form_core.html.haml2
-rw-r--r--app/views/switchboards/_index_core.html.haml10
-rw-r--r--app/views/switchboards/edit.html.haml12
-rw-r--r--app/views/switchboards/index.html.haml8
-rw-r--r--app/views/switchboards/new.html.haml3
-rw-r--r--app/views/switchboards/show.html.haml18
-rw-r--r--app/views/trigger/voicemail.html.erb4
-rw-r--r--app/views/users/_switchboards.html.haml7
-rw-r--r--app/views/users/show.html.haml3
35 files changed, 385 insertions, 5 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index c6f4107..68a6e22 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -13,4 +13,5 @@
//= require jquery
//= require jquery-ui
//= require jquery_ujs
+//= require private_pub
//= require_tree .
diff --git a/app/assets/javascripts/switchboard_entry.js.coffee b/app/assets/javascripts/switchboard_entry.js.coffee
new file mode 100644
index 0000000..d14825e
--- /dev/null
+++ b/app/assets/javascripts/switchboard_entry.js.coffee
@@ -0,0 +1,6 @@
+jQuery ->
+ $('#switchboard_entries').sortable
+ axis: 'y'
+ handle: '.handle'
+ update: ->
+ $.post($(this).data('update-url'), $(this).sortable('serialize')) \ No newline at end of file
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 44868e4..557bbda 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -16,4 +16,5 @@
*= require softkeys
*= require phone_numbers
*= require route_elements
+ *= require switchboard_entries
*/
diff --git a/app/assets/stylesheets/switchboard_entries.css.scss b/app/assets/stylesheets/switchboard_entries.css.scss
new file mode 100644
index 0000000..12b67ee
--- /dev/null
+++ b/app/assets/stylesheets/switchboard_entries.css.scss
@@ -0,0 +1,5 @@
+#switchboard_entries .handle {
+ font-size: 12px;
+ color: #777;
+ cursor: move;
+} \ No newline at end of file
diff --git a/app/controllers/switchboard_entries_controller.rb b/app/controllers/switchboard_entries_controller.rb
new file mode 100644
index 0000000..ef6c72e
--- /dev/null
+++ b/app/controllers/switchboard_entries_controller.rb
@@ -0,0 +1,74 @@
+class SwitchboardEntriesController < ApplicationController
+ load_and_authorize_resource :switchboard
+ authorize_resource :switchboard_entry, :through => :switchboard, :except => [:sort]
+
+ def index
+ @switchboard_entries = @switchboard.switchboard_entries
+ spread_breadcrumbs
+ end
+
+ def show
+ @switchboard_entry = @switchboard.switchboard_entries.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def new
+ @switchboard_entry = @switchboard.switchboard_entries.build
+ @sip_accounts = SipAccount.all - @switchboard.sip_accounts
+ spread_breadcrumbs
+ end
+
+ def create
+ @switchboard_entry = @switchboard.switchboard_entries.build(switchboard_entry_params)
+ spread_breadcrumbs
+ if @switchboard_entry.save
+ redirect_to switchboard_switchboard_entries_path(@switchboard), :notice => t('switchboard_entries.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @switchboard_entry = @switchboard.switchboard_entries.find(params[:id])
+ @sip_accounts = SipAccount.all - @switchboard.sip_accounts + [@switchboard_entry.sip_account]
+ spread_breadcrumbs
+ end
+
+ def update
+ @switchboard_entry = @switchboard.switchboard_entries.find(params[:id])
+ if @switchboard_entry.update_attributes(switchboard_entry_params)
+ redirect_to [@switchboard, @switchboard_entry], :notice => t('switchboard_entries.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @switchboard_entry = @switchboard.switchboard_entries.find(params[:id])
+ @switchboard_entry.destroy
+ redirect_to switchboard_switchboard_entries_path(@switchboard), :notice => t('switchboard_entries.controller.successfuly_destroyed')
+ end
+
+ def sort
+ params[:switchboard_entry].reverse.each do |id|
+ @switchboard.switchboard_entries.find(id).move_to_top
+ end
+ render nothing: true
+ end
+
+ private
+ def switchboard_entry_params
+ params.require(:switchboard_entry).permit(:name, :sip_account_id)
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@switchboard.user.current_tenant)
+ add_breadcrumb @switchboard.user, tenant_user_path(@switchboard.user.current_tenant, @switchboard.user)
+ add_breadcrumb t("switchboards.index.page_title"), user_switchboards_path(@switchboard.user)
+ add_breadcrumb @switchboard, user_switchboard_path(@switchboard.user, @switchboard)
+ add_breadcrumb t("switchboard_entries.index.page_title"), switchboard_switchboard_entries_path(@switchboard)
+ if @switchboard_entry && !@switchboard_entry.new_record?
+ add_breadcrumb @switchboard_entry, switchboard_switchboard_entries_path(@switchboard, @switchboard_entry)
+ end
+ end
+end
diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb
new file mode 100644
index 0000000..98008c1
--- /dev/null
+++ b/app/controllers/switchboards_controller.rb
@@ -0,0 +1,66 @@
+class SwitchboardsController < ApplicationController
+ load_and_authorize_resource :user
+ authorize_resource :switchboard, :through => :user
+
+ def index
+ @switchboards = @user.switchboards
+ spread_breadcrumbs
+ end
+
+ def show
+ @switchboard = @user.switchboards.find(params[:id])
+ @switchboard_entries = @switchboard.switchboard_entries
+ spread_breadcrumbs
+ end
+
+ def new
+ @switchboard = @user.switchboards.build
+ spread_breadcrumbs
+ end
+
+ def create
+ @switchboard = @user.switchboards.build(switchboard_params)
+ spread_breadcrumbs
+ if @switchboard.save
+ redirect_to user_switchboards_path(@user), :notice => t('switchboards.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @switchboard = @user.switchboards.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def update
+ @switchboard = @user.switchboards.find(params[:id])
+ spread_breadcrumbs
+ if @switchboard.update_attributes(switchboard_params)
+ redirect_to [@user, @switchboard], :notice => t('switchboards.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @switchboard = @user.switchboards.find(params[:id])
+ @switchboard.destroy
+ spread_breadcrumbs
+ redirect_to user_switchboards_path(@user), :notice => t('switchboards.controller.successfuly_destroyed')
+ end
+
+ private
+ def switchboard_params
+ params.require(:switchboard).permit(:name)
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@user.current_tenant)
+ add_breadcrumb @user, tenant_user_path(@user.current_tenant, @user)
+ add_breadcrumb t("switchboards.index.page_title"), user_switchboards_path(@user)
+ if @switchboard && !@switchboard.new_record?
+ add_breadcrumb @switchboard, user_switchboard_path(@user, @switchboard)
+ end
+ end
+end
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index 5e836c4..1a5bfca 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -42,6 +42,10 @@ class TriggerController < ApplicationController
end
end
+ # Indicate a new voicemail in the navigation bar.
+ #
+ PrivatePub.publish_to("/users/#{user.id}/messages/new", "$('#new_voicemail_indicator').hide.delay(250).show('slow').hide.delay(250).show('slow');")
+
render(
:status => 200,
:layout => false,
diff --git a/app/helpers/switchboard_entries_helper.rb b/app/helpers/switchboard_entries_helper.rb
new file mode 100644
index 0000000..ca9b1f9
--- /dev/null
+++ b/app/helpers/switchboard_entries_helper.rb
@@ -0,0 +1,2 @@
+module SwitchboardEntriesHelper
+end
diff --git a/app/helpers/switchboards_helper.rb b/app/helpers/switchboards_helper.rb
new file mode 100644
index 0000000..6fbea8a
--- /dev/null
+++ b/app/helpers/switchboards_helper.rb
@@ -0,0 +1,2 @@
+module SwitchboardsHelper
+end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index fe67547..2dd96b8 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -183,6 +183,11 @@ class Ability
#
can :manage, VoicemailMessage
can :manage, VoicemailSetting
+
+ # Switchboard
+ #
+ can :read, Switchboard, :id => user.switchboard_ids
+ can :read, SwitchboardEntry, :switchboard_id => user.switchboard_ids
end
end
else
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index 8bc811a..6c54549 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -7,7 +7,7 @@ class CallRoute < ActiveRecord::Base
has_many :route_elements, :dependent => :destroy, :order => :position
validates :name,
- :presence => true
+ :presence => true
validates :routing_table,
:presence => true,
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index bb45a4c..cea5f0e 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -42,6 +42,7 @@ class SipAccount < ActiveRecord::Base
has_many :b_call_legs, :class_name => 'Call', :foreign_key => 'b_sip_account_id'
has_many :acd_agents, :as => :destination, :dependent => :destroy
+ has_many :switchboard_entries, :dependent => :destroy
# Delegations:
#
@@ -212,6 +213,11 @@ class SipAccount < ActiveRecord::Base
return states
end
+ def non_e164_phone_numbers
+ array_of_phone_numbers_as_strings = self.phone_numbers.map{ |phone_number| phone_number.number.to_s }.sort
+ self.phone_numbers.where(:number => array_of_phone_numbers_as_strings.select { |phone_number| phone_number[0] != '+' })
+ end
+
private
def save_value_of_to_s
diff --git a/app/models/switchboard.rb b/app/models/switchboard.rb
new file mode 100644
index 0000000..74e2767
--- /dev/null
+++ b/app/models/switchboard.rb
@@ -0,0 +1,16 @@
+class Switchboard < ActiveRecord::Base
+ # https://github.com/rails/strong_parameters
+ include ActiveModel::ForbiddenAttributesProtection
+
+ validates :name,
+ :presence => true,
+ :uniqueness => {:scope => :user_id}
+
+ belongs_to :user, :touch => true
+ has_many :switchboard_entries, :dependent => :destroy
+ has_many :sip_accounts, :through => :switchboard_entries
+
+ def to_s
+ self.name.to_s
+ end
+end
diff --git a/app/models/switchboard_entry.rb b/app/models/switchboard_entry.rb
new file mode 100644
index 0000000..76d002f
--- /dev/null
+++ b/app/models/switchboard_entry.rb
@@ -0,0 +1,31 @@
+class SwitchboardEntry < ActiveRecord::Base
+ # https://github.com/rails/strong_parameters
+ include ActiveModel::ForbiddenAttributesProtection
+
+ belongs_to :switchboard, :touch => true
+ belongs_to :sip_account, :touch => true
+
+ validates :switchboard,
+ :presence => true
+
+ validates :sip_account,
+ :presence => true
+
+ validates :name,
+ :length => { :maximum => 10 },
+ :uniqueness => {:scope => :switchboard_id},
+ :allow_blank => true,
+ :allow_nil => true
+
+ acts_as_list :scope => [ :switchboard_id ]
+
+ default_scope order(:position)
+
+ def to_s
+ if self.name.blank? && !self.sip_account.to_s.blank?
+ self.sip_account.to_s
+ else
+ self.name.to_s
+ end
+ end
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index 913d75f..6091e32 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -94,6 +94,8 @@ class User < ActiveRecord::Base
has_many :group_memberships, :as => :item, :dependent => :destroy, :uniq => true
has_many :groups, :through => :group_memberships
+ has_many :switchboards, :dependent => :destroy
+
# Avatar like photo
mount_uploader :image, ImageUploader
diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml
index 8004c0e..fe5f48f 100644
--- a/app/views/layouts/_navbar.html.haml
+++ b/app/views/layouts/_navbar.html.haml
@@ -22,7 +22,11 @@
=t("call_histories.index.page_title")
%li
%a{:href => sip_account_voicemail_messages_path(current_user.sip_accounts.first)}
+ %i.icon-star.icon-white{:id => 'new_voicemail_indicator'}
=t("voicemail_messages.index.page_title")
+ :javascript
+ $("#new_voicemail_indicator").hide()
+ = subscribe_to "/users/#{current_user.id}/messages/new"
- if current_user
%ul.nav.pull-right
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index eab6096..027f837 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -36,4 +36,5 @@
.span12
%hr/
= render 'layouts/footer'
+
/ /container
diff --git a/app/views/switchboard_entries/_form.html.haml b/app/views/switchboard_entries/_form.html.haml
new file mode 100644
index 0000000..b3d56ec
--- /dev/null
+++ b/app/views/switchboard_entries/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@switchboard, @switchboard_entry]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('switchboard_entries.form.submit')
diff --git a/app/views/switchboard_entries/_form_core.html.haml b/app/views/switchboard_entries/_form_core.html.haml
new file mode 100644
index 0000000..6f340c2
--- /dev/null
+++ b/app/views/switchboard_entries/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.association :sip_account, :collection => @sip_accounts, :label => t('switchboard_entries.form.sip_account_id.label'), :hint => conditional_hint('switchboard_entries.form.sip_account_id.hint'), :autofocus => true, :include_blank => false
+ = f.input :name, :label => t('switchboard_entries.form.name.label'), :hint => conditional_hint('switchboard_entries.form.name.hint')
diff --git a/app/views/switchboard_entries/_index_core.html.haml b/app/views/switchboard_entries/_index_core.html.haml
new file mode 100644
index 0000000..d647626
--- /dev/null
+++ b/app/views/switchboard_entries/_index_core.html.haml
@@ -0,0 +1,17 @@
+%table.table.table-striped
+ %tr
+ %th
+ %th= t('switchboard_entries.index.sip_account_id')
+ %th= t('switchboard_entries.index.name')
+ %th
+
+ - if switchboard_entries.any?
+ %tbody{ :id => "switchboard_entries", :'data-update-url' => sort_switchboard_switchboard_entries_path(switchboard_entries.first.switchboard) }
+ - for switchboard_entry in switchboard_entries
+ = content_tag_for :tr, switchboard_entry do
+ %td
+ %span.handle
+ %i.icon-resize-vertical
+ %td= switchboard_entry.sip_account
+ %td= switchboard_entry.name
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => switchboard_entry.switchboard, :child => switchboard_entry} \ No newline at end of file
diff --git a/app/views/switchboard_entries/_switchboard_entry.html.haml b/app/views/switchboard_entries/_switchboard_entry.html.haml
new file mode 100644
index 0000000..8d8e747
--- /dev/null
+++ b/app/views/switchboard_entries/_switchboard_entry.html.haml
@@ -0,0 +1,27 @@
+%li.span1{:id => "switchboard_entry_id_#{switchboard_entry.id}"}
+ %div.thumbnail
+ %a.thumbnail{:href => tenant_user_path(switchboard_entry.sip_account.sip_accountable.current_tenant, switchboard_entry.sip_account.sip_accountable)}
+ - if switchboard_entry.sip_account.sip_accountable.image?
+ = image_tag(switchboard_entry.sip_account.sip_accountable.image_url(:mini).to_s, :class => 'img-rounded')
+ - else
+ - if switchboard_entry.sip_account.sip_accountable.male?
+ = image_tag 'icons/user-male-16x.png', :class => 'img-rounded'
+ - else
+ = image_tag 'icons/user-female-16x.png', :class => 'img-rounded'
+ %p
+ %small
+ = truncate(switchboard_entry.to_s, :length => 10)
+ %br
+ - if !switchboard_entry.sip_account.registration
+ %span.label.label-inverse
+ %i.icon-ban-circle.icon-white
+ - else
+ - if switchboard_entry.sip_account.call_legs(:where => ["HELD", "ACTIVE"]).size != 0
+ %span.label.label-success
+ %i.icon-user.icon-white
+ - if switchboard_entry.sip_account.call_legs(:where => ["RINGING"]).size != 0
+ %span.label.label-info
+ %i.icon-bell.icon-white
+ - if switchboard_entry.sip_account.phone_numbers.any?
+ %span.label
+ = switchboard_entry.sip_account.phone_numbers.first.number
diff --git a/app/views/switchboard_entries/edit.html.haml b/app/views/switchboard_entries/edit.html.haml
new file mode 100644
index 0000000..8885e25
--- /dev/null
+++ b/app/views/switchboard_entries/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("switchboard_entries.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/switchboard_entries/index.html.haml b/app/views/switchboard_entries/index.html.haml
new file mode 100644
index 0000000..302b778
--- /dev/null
+++ b/app/views/switchboard_entries/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("switchboard_entries.index.page_title")
+
+- if @switchboard_entries && @switchboard_entries.count > 0
+ = render "index_core", :switchboard_entries => @switchboard_entries
+
+= render :partial => 'shared/create_link', :locals => {:parent => @switchboard, :child_class => SwitchboardEntry} \ No newline at end of file
diff --git a/app/views/switchboard_entries/new.html.haml b/app/views/switchboard_entries/new.html.haml
new file mode 100644
index 0000000..0801a65
--- /dev/null
+++ b/app/views/switchboard_entries/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("switchboard_entries.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/switchboard_entries/show.html.haml b/app/views/switchboard_entries/show.html.haml
new file mode 100644
index 0000000..b519781
--- /dev/null
+++ b/app/views/switchboard_entries/show.html.haml
@@ -0,0 +1,22 @@
+- content_for :title, t("switchboard_entries.show.page_title")
+
+.row
+ .span6
+ %table.table.table-striped
+ %tr
+ %td
+ %strong= t('switchboard_entries.show.sip_account_id') + ":"
+ %td
+ = @switchboard_entry.sip_account
+ %tr
+ %td
+ %strong= t('switchboard_entries.show.name') + ":"
+ %td
+ = @switchboard_entry.name
+ %tr
+ %td
+ %strong= t('switchboard_entries.show.position') + ":"
+ %td
+ = @switchboard_entry.position
+
+ = render :partial => 'shared/show_edit_destroy_part', :locals => {:parent => @switchboard, :child => @switchboard_entry } \ No newline at end of file
diff --git a/app/views/switchboards/_form.html.haml b/app/views/switchboards/_form.html.haml
new file mode 100644
index 0000000..bb09713
--- /dev/null
+++ b/app/views/switchboards/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@user, @switchboard]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('switchboards.form.submit')
diff --git a/app/views/switchboards/_form_core.html.haml b/app/views/switchboards/_form_core.html.haml
new file mode 100644
index 0000000..61b5934
--- /dev/null
+++ b/app/views/switchboards/_form_core.html.haml
@@ -0,0 +1,2 @@
+.inputs
+ = f.input :name, :label => t('switchboards.form.name.label'), :hint => conditional_hint('switchboards.form.name.hint'), :autofocus => true
diff --git a/app/views/switchboards/_index_core.html.haml b/app/views/switchboards/_index_core.html.haml
new file mode 100644
index 0000000..858f624
--- /dev/null
+++ b/app/views/switchboards/_index_core.html.haml
@@ -0,0 +1,10 @@
+%table.table.table-striped
+ %tr
+ %th= t('switchboards.index.name')
+ %th
+
+
+ - for switchboard in switchboards
+ %tr
+ %td= switchboard.name
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => user, :child => switchboard} \ No newline at end of file
diff --git a/app/views/switchboards/edit.html.haml b/app/views/switchboards/edit.html.haml
new file mode 100644
index 0000000..f2e69f4
--- /dev/null
+++ b/app/views/switchboards/edit.html.haml
@@ -0,0 +1,12 @@
+- content_for :title, t("switchboards.edit.page_title")
+
+.row
+ .span12
+ = render "form"
+
+.row
+ .span12
+ - if @switchboard.switchboard_entries && @switchboard.switchboard_entries.count > 0
+ = render "switchboard_entries/index_core", :switchboard_entries => @switchboard.switchboard_entries
+
+ = render :partial => 'shared/create_link', :locals => {:parent => @switchboard, :child_class => SwitchboardEntry} \ No newline at end of file
diff --git a/app/views/switchboards/index.html.haml b/app/views/switchboards/index.html.haml
new file mode 100644
index 0000000..4f29d7d
--- /dev/null
+++ b/app/views/switchboards/index.html.haml
@@ -0,0 +1,8 @@
+- content_for :title, t("switchboards.index.page_title")
+
+.row
+ .span6
+ - if @switchboards && @switchboards.count > 0
+ = render :partial => "index_core", :locals => {:switchboards => @switchboards, :user => @user}
+
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => Switchboard} \ No newline at end of file
diff --git a/app/views/switchboards/new.html.haml b/app/views/switchboards/new.html.haml
new file mode 100644
index 0000000..9f5918f
--- /dev/null
+++ b/app/views/switchboards/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("switchboards.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml
new file mode 100644
index 0000000..18671c2
--- /dev/null
+++ b/app/views/switchboards/show.html.haml
@@ -0,0 +1,18 @@
+- content_for :title, @switchboard.name
+
+.row
+ .span12
+ .well.pull-right
+ %p
+ =current_user
+
+ %ul.thumbnails
+ = render :partial => "switchboard_entries/switchboard_entry", :collection => @switchboard_entries
+
+- if can? :edit, @switchboard
+ .row
+ .span12
+ %a.btn.btn-small.btn-warning{:href => switchboard_switchboard_entries_path(@switchboard) }
+ %i.icon-edit.icon-white
+ %span.hidden-phone
+ =t("switchboard_entries.index.page_title")
diff --git a/app/views/trigger/voicemail.html.erb b/app/views/trigger/voicemail.html.erb
deleted file mode 100644
index 9bafe17..0000000
--- a/app/views/trigger/voicemail.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<h1>Trigger#voicemail</h1>
-<p>Find me in app/views/trigger/voicemail.html.erb</p>
-
-<%= debug(params) %>
diff --git a/app/views/users/_switchboards.html.haml b/app/views/users/_switchboards.html.haml
new file mode 100644
index 0000000..183b6ae
--- /dev/null
+++ b/app/views/users/_switchboards.html.haml
@@ -0,0 +1,7 @@
+-# Switchboards
+-#
+- if SipAccount.any? && (can?( :index, Switchboard ) && user.switchboards.any? ) || can?( :create, Switchboard )
+ %h2= t('switchboards.index.page_title')
+ - if can?( :index, Switchboard ) && user.switchboards.count > 0
+ = render :partial => "switchboards/index_core", :locals => {:switchboards => user.switchboards, :user => user}
+ = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => Switchboard} \ No newline at end of file
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index ea90ab4..98f7cc6 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -87,3 +87,6 @@
- cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do
= render :partial => 'conferences', :locals => {:user => @user}
+
+ - cache(['user_switchboards_overview', I18n.locale, @user, @user.switchboards]) do
+ = render :partial => 'switchboards', :locals => {:user => @user} \ No newline at end of file