]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3432 Add password property type for widgets
authorDavid Gageot <david@gageot.net>
Thu, 5 Jul 2012 14:12:53 +0000 (16:12 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 5 Jul 2012 14:24:28 +0000 (16:24 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java
sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb

index 5d33398855494ae783037f8dbf105e696f591197..bf095c46c67b60b53708888c06f1162c81aa157c 100644 (file)
@@ -59,5 +59,10 @@ public enum WidgetPropertyType {
    *
    * @since 3.2
    */
-  TEXT
+  TEXT,
+
+  /**
+   * Variation of {#STRING} with masked characters
+   */
+  PASSWORD
 }
index c203272c239c8bbef90515c0f754577abe81c7a5..cf5c2fcb6b35f321bcca87a8499632760511c738 100644 (file)
@@ -21,6 +21,7 @@ module PropertiesHelper
 
   def property_value_field(definition, value)
     val=value || definition.defaultValue()
+
     if definition.type.name()==PropertyType::TYPE_INTEGER
       text_field_tag definition.key(), val, :size => 10
 
@@ -47,7 +48,11 @@ module PropertiesHelper
 
     elsif definition.type.name()==PropertyType::TYPE_TEXT
       text_area_tag definition.key(), val, :size => '40x6'
-  else
+
+    elsif definition.type.name()==PropertyType::TYPE_PASSWORD
+      password_field_tag definition.key(), val, :size => 10
+
+    else
       hidden_field_tag definition.key()
     end
   end
index c5227fff69daf66850902e2b5ac60b80fa75f4bf..9a9cd071e8c1ff8afe68cbe92ba04ae49c730519 100644 (file)
@@ -25,6 +25,7 @@ class PropertyType
   TYPE_METRIC = 'METRIC'
   TYPE_FILTER = 'FILTER'
   TYPE_TEXT = 'TEXT'
+  TYPE_PASSWORD = 'PASSWORD'
 
   def self.text_to_value(text, type)
     case type