You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by gi...@apache.org on 2016/03/07 17:13:41 UTC

syncope git commit: [SYNCOPE-719] Minor fixes related to datepicker, input with number type and checkbox

Repository: syncope
Updated Branches:
  refs/heads/master 082402cbe -> d5ec3c71b


[SYNCOPE-719] Minor fixes related to datepicker, input with number type and checkbox


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d5ec3c71
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d5ec3c71
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d5ec3c71

Branch: refs/heads/master
Commit: d5ec3c71b60eee2fe6b88106a23f2dbe3dc631e4
Parents: 082402c
Author: giacomolm <gi...@hotmail.it>
Authored: Mon Mar 7 17:12:41 2016 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Mon Mar 7 17:12:58 2016 +0100

----------------------------------------------------------------------
 client/enduser/pom.xml                          |  8 +++
 .../META-INF/resources/app/css/login.css        |  4 ++
 .../resources/META-INF/resources/app/index.html |  2 +
 .../app/js/directives/dynamicPlainAttribute.js  | 37 ++++++-------
 .../app/views/dynamicPlainAttribute.html        | 56 ++++++++++----------
 pom.xml                                         | 14 ++++-
 6 files changed, 71 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/client/enduser/pom.xml
----------------------------------------------------------------------
diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml
index ea17455..f6132cb 100644
--- a/client/enduser/pom.xml
+++ b/client/enduser/pom.xml
@@ -153,6 +153,14 @@ under the License.
       <groupId>org.webjars.bower</groupId>
       <artifactId>FileSaver.js</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.webjars</groupId>
+      <artifactId>momentjs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.webjars.npm</groupId>
+      <artifactId>moment-jdateformatparser</artifactId>
+    </dependency>
 
     <!--Jquery-->
     <dependency>

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/login.css b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
index fd6c01a..cc206e8 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
@@ -163,4 +163,8 @@ body{
     border-radius: 4px;
     box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
     transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
+}
+
+input[type="number"]{
+    padding-right: 0px !important
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/client/enduser/src/main/resources/META-INF/resources/app/index.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html
index d9da780..355338b 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/index.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html
@@ -67,6 +67,8 @@ under the License.
     <script type="text/javascript" src="../webjars/bootstrap-select/${bootstrap-select.version}/js/bootstrap-select.min.js"></script>
     <script src="../webjars/FileSaver.js/${fileSaver.version}/FileSaver.js" type="text/javascript"></script>
     <script src="../webjars/lodash/${lodash.version}/lodash.min.js"></script>
+    <script src="../webjars/momentjs/${momentjs.version}/moment.js"></script>
+    <script src="../webjars/moment-jdateformatparser/${moment-jdateformatparser.version}/moment-jdateformatparser.js"></script>
     <!--main angular application-->
     <script src="js/app.js"></script>
     <!--services-->

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
index d4204da..ee533d3 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
@@ -85,29 +85,24 @@ angular.module('self')
                     };
                     break;
                   case "Date":
-
-                    $scope.selectedDate = $scope.user.plainAttrs[schema.key].values[index];
                     $scope.format = $scope.schema.conversionPattern;
-                    $scope.includeTimezone = false;
-                    if ($scope.schema.conversionPattern.indexOf(".SSS") > -1) {
-                      $scope.format = $scope.format.replace(".SSS", ".sss");
-                    }
-                    if ($scope.schema.conversionPattern.indexOf("Z") > -1) {
-                      $scope.includeTimezone = true;
-                      $scope.format = $scope.format.replace("Z", "");
-                    }
-                    if ($scope.schema.conversionPattern.indexOf("\'") > -1) {
-                      $scope.format = $scope.format.replace(new RegExp("\'", "g"), "");
+                    var temporaryDate = moment($scope.user.plainAttrs[schema.key].values[index], moment().toMomentFormatString($scope.format));
+                    if(temporaryDate.isValid()){
+                      $scope.selectedDate = temporaryDate.toDate();  
                     }
+                    else{
+                      $scope.selectedDate = $scope.user.plainAttrs[schema.key].values[index];
+                    }                    
+                    $scope.includeTimezone = false;
 
-                    $scope.bindDateToModel = function (selectedDate, format) {
-                      var newFormat = $scope.includeTimezone ? format.concat(" Z") : format;
+                    $scope.bindDateToModel = function (selectedDate, format) {                                       
                       if (selectedDate) {
-                        selectedDate = $filter('date')(selectedDate, newFormat);
-                        var dateGood = selectedDate.toString();
+                        selectedDate = moment(selectedDate).format(moment().toMomentFormatString(format));
+                        //removing from selectedDate existing quotes, since moment doesn't remove the from the pattern
+                        var dateGood = selectedDate.toString().replace(/'/g, "");
                         $scope.user.plainAttrs[schema.key].values[index] = dateGood;
                       } else {
-                        $scope.user.plainAttrs[schema.key].values[index] = selectedDate;
+                        $scope.user.plainAttrs[schema.key].values[index] = selectedDate;                        
                       }
                     };
 
@@ -129,11 +124,11 @@ angular.module('self')
                     $scope.maxDate = new Date(2050, 5, 22);
 
                     $scope.open = function ($event) {
-                      $scope.status.opened = true;
+                      $scope.status.opened = true;                      
                     };
 
                     $scope.setDate = function (year, month, day) {
-                      $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day);
+                      $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day);                      
                     };
 
                     $scope.dateOptions = {
@@ -173,12 +168,12 @@ angular.module('self')
                         }
                       }
 
-                    };
+                    };                    
                     break;
 
                   case "Boolean":
                     $scope.user.plainAttrs[schema.key].values[index] =
-                            Boolean($scope.user.plainAttrs[schema.key].values[index]) || false;
+                           $scope.user.plainAttrs[schema.key].values[index] == "true" ? true : false;
                     break;
 
                 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
index 70ae05b..b3ffa7b 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
@@ -38,41 +38,41 @@ under the License.
          ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
   <p ng-switch-when="Date" class="input-group" >
     <input type="text" class="form-control" 
-           uib-datepicker-popup="{{format}}"
+           uib-datepicker-popup
            ng-model="selectedDate"
            ng-change="bindDateToModel(selectedDate, format)"
            min-date="minDate" max-date="maxDate"
            is-open="status.opened" datepicker-options="dateOptions"
            ng-required="{{schema.mandatoryCondition}}" close-text="Close" ng-init="initAttribute(schema, index)"/>
-  <span class="input-group-btn">
-    <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
-  </span>
-</p>
+    <span class="input-group-btn">
+      <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
+    </span>
+  </p>
 
-<div ng-switch-when="Enum" ng-init="initAttribute(schema, index)">
-  <select class="form-control"
-          ng-model="user.plainAttrs[schema.key].values[index]"
-          ng-required="{{schema.mandatoryCondition}}">
-    <option ng-repeat="value in enumerationValues" value="{{value}}">{{schema.enumerationKeys[$index] || value}}</option>
-  </select>
-</div>
-
-<div ng-switch-when="Binary" ng-init="initAttribute(schema, index)">
-  <div enctype="multipart/form-data" accept-charset="UTF-8">
-    <input id="fileInput" type="file" ng-required="{{schema.mandatoryCondition}}"/>
-    <button type="button" title="Download file" class="fileButton btn btn-default btn-sm" ng-click="download()">
-      <i class="glyphicon glyphicon-download" ></i>
-    </button>
-    <button type="button" class="fileButton btn btn-default btn-sm" title="Remove file" ng-click="remove()">
-      <i class="glyphicon glyphicon-remove-sign" ></i>
-    </button>
-    <h4><span class="label label-primary" ng-model="userFile">{{userFile}}</span></h4>
+  <div ng-switch-when="Enum" ng-init="initAttribute(schema, index)">
+    <select class="form-control"
+            ng-model="user.plainAttrs[schema.key].values[index]"
+            ng-required="{{schema.mandatoryCondition}}">
+      <option ng-repeat="value in enumerationValues" value="{{value}}">{{schema.enumerationKeys[$index]|| value}}</option>
+    </select>
   </div>
 
-</div>
-<input ng-switch-default class="form-control" type="text"
-       ng-model="user.plainAttrs[schema.key].values[index]"
-       ng-required="{{schema.mandatoryCondition}}" 
-       ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/>
+  <div ng-switch-when="Binary" ng-init="initAttribute(schema, index)">
+    <div enctype="multipart/form-data" accept-charset="UTF-8">
+      <input id="fileInput" type="file" ng-required="{{schema.mandatoryCondition}}"/>
+      <button type="button" title="Download file" class="fileButton btn btn-default btn-sm" ng-click="download()">
+        <i class="glyphicon glyphicon-download" ></i>
+      </button>
+      <button type="button" class="fileButton btn btn-default btn-sm" title="Remove file" ng-click="remove()">
+        <i class="glyphicon glyphicon-remove-sign" ></i>
+      </button>
+      <h4><span class="label label-primary" ng-model="userFile">{{userFile}}</span></h4>
+    </div>
+
+  </div>
+  <input ng-switch-default class="form-control" type="text"
+         ng-model="user.plainAttrs[schema.key].values[index]"
+         ng-required="{{schema.mandatoryCondition}}" 
+         ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/>
 
 </div>

http://git-wip-us.apache.org/repos/asf/syncope/blob/d5ec3c71/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 818446b..f988bf7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -394,7 +394,7 @@ under the License.
 
     <angular.version>1.5.0</angular.version>
     <angular-ui-router.version>0.2.17</angular-ui-router.version>
-    <angular-ui-bootstrap.version>1.1.1-1</angular-ui-bootstrap.version>
+    <angular-ui-bootstrap.version>1.2.1</angular-ui-bootstrap.version>
     <angular-ui-select.version>0.14.8</angular-ui-select.version>
     <angular-treasure-overlay-spinner.version>1.1.0</angular-treasure-overlay-spinner.version>
     <ng-password-strength.version>0.2.1</ng-password-strength.version>
@@ -402,6 +402,8 @@ under the License.
     <kendo-ui-core.version>2014.2.716</kendo-ui-core.version>
     <select2.version>3.4.8</select2.version>
     <fileSaver.version>0.0.2</fileSaver.version>
+    <momentjs.version>2.11.1</momentjs.version>
+    <moment-jdateformatparser.version>1.0.0</moment-jdateformatparser.version>
     
     <izpack.version>5.0.6</izpack.version>
     <httpclient.version>4.3.6</httpclient.version>
@@ -1133,6 +1135,16 @@ under the License.
         <artifactId>FileSaver.js</artifactId>
         <version>${fileSaver.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.webjars</groupId>
+        <artifactId>momentjs</artifactId>
+        <version>${momentjs.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.webjars.npm</groupId>
+        <artifactId>moment-jdateformatparser</artifactId>
+        <version>${moment-jdateformatparser.version}</version>
+      </dependency>
 
       <dependency>
         <groupId>com.beust</groupId>