archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1225532 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js: archiva/main-tmpl.js archiva/templates/topbar.html archiva/utils.js redback/redback.js redback/templates/login.html redback/user.js
Date Thu, 29 Dec 2011 13:53:56 GMT
Author: olamy
Date: Thu Dec 29 13:53:56 2011
New Revision: 1225532

URL: http://svn.apache.org/viewvc?rev=1225532&view=rev
Log:
use a dialog confirm based on bootstrap modal, jqueryui was a bit ugly

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/topbar.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
Thu Dec 29 13:53:56 2011
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-require(["text!archiva/templates/menu.html","text!archiva/templates/topbar.html","text!archiva/templates/message.html"],
-  function(menu,topbar,message) {
+require(["text!archiva/templates/menu.html","text!archiva/templates/topbar.html","text!archiva/templates/message.html",
+          "text!archiva/templates/modal.html"],
+  function(menu,topbar,message,modal) {
 
     // template loading
     $.tmpl( menu, $.i18n.map ).appendTo("#html-fragments");
     $.tmpl( topbar, $.i18n.map ).appendTo("#html-fragments");
+    $.tmpl( modal, $.i18n.map ).appendTo("#html-fragments");
     $("#html-fragments").append(message);
     $.log("main-tmpl.js menu loaded");
   }

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/topbar.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/topbar.html?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/topbar.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/topbar.html
Thu Dec 29 13:53:56 2011
@@ -26,6 +26,9 @@
             <span class="label notice">${register}</span>
           </a>
         </li>
+          <li>
+            <a href="#" onclick="openDialogConfirm(function(){alert('ok')}, 'okMessage',
'cancelMessage', 'title')">test</a>
+          </li>
       </ul>
       <form class="pull-right" action="">
         <input type="text" placeholder="Search" />

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
Thu Dec 29 13:53:56 2011
@@ -102,4 +102,78 @@ clearForm=function(selectorStr){
     $(this).val("");
   });
 
+}
+
+/**
+ * open a confirm dialog based on bootstrap modal
+ * @param okFn callback function to call on ok confirm
+ * @param okMessage
+ * @param cancelMessage
+ * @param title
+ */
+openDialogConfirm=function(okFn, okMessage, cancelMessage, title,bodyText){
+  if (window.modalConfirmDialog==null) {
+    window.modalConfirmDialog = $("#dialog-confirm-modal").modal({backdrop:'static',show:false});
+    window.modalConfirmDialog.bind('hidden', function () {
+      $("#dialog-confirm-modal-header-title").html("");
+      $("#dialog-confirm-modal-body-text").html("");
+    })
+    $("#dialog-confirm-modal-cancel").on("click", function(){
+      window.modalConfirmDialog.modal('hide');
+    });
+  }
+  $("#dialog-confirm-modal-header-title").html(title);
+  $("#dialog-confirm-modal-body-text").html(bodyText);
+  if (okMessage){
+    $("#dialog-confirm-modal-ok").html(okMessage);
+  }
+  if (cancelMessage){
+    $("#dialog-confirm-modal-cancel").html(cancelMessage);
+  }
+  window.modalConfirmDialog.modal('show');
+
+  // unbind previous events !!
+  $("#dialog-confirm-modal-ok").off( );
+  $("#dialog-confirm-modal-ok").on("click", okFn);
+
+}
+
+/**
+ * return a small spinner html img element
+ */
+smallSpinnerImg=function(){
+  return "<img id=\"login-spinner\" src=\"images/small-spinner.gif\"/>";
+};
+
+closeDialogConfirm=function(){
+  window.modalConfirmDialog.modal('hide');
+}
+
+closeDialogConfirmui=function(){
+  $("#dialog-confirm" ).dialog("close");
+}
+
+/**
+ * open a confirm dialog with jqueryui
+ * @param okFn callback function to call on ok confirm
+ * @param okMessage
+ * @param cancelMessage
+ * @param title
+ */
+openDialogConfirmui=function(okFn, okMessage, cancelMessage, title){
+  $("#dialog-confirm" ).dialog({
+    resizable: false,
+    title: title,
+    modal: true,
+    show: 'slide',
+    buttons: [{
+      text: okMessage,
+      click: okFn},
+      {
+      text: cancelMessage,
+      click:function() {
+        $(this).dialog( "close" );
+      }
+    }]
+  });
 }
\ No newline at end of file

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js
Thu Dec 29 13:53:56 2011
@@ -53,42 +53,6 @@ $(function() {
   });
 
   /**
-   * return a small spinner html img element
-   */
-  smallSpinnerImg=function(){
-    return "<img id=\"login-spinner\" src=\"images/small-spinner.gif\"/>";
-  };
-
-  /**
-   * open a confirm dialog
-   * @param okFn callback function to call on ok confirm
-   * @param okMessage
-   * @param cancelMessage
-   * @param title
-   */
-  openDialogConfirm=function(okFn, okMessage, cancelMessage, title){
-    $("#dialog-confirm" ).dialog({
-      resizable: false,
-      title: title,
-      modal: true,
-      show: 'slide',
-      buttons: [{
-        text: okMessage,
-        click: okFn},
-        {
-        text: cancelMessage,
-        click:function() {
-          $(this).dialog( "close" );
-        }
-      }]
-    });
-  }
-
-  closeDialogConfirm=function(){
-    $("#dialog-confirm" ).dialog("close");
-  }
-
-  /**
    * return a user see user.js if user logged otherwise null
    */
   userLogged=function() {

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html
Thu Dec 29 13:53:56 2011
@@ -23,7 +23,7 @@
       </form>
   </div>
   <div class="modal-footer" id="modal-login-footer">
-      <button class="btn primary" onclick="return login();" id="modal-login-ok">${login}</button>
+    <button class="btn primary" onclick="return login();" id="modal-login-ok">${login}</button>
   </div>
 </div>
 

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js?rev=1225532&r1=1225531&r2=1225532&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
Thu Dec 29 13:53:56 2011
@@ -132,7 +132,7 @@ $(function() {
 
       this.deleteUser=function() {
         clearUserMessages();
-        // FIXME i18n
+
         var currentUser = this;
         openDialogConfirm(function(){
           $.ajax("restServices/redbackServices/userService/deleteUser/"+currentUser.username(),
{



Mime
View raw message