continue implementing notes

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

View file

@ -595,7 +595,12 @@ namespace SparkleLib {
git_notes.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Added note to " + revision);
SyncUpNotes ();
}
public override void SyncUpNotes ()
{
while (Status != SyncStatus.Idle) {
System.Threading.Thread.Sleep (5 * 20);
}
@ -604,9 +609,15 @@ namespace SparkleLib {
git_push.Start ();
git_push.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Notes pushed");
if (git_push.ExitCode == 0) {
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);
}

View file

@ -111,8 +111,10 @@ namespace SparkleLib {
// In the unlikely case that we haven't synced up our
// changes or the server was down, sync up again
if (HasUnsyncedChanges)
if (HasUnsyncedChanges) {
SyncUpBase ();
SyncUpNotes ();
}
};
this.remote_timer.Start ();
@ -233,8 +235,10 @@ namespace SparkleLib {
SyncDownBase ();
// Push changes that were made since the last disconnect
if (HasUnsyncedChanges)
if (HasUnsyncedChanges) {
SyncUpBase ();
SyncUpNotes ();
}
};
// 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
private double CalculateFolderSize (DirectoryInfo parent)
{

View file

@ -397,11 +397,10 @@ namespace SparkleShare {
foreach (SparkleNote note in change_set.Notes) {
comments += "<tr>" +
" <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>" +
" <td class=\"comment-timestamp\">" + note.Timestamp + "</td>" +
" <td></td>" +
" <td class=\"comment-text\" colspan=\"2\">" + note.Body + "</td>" +
"</tr>";
}
@ -451,7 +450,8 @@ namespace SparkleShare {
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/>
<small><!-- $event-time --></small>
</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>
<!-- $event-entry-content -->
<div style='clear: both'></div>
<div style='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;'>
<div class="comments-wrapper">
<!-- $event-comments -->
<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>
<input style="float:right; margin-top: 6px;margin-bottom: 6px;" type="button"
value="Add note" id="<!-- $event-folder -->~<!-- $event-revision -->">
<textarea class="comment-textarea"></textarea>
<div style='clear: both'></div>
<input class="comment-button" type="button" value="Add note"
id="<!-- $event-folder -->~<!-- $event-revision -->">
</div>
<div style='clear: both'></div>
</div>

View file

@ -16,9 +16,13 @@
table = $(this).parent ().find ("table");
comments = table.html ();
comments += '<tr><td class="comment-author">Hylke Bons</td><td class="comment-text" rowspan="2">' + text + '</td></tr>';
comments += '<tr><td class="comment-timestamp">just now</td><td></td></tr>'
comments += '<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);
location = this.id + '~' + text;
@ -48,11 +52,9 @@
td {
vertical-align: top;
font-size: 12px;
font-size: 12px;
}
.day-entry-header {
font-size: <!-- $day-entry-header-font-size -->;
color: #444;
@ -61,7 +63,6 @@ font-size: 12px;
margin-left: auto;
margin-right: auto;
}
a {
color: <!-- $a-color -->;
@ -72,8 +73,8 @@ font-size: 12px;
color: <!-- $a-hover-color -->;
}
.event-time {
margin: 15px;
.event-folder {
margin: 6px;
opacity: 0.8;
font-size: 80%;
color: #fff;
@ -81,15 +82,16 @@ font-size: 12px;
padding: 3px 15px;
font-weight: bold;
-webkit-border-radius: 100px;
cursor: pointer;
}
.event-entry-content {
display: block;
background-color: #f0f0f0;
margin-bottom: 12px;
padding: 0px;
padding-bottom: 6px;
border: #ccc 1px solid;
display: block;
background-color: #f0f0f0;
margin-bottom: 12px;
padding: 0px;
padding-bottom: 6px;
border: #ccc 1px solid;
}
.wrapper {
@ -153,11 +155,14 @@ font-size: 12px;
}
.event-info {
padding: 6px;
float: left;
margin-bottom: 8px;
width: 100%;
background-color: #fff;
border-bottom: 1px #ccc solid;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.comments {
@ -166,12 +171,42 @@ font-size: 12px;
.comment-author {
font-weight: bold;
width: 25%;
width: 75%;
}
.comment-timestamp {
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>
</head>