From db9dbf03d88cfbd68ce99a242730b9e870339539 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 7 Mar 2013 13:15:35 +0100 Subject: Added Switchboard scaffold. --- app/views/switchboards/_form.html.haml | 7 +++++++ app/views/switchboards/_form_core.html.haml | 2 ++ app/views/switchboards/_index_core.html.haml | 10 ++++++++++ app/views/switchboards/edit.html.haml | 3 +++ app/views/switchboards/index.html.haml | 8 ++++++++ app/views/switchboards/new.html.haml | 3 +++ app/views/switchboards/show.html.haml | 12 ++++++++++++ 7 files changed, 45 insertions(+) create mode 100644 app/views/switchboards/_form.html.haml create mode 100644 app/views/switchboards/_form_core.html.haml create mode 100644 app/views/switchboards/_index_core.html.haml create mode 100644 app/views/switchboards/edit.html.haml create mode 100644 app/views/switchboards/index.html.haml create mode 100644 app/views/switchboards/new.html.haml create mode 100644 app/views/switchboards/show.html.haml (limited to 'app/views/switchboards') 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..1ab0efe --- /dev/null +++ b/app/views/switchboards/edit.html.haml @@ -0,0 +1,3 @@ +- content_for :title, t("switchboards.edit.page_title") + += render "form" \ 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..746e180 --- /dev/null +++ b/app/views/switchboards/show.html.haml @@ -0,0 +1,12 @@ +- content_for :title, t("switchboards.show.page_title") + +.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 -- cgit v1.2.3 From 21d0843117c0962bd962fc50fccaf276a5b3067f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 08:43:23 +0100 Subject: Misc --- app/views/switchboards/show.html.haml | 53 ++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) (limited to 'app/views/switchboards') 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") -- cgit v1.2.3 From 13e16223977966f9751e7b8e3fb587e2df0a0801 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 09:52:31 +0100 Subject: Add a second configuration option. --- app/views/switchboards/edit.html.haml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/views/switchboards') diff --git a/app/views/switchboards/edit.html.haml b/app/views/switchboards/edit.html.haml index 1ab0efe..f2e69f4 100644 --- a/app/views/switchboards/edit.html.haml +++ b/app/views/switchboards/edit.html.haml @@ -1,3 +1,12 @@ - content_for :title, t("switchboards.edit.page_title") -= render "form" \ No newline at end of file +.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 -- cgit v1.2.3 From f0932e38b890b08397020a5994ddde7110d7b8db Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 10:50:49 +0100 Subject: refactoring --- app/views/switchboards/show.html.haml | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'app/views/switchboards') diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml index b81980c..18671c2 100644 --- a/app/views/switchboards/show.html.haml +++ b/app/views/switchboards/show.html.haml @@ -1,6 +1,5 @@ - content_for :title, @switchboard.name - .row .span12 .well.pull-right @@ -8,33 +7,7 @@ =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 + = render :partial => "switchboard_entries/switchboard_entry", :collection => @switchboard_entries - if can? :edit, @switchboard .row -- cgit v1.2.3 From 5d3eeec6962010eb0b9cbcb9d3bb87d016bce199 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 12 Mar 2013 13:40:18 +0100 Subject: Added sip_account_update trigger --- app/views/switchboards/show.html.haml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/views/switchboards') diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml index 18671c2..2932366 100644 --- a/app/views/switchboards/show.html.haml +++ b/app/views/switchboards/show.html.haml @@ -16,3 +16,5 @@ %i.icon-edit.icon-white %span.hidden-phone =t("switchboard_entries.index.page_title") + += subscribe_to "/switchboards/#{@switchboard.id}" \ No newline at end of file -- cgit v1.2.3 From 3a0ea10cdd6084a8beb235f5c1573c22a5d733f0 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 14 Mar 2013 20:21:59 +0100 Subject: Added a dashboard for Switchboard. --- .../switchboards/_current_user_dashboard.html.haml | 26 ++++++++++++++++++++++ app/views/switchboards/show.html.haml | 23 ++++++++++--------- 2 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 app/views/switchboards/_current_user_dashboard.html.haml (limited to 'app/views/switchboards') diff --git a/app/views/switchboards/_current_user_dashboard.html.haml b/app/views/switchboards/_current_user_dashboard.html.haml new file mode 100644 index 0000000..1c57a0d --- /dev/null +++ b/app/views/switchboards/_current_user_dashboard.html.haml @@ -0,0 +1,26 @@ +.dashboard + - current_user.sip_accounts.each do |sip_account| + %table.table.table-striped + %thead + %tr + %td + SIP Account + %td + Direction + %td + StartStamp + %td + Destination + %td + CalleeName + %tbody + - sip_account.calls.each do |call| + %tr + %td + - current_user.sip_accounts.each do |sip_account| + %span.label.label-info + =sip_account.phone_numbers.first.to_s + %td=call.direction + %td=l Time.at(call.start_stamp) + %td=call.destination + %td=call.callee_name \ No newline at end of file diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml index 2932366..a825806 100644 --- a/app/views/switchboards/show.html.haml +++ b/app/views/switchboards/show.html.haml @@ -1,20 +1,21 @@ -- content_for :title, @switchboard.name +- content_for :title, "Switchboard #{@switchboard.name}" .row .span12 - .well.pull-right - %p - =current_user + = render :partial => "current_user_dashboard", :current_user => 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") + - 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") + + .span6 + = subscribe_to "/switchboards/#{@switchboard.id}" \ No newline at end of file -- cgit v1.2.3 From 0b4e3dfd031b21c26f7bc9c7c05cd931950ecbd6 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 14 Mar 2013 21:34:06 +0100 Subject: Switchboard stuff --- .../switchboards/_current_user_dashboard.html.haml | 35 +++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'app/views/switchboards') diff --git a/app/views/switchboards/_current_user_dashboard.html.haml b/app/views/switchboards/_current_user_dashboard.html.haml index 1c57a0d..8dd75b9 100644 --- a/app/views/switchboards/_current_user_dashboard.html.haml +++ b/app/views/switchboards/_current_user_dashboard.html.haml @@ -4,23 +4,30 @@ %thead %tr %td - SIP Account - %td - Direction - %td - StartStamp %td Destination %td - CalleeName + Start + %td{:span => '2'} + Caller %tbody - - sip_account.calls.each do |call| + - sip_account.call_legs.where(callstate: 'RINGING').each do |call_leg| + %tr.warning + %td + %i.icon-bell + %td + %span.label.label-info + =sip_account.phone_numbers.first.to_s + %td=l Time.at(call_leg.start_stamp) + %td=call_leg.callee_name + %td=call_leg.callee_number + + - sip_account.b_call_legs.where(direction: 'inbound').each do |call_leg| %tr %td - - current_user.sip_accounts.each do |sip_account| - %span.label.label-info - =sip_account.phone_numbers.first.to_s - %td=call.direction - %td=l Time.at(call.start_stamp) - %td=call.destination - %td=call.callee_name \ No newline at end of file + %td + %span.label.label-info + =sip_account.phone_numbers.first.to_s + %td=l Time.at(call_leg.start_stamp) + %td=call_leg.b_caller_id_name + %td=call_leg.b_caller_id_number -- cgit v1.2.3