diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-04-04 12:05:30 +0200 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-04-04 12:05:30 +0200 |
commit | d1ae9ca0016388a0778ece5f382c99f156bdabcb (patch) | |
tree | 632e46e34a4338a6e3b4f7cb2c29c123f50a4ea9 /app | |
parent | 4ebbcf3b5576cc342086e2f54950a119a49f2bf9 (diff) | |
parent | d6a733440eee34dab3daf25089d40aed91018a49 (diff) |
Merge branch 'emberjs' into develop
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/switchboards_controller.rb | 3 | ||||
-rw-r--r-- | app/models/switchboard.rb | 6 | ||||
-rw-r--r-- | app/views/switchboards/_form_core.html.haml | 1 | ||||
-rw-r--r-- | app/views/switchboards/show.html.erb | 3 |
4 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb index f48e7fb..3e2f8d6 100644 --- a/app/controllers/switchboards_controller.rb +++ b/app/controllers/switchboards_controller.rb @@ -18,6 +18,7 @@ class SwitchboardsController < ApplicationController @switchboard.show_avatars = true @switchboard.entry_width = 2 @switchboard.reload_interval = 2000 + @switchboard.amount_of_displayed_phone_numbers = 1 spread_breadcrumbs end @@ -55,7 +56,7 @@ class SwitchboardsController < ApplicationController private def switchboard_params - params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width) + params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width, :amount_of_displayed_phone_numbers) end def spread_breadcrumbs diff --git a/app/models/switchboard.rb b/app/models/switchboard.rb index 53f69a4..cf8c708 100644 --- a/app/models/switchboard.rb +++ b/app/models/switchboard.rb @@ -18,6 +18,12 @@ class Switchboard < ActiveRecord::Base :less_than => 5 } + validates :amount_of_displayed_phone_numbers, + :numericality => { :only_integer => true, + :greater_than_or_equal_to => 0, + :less_than => 20 + } + belongs_to :user, :touch => true has_many :switchboard_entries, :dependent => :destroy has_many :sip_accounts, :through => :switchboard_entries diff --git a/app/views/switchboards/_form_core.html.haml b/app/views/switchboards/_form_core.html.haml index 59a2442..2258640 100644 --- a/app/views/switchboards/_form_core.html.haml +++ b/app/views/switchboards/_form_core.html.haml @@ -3,3 +3,4 @@ = f.input :reload_interval, :label => t('switchboards.form.reload_interval.label'), :hint => conditional_hint('switchboards.form.reload_interval.hint') = f.input :show_avatars, :label => t('switchboards.form.show_avatars.label'), :hint => conditional_hint('switchboards.form.show_avatars.hint') = f.input :entry_width, :label => t('switchboards.form.entry_width.label'), :hint => conditional_hint('switchboards.form.entry_width.hint') + = f.input :amount_of_displayed_phone_numbers, :label => t('switchboards.form.amount_of_displayed_phone_numbers.label'), :hint => conditional_hint('switchboards.form.amount_of_displayed_phone_numbers.hint')
\ No newline at end of file diff --git a/app/views/switchboards/show.html.erb b/app/views/switchboards/show.html.erb index 1fd9d9a..a240b55 100644 --- a/app/views/switchboards/show.html.erb +++ b/app/views/switchboards/show.html.erb @@ -4,6 +4,7 @@ var switchboard_id = <%= @switchboard.id %>; var show_avatars = <%= @switchboard.show_avatars.to_s %>; var reload_interval = <%= @switchboard.reload_interval.nil? ? 0 : @switchboard.reload_interval %>; + var amount_of_displayed_phone_numbers = <%= @switchboard.amount_of_displayed_phone_numbers %>; </script> <div class='row'> @@ -27,7 +28,7 @@ <small> {{switchboardEntry.name}}<br> - {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumbers}} + {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}} <span class="label"> {{phoneNumber.number}} </span> |