This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 95460eae30ff7065164ce00c2211415a3a29c7da Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed May 6 10:48:39 2015 +0200 Added file icons on the browse tree --- .../nuiton/scmwebeditor/actions/BrowseAction.java | 24 +++++++++++- src/main/webapp/WEB-INF/content/browse.jsp | 13 +++++-- src/main/webapp/css/main.css | 41 ++++++++++++++++++++- src/main/webapp/img/icons/css.png | Bin 0 -> 3541 bytes src/main/webapp/img/{ => icons}/file.png | Bin src/main/webapp/img/icons/html.png | Bin 0 -> 3298 bytes src/main/webapp/img/icons/java.png | Bin 0 -> 3298 bytes src/main/webapp/img/icons/javascript.png | Bin 0 -> 3394 bytes src/main/webapp/img/icons/rst.png | Bin 0 -> 3267 bytes src/main/webapp/img/icons/tex.png | Bin 0 -> 3251 bytes src/main/webapp/img/icons/txt.png | Bin 0 -> 490 bytes src/main/webapp/img/icons/xml.png | Bin 0 -> 219 bytes src/main/webapp/js/scmDetector.js | 2 - 13 files changed, 71 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java index c2277c7..8b7b9f1 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java @@ -225,7 +225,27 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR node.setId(file); node.setTitle(file.substring(file.lastIndexOf("/") + 1)); node.setState(TreeNode.NODE_STATE_LEAF); - node.setIcon("ui-icon-document"); + + if (file.endsWith((".js"))) { + node.setIcon("ui-icon-js"); + } else if (file.endsWith(".html") || file.endsWith(".htm")) { + node.setIcon("ui-icon-html"); + } else if (file.endsWith(".xml")) { + node.setIcon("ui-icon-xml"); + } else if (file.endsWith(".java")) { + node.setIcon("ui-icon-java"); + } else if (file.endsWith(".css")) { + node.setIcon("ui-icon-css"); + } else if (file.endsWith(".rst")) { + node.setIcon("ui-icon-rst"); + } else if (file.endsWith(".tex")) { + node.setIcon("ui-icon-tex"); + } else if (file.endsWith(".txt")) { + node.setIcon("ui-icon-txt"); + } else { + node.setIcon("ui-icon-document"); + } + resultDto.getNodes().add(node); } } @@ -237,7 +257,7 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR TreeNode node = new TreeNode(); node.setId(value); - node.setTitle(value.substring(value.lastIndexOf("/"))); + node.setTitle(value.substring(value.lastIndexOf("/") + 1)); resultDto.getNodes().add(node); } } diff --git a/src/main/webapp/WEB-INF/content/browse.jsp b/src/main/webapp/WEB-INF/content/browse.jsp index 0ec28f5..e5a1be5 100644 --- a/src/main/webapp/WEB-INF/content/browse.jsp +++ b/src/main/webapp/WEB-INF/content/browse.jsp @@ -29,12 +29,17 @@ <sj:head debug="true" jquerytheme="default"/> <script> + $.subscribe('treeClicked', function(event, data) { var item = event.originalEvent.data.rslt.obj; - if (item.text().indexOf("/") == -1) { - var scmType = $("#scmType").val(); - document.location.href = ("edit.action?address=" + item.attr("id") + "&scmType=" + scmType); + if (item.length == 1) { + var classAttr = item[0].getAttribute("class"); + + if (classAttr == "jstree-leaf") { + var scmType = $("#scmType").val(); + document.location.href = ("edit.action?address=" + item.attr("id") + "&scmType=" + scmType); + } } }); @@ -47,7 +52,7 @@ if (json.length == 1) { var object = json[0]; - if (object.title.startsWith('/')) { + if (object.state == "closed") { var htmlObject = document.getElementById(object.id); var children = htmlObject.children; children.item('ins').click(); diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index 215c0c6..2b9d203 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -50,8 +50,47 @@ li { display:inline; } +.ui-icon-js { + background-image:url("../img/icons/javascript.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-html { + background-image:url("../img/icons/html.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-xml { + background-image:url("../img/icons/xml.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-java { + background-image:url("../img/icons/java.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-css { + background-image:url("../img/icons/css.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-tex { + background-image:url("../img/icons/tex.png") !important; + background-position: 0 1px !important ; +} + +.ui-icon-rst { + background-image:url("../img/icons/rst.png") !important; + background-position: 0 1px !important ; +} +.ui-icon-txt { + background-image:url("../img/icons/txt.png") !important; + background-position: 0 1px !important ; +} + .ui-icon-document { - background-image:url("../img/file.png") !important; + background-image:url("../img/icons/file.png") !important; background-position: 0 1px !important ; } diff --git a/src/main/webapp/img/icons/css.png b/src/main/webapp/img/icons/css.png new file mode 100644 index 0000000..8bf2375 Binary files /dev/null and b/src/main/webapp/img/icons/css.png differ diff --git a/src/main/webapp/img/file.png b/src/main/webapp/img/icons/file.png similarity index 100% rename from src/main/webapp/img/file.png rename to src/main/webapp/img/icons/file.png diff --git a/src/main/webapp/img/icons/html.png b/src/main/webapp/img/icons/html.png new file mode 100644 index 0000000..caba574 Binary files /dev/null and b/src/main/webapp/img/icons/html.png differ diff --git a/src/main/webapp/img/icons/java.png b/src/main/webapp/img/icons/java.png new file mode 100644 index 0000000..6d40d73 Binary files /dev/null and b/src/main/webapp/img/icons/java.png differ diff --git a/src/main/webapp/img/icons/javascript.png b/src/main/webapp/img/icons/javascript.png new file mode 100644 index 0000000..e966f88 Binary files /dev/null and b/src/main/webapp/img/icons/javascript.png differ diff --git a/src/main/webapp/img/icons/rst.png b/src/main/webapp/img/icons/rst.png new file mode 100644 index 0000000..a2e9e2d Binary files /dev/null and b/src/main/webapp/img/icons/rst.png differ diff --git a/src/main/webapp/img/icons/tex.png b/src/main/webapp/img/icons/tex.png new file mode 100644 index 0000000..ef51d39 Binary files /dev/null and b/src/main/webapp/img/icons/tex.png differ diff --git a/src/main/webapp/img/icons/txt.png b/src/main/webapp/img/icons/txt.png new file mode 100644 index 0000000..fdd1766 Binary files /dev/null and b/src/main/webapp/img/icons/txt.png differ diff --git a/src/main/webapp/img/icons/xml.png b/src/main/webapp/img/icons/xml.png new file mode 100644 index 0000000..f100380 Binary files /dev/null and b/src/main/webapp/img/icons/xml.png differ diff --git a/src/main/webapp/js/scmDetector.js b/src/main/webapp/js/scmDetector.js index 76f3a1a..aefb2b4 100644 --- a/src/main/webapp/js/scmDetector.js +++ b/src/main/webapp/js/scmDetector.js @@ -5,8 +5,6 @@ $(document).ready(function() { $.getJSON("detectScm.action?address=" + address, function(result) { - console.log(result.detectedScm); - if (result.detectedScm != null) { $("#scmType").val(result.detectedScm); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.