continue implementing notes

This commit is contained in:
Hylke Bons 2011-06-22 20:38:14 +01:00
parent 3e02724bb6
commit cd9c5ff78d
5 changed files with 87 additions and 39 deletions

View file

@ -595,7 +595,12 @@ namespace SparkleLib {
git_notes.WaitForExit (); git_notes.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Added note to " + revision); SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Added note to " + revision);
SyncUpNotes ();
}
public override void SyncUpNotes ()
{
while (Status != SyncStatus.Idle) { while (Status != SyncStatus.Idle) {
System.Threading.Thread.Sleep (5 * 20); System.Threading.Thread.Sleep (5 * 20);
} }
@ -604,9 +609,15 @@ namespace SparkleLib {
git_push.Start (); git_push.Start ();
git_push.WaitForExit (); git_push.WaitForExit ();
if (git_push.ExitCode == 0) {
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Notes pushed"); SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Notes pushed");
SparkleAnnouncement announcement = new SparkleAnnouncement (Identifier, note_namespace); } else {
HasUnsyncedChanges = true;
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing notes failed, trying again later");
}
SparkleAnnouncement announcement = new SparkleAnnouncement (Identifier, SHA1 (DateTime.Now.ToString ()));
base.listener.Announce (announcement); base.listener.Announce (announcement);
} }

View file

@ -111,8 +111,10 @@ namespace SparkleLib {
// In the unlikely case that we haven't synced up our // In the unlikely case that we haven't synced up our
// changes or the server was down, sync up again // changes or the server was down, sync up again
if (HasUnsyncedChanges) if (HasUnsyncedChanges) {
SyncUpBase (); SyncUpBase ();
SyncUpNotes ();
}
}; };
this.remote_timer.Start (); this.remote_timer.Start ();
@ -233,8 +235,10 @@ namespace SparkleLib {
SyncDownBase (); SyncDownBase ();
// Push changes that were made since the last disconnect // Push changes that were made since the last disconnect
if (HasUnsyncedChanges) if (HasUnsyncedChanges) {
SyncUpBase (); SyncUpBase ();
SyncUpNotes ();
}
}; };
// Start polling when the connection to the irc channel is lost // Start polling when the connection to the irc channel is lost
@ -449,6 +453,12 @@ namespace SparkleLib {
} }
public virtual void SyncUpNotes ()
{
}
// Recursively gets a folder's size in bytes // Recursively gets a folder's size in bytes
private double CalculateFolderSize (DirectoryInfo parent) private double CalculateFolderSize (DirectoryInfo parent)
{ {

View file

@ -397,11 +397,10 @@ namespace SparkleShare {
foreach (SparkleNote note in change_set.Notes) { foreach (SparkleNote note in change_set.Notes) {
comments += "<tr>" + comments += "<tr>" +
" <td class=\"comment-author\">" + note.UserName + "</td>" + " <td class=\"comment-author\">" + note.UserName + "</td>" +
" <td class=\"comment-text\" rowspan=\"2\">" + note.Body + "</td>" + " <td class=\"comment-timestamp\">" + note.Timestamp.ToString ("d MMM") + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td class=\"comment-timestamp\">" + note.Timestamp + "</td>" + " <td class=\"comment-text\" colspan=\"2\">" + note.Body + "</td>" +
" <td></td>" +
"</tr>"; "</tr>";
} }
@ -451,7 +450,8 @@ namespace SparkleShare {
event_log += day_entry.Replace ("<!-- $day-entry-content -->", event_entries); event_log += day_entry.Replace ("<!-- $day-entry-content -->", event_entries);
} }
return event_log_html.Replace ("<!-- $event-log-content -->", event_log); return event_log_html.Replace ("<!-- $event-log-content -->", event_log)
.Replace ("<!-- $username -->", UserName);
} }

View file

@ -8,24 +8,16 @@
<b><!-- $event-user-name --></b><br/> <b><!-- $event-user-name --></b><br/>
<small><!-- $event-time --></small> <small><!-- $event-time --></small>
</div> </div>
<div class='event-time' style='background-color: <!-- $event-folder-color -->'><!-- $event-folder --></div> <div class='event-folder' style='background-color: <!-- $event-folder-color -->'><!-- $event-folder --></div>
</div> </div>
<!-- $event-entry-content --> <!-- $event-entry-content -->
<div style='clear: both'></div> <div style='clear: both'></div>
<div style='margin-top: 9px;border-top: 1px #ccc solid;box-sizing: border-box; <div class="comments-wrapper">
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box; margin-top: 3px;width:100%;padding:12px;'>
<!-- $event-comments --> <!-- $event-comments -->
<textarea class="comment-textarea"></textarea>
<textarea style="margin-top: 12px;box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
width: 75%;float:right;height: 40px"></textarea>
<div style='clear: both'></div> <div style='clear: both'></div>
<input style="float:right; margin-top: 6px;margin-bottom: 6px;" type="button" <input class="comment-button" type="button" value="Add note"
value="Add note" id="<!-- $event-folder -->~<!-- $event-revision -->"> id="<!-- $event-folder -->~<!-- $event-revision -->">
</div> </div>
<div style='clear: both'></div> <div style='clear: both'></div>
</div> </div>

View file

@ -16,9 +16,13 @@
table = $(this).parent ().find ("table"); table = $(this).parent ().find ("table");
comments = table.html (); comments = table.html ();
comments += '<tr><td class="comment-author">Hylke Bons</td><td class="comment-text" rowspan="2">' + text + '</td></tr>'; comments += '<tr>' +
comments += '<tr><td class="comment-timestamp">just now</td><td></td></tr>' ' <td class=\"comment-author\"><!-- $username --></td>' +
' <td class=\"comment-timestamp\">just now</td>' +
'</tr>' +
'<tr>' +
' <td class=\"comment-text\" colspan=\"2\">' + text + '</td>' +
'</tr>';
table.html (comments); table.html (comments);
location = this.id + '~' + text; location = this.id + '~' + text;
@ -51,8 +55,6 @@
font-size: 12px; font-size: 12px;
} }
.day-entry-header { .day-entry-header {
font-size: <!-- $day-entry-header-font-size -->; font-size: <!-- $day-entry-header-font-size -->;
color: #444; color: #444;
@ -62,7 +64,6 @@ font-size: 12px;
margin-right: auto; margin-right: auto;
} }
a { a {
color: <!-- $a-color -->; color: <!-- $a-color -->;
text-decoration: none; text-decoration: none;
@ -72,8 +73,8 @@ font-size: 12px;
color: <!-- $a-hover-color -->; color: <!-- $a-hover-color -->;
} }
.event-time { .event-folder {
margin: 15px; margin: 6px;
opacity: 0.8; opacity: 0.8;
font-size: 80%; font-size: 80%;
color: #fff; color: #fff;
@ -81,6 +82,7 @@ font-size: 12px;
padding: 3px 15px; padding: 3px 15px;
font-weight: bold; font-weight: bold;
-webkit-border-radius: 100px; -webkit-border-radius: 100px;
cursor: pointer;
} }
.event-entry-content { .event-entry-content {
@ -153,11 +155,14 @@ font-size: 12px;
} }
.event-info { .event-info {
padding: 6px;
float: left; float: left;
margin-bottom: 8px; margin-bottom: 8px;
width: 100%; width: 100%;
background-color: #fff; background-color: #fff;
border-bottom: 1px #ccc solid; border-bottom: 1px #ccc solid;
box-sizing: border-box;
-webkit-box-sizing: border-box;
} }
.comments { .comments {
@ -166,12 +171,42 @@ font-size: 12px;
.comment-author { .comment-author {
font-weight: bold; font-weight: bold;
width: 25%; width: 75%;
} }
.comment-timestamp { .comment-timestamp {
color: <!-- $secondary-font-color -->; color: <!-- $secondary-font-color -->;
padding-bottom: 12px; text-align: right;
}
.comment-button {
float:right;
margin-top: 6px;
margin-bottom: 6px;"
}
.comment-textarea {
margin-top: 12px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
height: 40px;
}
.comments-wrapper {
margin-top: 9px;
border-top: 1px #ccc solid;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
margin-top: 3px;
width: 100%;
padding: 12px;
}
.comment-text {
padding-bottom: 6px;
} }
</style> </style>
</head> </head>