From adc6971a49fd7a4a343c8a21eaaad5972dcfdd73 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 19 Jun 2017 16:22:12 +0200
Subject: [PATCH] admin and manual links moved to info tab

---
 .../src/main/js/gui/leftPanel/Footer.js       |  24 ----
 .../main/js/gui/leftPanel/ProjectInfoPanel.js | 110 +++++++++++++-----
 .../js/gui/leftPanel/ProjectInfoPanel-test.js |   9 ++
 3 files changed, 90 insertions(+), 53 deletions(-)

diff --git a/frontend-js/src/main/js/gui/leftPanel/Footer.js b/frontend-js/src/main/js/gui/leftPanel/Footer.js
index 61f146f87f..ffc7e3420b 100644
--- a/frontend-js/src/main/js/gui/leftPanel/Footer.js
+++ b/frontend-js/src/main/js/gui/leftPanel/Footer.js
@@ -26,30 +26,6 @@ Footer.prototype._createFooterGui = function() {
   var projectId = self.getMap().getProject().getProjectId();
   self.getElement().className = "footerLinks";
 
-  var link = Functions.createElement({
-    type : "a",
-    name : "footerManualLink",
-    style : "padding-left:25px;",
-    content : '<i class="fa fa-lock" style="font-size:17px"></i> &nbsp;MANUAL',
-  });
-  link.href = "#";
-  link.onclick = function() {
-    return ServerConnector.getConfigurationParam(ConfigurationType.USER_MANUAL_FILE).then(function(manualFileUrl) {
-      var win = window.open(manualFileUrl, '_user_manual_');
-      win.focus();
-    });
-  };
-  self.getElement().appendChild(link);
-
-  link = Functions.createElement({
-    type : "a",
-    name : "footerAdminLink",
-    style : "padding-left:25px;",
-    content : 'EXPORT&nbsp; <i class="fa fa-mail-forward" style="font-size:17px"></i>',
-  });
-  link.href = ServerConnector.getServerBaseUrl() + "/export.xhtml?id=" + projectId;
-  self.getElement().appendChild(link);
-
   var loadingDiv = Functions.createElement({
     type : "div",
     style : "display:none; ",
diff --git a/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js b/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js
index 7347126a6e..6c0ef561b1 100644
--- a/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js
+++ b/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js
@@ -2,6 +2,7 @@
 
 /* exported logger */
 
+var ConfigurationType = require('../../ConfigurationType');
 var Panel = require('./Panel');
 var PanelControlElementType = require('../PanelControlElementType');
 var PublicationListDialog = require('./PublicationListDialog');
@@ -22,6 +23,8 @@ ProjectInfoPanel.prototype.constructor = ProjectInfoPanel;
 
 ProjectInfoPanel.prototype._createInfoPanelGui = function() {
   var self = this;
+  var projectId = self.getMap().getProject().getProjectId();
+
   var infoDiv = Functions.createElement({
     type : "div",
     name : "infoDiv",
@@ -31,7 +34,7 @@ ProjectInfoPanel.prototype._createInfoPanelGui = function() {
   this.setControlElement(PanelControlElementType.INFO_DIV, infoDiv);
 
   var infoTitle = Functions.createElement({
-    type : "h5",
+    type : "h4",
     content : "PROJECT INFO:"
   });
   infoDiv.appendChild(infoTitle);
@@ -78,53 +81,102 @@ ProjectInfoPanel.prototype._createInfoPanelGui = function() {
   this.setControlElement(PanelControlElementType.INFO_PROJECT_DESCRIOPTION_TEXT, projectDescriptionText);
   dataTab.appendChild(self.createTableRow([ projectDescriptionLabel, projectDescriptionText ]));
 
-  var projectPublicationsLabel = Functions.createElement({
+  infoTitle = Functions.createElement({
+    type : "h4",
+    content : "Data:"
+  });
+  infoDiv.appendChild(infoTitle);
+
+  var dialogDiv = Functions.createElement({
     type : "div",
-    content : "Publications:"
   });
 
-  var projectPublicationsDiv = Functions.createElement({
-    type : "div"
+  this.publicationListDialog = new PublicationListDialog({
+    customMap : self.getMap(),
+    element : dialogDiv,
+  });
+
+  dataTab = Functions.createElement({
+    type : "ul",
   });
+  infoDiv.appendChild(dataTab);
+
   var projectPublicationsText = Functions.createElement({
-    type : "label",
+    type : "span",
     name : "projectPublicationsText",
+    style : "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
   });
   this.setControlElement(PanelControlElementType.INFO_PROJECT_PUBLICATIONS_TEXT, projectPublicationsText);
 
   var projectPublicationsButton = Functions.createElement({
-    type : "button",
+    type : "a",
     name : "projectPublicationsButton",
-    content : "SHOW"
   });
+  projectPublicationsButton.appendChild(Functions.createElement({
+    type : "span",
+    content : "<i class='fa fa-list'>&nbsp;",
+  }));
+
+  projectPublicationsButton.appendChild(projectPublicationsText);
+  projectPublicationsButton.appendChild(Functions.createElement({
+    type : "span",
+    style : "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
+    content : "&nbsp;publication(s)",
+  }));
   this.setControlElement(PanelControlElementType.INFO_PROJECT_SHOW_PUBLICATIONS_BUTTON, projectPublicationsButton);
-  projectPublicationsDiv.appendChild(projectPublicationsText);
-  projectPublicationsDiv.appendChild(projectPublicationsButton);
 
-  dataTab.appendChild(self.createTableRow([ projectPublicationsLabel, projectPublicationsDiv ]));
-
-  var projectOriginalFileLabel = Functions.createElement({
-    type : "div",
-    content : "Original file:"
+  var liElement = Functions.createElement({
+    type : "li",
+    style : "line-height: 30px;",
   });
+  liElement.appendChild(projectPublicationsButton);
+  dataTab.appendChild(liElement);
+
   var projectOriginalFileButton = Functions.createElement({
-    type : "button",
+    type : "a",
     name : "projectOriginalFileButton",
-    content : "Download",
+    href : "#",
+    content : "<i class='fa fa-files-o'>&nbsp;source file",
   });
   this.setControlElement(PanelControlElementType.INFO_PROJECT_GET_ORIGINAL_FILE_BUTTON, projectOriginalFileButton);
-  dataTab.appendChild(self.createTableRow([ projectOriginalFileLabel, projectOriginalFileButton ]));
-  
-  
-  var dialogDiv = Functions.createElement({
-    type : "div",
-  });
-  
-  this.publicationListDialog = new PublicationListDialog({
-    customMap: self.getMap(),
-    element: dialogDiv,
+  var liElement = Functions.createElement({
+    type : "li",
+    style : "line-height: 30px",
+  });
+  liElement.appendChild(projectOriginalFileButton);
+  dataTab.appendChild(liElement);
+
+  var exportButton = Functions.createElement({
+    type : "a",
+    href : ServerConnector.getServerBaseUrl() + "/export.xhtml?id=" + projectId,
+    content : '<i class="fa fa-mail-forward">&nbsp;EXPORT',
+  });
+  var liElement = Functions.createElement({
+    type : "li",
+    style : "line-height: 30px",
+  });
+  liElement.appendChild(exportButton);
+  dataTab.appendChild(liElement);
+
+  var manualButton = Functions.createElement({
+    type : "a",
+    name : "manualLink",
+    content : '<i class="fa fa-file">&nbsp;MANUAL',
+  });
+  manualButton.href = "#";
+  manualButton.onclick = function() {
+    return ServerConnector.getConfigurationParam(ConfigurationType.USER_MANUAL_FILE).then(function(manualFileUrl) {
+      var win = window.open(manualFileUrl, '_user_manual_');
+      win.focus();
+    });
+  };
+  liElement = Functions.createElement({
+    type : "li",
+    style : "line-height: 30px",
   });
-  
+  liElement.appendChild(manualButton);
+  dataTab.appendChild(liElement);
+
 };
 
 ProjectInfoPanel.prototype._createInfoPanelLogic = function() {
@@ -145,7 +197,7 @@ ProjectInfoPanel.prototype.downloadSourceFile = function() {
   var self = this;
   return ServerConnector.getProjectSourceDownloadUrl().then(function(url) {
     return self.downloadFile(url);
-  }).catch(GuiConnector.alert);
+  }).then(null, GuiConnector.alert);
 };
 
 ProjectInfoPanel.prototype.showPublicationListDialog = function() {
diff --git a/frontend-js/src/test/js/gui/leftPanel/ProjectInfoPanel-test.js b/frontend-js/src/test/js/gui/leftPanel/ProjectInfoPanel-test.js
index 943fdbcd61..e03b756f9f 100644
--- a/frontend-js/src/test/js/gui/leftPanel/ProjectInfoPanel-test.js
+++ b/frontend-js/src/test/js/gui/leftPanel/ProjectInfoPanel-test.js
@@ -49,6 +49,15 @@ describe('ProjectInfoPanel', function() {
     return panel.downloadSourceFile();
   });
 
+  it('open manual', function() {
+    var div = testDiv;
+    var panel = new ProjectInfoPanel({
+      element : div,
+      customMap : helper.createCustomMap(),
+    });
+    return $("[name='manualLink']", $(div))[0].onclick();
+  });
+
   it('show publication list', function() {
     return ServerConnector.getProject().then(function(project) {
       var div = testDiv;
-- 
GitLab