aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-01-23 12:37:16 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2013-01-23 12:37:16 +0100
commit2bcacbdfeb7de33a8c0a7124bd0098f371f5408f (patch)
tree9a45e1a5e774e4f21440df62b7c7f9908720f0be
parent1902934816aa018f1804182d9852326d82bbf80b (diff)
downloadsonarqube-2bcacbdfeb7de33a8c0a7124bd0098f371f5408f.tar.gz
sonarqube-2bcacbdfeb7de33a8c0a7124bd0098f371f5408f.zip
SONAR-3692 Boolean type are now always displayed as select box
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb2
8 files changed, 22 insertions, 19 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
index 6744ae13f21..a63afaf7b96 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
@@ -41,7 +41,7 @@ module PropertiesHelper
case type
when PropertyType::TYPE_STRING
- text_field_tag name, value, {:size => options[:size] || 25}.update(html_options)
+ text_field_tag name, value, {:size => options[:size] || 50}.update(html_options)
when PropertyType::TYPE_TEXT
cols = options[:size] || nil
@@ -49,18 +49,13 @@ module PropertiesHelper
text_area_tag name, value, {:class => html_class, :rows => '5', :cols => cols}.update(html_options)
when PropertyType::TYPE_PASSWORD
- password_field_tag name, value, {:size => options[:size] || 25}.update(html_options)
+ password_field_tag name, value, {:size => options[:size] || 50}.update(html_options)
when PropertyType::TYPE_BOOLEAN
- if !options[:default].blank? || screen == SCREEN_SETTINGS
- default_value = options[:default].blank? ? '' : message('default')
- select_options = "<option value='' #{ 'selected' if value.blank? }>#{ default_value }</option>"
- select_options += "<option value='true' #{ 'selected' if value=='true' }>#{ message('true') }</option>"
- select_options += "<option value='false' #{ 'selected' if value=='false' }>#{ message('false') }</option>"
- select_tag name, select_options, html_options
- else
- (hidden_field_tag name, 'false', html_options) + (check_box_tag name, 'true', value=='true', html_options)
- end
+ select_options = "<option value='' #{ 'selected' if value.blank? }>#{ message('default') }</option>"
+ select_options += "<option value='true' #{ 'selected' if value=='true' }>#{ message('true') }</option>"
+ select_options += "<option value='false' #{ 'selected' if value=='false' }>#{ message('false') }</option>"
+ select_tag name, select_options, html_options
when PropertyType::TYPE_INTEGER
size = options[:size] || 10
@@ -75,7 +70,7 @@ module PropertiesHelper
:placeholder => !options[:default].blank? ? message('default') : nil}
when PropertyType::TYPE_REGULAR_EXPRESSION
- size = options[:size] || 25
+ size = options[:size] || 50
text_field_tag name, value, {:size => size}.update(html_options)
when PropertyType::TYPE_FILTER
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb
index 465f7ba0c3b..ccada016ab8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb
@@ -27,4 +27,12 @@ module WidgetPropertiesHelper
property_input_field definition.key, definition.type.name, value, 'WIDGET', options
end
+ def default_value(property_def)
+ defaultValue = property_def.defaultValue
+ # Boolean type should always have a default value, if no one is provided it's force to false
+ defaultValue = property_def.type.name == PropertyType::TYPE_BOOLEAN ? 'false' : property_def.defaultValue if defaultValue.blank?
+ defaultValue = '********' if property_def.type.name == PropertyType::TYPE_PASSWORD
+ defaultValue
+ end
+
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
index df14ac28ff4..ae05758e1ca 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
@@ -37,8 +37,8 @@
<% unless property_description.blank? -%>
<div><%= property_description -%></div>
<% end %>
- <% unless property_def.defaultValue.blank? -%>
- <div><%= message('default') %>:: <%= property_def.type.name == PropertyType::TYPE_PASSWORD ? '********' : h(property_def.defaultValue) -%></div>
+ <% if !property_def.defaultValue.blank? || property_def.type.name == PropertyType::TYPE_BOOLEAN -%>
+ <div><%= message('default') %>: <%= h(default_value property_def) -%></div>
<% end -%>
</div>
</td>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
index d9e9399908d..721480a62aa 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
@@ -1,5 +1,5 @@
<%
options = {:id => id}
- options[:size] = (defined? size) ? size : 50
+ options[:size] = (defined? size) ? size : nil
%>
<%= property_input_field(name, PropertyType::TYPE_FLOAT, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
index 79f4a1f6efa..5f7c39e8c7b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
@@ -1,5 +1,5 @@
<%
options = {:id => id}
- options[:size] = (defined? size) ? size : 50
+ options[:size] = (defined? size) ? size : nil
%>
<%= property_input_field(name, PropertyType::TYPE_INTEGER, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
index ee7ca50b73a..68bc7edb71a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
@@ -1,5 +1,5 @@
<%
options = {:id => id}
- options[:size] = (defined? size) ? size : 50
+ options[:size] = (defined? size) ? size : nil
%>
<%= property_input_field(name, PropertyType::TYPE_PASSWORD, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
index 7dececf6629..8274fd8ef8f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
@@ -1,5 +1,5 @@
<%
options = {:id => id}
- options[:size] = (defined? size) ? size : 50
+ options[:size] = (defined? size) ? size : nil
%>
<%= property_input_field(name, PropertyType::TYPE_REGULAR_EXPRESSION, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
index 3df9028bebe..b28c75604a7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
@@ -1,5 +1,5 @@
<%
options = {:id => id}
- options[:size] = (defined? size) ? size : 50
+ options[:size] = (defined? size) ? size : nil
%>
<%= property_input_field(name, PropertyType::TYPE_STRING, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file