Преглед изворни кода

AMBARI-5070. Labels of Advanced configuration properties wrap over in between words. (onechiporenko)

Oleg Nechiporenko пре 11 година
родитељ
комит
0c3b372aec

+ 4 - 0
ambari-web/app/styles/application.less

@@ -55,6 +55,10 @@ html, body {
   height: 100%;
   height: 100%;
 }
 }
 
 
+wbr {
+  display: inline-block;
+}
+
 #wrapper {
 #wrapper {
   min-height: 100%;
   min-height: 100%;
 }
 }

+ 1 - 1
ambari-web/app/templates/common/configs/service_config.hbs

@@ -99,7 +99,7 @@
                           {{#if showLabel}}
                           {{#if showLabel}}
                             <span {{bindAttr class="errorMessage:error: :control-group :control-label-span"}}>
                             <span {{bindAttr class="errorMessage:error: :control-group :control-label-span"}}>
                               <label class="control-label">
                               <label class="control-label">
-                                {{displayName}}
+                                {{formatWordBreak displayName}}
                                 {{#if App.supports.secureCluster}}
                                 {{#if App.supports.secureCluster}}
                                   {{#if isSecureConfig}}
                                   {{#if isSecureConfig}}
                                     <a href="javascript:void(null);"><i class="icon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i></a>
                                     <a href="javascript:void(null);"><i class="icon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i></a>

+ 28 - 0
ambari-web/app/utils/helper.js

@@ -437,6 +437,34 @@ App.registerBoundHelper('formatNull', Em.View.extend({
   }.property('content')
   }.property('content')
 }));
 }));
 
 
+/**
+ * Return formatted string with inserted <code>wbr</code>-tag after each dot
+ *
+ * @param {String} content
+ *
+ * Examples:
+ *
+ * returns 'apple'
+ * {{formatWordBreak 'apple'}}
+ *
+ * returns 'apple.<wbr />banana'
+ * {{formatWordBreak 'apple.banana'}}
+ *
+ * returns 'apple.<wbr />banana.<wbr />uranium'
+ * {{formatWordBreak 'apple.banana.uranium'}}
+ */
+App.registerBoundHelper('formatWordBreak', Em.View.extend({
+  tagName: 'span',
+  template: Em.Handlebars.compile('{{{view.result}}}'),
+
+  /**
+   * @type {string}
+   */
+  result: function() {
+    return this.get('content').replace(/\./g, '.<wbr />');
+  }.property('content')
+}));
+
 /**
 /**
  * Ambari overrides the default date transformer.
  * Ambari overrides the default date transformer.
  * This is done because of the non-standard data
  * This is done because of the non-standard data