Browse Source

Optimize the views

dev
Aimeast 12 years ago
parent
commit
19684d2e05
  1. 4
      GitCandy/Git/GitService.cs
  2. 2
      GitCandy/Models/TagModel.cs
  3. 2
      GitCandy/Views/Repository/Blame.cshtml
  4. 4
      GitCandy/Views/Repository/Blob.cshtml
  5. 4
      GitCandy/Views/Repository/Branches.cshtml
  6. 4
      GitCandy/Views/Repository/Commit.cshtml
  7. 4
      GitCandy/Views/Repository/Commits.cshtml
  8. 2
      GitCandy/Views/Repository/Tags.cshtml
  9. 36
      GitCandy/Views/Repository/Tree.cshtml

4
GitCandy/Git/GitService.cs

@ -445,10 +445,10 @@ namespace GitCandy.Git
{
ReferenceName = s.Name,
Sha = s.Target.Sha,
DateTime = ((Commit)s.Target).Author.When.LocalDateTime,
When = ((Commit)s.Target).Author.When,
MessageShort = ((Commit)s.Target).MessageShort.RepetitionIfEmpty(NoCommitMessage),
})
.OrderByDescending(s => s.DateTime)
.OrderByDescending(s => s.When)
.ToArray()
};
return model;

2
GitCandy/Models/TagModel.cs

@ -6,7 +6,7 @@ namespace GitCandy.Models
{
public string ReferenceName { get; set; }
public string Sha { get; set; }
public DateTime DateTime { get; set; }
public DateTimeOffset When { get; set; }
public string MessageShort { get; set; }
}
}

2
GitCandy/Views/Repository/Blame.cshtml

@ -32,7 +32,7 @@
<span title="@hunk.AuthorEmail">@hunk.Author</span>
</div>
<div>
<span title="@hunk.AuthorDate.LocalDateTime">@hunk.AuthorDate.LocalDateTime.ToShortDateString()</span>
<span title="@hunk.AuthorDate">@hunk.AuthorDate.LocalDateTime.ToShortDateString()</span>
<span title="@hunk.MessageShort">@hunk.MessageShort.ShortString(33)</span>
</div>
</td>

4
GitCandy/Views/Repository/Blob.cshtml

@ -14,11 +14,11 @@
<div class="row">
<div class="span12">
<div class="pull-left keep-space">@Model.Commit.Author.Name</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt @Model.Commit.Author.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt <span title="@Model.Commit.Author.When">@Model.Commit.Author.When.LocalDateTime</span></div>
@if (Model.Commit.Author != Model.Commit.Committer)
{
<div class="pull-left keep-space">@Model.Commit.Committer.Name</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt @Model.Commit.Committer.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt <span title="@Model.Commit.Committer.When">@Model.Commit.Committer.When.LocalDateTime</span></div>
}
</div>
</div>

4
GitCandy/Views/Repository/Branches.cshtml

@ -12,7 +12,7 @@
<td>
<div>@Model.Commit.ReferenceName</div>
<div class="pull-left keep-space" title="@Model.Commit.Author">@Model.Commit.Author.Name</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt @Model.Commit.Author.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt <span title="@Model.Commit.Author.When">@Model.Commit.Author.When.LocalDateTime</span></div>
</td>
<td></td>
<td></td>
@ -24,7 +24,7 @@
<td>
<div>@Html.ActionLink(item.Commit.ReferenceName, "Tree", Html.OverRoute(new { path = item.Commit.ReferenceName }))</div>
<div class="pull-left keep-space" title="@item.Commit.Author">@item.Commit.Author.Name</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt @item.Commit.Author.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt <span title="@item.Commit.Author.When">@item.Commit.Author.When.LocalDateTime</span></div>
</td>
<td><p class="text-right">@item.Behind @SR.Repository_Behind</p></td>
<td><p class="text-left">@item.Ahead @SR.Repository_Ahead</p></td>

4
GitCandy/Views/Repository/Commit.cshtml

@ -12,11 +12,11 @@
<div class="span9 pull-left">
<pre>@Model.CommitMessage</pre>
<div class="pull-left keep-space">@Model.Author.Name</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt @Model.Author.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt <span title="@Model.Author.When">@Model.Author.When.LocalDateTime</span></div>
@if (Model.Author != Model.Committer)
{
<div class="pull-left keep-space">@Model.Committer.Name</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt @Model.Committer.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt <span title="@Model.Committer.When">@Model.Committer.When.LocalDateTime</span></div>
}
</div>
<div class="span1 pull-right">

4
GitCandy/Views/Repository/Commits.cshtml

@ -14,10 +14,10 @@
<div class="row">
<div class="span9 pull-left">
<div title="@commit.CommitMessageShort">@Html.ActionLink(commit.CommitMessageShort.ShortString(100), "Commit", Html.OverRoute(new { path = commit.Sha + "/" + Model.Path }))</div>
<div>@commit.Author.Name @SR.Repository_AuthoredAt @commit.Author.When.LocalDateTime</div>
<div>@commit.Author.Name @SR.Repository_AuthoredAt <span title="@commit.Author.When">@commit.Author.When.LocalDateTime</span></div>
@if (commit.Author != commit.Committer)
{
<div class="keep-space">@commit.Committer.Name @SR.Repository_CommittedAt @commit.Committer.When.LocalDateTime</div>
<div class="keep-space">@commit.Committer.Name @SR.Repository_CommittedAt <span title="@commit.Committer.When">@commit.Committer.When.LocalDateTime</span></div>
}
</div>
<div class="span1 pull-right">

2
GitCandy/Views/Repository/Tags.cshtml

@ -18,7 +18,7 @@
@Html.Partial("_ZipButton", tag.ReferenceName)
</div>
<div>@Html.ActionLink(tag.ReferenceName, "Tree", Html.OverRoute(new { path = tag.ReferenceName ?? tag.Sha }))</div>
<div title="@tag.DateTime">@tag.DateTime.ToShortDateString()</div>
<div title="@tag.When">@tag.When.LocalDateTime.ToShortDateString()</div>
<div>@tag.MessageShort</div>
<div>@Html.ActionLink(tag.Sha, "Commit", Html.OverRoute(new { path = tag.ReferenceName ?? tag.Sha }))</div>
</div>

36
GitCandy/Views/Repository/Tree.cshtml

@ -90,11 +90,11 @@ else
</div>
<div class="clearfix">
<div class="pull-left">@Model.Commit.Author.Name</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt @Model.Commit.Author.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_AuthoredAt <span title="@Model.Commit.Author.When">@Model.Commit.Author.When.LocalDateTime</span></div>
@if (Model.Commit.Author != Model.Commit.Committer)
{
<div class="pull-left keep-space">@Model.Commit.Committer.Name</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt @Model.Commit.Committer.When.LocalDateTime</div>
<div class="pull-left keep-space">@SR.Repository_CommittedAt <span title="@Model.Commit.Committer.When">@Model.Commit.Committer.When.LocalDateTime</span></div>
}
<div class="pull-right">@Model.Commit.Sha.ToShortSha()</div>
</div>
@ -104,22 +104,24 @@ else
{
<tr>
<td>
@if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.Tree)
{ <i class="icon-folder-close"></i> }
else if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.Blob)
{ <i class="icon-file"></i> }
else if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.GitLink)
{ <i class="icon-bookmark"></i> }
else
{ <i class="icon-leaf"></i> }
@if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.GitLink)
{ @entry.Name }
else
{ @Html.ActionLink(entry.Name, entry.EntryType.ToString(), Html.OverRoute(new { path = (Model.ReferenceName ?? Model.Commit.Sha) + "/" + entry.Path })) }
<span title="@entry.Name">
@if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.Tree)
{ <i class="icon-folder-close"></i> }
else if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.Blob)
{ <i class="icon-file"></i> }
else if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.GitLink)
{ <i class="icon-bookmark"></i> }
else
{ <i class="icon-leaf"></i> }
@if (entry.EntryType == LibGit2Sharp.TreeEntryTargetType.GitLink)
{ @entry.Name.ShortString(25) }
else
{ @Html.ActionLink(entry.Name.ShortString(25), entry.EntryType.ToString(), Html.OverRoute(new { path = (Model.ReferenceName ?? Model.Commit.Sha) + "/" + entry.Path })) }
</span>
</td>
<td title="@entry.Commit.CommitMessageShort">@Html.ActionLink(entry.Commit.CommitMessageShort.ShortString(70), "Commit", Html.OverRoute(new { path = entry.Commit.Sha }))</td>
<td title="@entry.Commit.Author">@entry.Commit.Author.Name</td>
<td title="@entry.Commit.Author.When.LocalDateTime">@entry.Commit.Author.When.LocalDateTime.ToShortDateString()</td>
<td><span title="@entry.Commit.CommitMessageShort">@Html.ActionLink(entry.Commit.CommitMessageShort.ShortString(70), "Commit", Html.OverRoute(new { path = entry.Commit.Sha }))</span></td>
<td title="@entry.Commit.Author">@entry.Commit.Author.Name.ShortString(20)</td>
<td title="@entry.Commit.Author.When">@entry.Commit.Author.When.LocalDateTime.ToShortDateString()</td>
</tr>
}
</tbody>

Loading…
Cancel
Save