Paul Martin
2016-04-06 5bb79fbb553a11e6582392f658233cf58a4ceb11
Fix for #1042 - Filestore items now shown as icons
8 files modified
65 ■■■■ changed files
src/main/java/com/gitblit/wicket/WicketUtils.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html 2 ●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java 9 ●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/CommitPage.html 2 ●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/CommitPage.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/TreePage.html 2 ●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/TreePage.java 16 ●●●● patch | view | raw | blame | history
src/main/resources/gitblit.css 4 ●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/WicketUtils.java
@@ -73,8 +73,8 @@
        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) {
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html
@@ -45,7 +45,7 @@
            <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>
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -148,6 +148,8 @@
                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;
@@ -200,8 +202,6 @@
                // 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));
@@ -219,8 +219,6 @@
                                    && !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;
@@ -269,9 +267,6 @@
                                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)));
src/main/java/com/gitblit/wicket/pages/CommitPage.html
@@ -79,7 +79,7 @@
            <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>
src/main/java/com/gitblit/wicket/pages/CommitPage.java
@@ -16,43 +16,28 @@
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;
@@ -185,13 +170,14 @@
            @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;
@@ -256,8 +242,6 @@
                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))
@@ -276,10 +260,6 @@
                                    && !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;
@@ -329,8 +309,6 @@
                            }});
                                                    
                    } 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)));
src/main/java/com/gitblit/wicket/pages/TreePage.html
@@ -23,7 +23,7 @@
        <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>
src/main/java/com/gitblit/wicket/pages/TreePage.java
@@ -98,15 +98,15 @@
                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()) {
@@ -116,8 +116,6 @@
                        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);
@@ -146,8 +144,6 @@
                                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));
@@ -175,8 +171,6 @@
                        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;
@@ -250,8 +244,6 @@
                                }});
                            
                        } 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)));
src/main/resources/gitblit.css
@@ -2356,3 +2356,7 @@
.file-negative {
    color:#D51900;
}
.filestore-item {
    color:#815b3a;
}