From 595e5f9d32c9dda8f7b6c0dd5e7e4fba4693eca4 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 20 Mar 2013 17:08:14 +0100 Subject: basic Ember.js setup --- app/controllers/switchboards_controller.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb index 98008c1..c499c69 100644 --- a/app/controllers/switchboards_controller.rb +++ b/app/controllers/switchboards_controller.rb @@ -8,6 +8,9 @@ class SwitchboardsController < ApplicationController end def show + if @user.nil? + @user = current_user + end @switchboard = @user.switchboards.find(params[:id]) @switchboard_entries = @switchboard.switchboard_entries spread_breadcrumbs -- cgit v1.2.3 From 877364c24ef9c7954f0e193456bb3f2d39169977 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 25 Mar 2013 10:26:49 +0100 Subject: First try --- app/controllers/switchboard_entries_controller.rb | 13 +++++++++++-- app/controllers/switchboards_controller.rb | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/switchboard_entries_controller.rb b/app/controllers/switchboard_entries_controller.rb index ef6c72e..32ca9bb 100644 --- a/app/controllers/switchboard_entries_controller.rb +++ b/app/controllers/switchboard_entries_controller.rb @@ -8,8 +8,17 @@ class SwitchboardEntriesController < ApplicationController end def show - @switchboard_entry = @switchboard.switchboard_entries.find(params[:id]) - spread_breadcrumbs + if @switchboard + @switchboard_entry = @switchboard.switchboard_entries.find(params[:id]) + spread_breadcrumbs + else + @switchboard_entry = SwitchboardEntry.find(params[:id]) + end + + respond_to do |format| + format.html + format.json { render json: @switchboard_entry } + end end def new diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb index c499c69..8ceb96d 100644 --- a/app/controllers/switchboards_controller.rb +++ b/app/controllers/switchboards_controller.rb @@ -3,8 +3,16 @@ class SwitchboardsController < ApplicationController authorize_resource :switchboard, :through => :user def index + if @user.nil? + @user = current_user + end @switchboards = @user.switchboards spread_breadcrumbs + + respond_to do |format| + format.html + format.json { render json: @switchboards } + end end def show @@ -14,6 +22,11 @@ class SwitchboardsController < ApplicationController @switchboard = @user.switchboards.find(params[:id]) @switchboard_entries = @switchboard.switchboard_entries spread_breadcrumbs + + respond_to do |format| + format.html + format.json { render json: @switchboard } + end end def new -- cgit v1.2.3 From 64653a9149eca977c16233abb0a472730b94a464 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Mar 2013 16:55:08 +0100 Subject: Store reload interval in the Switchboard table. --- app/controllers/switchboard_entries_controller.rb | 13 +++++++++++-- app/controllers/switchboards_controller.rb | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/switchboard_entries_controller.rb b/app/controllers/switchboard_entries_controller.rb index 32ca9bb..3f82976 100644 --- a/app/controllers/switchboard_entries_controller.rb +++ b/app/controllers/switchboard_entries_controller.rb @@ -3,8 +3,17 @@ class SwitchboardEntriesController < ApplicationController authorize_resource :switchboard_entry, :through => :switchboard, :except => [:sort] def index - @switchboard_entries = @switchboard.switchboard_entries - spread_breadcrumbs + if @switchboard + @switchboard_entries = @switchboard.switchboard_entries + spread_breadcrumbs + else + @switchboard_entries = SwitchboardEntry.where(:id => params[:ids]) + end + + respond_to do |format| + format.html + format.json { render json: @switchboard_entries } + end end def show diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb index 8ceb96d..d3424ad 100644 --- a/app/controllers/switchboards_controller.rb +++ b/app/controllers/switchboards_controller.rb @@ -31,6 +31,9 @@ class SwitchboardsController < ApplicationController def new @switchboard = @user.switchboards.build + @switchboard.show_avatars = true + @switchboard.entry_width = 2 + @switchboard.reload_interval = 2000 spread_breadcrumbs end @@ -68,7 +71,7 @@ class SwitchboardsController < ApplicationController private def switchboard_params - params.require(:switchboard).permit(:name) + params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width) end def spread_breadcrumbs -- cgit v1.2.3 From cea2cc3c1cc1e48fc4600c698d52dfda2bde4505 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 3 Apr 2013 22:08:19 +0200 Subject: Massive changes to the switchboard. --- app/controllers/api/v1/phone_numbers_controller.rb | 23 +++++++++++++++++++ app/controllers/api/v1/sip_accounts_controller.rb | 23 +++++++++++++++++++ .../api/v1/switchboard_entries_controller.rb | 23 +++++++++++++++++++ app/controllers/api/v1/switchboards_controller.rb | 21 +++++++++++++++++ app/controllers/switchboard_entries_controller.rb | 26 ++++------------------ app/controllers/switchboards_controller.rb | 16 ------------- 6 files changed, 94 insertions(+), 38 deletions(-) create mode 100644 app/controllers/api/v1/phone_numbers_controller.rb create mode 100644 app/controllers/api/v1/sip_accounts_controller.rb create mode 100644 app/controllers/api/v1/switchboard_entries_controller.rb create mode 100644 app/controllers/api/v1/switchboards_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/api/v1/phone_numbers_controller.rb b/app/controllers/api/v1/phone_numbers_controller.rb new file mode 100644 index 0000000..ff58fd3 --- /dev/null +++ b/app/controllers/api/v1/phone_numbers_controller.rb @@ -0,0 +1,23 @@ +module Api + module V1 + class PhoneNumbersController < ApplicationController + respond_to :json + + def index + if params[:ids] + @phone_numbers = PhoneNumber.where(:id => params[:ids]) + else + @phone_numbers = PhoneNumber.all + end + + respond_with @phone_numbers + end + + def show + @phone_number = PhoneNumber.find(params[:id]) + + respond_with @phone_number + end + end + end +end diff --git a/app/controllers/api/v1/sip_accounts_controller.rb b/app/controllers/api/v1/sip_accounts_controller.rb new file mode 100644 index 0000000..6f305a4 --- /dev/null +++ b/app/controllers/api/v1/sip_accounts_controller.rb @@ -0,0 +1,23 @@ +module Api + module V1 + class SipAccountsController < ApplicationController + respond_to :json + + def index + if params[:ids] + @sip_accounts = SipAccount.where(:id => params[:ids]) + else + @sip_accounts = SipAccount.all + end + + respond_with @sip_accounts + end + + def show + @sip_account = SipAccount.find(params[:id]) + + respond_with @sip_account + end + end + end +end diff --git a/app/controllers/api/v1/switchboard_entries_controller.rb b/app/controllers/api/v1/switchboard_entries_controller.rb new file mode 100644 index 0000000..688f108 --- /dev/null +++ b/app/controllers/api/v1/switchboard_entries_controller.rb @@ -0,0 +1,23 @@ +module Api + module V1 + class SwitchboardEntriesController < ApplicationController + respond_to :json + + def index + if params[:ids] + @switchboard_entries = SwitchboardEntry.where(:id => params[:ids]) + else + @switchboard_entries = SwitchboardEntry.all + end + + respond_with @switchboard_entries + end + + def show + @switchboard_entry = SwitchboardEntry.find(params[:id]) + + respond_with @switchboard_entry + end + end + end +end \ No newline at end of file diff --git a/app/controllers/api/v1/switchboards_controller.rb b/app/controllers/api/v1/switchboards_controller.rb new file mode 100644 index 0000000..e6996ca --- /dev/null +++ b/app/controllers/api/v1/switchboards_controller.rb @@ -0,0 +1,21 @@ +module Api + module V1 + class SwitchboardsController < ApplicationController + respond_to :json + + def index + @user = current_user + @switchboards = @user.switchboards + + respond_with @switchboards + end + + def show + @user = current_user + @switchboard = @user.switchboards.find(params[:id]) + + respond_with @switchboard + end + end + end +end diff --git a/app/controllers/switchboard_entries_controller.rb b/app/controllers/switchboard_entries_controller.rb index 3f82976..ef6c72e 100644 --- a/app/controllers/switchboard_entries_controller.rb +++ b/app/controllers/switchboard_entries_controller.rb @@ -3,31 +3,13 @@ class SwitchboardEntriesController < ApplicationController authorize_resource :switchboard_entry, :through => :switchboard, :except => [:sort] def index - if @switchboard - @switchboard_entries = @switchboard.switchboard_entries - spread_breadcrumbs - else - @switchboard_entries = SwitchboardEntry.where(:id => params[:ids]) - end - - respond_to do |format| - format.html - format.json { render json: @switchboard_entries } - end + @switchboard_entries = @switchboard.switchboard_entries + spread_breadcrumbs end def show - if @switchboard - @switchboard_entry = @switchboard.switchboard_entries.find(params[:id]) - spread_breadcrumbs - else - @switchboard_entry = SwitchboardEntry.find(params[:id]) - end - - respond_to do |format| - format.html - format.json { render json: @switchboard_entry } - end + @switchboard_entry = @switchboard.switchboard_entries.find(params[:id]) + spread_breadcrumbs end def new diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb index d3424ad..f48e7fb 100644 --- a/app/controllers/switchboards_controller.rb +++ b/app/controllers/switchboards_controller.rb @@ -3,30 +3,14 @@ class SwitchboardsController < ApplicationController authorize_resource :switchboard, :through => :user def index - if @user.nil? - @user = current_user - end @switchboards = @user.switchboards spread_breadcrumbs - - respond_to do |format| - format.html - format.json { render json: @switchboards } - end end def show - if @user.nil? - @user = current_user - end @switchboard = @user.switchboards.find(params[:id]) @switchboard_entries = @switchboard.switchboard_entries spread_breadcrumbs - - respond_to do |format| - format.html - format.json { render json: @switchboard } - end end def new -- cgit v1.2.3