summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-28 09:26:47 +0100
committerspag <spag@golwen.net>2013-01-28 09:26:47 +0100
commit29ac1a26b5d78c3d8570928df73610de0a361297 (patch)
tree3ec56353f7a9ec3c8a7275708e9ce0c088411cf7
parente500814c387818938bfe76299a25a04de7e1cbfb (diff)
render route endpoint
-rw-r--r--app/models/call_route.rb11
-rw-r--r--app/views/call_routes/_index_core.html.haml11
-rw-r--r--app/views/call_routes/show.html.haml11
-rw-r--r--config/locales/views/call_routes/de.yml6
-rw-r--r--config/locales/views/call_routes/en.yml6
5 files changed, 29 insertions, 16 deletions
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index 28120c1..b4496ab 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -238,4 +238,15 @@ class CallRoute < ActiveRecord::Base
end
end
end
+
+ def endpoint
+ if self.endpoint_id.to_i > 0
+ begin
+ return self.endpoint_type.camelize.constantize.where(:id => self.endpoint_id.to_i).first
+ rescue
+ return nil
+ end
+ end
+ end
+
end
diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml
index 2e9238e..f0acebb 100644
--- a/app/views/call_routes/_index_core.html.haml
+++ b/app/views/call_routes/_index_core.html.haml
@@ -4,7 +4,7 @@
%tr
%th= t('call_routes.index.name')
%th= t('route_elements.index.pattern')
- %th= t('call_routes.index.endpoint_type')
+ %th= t('call_routes.index.endpoint')
%tbody
- for call_route in call_routes
@@ -18,5 +18,10 @@
= ', ...'
- else
= '-'
- %td= call_route.endpoint_type
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} \ No newline at end of file
+ %td
+ - endpoint = call_route.endpoint
+ - if endpoint
+ = endpoint
+ - else
+ = call_route.endpoint_type
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route}
diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml
index 70fe13e..09daf53 100644
--- a/app/views/call_routes/show.html.haml
+++ b/app/views/call_routes/show.html.haml
@@ -7,11 +7,12 @@
%strong= t('call_routes.show.name') + ":"
= @call_route.name
%p
- %strong= t('call_routes.show.endpoint_type') + ":"
- = @call_route.endpoint_type
-%p
- %strong= t('call_routes.show.endpoint_id') + ":"
- = @call_route.endpoint_id
+ %strong= t('call_routes.show.endpoint') + ":"
+ - endpoint = @call_route.endpoint
+ - if endpoint
+ = endpoint
+ - else
+ = @call_route.endpoint_type
= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route }
diff --git a/config/locales/views/call_routes/de.yml b/config/locales/views/call_routes/de.yml
index 260b869..a8d6f4b 100644
--- a/config/locales/views/call_routes/de.yml
+++ b/config/locales/views/call_routes/de.yml
@@ -9,8 +9,7 @@ de:
page_title: 'Liste aller Call Routen'
routing_table: 'Routing Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Call Route'
@@ -23,8 +22,7 @@ de:
page_title: 'Call Route bearbeiten'
routing_table: 'Routing Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
diff --git a/config/locales/views/call_routes/en.yml b/config/locales/views/call_routes/en.yml
index 25e4c51..8596474 100644
--- a/config/locales/views/call_routes/en.yml
+++ b/config/locales/views/call_routes/en.yml
@@ -9,8 +9,7 @@ en:
page_title: 'Listing Call route'
table: 'Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Are you sure you want to delete this Call route?'
@@ -23,8 +22,7 @@ en:
page_title: 'Show Call route'
table: 'Table'
name: 'Name'
- endpoint_type: 'Endpoint type'
- endpoint_id: 'Endpoint'
+ endpoint: 'Endpoint'
position: 'Position'
actions:
confirm_destroy: 'Are you sure you want to delete this element?'