The Unified and Autonomous Development Platform
Change tooltip to be toggled with class selector (tooltiped) instead of attribute selector ([data-toggle='tooltip'])
steve73933e7e19a5
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.cssindex 095ea0e2e1..46e8b0a6d6 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css@@ -570,7 +570,7 @@ a.diffstat:hover { text-decoration: none; }.form-comment .comment-editor-head .nav-tabs { padding-left: 18px; }.form-comment .comment-editor-body { background: white; padding: 12px; }.form-comment textarea { display: block; width: 100%; resize: vertical; padding: 10px; min-height: 100px; max-height: 500px; border-color: #aaa; }-.form-comment .form-actions { padding: 0 12px; margin-bottom: 12px; }+.form-comment .form-actions { padding: 0; margin-top: 12px; }.form-comment .form-actions .primary { float: right; }.form-comment .form-actions .secondary { float: left; }diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/js/page.js b/gitop.web/src/main/java/com/pmease/gitop/web/assets/js/page.jsindex 3587c4b46b..94de6717c6 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/js/page.js+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/js/page.js@@ -167,7 +167,7 @@ var gitop = {$(document).ready(function() {$('#globalheader a').tooltip({placement: 'bottom'});- $('#main [data-toggle="tooltip"]').tooltip();+ $('#main .tooltiped').tooltip();$(window).on("beforeunload", function() {$(":focus").trigger("blur");diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.html b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.htmlindex 06f7b8727e..ed47d35f66 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.html@@ -3,13 +3,16 @@<form class="form-comment" wicket:id="form"><div class="comment-editor-head"><ul class="nav nav-tabs">- <li wicket:id="tabli"><a wicket:id="link"><span wicket:id="name"></span></a></li>+ <li class="active"><a wicket:id="writelink">Write</a></li>+ <li><a wicket:id="previewlink">Preview</a></li></ul></div>- <div class="comment-editor-body">- <div wicket:id="body"></div>+ <div class="tab-content comment-editor-body">+ <div class="tab-pane active" wicket:id="edit"></div>+ <div class="tab-pane" wicket:id="preview"></div>++ <div class="form-actions clearfix" wicket:id="actions"></div></div>- <div class="form-actions clearfix" wicket:id="actions"></div></form><wicket:fragment wicket:id="editfrag">@@ -27,5 +30,10 @@</div></div></wicket:fragment>++ <wicket:fragment wicket:id="submitfrag">+ <button class="btn btn-default btn-cancel secondary" wicket:id="btnCancel"><span wicket:id="name"></span></button>+ <button class="btn btn-success btn-submit primary" wicket:id="btnSubmit"><span wicket:id="name"></span></button>+ </wicket:fragment></wicket:panel></html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.javaindex dc25dde48a..cabb905306 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentEditor.java@@ -1,21 +1,26 @@package com.pmease.gitop.web.component.comment;-import org.apache.commons.lang3.text.WordUtils;+import org.apache.wicket.AttributeModifier;import org.apache.wicket.Component;+import org.apache.wicket.ajax.AjaxEventBehavior;import org.apache.wicket.ajax.AjaxRequestTarget;+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.behavior.AttributeAppender;+import org.apache.wicket.ajax.markup.html.form.AjaxButton;+import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;+import org.apache.wicket.markup.head.OnLoadHeaderItem;+import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.form.TextArea;-import org.apache.wicket.markup.html.link.AbstractLink;-import org.apache.wicket.markup.html.list.Loop;-import org.apache.wicket.markup.html.list.LoopItem;import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.markup.html.panel.Panel;import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;import org.apache.wicket.model.Model;+import org.apache.wicket.request.IRequestParameters;+import org.apache.wicket.request.cycle.RequestCycle;import org.parboiled.common.Preconditions;import com.google.common.base.Strings;@@ -32,8 +37,6 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel@SuppressWarnings("serial")public abstract class CommitCommentEditor extends Panel {- abstract protected Component createSubmitButtons(String id, Form<?> form);-protected Form<?> form;public CommitCommentEditor(String id) {@@ -47,91 +50,150 @@ public abstract class CommitCommentEditor extends Panel {add(form);}- private static enum Mode {- WRITE, PREVIEW- }-- private Mode mode = Mode.WRITE;+ private WebMarkupContainer previewPanel;@Overrideprotected void onInitialize() {super.onInitialize();- form.add(new Loop("tabli", Mode.values().length) {-+ Component editor = newEditPanel("edit");+ previewPanel = (WebMarkupContainer) newPreviewPanel("preview");++ form.add(editor);+ form.add(previewPanel);++ WebMarkupContainer editLink = new WebMarkupContainer("writelink");+ editLink.add(AttributeModifier.replace("href", "#" + editor.getMarkupId(true)));+ form.add(editLink);++ WebMarkupContainer previewLink = new WebMarkupContainer("previewlink");+ previewLink.add(AttributeModifier.replace("href", "#" + previewPanel.getMarkupId(true)));+ previewLink.add(new AjaxEventBehavior("shown.bs.tab") {+@Override- protected void populateItem(LoopItem item) {- final Mode m = Mode.values()[item.getIndex()];- item.add(AttributeAppender.append("class", m == mode ? "active" : ""));- AbstractLink link = new AjaxLink<Void>("link") {-- @Override- public void onClick(AjaxRequestTarget target) {- mode = m;- onModeChanged(target);- }- };+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {+ super.updateAjaxAttributes(attributes);- link.add(new Label("name", WordUtils.capitalizeFully(m.name())));- item.add(link);+ attributes.getDynamicExtraParameters()+ .add(String.format("return {'text': $('#%s').val() }", inputField.getMarkupId()));+ }++ @Override+ public void renderHead(Component component, IHeaderResponse response) {+ response.render(OnLoadHeaderItem.forScript(getCallbackScript().toString()));+ }++ @Override+ protected void onEvent(AjaxRequestTarget target) {+ IRequestParameters request = RequestCycle.get().getRequest().getRequestParameters();+ String text = request.getParameterValue("text").toString(null);+ updatePreview(target, text);}+});- form.add(newContent("body"));+ form.add(previewLink);++ form.add(createSubmitBar("actions", form));+ }++ protected Component createSubmitBar(String id, Form<?> form) {+ Fragment frag = new Fragment(id, "submitfrag", this);++ frag.add(createCancelButton("btnCancel", form));+ frag.add(createSubmitButton("btnSubmit", form));- form.add(createSubmitButtons("actions", form));+ return frag;}- protected void onModeChanged(AjaxRequestTarget target) {- Component c = newContent("body");- form.addOrReplace(c);- target.add(form);+ abstract protected void onCancel(AjaxRequestTarget target, Form<?> form);+ abstract protected void onSubmit(AjaxRequestTarget target, Form<?> form);++ protected Component createCancelButton(String id, Form<?> form) {+ AjaxLink<Void> cancelBtn = new AjaxLink<Void>("btnCancel") {++ @Override+ public void onClick(AjaxRequestTarget target) {+ onCancel(target, getForm());+ }++ };++ cancelBtn.add(new Label("name", getCancelButtonLabel()));+ return cancelBtn;}- protected Component newContent(String id) {- Component c;- if (mode == Mode.WRITE) {- c = newEditPanel(id);- } else {- // PREVIEW- c = newPreviewPanel(id);- }+ protected Component createSubmitButton(String id, Form<?> form) {+ AjaxButton btn = new AjaxButton(id, form) {+ @Override+ public void onSubmit(AjaxRequestTarget target, Form<?> form) {+ CommitCommentEditor.this.onSubmit(target, form);+ }+ };- c.setOutputMarkupId(true);- return c;+ btn.add(new Label("name", getSubmitButtonLabel()));+ return btn;+ }++ protected IModel<String> getCancelButtonLabel() {+ return Model.of("Close Form");+ }++ protected IModel<String> getSubmitButtonLabel() {+ return Model.of("Add a comment");}public String getCommentText() {return (String) getDefaultModelObject();}+ TextArea<String> inputField;@SuppressWarnings("unchecked")private Component newEditPanel(String id) {Fragment frag = new Fragment(id, "editfrag", this);frag.add(new NotificationPanel("feedback", form));- frag.add(new TextArea<String>("input", (IModel<String>) getDefaultModel()));+ frag.add(inputField = new TextArea<String>("input", (IModel<String>) getDefaultModel()));return frag;}+ @SuppressWarnings("unchecked")private Component newPreviewPanel(String id) {Fragment frag = new Fragment(id, "previewfrag", this);User user = Preconditions.checkNotNull(Gitop.getInstance(UserManager.class).getCurrent());frag.add(new UserAvatarLink("author", new UserModel(user)));- frag.add(new WikiTextPanel("content", new AbstractReadOnlyModel<String>() {+ frag.add(newPreview((IModel<String>) getDefaultModel()));++ return frag;+ }++ private Component newPreview(final IModel<String> text) {+ return new WikiTextPanel("content", new AbstractReadOnlyModel<String>() {@Overridepublic String getObject() {- String str = getCommentText();+ String str = text.getObject();if (Strings.isNullOrEmpty(str)) {return "Nothing to be shown";} else {return str;}}- }));+ }).setOutputMarkupId(true);+ }++ private void updatePreview(AjaxRequestTarget target, String text) {+ Component c = newPreview(Model.of(text));+ previewPanel.addOrReplace(c);+ target.add(c);+ }++ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);- return frag;+ response.render(OnDomReadyHeaderItem.forScript(+ String.format("$('#%s a').click(function(e){e.preventDefault(); $(this).tab('show') })", getMarkupId())));}public Form<?> getForm() {diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.htmlindex a6910425d1..511daba99d 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.html@@ -18,10 +18,5 @@<div wicket:id="content"></div></div></div>-- <wicket:fragment wicket:id="submitfrag">- <button class="btn btn-default secondary" wicket:id="btnCancel">Cancel</button>- <button class="btn btn-gray primary" wicket:id="btnUpdate">Update Comment</button>- </wicket:fragment></wicket:panel></html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.javaindex ba54f1c250..3d35fddfe6 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/comment/CommitCommentPanel.java@@ -5,11 +5,9 @@ import java.util.Date;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.event.Broadcast;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.form.Form;-import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.markup.html.panel.Panel;import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;@@ -120,46 +118,43 @@ public class CommitCommentPanel extends Panel {protected void onEdit(AjaxRequestTarget target) {Component c = new CommitCommentEditor("content", Model.of(getCommitComment().getContent())) {++ private void updateCommentLabel(AjaxRequestTarget target) {+ Component label = newCommentLabel();+ CommitCommentPanel.this.addOrReplace(label);+ target.add(label);+ }@Override- protected Component createSubmitButtons(String id, Form<?> form) {- Fragment frag = new Fragment(id, "submitfrag", CommitCommentPanel.this);- frag.add(new AjaxLink<Void>("btnCancel") {+ protected void onCancel(AjaxRequestTarget target, Form<?> form) {+ updateCommentLabel(target);+ }- @Override- public void onClick(AjaxRequestTarget target) {- updateCommentLabel(target);- }- });+ @Override+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {+ String comment = getCommentText();+ if (Strings.isNullOrEmpty(comment)) {+ form.error("Comment can not be empty");+ target.add(form);+ return;+ }- frag.add(new AjaxButton("btnUpdate", form) {-- @Override- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {- String comment = getCommentText();- if (Strings.isNullOrEmpty(comment)) {- form.error("Comment can not be empty");- target.add(form);- return;- }-- CommitComment cc = getCommitComment();- cc.setUpdatedDate(new Date());- cc.setContent(comment);-- Gitop.getInstance(CommitCommentManager.class).save(cc);- updateCommentLabel(target);-// updateAgeLabel(target);- }- });+ CommitComment cc = getCommitComment();+ cc.setUpdatedDate(new Date());+ cc.setContent(comment);- return frag;+ Gitop.getInstance(CommitCommentManager.class).save(cc);+ updateCommentLabel(target);}- private void updateCommentLabel(AjaxRequestTarget target) {- Component label = newCommentLabel();- CommitCommentPanel.this.addOrReplace(label);- target.add(label);+ @Override+ protected IModel<String> getCancelButtonLabel() {+ return Model.of("Cancel");+ }++ @Override+ protected IModel<String> getSubmitButtonLabel() {+ return Model.of("Update this comment");}};diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/label/AgeLabel.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/label/AgeLabel.javaindex 7416a8f1a5..7e243bcfa2 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/label/AgeLabel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/label/AgeLabel.java@@ -20,7 +20,6 @@ public class AgeLabel extends Label {protected void onComponentTag(ComponentTag tag) {super.onComponentTag(tag);tag.put("title", DateUtils.format(getDate(), Constants.DATETIME_FORMAT));- tag.put("data-toggle", "tooltip");String classes = tag.getAttribute("class");if (classes == null) {classes = "";@@ -28,6 +27,9 @@ public class AgeLabel extends Label {if (!classes.contains("age")) {classes += " age";}+ if (!classes.contains("tooltiped")) {+ classes += " tooltiped";+ }tag.put("class", classes);}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/GitPersonLink.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/GitPersonLink.javaindex c2c88afae1..884898fc9a 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/GitPersonLink.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/GitPersonLink.java@@ -112,7 +112,7 @@ public class GitPersonLink extends Panel {throw new IllegalStateException();}- c.add(AttributeModifier.replace("data-toggle", "tooltip"));+ c.add(AttributeModifier.append("class", "tooltiped"));if (!Strings.isNullOrEmpty(tooltipPosition)) {c.add(AttributeModifier.replace("data-placement", tooltipPosition));}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/GlobalHeaderPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/GlobalHeaderPanel.htmlindex ec4d8eb141..fe99e40ac0 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/GlobalHeaderPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/GlobalHeaderPanel.html@@ -21,12 +21,12 @@<wicket:enclosure child="logoutLink"><wicket:enclosure child="adminlink"><li class="separator"></li>- <li><a wicket:id="adminlink" data-toggle="tooltip" title="System administration"><i class="icon icon-cog"></i></a></li>+ <li><a class="tooltiped" wicket:id="adminlink" data-toggle="tooltip" title="System administration"><i class="icon icon-cog"></i></a></li></wicket:enclosure><li class="separator"></li>- <li><a data-toggle="tooltip" title="Create a new repository" wicket:id="newlink"><i class="icon icon-repo-add"></i></a></li>- <li><a wicket:id="profileLink" data-toggle="tooltip" title="Account settings"><i class="icon icon-tools"></i></a></li>- <li><a data-toggle="tooltip" title="Sign out" wicket:id="logoutLink"><i class="icon icon-logout"></i></a></li>+ <li><a class="tooltiped" data-toggle="tooltip" title="Create a new repository" wicket:id="newlink"><i class="icon icon-repo-add"></i></a></li>+ <li><a class="tooltiped" wicket:id="profileLink" data-toggle="tooltip" title="Account settings"><i class="icon icon-tools"></i></a></li>+ <li><a class="tooltiped" data-toggle="tooltip" title="Sign out" wicket:id="logoutLink"><i class="icon icon-logout"></i></a></li><li class="separator"></li><li class="avatar-user"><wicket:container wicket:id="userlink"></wicket:container></li></wicket:enclosure>diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/home/AccountHomePage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/home/AccountHomePage.htmlindex 9db4e18dc4..bb71015b1a 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/home/AccountHomePage.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/home/AccountHomePage.html@@ -9,7 +9,7 @@<h1 class="vcard-name"><b wicket:id="fullname"></b><em wicket:id="username"></em>- <a class="img-link" data-toggle="tooltip" data-placement="right" title="edit your profile"><i class="icon icon-pencil"></i></a>+ <a class="img-link tooltiped" data-toggle="tooltip" data-placement="right" title="edit your profile"><i class="icon icon-pencil"></i></a></h1></div>diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.htmlindex cacad36093..0f6834e2a7 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html@@ -13,7 +13,7 @@</div><wicket:fragment wicket:id="memberactionfrag">- <a class="img-link remove-link" wicket:id="remove" data-toggle="tooltip" title="remove this user from this team"><i class="icon icon-delete-circle"></i></a>+ <a class="img-link remove-link tooltiped" wicket:id="remove" data-toggle="tooltip" title="remove this user from this team"><i class="icon icon-delete-circle"></i></a></wicket:fragment></wicket:panel></html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/ContributorsPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/ContributorsPanel.javaindex d99f7a6232..f869e82309 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/ContributorsPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/ContributorsPanel.java@@ -4,6 +4,7 @@ import java.util.List;import org.apache.wicket.Component;import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.EnclosureContainer;import org.apache.wicket.markup.html.basic.Label;@@ -16,15 +17,13 @@ import org.apache.wicket.model.IModel;import org.apache.wicket.model.Model;import com.google.common.collect.Lists;-import com.pmease.commons.wicket.behavior.TooltipBehavior;import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;import com.pmease.gitop.web.component.link.GitPersonLink;import com.pmease.gitop.web.component.link.GitPersonLink.Mode;import com.pmease.gitop.web.page.project.api.GitPerson;-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig.Placement;+import de.agilecoders.wicket.jquery.JQuery;@SuppressWarnings("serial")public class ContributorsPanel extends Panel {@@ -106,10 +105,6 @@ public class ContributorsPanel extends Panel {moreContainer.add(dropdownPanel);add(moreContainer);-- add(new TooltipBehavior(new TooltipConfig()- .withPlacement(Placement.top)- .withSelector("[data-toggle=\"tooltip\"]")));}@SuppressWarnings("unchecked")@@ -120,5 +115,7 @@ public class ContributorsPanel extends Panel {@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);++ response.render(OnDomReadyHeaderItem.forScript(JQuery.$(this, ".tooltiped").chain("tooltip").get()));}}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/DiffViewPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/DiffViewPanel.htmlindex 6d1a6d3048..25bb3062c2 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/DiffViewPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/DiffViewPanel.html@@ -21,7 +21,7 @@</wicket:enclosure><span wicket:id="path"></span></a>- <a class="diffstat" wicket:id="statlink" data-toggle="tooltip" data-placement="left">+ <a class="diffstat tooltiped" wicket:id="statlink" data-toggle="tooltip" data-placement="left"><wicket:container wicket:id="statbar"></wicket:container></a></li>diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.htmlindex ebee9ea478..5888e8176c 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.html@@ -2,7 +2,7 @@<wicket:panel><div class="panel-heading clearfix"><div class="pull-left meta">- <span class="diffstat inline" data-toggle="tooltip" data-placement="right" wicket:id="statspan">+ <span class="diffstat inline tooltiped" data-toggle="tooltip" data-placement="right" wicket:id="statspan"><wicket:container wicket:id="stat"></wicket:container></span>@@ -10,7 +10,7 @@</div><div class="actions pull-right"><span wicket:id="actions"></span>- <a class="btn btn-default btn-sm" wicket:id="bloblink">View file @ <b class="sha" wicket:id="sha"></b></a>+ <a class="btn btn-default btn-sm tooltiped" wicket:id="bloblink" title="View the whole file at this revision">View</a></div></div><div class="panel-body">diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.javaindex 409250c9dc..b084003f3d 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/BlobDiffPanel.java@@ -11,7 +11,6 @@ import org.apache.wicket.markup.html.link.BookmarkablePageLink;import org.apache.wicket.markup.html.panel.Panel;import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;-import org.apache.wicket.model.Model;import org.eclipse.jgit.diff.DiffEntry.ChangeType;import org.eclipse.jgit.diff.DiffEntry.Side;@@ -19,7 +18,6 @@ import com.google.common.base.Splitter;import com.google.common.collect.Lists;import com.pmease.gitop.model.CommitComment;import com.pmease.gitop.model.Project;-import com.pmease.gitop.web.git.GitUtils;import com.pmease.gitop.web.page.project.source.blob.SourceBlobPage;import com.pmease.gitop.web.page.project.source.commit.diff.DiffStatBar;import com.pmease.gitop.web.page.project.source.commit.diff.patch.FileHeader;@@ -102,106 +100,12 @@ public abstract class BlobDiffPanel extends Panel {paths));blobLink.setVisibilityAllowed(getFile().getChangeType() != ChangeType.DELETE);add(blobLink);- blobLink.add(new Label("sha", Model.of(GitUtils.abbreviateSHA(until, 6))));+// blobLink.add(new Label("sha", Model.of(GitUtils.abbreviateSHA(until, 6))));add(createActionsBar("actions"));add(createDiffContent("diffcontent"));}- /*- private Component createContent(String id) {- FileHeader file = getFile();- List<? extends HunkHeader> hunks = file.getHunks();-- if (hunks.isEmpty()) {- // hunks is empty when this file is renamed, or the file is binary- // or this file is just an empty file- //-- // renamed without change- if (file.getChangeType() == ChangeType.RENAME) {- return createMessageLabel(id, Model.of("File renamed without changes"));- }-- // binary file also including image file, so we need detect the- // media type- if (file.getPatchType() == PatchType.BINARY) {- String path;- if (file.getChangeType() == ChangeType.DELETE) {- path = file.getOldPath();- } else {- path = file.getNewPath();- }-- FileTypes types = Gitop.getInstance(FileTypes.class);-- // fast detect the media type without loading file blob- //- MediaType mediaType = types.getMediaType(path, new byte[0]);- if (MediaTypeUtils.isImageType(mediaType)- && types.isSafeInline(mediaType)) {- // image diffs- return new ImageBlobDiffPanel(id, getFileModel(), projectModel, sinceModel, untilModel);-- } else {- // other binary diffs- return createMessageLabel(id, Model.of("File is a binary file"));-- }- }-- // file is just an empty file- return createMessageLabel(id, Model.of("File is empty"));-- } else {- // blob is text and we can show diffs-- if (index > Constants.MAX_RENDERABLE_BLOBS) {- // too many renderable blobs- // only show diff stats instead of showing the contents- //- return createMessageLabel(id, Model.of(- file.getDiffStat().getAdditions() + " additions, "- + file.getDiffStat().getDeletions() + " deletions"));- }-- if (hunks.size() > Constants.MAX_RENDERABLE_DIFF_LINES) {- // don't show huge diff (exceed 10000 lines)- //- return createMessageLabel(id, new AbstractReadOnlyModel<String>() {-- @Override- public String getObject() {- String since = sinceModel.getObject();- String until = untilModel.getObject();-- if (Strings.isNullOrEmpty(since)) {- since = "";- }-- return "<p>"- + "The diff for this file is too large to render. "- + "You can run below command to get the diff manually:"- + "</p> "- + "<pre><code>"- + "git diff -C -M " + since + " " + until + " -- "- + StringUtils.quoteArgument(getFile().getNewPath())- + "</code></pre>";- }-- }).withHtmlMessage(true);- }-- }- }-- private Alert createMessageLabel(String id, IModel<String> model) {- Alert alert = new Alert(id, model);- alert.type(Alert.Type.Warning).setCloseButtonVisible(false);- return alert;- }- */-protected FileHeader getFile() {return (FileHeader) getDefaultModelObject();}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.htmlindex 14005861e0..b0b3a81de6 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.html@@ -2,7 +2,7 @@<wicket:panel><tr class="diff-line hunk-head" wicket:id="aboveexpander"><td class="diff-line-num expander" colspan="2">- <a data-toggle="tooltip" title="show more lines" wicket:id="expander"><i class="icon icon-expand"></i></a>+ <a class="tooltiped" data-toggle="tooltip" title="show more lines" wicket:id="expander"><i class="icon icon-expand"></i></a></td><td class="diff-line-code"><pre wicket:id="header">@@ xxx @@ context func</pre>@@ -13,7 +13,7 @@</tr><tr class="diff-line hunk-head" wicket:id="belowexpander"><td class="diff-line-num expander" colspan="2">- <a data-toggle="tooltip" data-placement="bottom" title="show more lines" wicket:id="expander"><i class="icon icon-expand"></i></a>+ <a class="tooltiped" data-toggle="tooltip" data-placement="bottom" title="show more lines" wicket:id="expander"><i class="icon icon-expand"></i></a></td><td class="diff-line-code"></td></tr>@@ -48,11 +48,5 @@<div wicket:id="commentform"></div></td></wicket:fragment>-- <wicket:fragment wicket:id="commentformsubmitsfrag">- <button class="btn btn-gray" wicket:id="close">Close form</button>- <button class="btn btn-success btn-submit" wicket:id="comment">Comment on this line</button>- </wicket:fragment>-</wicket:panel></html>\ No newline at end of filediff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.javaindex de9b494cfd..2db71bd7de 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.java+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/diff/renderer/text/HunkPanel.java@@ -6,7 +6,6 @@ import java.util.List;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.event.Broadcast;import org.apache.wicket.event.IEvent;@@ -205,7 +204,7 @@ public class HunkPanel extends Panel {target.add(expander);String aboveMarkupId = expander.getMarkupId();- target.appendJavaScript("$('#" + aboveMarkupId + " a').tooltip();");+ target.appendJavaScript("$('#" + aboveMarkupId + " .tooltiped').tooltip();");HunkHeader hunk = getCurrentHunk();List<String> blobLines = blobLinesModel.getObject();@@ -350,38 +349,33 @@ public class HunkPanel extends Panel {private WebMarkupContainer newCommentForm(final int position) {return new CommitCommentEditor("commentform") {-@Override- protected Component createSubmitButtons(String id, final Form<?> form) {- Fragment frag = new Fragment(id, "commentformsubmitsfrag", HunkPanel.this);- frag.add(new AjaxLink<Void>("close") {-- @Override- public void onClick(AjaxRequestTarget target) {- send(HunkPanel.this, Broadcast.DEPTH, new CloseInlineCommentEvent(target, position, getLineId(position)));- }- });+ protected void onCancel(AjaxRequestTarget target, Form<?> form) {+ send(HunkPanel.this, Broadcast.DEPTH, new CloseInlineCommentEvent(target, position, getLineId(position)));+ }- AjaxButton submit = new AjaxButton("comment", form) {- @Override- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {- String lineId = getLineId(position);- CommitComment comment = new CommitComment();- comment.setAuthor(GitopSession.getCurrentUser().get());- comment.setCommit(commitModel.getObject());- comment.setLine(lineId);- comment.setProject(projectModel.getObject());- comment.setContent(getCommentText());- Gitop.getInstance(CommitCommentManager.class).save(comment);-- send(getPage(), Broadcast.DEPTH, new InlineCommentAddedEvent(target, position, lineId, comment.getId()));- }- };-- frag.add(submit);- form.setDefaultButton(submit);+ @Override+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {+ String lineId = getLineId(position);+ CommitComment comment = new CommitComment();+ comment.setAuthor(GitopSession.getCurrentUser().get());+ comment.setCommit(commitModel.getObject());+ comment.setLine(lineId);+ comment.setProject(projectModel.getObject());+ comment.setContent(getCommentText());+ Gitop.getInstance(CommitCommentManager.class).save(comment);- return frag;+ send(getPage(), Broadcast.DEPTH, new InlineCommentAddedEvent(target, position, lineId, comment.getId()));+ }++ @Override+ protected IModel<String> getCancelButtonLabel() {+ return Model.of("Close form");+ }++ @Override+ protected IModel<String> getSubmitButtonLabel() {+ return Model.of("Comment on this line");}};}diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.htmlindex 4d5c7e27dd..7e8c8b64d8 100644--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/component/SourceBreadcrumbPanel.html@@ -1,7 +1,7 @@<html xmlns:wicket><wicket:panel><div class="file-navigator">- <a class="btn btn-success" data-toggle="tooltip" title="compare and review"><i class="icon icon-git-branch-compare"></i></a>+ <a class="btn btn-success tooltiped" data-toggle="tooltip" title="compare and review"><i class="icon icon-git-branch-compare"></i></a><wicket:container wicket:id="revselector"></wicket:container><ol class="breadcrumb inline breadcrumb-paths"><li>@@ -9,7 +9,7 @@</li><li wicket:id="paths"><a wicket:id="link"><span wicket:id="name"></span></a></li><li>- <a data-toggle="tooltip" title="Fork this repository and add a new file"><i class="icon icon-file-add"></i></a>+ <a class="tooltiped" data-toggle="tooltip" title="Fork this repository and add a new file"><i class="icon icon-file-add"></i></a></li></ol></div>