]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1711] Add buttons for managing repository group as can be a pain with long list...
authorOlivier Lamy <olamy@apache.org>
Mon, 19 Nov 2012 12:50:25 +0000 (12:50 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 19 Nov 2012 12:50:25 +0000 (12:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411157 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html

index a4117fe2941e07bc113c8d402bf129e9f729b78d..4330f288640a9882af7bb332927cf438fd9dffb6 100644 (file)
@@ -75,21 +75,31 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
       $.log("removeRepository:"+id);
     }
 
-    this.renderSortableAvailables=function(){
-      $.log("renderSortableAvailables");
-      //$("#main-content").find("#repository-groups-edit-available-repositories" ).find(".icon-minus-sign" ).hide();
-
-    }
+    this.renderSortableAvailables=function(repositoryGroupsViewModel){
+      $("#main-content").find("#repository-groups-edit-available-repositories").find(".icon-plus-sign" ).on("click",function(){
+        var idVal = $(this).attr("id");
+        idVal=idVal.substringAfterFirst("plus-");
+        for (var i=0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
+          if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
+            self.availableRepositories.remove(repositoryGroupsViewModel.managedRepositories()[i]);
+          }
+        }
+        $.log("size before:"+self.repositoryGroup.repositories().length+","+self.repositoryGroup.managedRepositories().length);
 
-    this.removeChoosed=function(id){
-      $.log("removeChoosed:"+id);
+        for(var i= 0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
+          if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
+            $.log("find repo to add");
+            self.repositoryGroup.repositories.push(idVal);
+            self.repositoryGroup.managedRepositories.push(findManagedRepository(idVal,self.repositoryGroupsViewModel.managedRepositories()));
+          }
+        }
+      });
     }
 
     this.renderSortableChoosed=function(repositoryGroupsViewModel){
       $("#main-content").find("#repository-groups-edit-order-div").find(".icon-minus-sign" ).on("click",function(){
         var idVal = $(this).attr("id");
         idVal=idVal.substringAfterFirst("minus-");
-        $.log("renderSortableChoosed:"+idVal);
         for (var i=0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
           if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
             self.availableRepositories.push(repositoryGroupsViewModel.managedRepositories()[i]);
@@ -106,9 +116,6 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
             repositories.push(self.repositoryGroup.managedRepositories()[i].id());
           }
         }
-        //self.repositoryGroup.repositories(repositories);
-        //self.repositoryGroup.modified(true);
-        $.log("size after:"+self.repositoryGroup.repositories().length+","+self.repositoryGroup.managedRepositories().length);
       });
     }
   }
@@ -165,6 +172,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
             activateRepositoryGroupEditTab();
             ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
             repositoryGroupViewModel.renderSortableChoosed(self);
+            repositoryGroupViewModel.renderSortableAvailables(self);
             mainContent.find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
           }
         });
@@ -280,7 +288,8 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
 
                       activateRepositoryGroupEditTab();
                       ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
-                      repositoryGroupViewModel.renderSortableChoosed();
+                      repositoryGroupViewModel.renderSortableChoosed(self.repositoryGroupsViewModel);
+                      repositoryGroupViewModel.renderSortableAvailables(self.repositoryGroupsViewModel);
                     }
                     if ($(e.target).attr("href")=="#repository-groups-view") {
                       mainContent.find("#repository-groups-view-tabs-li-edit a").html($.i18n.prop("add"));
index 1049a4a421dc3bf238e746d573a4e47cb2eaca41..4fe831774ebc738b17998d4cdb3316297f13f165 100644 (file)
 <script id="repository-group-edit-order-tmpl-available" type="text/html">
   <div class="well draggable-item">
     <span class="pull-right">
-      <i class="icon-plus-sign" id="plus-${$data.id()}"/>
+      <i class="icon-plus-sign cursor-hand" id="plus-${$data.id()}"/>
     </span>
     <blockquote>
       ${$data.id()}