diff --git a/SparkleLib/SparkleChangeSet.cs b/SparkleLib/SparkleChangeSet.cs index c0ddbf48..069bc791 100644 --- a/SparkleLib/SparkleChangeSet.cs +++ b/SparkleLib/SparkleChangeSet.cs @@ -38,7 +38,40 @@ namespace SparkleLib { public List MovedTo = new List (); public List Notes = new List (); - } + + public string RelativeTimestamp { + get { + TimeSpan time_span = DateTime.Now - Timestamp; + + if (time_span <= TimeSpan.FromSeconds (60)) + return "just now"; + + if (time_span <= TimeSpan.FromMinutes (60)) + return time_span.Minutes > 1 + ? time_span.Minutes + " minutes ago" + : "a minute ago"; + + if (time_span <= TimeSpan.FromHours (24)) + return time_span.Hours > 1 + ? time_span.Hours + " hours ago" + : "an hour ago"; + + if (time_span <= TimeSpan.FromDays (30)) + return time_span.Days > 1 + ? time_span.Days + " days ago" + : "a day ago"; + + if (time_span <= TimeSpan.FromDays (365)) + return time_span.Days > 30 + ? (time_span.Days / 30) + " months ago" + : "a month ago"; + + return time_span.Days > 365 + ? (time_span.Days / 365) + " years ago" + : "a year ago"; + } + } + } public class SparkleNote { diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index d652eed3..e94e4bd5 100644 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -264,6 +264,9 @@ Pixmaps\about.png + + HTML\jquery.js + diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index d8321663..060423fa 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -312,7 +312,7 @@ namespace SparkleShare { } new Thread (new ThreadStart (delegate { - FetchAvatars (emails, 36); + FetchAvatars (emails, 48); })).Start (); string event_log_html = EventLogHTML; @@ -392,33 +392,27 @@ namespace SparkleShare { string comments = ""; if (change_set.SupportsNotes) { - comments = ""; + comments = "
"; if (change_set.Notes != null) { change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); foreach (SparkleNote note in change_set.Notes) { - comments += "
" + - " " + - " " + - "" + - "" + - " " + - ""; + comments += "
" + note.Body + "

" + note.UserName + "

"; } } - comments += "
" + note.UserName + "" + note.Timestamp.ToString ("d MMM") + "
" + note.Body + "
"; + comments += ""; } string avatar_email = ""; - if (File.Exists (GetAvatar (change_set.UserEmail, 36))) + if (File.Exists (GetAvatar (change_set.UserEmail, 48))) avatar_email = change_set.UserEmail; event_entry += ""; event_entries += event_entry_html.Replace ("", event_entry) .Replace ("", change_set.UserName) - .Replace ("", "file://" + GetAvatar (avatar_email, 36)) + .Replace ("", "file://" + GetAvatar (avatar_email, 48)) .Replace ("", change_set.Timestamp.ToString ("H:mm")) .Replace ("", change_set.Folder) .Replace ("", change_set.Revision) @@ -434,24 +428,24 @@ namespace SparkleShare { today.Month == activity_day.DateTime.Month && today.Year == activity_day.DateTime.Year) { - day_entry = day_entry_html.Replace ("", "Today"); + day_entry = day_entry_html.Replace ("", "Today"); } else if (yesterday.Day == activity_day.DateTime.Day && yesterday.Month == activity_day.DateTime.Month && yesterday.Year == activity_day.DateTime.Year) { - day_entry = day_entry_html.Replace ("", "Yesterday"); + day_entry = day_entry_html.Replace ("", "Yesterday"); } else { if (activity_day.DateTime.Year != DateTime.Now.Year) { // TRANSLATORS: This is the date in the event logs day_entry = day_entry_html.Replace ("", - "" + activity_day.DateTime.ToString (_("ddd MMM d, yyyy")) + ""); + activity_day.DateTime.ToString (_("dddd, MMMM d, yyyy"))); } else { // TRANSLATORS: This is the date in the event logs, without the year day_entry = day_entry_html.Replace ("", - "" + activity_day.DateTime.ToString (_("ddd MMM d")) + ""); + activity_day.DateTime.ToString (_("dddd, MMMM d"))); } } diff --git a/data/html/event-entry.html b/data/html/event-entry.html index 580fd1a6..dd7123ce 100644 --- a/data/html/event-entry.html +++ b/data/html/event-entry.html @@ -1,38 +1,28 @@ -
-
-
-
-
+
+
+
-
-
-
-
+ - +
+
+
Add note
+
Show all
-
-
-
Comment
- +
-
- -
-
- - - - -
-
-
-
- -
+
+
+ +
+ + +
+
+
-
+
diff --git a/data/html/event-log.html b/data/html/event-log.html index 7cda57ed..ee1a1862 100644 --- a/data/html/event-log.html +++ b/data/html/event-log.html @@ -19,11 +19,30 @@ } }); - $('.comment').click(function () { + // Show the form when 'Add note' is clicked + $('.note').click(function () { $(this).parent ().find ('.comments-wrapper').show (); //$(this).parent ().find ('.comments-wrapper').css ('cursor', 'default'); }); + // Hide the 'Show all' link when there are less than 10 events + $('.show').each (function () { + var entries = $(this).parent ().find ('dl').children ().length; + + if (entries <= 10) { + $(this).hide (); + } else { + // Append the number of entries + $(this).html ('Show all ' + entries); + } + }); + + // When 'Show all' is clicked, show all collapsed events + $('.show').click(function () { + $(this).parent ().find ('dl').children ().show (); + $(this).hide (); + }); + $("input").click(function () { textarea = $(this).parent ().find ('textarea'); text = textarea.val (); @@ -74,20 +93,26 @@ color: ; } - td { - vertical-align: top; - font-size: 12px; + .comment-text { + font-size: 90%; + padding: 12px; + background-color: #FFF4DB; + margin-bottom: 1px; + } .day-entry-header { - font-size: ; - color: #444; - padding: 18px; - padding-top: 9px; + opacity: 0.5; margin-left: auto; margin-right: auto; display: block; text-align: center; + margin-bottom: 24px; + font-weight: bold; + } + + .day-entry-content .event-entry:last-child { + border: none; } a { @@ -102,12 +127,9 @@ color: ; } - .stuff { - width: 100%; - padding-left: 56px; - } - .event-timestamp { + float: left; + font-size: 80%; color: ; } @@ -121,15 +143,21 @@ color: ; } - .event-entry-content { + .event-entry { + margin-bottom: 24px; + padding-bottom: 24px; + border-bottom: 1px solid; + width: 100%; + padding-left: 60px; + background-repeat: no-repeat; display: block; - padding-bottom: 60px; - padding: 0px; } .action { + font-size: 80%; margin-left: 15px; float: right; + margin-bottom: 9px; color: ; } @@ -147,32 +175,39 @@ } .separator { + clear: both; border-bottom: 1px #ccc solid; margin-top: 24px; margin-bottom: 24px; } dl { - background-color:orange; padding : 0; margin: 0; margin-bottom: 12px; + padding-top: 6px; + clear: both; } dd { + display: none; overflow: hidden; text-overflow: ellipsis; width: 90%; padding: 0; padding-top: 2px; padding-bottom: 2px; - padding-left: 22px; + padding-left: 20px; margin: 0; - margin-bottom: 2px; + margin-bottom: 1px; background-repeat: no-repeat; background-position: center left; } + dl dd:nth-child(-n+10) { + display: block; + } + .document-added { background-image: url(''); } @@ -208,11 +243,16 @@ .comments { width: 100%; + font-size: 90%; + margin-bottom: 9px; } .comment-author { + font-size: 90%; font-weight: bold; width: 75%; + margin: 0; + margin-top: 12px; } .comment-timestamp { @@ -229,7 +269,7 @@ box-sizing: border-box; -webkit-box-sizing: border-box; width: 100%; - height: 50px; + height: 3em; padding-bottom: 6px; } @@ -237,6 +277,7 @@ box-sizing: border-box; -webkit-box-sizing: border-box; width: 100%; + } .comments-wrapper { box-sizing: border-box;