summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/switchboard_entry.rb1
-rw-r--r--app/views/switchboards/show.html.haml53
-rw-r--r--config/routes.rb4
3 files changed, 47 insertions, 11 deletions
diff --git a/app/models/switchboard_entry.rb b/app/models/switchboard_entry.rb
index d1e9a0c..76d002f 100644
--- a/app/models/switchboard_entry.rb
+++ b/app/models/switchboard_entry.rb
@@ -12,6 +12,7 @@ class SwitchboardEntry < ActiveRecord::Base
:presence => true
validates :name,
+ :length => { :maximum => 10 },
:uniqueness => {:scope => :switchboard_id},
:allow_blank => true,
:allow_nil => true
diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml
index 746e180..b81980c 100644
--- a/app/views/switchboards/show.html.haml
+++ b/app/views/switchboards/show.html.haml
@@ -1,12 +1,45 @@
-- content_for :title, t("switchboards.show.page_title")
+- content_for :title, @switchboard.name
+
.row
- .span6
- %table.table.table-striped
- %tr
- %td
- %strong= t('switchboards.show.name') + ":"
- %td
- = @switchboard.name
-
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @user, :child => @switchboard } \ No newline at end of file
+ .span12
+ .well.pull-right
+ %p
+ =current_user
+
+ %ul.thumbnails
+ - @switchboard.switchboard_entries.each do |switchboard_entry|
+ %li.span1
+ %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)
+ %span{:class => "label #{(switchboard_entry.sip_account.registration ? '' : 'label-inverse')}"}
+ - if !switchboard_entry.sip_account.registration
+ %i.icon-ban-circle.icon-white
+ - if switchboard_entry.sip_account.phone_numbers.count > 1
+ - phone_numbers = []
+ - switchboard_entry.sip_account.phone_numbers.order(:position).each do |phone_number|
+ - if phone_number.number.length < 6
+ - phone_numbers << phone_number
+ - if phone_numbers.size == 0
+ - phone_numbers = switchboard_entry.sip_account.phone_numbers.order(:position)
+ - else
+ - phone_numbers = switchboard_entry.sip_account.phone_numbers
+ = render 'phone_numbers/listing', :phone_numbers => phone_numbers
+
+- 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/config/routes.rb b/config/routes.rb
index 369ec92..cfee51b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -215,7 +215,9 @@ Gemeinschaft42c::Application.routes.draw do
resources :fax_accounts
resources :system_messages, :except => [ :edit, :update, :destroy ]
resources :parking_stalls
- resources :switchboards
+ resources :switchboards do
+ get :display
+ end
end
resources :user_groups do