summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/gateway_settings_controller.rb15
-rw-r--r--app/models/gateway.rb11
-rw-r--r--app/views/gateway_settings/_index_core.html.haml4
-rw-r--r--app/views/gateway_settings/show.html.haml4
-rw-r--r--config/hirb.yml9
-rw-r--r--db/schema.rb32
6 files changed, 62 insertions, 13 deletions
diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb
index 04af795..5d9f7e5 100644
--- a/app/controllers/gateway_settings_controller.rb
+++ b/app/controllers/gateway_settings_controller.rb
@@ -3,6 +3,7 @@ class GatewaySettingsController < ApplicationController
load_and_authorize_resource :gateway_setting, :through => [:gateway]
def index
+ @gateway_settings = @gateway.gateway_settings
end
def show
@@ -13,30 +14,30 @@ class GatewaySettingsController < ApplicationController
end
def create
- @gateway_setting = GatewaySetting.new(params[:gateway_setting])
+ @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting])
if @gateway_setting.save
- redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_created')
+ redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_created')
else
render :new
end
end
def edit
- @gateway_setting = GatewaySetting.find(params[:id])
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
end
def update
- @gateway_setting = GatewaySetting.find(params[:id])
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
if @gateway_setting.update_attributes(params[:gateway_setting])
- redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_updated')
+ redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_updated')
else
render :edit
end
end
def destroy
- @gateway_setting = GatewaySetting.find(params[:id])
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
@gateway_setting.destroy
- redirect_to gateway_settings_url, :notice => t('gateway_settings.controller.successfuly_destroyed')
+ redirect_to gateway_gateway_settings_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed')
end
end
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index 72cf72c..d879fe9 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -14,4 +14,15 @@ class Gateway < ActiveRecord::Base
:presence => true,
:inclusion => { :in => TECHNOLOGIES }
+ before_validation :downcase_technology
+
+ def to_s
+ name
+ end
+
+ private
+ def downcase_technology
+ technology = technology.downcase
+ end
+
end
diff --git a/app/views/gateway_settings/_index_core.html.haml b/app/views/gateway_settings/_index_core.html.haml
index 1b8e443..5b93f16 100644
--- a/app/views/gateway_settings/_index_core.html.haml
+++ b/app/views/gateway_settings/_index_core.html.haml
@@ -9,9 +9,9 @@
- reset_cycle
- for gateway_setting in gateway_settings
%tr{:class => cycle('odd', 'even')}
- %td= gateway_setting.gateway_id
+ %td= gateway_setting.gateway
%td= gateway_setting.name
%td= gateway_setting.value
%td= gateway_setting.class_type
%td= gateway_setting.description
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gateway_setting} \ No newline at end of file
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => gateway_setting.gateway, :child_class => gateway_setting} \ No newline at end of file
diff --git a/app/views/gateway_settings/show.html.haml b/app/views/gateway_settings/show.html.haml
index 4f38e0b..14de6de 100644
--- a/app/views/gateway_settings/show.html.haml
+++ b/app/views/gateway_settings/show.html.haml
@@ -2,7 +2,7 @@
%p
%strong= t('gateway_settings.show.gateway_id') + ":"
- = @gateway_setting.gateway_id
+ = @gateway_setting.gateway
%p
%strong= t('gateway_settings.show.name') + ":"
= @gateway_setting.name
@@ -16,4 +16,4 @@
%strong= t('gateway_settings.show.description') + ":"
= @gateway_setting.description
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gateway_setting } \ No newline at end of file
+= render :partial => 'shared/show_edit_destroy_part', :locals => {:parent => @gateway_setting.gateway, :child_class => @gateway_setting} \ No newline at end of file
diff --git a/config/hirb.yml b/config/hirb.yml
index f011c9d..da7c083 100644
--- a/config/hirb.yml
+++ b/config/hirb.yml
@@ -198,4 +198,11 @@
- first_name
- user_name
- user
-
+ GatewaySetting:
+ :options:
+ :fields:
+ - id
+ - gateway
+ - name
+ - value
+ - class_type
diff --git a/db/schema.rb b/db/schema.rb
index a6aae9b..bc51504 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130112103337) do
+ActiveRecord::Schema.define(:version => 20130113090705) do
create_table "access_authorizations", :force => true do |t|
t.string "access_authorizationable_type"
@@ -490,6 +490,36 @@ ActiveRecord::Schema.define(:version => 20130112103337) do
t.integer "stop_time", :default => 0, :null => false
end
+ create_table "gateway_parameters", :force => true do |t|
+ t.integer "gateway_id"
+ t.string "name"
+ t.string "value"
+ t.string "class_type"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "gateway_settings", :force => true do |t|
+ t.integer "gateway_id"
+ t.string "name"
+ t.string "value"
+ t.string "class_type"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "gateways", :force => true do |t|
+ t.string "name"
+ t.string "technology"
+ t.boolean "inbound"
+ t.boolean "outbound"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "gemeinschaft_setups", :force => true do |t|
t.integer "user_id"
t.integer "sip_domain_id"