Fix for #1042 - Filestore items now shown as icons
| | |
| | | container.add(new SimpleAttributeModifier("style", background));
|
| | | }
|
| | |
|
| | | public static void setHtmlTooltip(Component container, String value) {
|
| | | container.add(new SimpleAttributeModifier("title", value));
|
| | | public static Component setHtmlTooltip(Component container, String value) {
|
| | | return container.add(new SimpleAttributeModifier("title", value));
|
| | | }
|
| | |
|
| | | public static void setInputPlaceholder(Component container, String value) {
|
| | |
| | | <td class="changeType"><span wicket:id="changeType">[change type]</span></td>
|
| | | <td class="path"><span wicket:id="pathName">[commit path]</span></td>
|
| | | <td class="hidden-phone rightAlign">
|
| | | <span wicket:id="filestore" style="margin-right:20px;" class="aui-lozenge aui-lozenge-moved"></span>
|
| | | <span wicket:id="filestore" style="margin-right:20px;" class="fa fa-fw fa-external-link-square filestore-item"></span>
|
| | | <span class="hidden-tablet" style="padding-right:20px;" wicket:id="diffStat"></span>
|
| | | <span class="link">
|
| | | <span class="hidden-tablet"><a wicket:id="patch"><wicket:message key="gb.patch"></wicket:message></a> | </span><a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a><span class="hidden-tablet"> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a></span> | <a wicket:id="blame"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
|
| | |
| | | setChangeTypeTooltip(changeType, entry.changeType); |
| | | item.add(changeType); |
| | | item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true)); |
| | | item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore")) |
| | | .setVisible(entry.isFilestoreItem())); |
| | | |
| | | boolean hasSubmodule = false; |
| | | String submodulePath = null; |
| | |
| | | |
| | | // quick links |
| | | if (entry.isSubmodule()) { |
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); |
| | | |
| | | item.add(new ExternalLink("raw", "").setEnabled(false)); |
| | | // submodule |
| | | item.add(new ExternalLink("patch", "").setEnabled(false)); |
| | |
| | | && !entry.changeType.equals(ChangeType.DELETE))); |
| | | |
| | | if (entry.isFilestoreItem()) { |
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(true)); |
| | | |
| | | item.add(new Link<Object>("view", null) { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | getRequestCycle().setRequestTarget(new ResourceStreamRequestTarget(resourceStream, entry.path)); |
| | | }}); |
| | | } else { |
| | | |
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); |
| | | |
| | | item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils |
| | | .newPathParameter(repositoryName, entry.commitId, entry.path)) |
| | | .setEnabled(!entry.changeType.equals(ChangeType.DELETE))); |
| | |
| | | <td class="changeType"><span wicket:id="changeType">[change type]</span></td>
|
| | | <td class="path"><span wicket:id="pathName">[commit path]</span></td>
|
| | | <td class="hidden-phone rightAlign">
|
| | | <span wicket:id="filestore" style="margin-right:20px;" class="aui-lozenge aui-lozenge-moved"></span>
|
| | | <span wicket:id="filestore" style="margin-right:20px;" class="fa fa-fw fa-external-link-square filestore-item"></span>
|
| | | <span class="hidden-tablet" style="padding-right:20px;" wicket:id="diffStat"></span>
|
| | | <span class="link">
|
| | | <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <span class="hidden-tablet"><a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a> | </span><a wicket:id="blame"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
|
| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.io.OutputStream;
|
| | | import java.sql.Blob;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | | import java.util.concurrent.Callable;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.SimpleAttributeModifier;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.link.DownloadLink;
|
| | | import org.apache.wicket.markup.html.link.ExternalLink;
|
| | | import org.apache.wicket.markup.html.link.Link;
|
| | | import org.apache.wicket.markup.html.link.ResourceLink;
|
| | | import org.apache.wicket.markup.repeater.Item;
|
| | | import org.apache.wicket.markup.repeater.data.DataView;
|
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | | import org.apache.wicket.model.AbstractReadOnlyModel;
|
| | | import org.apache.wicket.model.IModel;
|
| | | import org.apache.wicket.model.StringResourceModel;
|
| | | import org.apache.wicket.request.target.basic.RedirectRequestTarget;
|
| | | import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget;
|
| | | import org.apache.wicket.util.resource.AbstractResourceStream;
|
| | | import org.apache.wicket.util.resource.AbstractResourceStreamWriter;
|
| | | import org.apache.wicket.util.resource.IResourceStream;
|
| | | import org.bouncycastle.jcajce.provider.symmetric.Threefish;
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.manager.FilestoreManager;
|
| | | import com.gitblit.manager.GitblitManager;
|
| | | import com.gitblit.models.FilestoreModel;
|
| | | import com.gitblit.models.GitNote;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.SubmoduleModel;
|
| | | import com.gitblit.models.UserModel;
|
| | |
| | | @Override
|
| | | public void populateItem(final Item<PathChangeModel> item) {
|
| | | final PathChangeModel entry = item.getModelObject();
|
| | | final String filestoreItemUrl = entry.isFilestoreItem() ? JGitUtils.getLfsRepositoryUrl(getContextUrl(), repositoryName, entry.getFilestoreOid()) : null;
|
| | |
|
| | | Label changeType = new Label("changeType", "");
|
| | | WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);
|
| | | setChangeTypeTooltip(changeType, entry.changeType);
|
| | | item.add(changeType);
|
| | | item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true));
|
| | | item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore"))
|
| | | .setVisible(entry.isFilestoreItem()));
|
| | |
|
| | | boolean hasSubmodule = false;
|
| | | String submodulePath = null;
|
| | |
| | | if (entry.isSubmodule()) {
|
| | | item.add(new ExternalLink("raw", "").setEnabled(false));
|
| | |
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | | |
| | | // submodule
|
| | | item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils
|
| | | .newPathParameter(repositoryName, entry.commitId, entry.path))
|
| | |
| | | && !entry.changeType.equals(ChangeType.DELETE)));
|
| | |
|
| | | if (entry.isFilestoreItem()) {
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(true));
|
| | | |
| | | |
| | | |
| | | item.add(new Link<Object>("view", null) {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | }});
|
| | |
|
| | | } else {
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | | |
| | | item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
|
| | | .newPathParameter(repositoryName, entry.commitId, entry.path))
|
| | | .setEnabled(!entry.changeType.equals(ChangeType.DELETE)));
|
| | |
| | | <tr wicket:id="changedPath">
|
| | | <td class="hidden-phone icon"><img wicket:id="pathIcon" /></td>
|
| | | <td><span wicket:id="pathName"></span></td>
|
| | | <td class="hidden-phone filestore"><span wicket:id="filestore" class="aui-lozenge aui-lozenge-moved"></span></td>
|
| | | <td class="hidden-phone filestore"><span wicket:id="filestore" class="fa fa-fw fa-external-link-square filestore-item"></span></td>
|
| | | <td class="hidden-phone size"><span wicket:id="pathSize">[path size]</span></td>
|
| | | <td class="hidden-phone mode"><span wicket:id="pathPermissions">[path permissions]</span></td>
|
| | | <td class="treeLinks"><span wicket:id="pathLinks">[path links]</span></td>
|
| | |
| | | final PathModel entry = item.getModelObject();
|
| | |
|
| | | item.add(new Label("pathPermissions", JGitUtils.getPermissionsFromMode(entry.mode)));
|
| | | |
| | | item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore"))
|
| | | .setVisible(entry.isFilestoreItem()));
|
| | |
|
| | | if (entry.isParentPath) {
|
| | | // parent .. path
|
| | | item.add(WicketUtils.newBlankImage("pathIcon"));
|
| | | item.add(new Label("pathSize", ""));
|
| | | item.add(new LinkPanel("pathName", null, entry.name, TreePage.class,
|
| | | WicketUtils
|
| | | .newPathParameter(repositoryName, id, entry.path)));
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | | WicketUtils.newPathParameter(repositoryName, id, entry.path)));
|
| | | item.add(new Label("pathLinks", ""));
|
| | | } else {
|
| | | if (entry.isTree()) {
|
| | |
| | | item.add(new LinkPanel("pathName", "list", entry.name, TreePage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, id,
|
| | | entry.path)));
|
| | |
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | |
|
| | | // links
|
| | | Fragment links = new Fragment("pathLinks", "treeLinks", this);
|
| | |
| | | getShortObjectId(submoduleId), TreePage.class,
|
| | | WicketUtils.newPathParameter(submodulePath, submoduleId, "")).setEnabled(hasSubmodule));
|
| | |
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | | |
| | | Fragment links = new Fragment("pathLinks", "submoduleLinks", this);
|
| | | links.add(new BookmarkablePageLink<Void>("view", SummaryPage.class,
|
| | | WicketUtils.newRepositoryParameter(submodulePath)).setEnabled(hasSubmodule));
|
| | |
| | | Fragment links = new Fragment("pathLinks", "blobLinks", this);
|
| | |
|
| | | if (entry.isFilestoreItem()) {
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(true));
|
| | | |
| | | item.add(new LinkPanel("pathName", "list", displayPath, new Link<Object>("link", null) {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | }});
|
| | |
|
| | | } else {
|
| | | item.add(new Label("filestore", getString("gb.filestore")).setVisible(false));
|
| | | |
| | | item.add(new LinkPanel("pathName", "list", displayPath, BlobPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, id,
|
| | | path)));
|
| | |
| | | .file-negative {
|
| | | color:#D51900;
|
| | | }
|
| | |
|
| | | .filestore-item {
|
| | | color:#815b3a;
|
| | | } |