Skip to content

The Unified and Autonomous Development Platform

Finished file browsing, anything else?

robin shinebb03a4bdaf46
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js
index b8e9b9ff7a..594516ad93 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js
@@ -518,7 +518,7 @@ pmease.commons = {
},
setupDropdownAndModel: function() {
- $(document).mousedown(function(event) {
+ $(document).bind("mousedown touchstart", function(event) {
var source = $(event.target);
if (!source.closest(".dropdown-trigger")[0])
pmease.commons.dropdown.hideExcept(source);
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/RunTaskBehavior.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/RunTaskBehavior.java
index d9dc107429..a8c5df5fce 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/RunTaskBehavior.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/RunTaskBehavior.java
@@ -10,20 +10,25 @@ public abstract class RunTaskBehavior extends AbstractDefaultAjaxBehavior {
protected void respond(AjaxRequestTarget target) {
target.prependJavaScript(String.format(""
+ "var $button = $('#%s');"
+ + "if ($button.length != 0) {"
+ "$button.removeAttr('disabled');"
+ "$button.val($button[0].prevValue);"
- + "$button.html($button[0].prevHtml);",
+ + "$button.html($button[0].prevHtml);"
+ + "}",
getComponent().getMarkupId()));
runTask(target);
}
public void requestRun(AjaxRequestTarget target) {
- target.appendJavaScript(String.format("var $button = $('#%s');"
+ target.appendJavaScript(String.format(""
+ + "var $button = $('#%s');"
+ + "if ($button.length != 0) {"
+ "$button.attr('disabled', 'disabled');"
+ "$button[0].prevValue = $button.val();"
+ "$button[0].prevHtml = $button.html();"
+ "$button.val($button.val() + ' in progress...');"
- + "$button.html($button.html() + ' in progress...');",
+ + "$button.html($button.html() + ' in progress...');"
+ + "}",
getComponent().getMarkupId()));
target.appendJavaScript(getCallbackScript());
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/LastCommitPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/LastCommitPanel.html
index 1ca1c0b38f..c406c72a20 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/LastCommitPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/LastCommitPanel.html
@@ -1,9 +1,10 @@
<wicket:panel>
- <div class="clearfix">
+ <div class="last-commit clearfix">
<span wicket:id="author" class="author pull-left"></span>
<span wicket:id="date" class="date pull-left"></span>
<span wicket:id="message" class="message pull-left"></span>
<input wicket:id="hash" class="hash pull-right" readonly="readonly"
onfocus="var $this=$(this);setTimeout(function(){$this.select();}, 100);"></input>
</div>
+ <div class="message clearfix"></div>
</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.css
index d6b2ccafc1..c0daf50c2a 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.css
@@ -96,9 +96,13 @@
font-size: 13px;
margin-top: 3px;
}
-#repo-file>.last-commit .message {
+#repo-file>.last-commit span.message {
margin-top: 2px;
}
+#repo-file>.last-commit div.message {
+ display: none;
+ margin-top: 6px;
+}
#repo-file>.last-commit .hash {
font-size: 13px;
width: 62px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.js
index dab9f4b1d9..5f928ff5c5 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.js
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/repo-file.js
@@ -23,10 +23,17 @@ $(window).load(function() {
$(window).resize(function(e) {
e.stopPropagation();
-
+
var $head = $("#repo-file>.head");
var $revisionSelector = $head.find(">.revision-selector");
- var maxWidth = $head.width() - $revisionSelector.outerWidth() - 60;
+
+ // we should simply call $head.width() here, but the value is incorrect after maximize and restore
+ // window in IE and Chrome (maybe due to use of table in sidebar?), so we go with the complicate
+ // approach of calculating the head width
+ var headWidth = $("#repository").width() - $("#repository>.body>.sidebar>table>tbody>tr>td.nav").outerWidth();
+
+ // below code moves file navigator to bottom if it is too wide
+ var maxWidth = headWidth - $revisionSelector.outerWidth() - 60;
var maxHeight = $head.height();
var $fileNavigator = $head.find(">.file-navigator");
@@ -41,6 +48,29 @@ $(window).load(function() {
}
}
+ // below code moves last commit message to bottom if it is too wide
+ var $lastCommit = $("#repo-file>.last-commit");
+ if ($lastCommit.length != 0) {
+ // why calculate width this way, see above comment when handling file navigator
+ maxWidth = headWidth - ($lastCommit.outerWidth()-$lastCommit.width())
+ - $lastCommit.find(".author").outerWidth(true)
+ - $lastCommit.find(".date").outerWidth(true)
+ - $lastCommit.find(".hash").outerWidth(true);
+ console.log($lastCommit.find(".date").outerWidth(true));
+ maxHeight = $lastCommit.find(".author").outerHeight();
+ var $message = $lastCommit.find(".last-commit>span.message");
+ if ($message.length != 0) {
+ if ($message.outerWidth(true) > maxWidth || $message.outerHeight() > maxHeight)
+ $lastCommit.find("div.message").show().append($message);
+ } else {
+ $message = $lastCommit.find("div.message>span");
+ if ($message.outerWidth(true) <= maxWidth && $message.outerHeight() <= maxHeight) {
+ $message.insertAfter($lastCommit.find(".date"));
+ $lastCommit.find("div.message").hide();
+ }
+ }
+ }
+
var $fileViewer = $("#repo-file>.file-viewer");
var width = $(window).width()-$("#repo-file").parent().prev().outerWidth();
var height = $(window).height()-$fileViewer.offset().top;