summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/gateway_setting.rb4
-rw-r--r--app/views/gateway_settings/_form_core.html.haml2
-rw-r--r--app/views/gateway_settings/_index_core.html.haml6
3 files changed, 5 insertions, 7 deletions
diff --git a/app/models/gateway_setting.rb b/app/models/gateway_setting.rb
index 078901f..cf1292d 100644
--- a/app/models/gateway_setting.rb
+++ b/app/models/gateway_setting.rb
@@ -1,4 +1,6 @@
class GatewaySetting < ActiveRecord::Base
+ CLASS_TYPES = ['String', 'Integer', 'Boolean']
+
attr_accessible :gateway_id, :name, :value, :class_type, :description
belongs_to :gateway
@@ -9,7 +11,7 @@ class GatewaySetting < ActiveRecord::Base
validates :class_type,
:presence => true,
- :inclusion => { :in => ['String', 'Integer', 'Boolean'] }
+ :inclusion => { :in => CLASS_TYPES }
def to_s
name
diff --git a/app/views/gateway_settings/_form_core.html.haml b/app/views/gateway_settings/_form_core.html.haml
index 90f4eba..3d93509 100644
--- a/app/views/gateway_settings/_form_core.html.haml
+++ b/app/views/gateway_settings/_form_core.html.haml
@@ -1,5 +1,5 @@
.inputs
= f.input :name, :label => t('gateway_settings.form.name.label'), :hint => conditional_hint('gateway_settings.form.name.hint'), :autofocus => true
= f.input :value, :label => t('gateway_settings.form.value.label'), :hint => conditional_hint('gateway_settings.form.value.hint')
- = f.input :class_type, :label => t('gateway_settings.form.class_type.label'), :hint => conditional_hint('gateway_settings.form.class_type.hint')
+ = f.input :class_type, :collection => GatewaySetting::CLASS_TYPES, :label => t('gateway_settings.form.class_type.label'), :hint => conditional_hint('gateway_settings.form.class_type.hint'), :include_blank => false
= f.input :description, :label => t('gateway_settings.form.description.label'), :hint => conditional_hint('gateway_settings.form.description.hint')
diff --git a/app/views/gateway_settings/_index_core.html.haml b/app/views/gateway_settings/_index_core.html.haml
index ca4ce09..40946f5 100644
--- a/app/views/gateway_settings/_index_core.html.haml
+++ b/app/views/gateway_settings/_index_core.html.haml
@@ -1,17 +1,13 @@
%table
%tr
- %th= t('gateway_settings.index.gateway_id')
%th= t('gateway_settings.index.name')
%th= t('gateway_settings.index.value')
- %th= t('gateway_settings.index.class_type')
%th= t('gateway_settings.index.description')
- reset_cycle
- for gateway_setting in gateway_settings
%tr{:class => cycle('odd', 'even')}
- %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 => {:parent => gateway_setting.gateway, :child => gateway_setting} \ No newline at end of file
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => gateway_setting.gateway, :child => gateway_setting}