fix notes
This commit is contained in:
parent
03d547e0c7
commit
8cef98a010
|
@ -444,7 +444,6 @@ namespace SparkleLib {
|
||||||
change_set.UserName = match.Groups [2].Value;
|
change_set.UserName = match.Groups [2].Value;
|
||||||
change_set.UserEmail = match.Groups [3].Value;
|
change_set.UserEmail = match.Groups [3].Value;
|
||||||
change_set.IsMerge = is_merge_commit;
|
change_set.IsMerge = is_merge_commit;
|
||||||
change_set.SupportsNotes = true;
|
|
||||||
|
|
||||||
change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value),
|
change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value),
|
||||||
int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value),
|
int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value),
|
||||||
|
@ -467,7 +466,7 @@ namespace SparkleLib {
|
||||||
string file_path = entry_line.Substring (39);
|
string file_path = entry_line.Substring (39);
|
||||||
string to_file_path;
|
string to_file_path;
|
||||||
|
|
||||||
if (change_type.Equals ("A")) {
|
if (change_type.Equals ("A") && !file_path.Contains (".notes")) {
|
||||||
change_set.Added.Add (file_path);
|
change_set.Added.Add (file_path);
|
||||||
|
|
||||||
} else if (change_type.Equals ("M")) {
|
} else if (change_type.Equals ("M")) {
|
||||||
|
@ -487,10 +486,14 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((change_set.Added.Count + change_set.Edited.Count +
|
||||||
|
change_set.Deleted.Count) > 0) {
|
||||||
|
|
||||||
change_set.Notes.AddRange (GetNotes (change_set.Revision));
|
change_set.Notes.AddRange (GetNotes (change_set.Revision));
|
||||||
change_sets.Add (change_set);
|
change_sets.Add (change_set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return change_sets;
|
return change_sets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ namespace SparkleLib {
|
||||||
public string Folder;
|
public string Folder;
|
||||||
public string Revision;
|
public string Revision;
|
||||||
public DateTime Timestamp;
|
public DateTime Timestamp;
|
||||||
public bool SupportsNotes = false;
|
|
||||||
public bool IsMerge = false;
|
public bool IsMerge = false;
|
||||||
|
|
||||||
public List<string> Added = new List<string> ();
|
public List<string> Added = new List<string> ();
|
||||||
|
|
|
@ -308,7 +308,8 @@ namespace SparkleLib {
|
||||||
if (!this.watcher.EnableRaisingEvents)
|
if (!this.watcher.EnableRaisingEvents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.FullPath.Contains (Path.DirectorySeparatorChar + "."))
|
if (args.FullPath.Contains (Path.DirectorySeparatorChar + ".") &&
|
||||||
|
!args.FullPath.Contains (Path.DirectorySeparatorChar + ".notes"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WatcherChangeTypes wct = args.ChangeType;
|
WatcherChangeTypes wct = args.ChangeType;
|
||||||
|
@ -348,9 +349,9 @@ namespace SparkleLib {
|
||||||
"<timestamp>([0-9]+)</timestamp>.*" +
|
"<timestamp>([0-9]+)</timestamp>.*" +
|
||||||
"<body>(.+)</body>", RegexOptions.Compiled);
|
"<body>(.+)</body>", RegexOptions.Compiled);
|
||||||
|
|
||||||
foreach (string file_name in Directory.GetFiles (notes_path)) {
|
foreach (string file_path in Directory.GetFiles (notes_path)) {
|
||||||
if (file_name.StartsWith (revision)) {
|
if (Path.GetFileName (file_path).StartsWith (revision)) {
|
||||||
string note_xml = String.Join ("", File.ReadAllLines (file_name));
|
string note_xml = String.Join ("", File.ReadAllLines (file_path));
|
||||||
|
|
||||||
Match match_notes = regex_notes.Match (note_xml);
|
Match match_notes = regex_notes.Match (note_xml);
|
||||||
|
|
||||||
|
@ -513,6 +514,13 @@ namespace SparkleLib {
|
||||||
writer.Write (note);
|
writer.Write (note);
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
|
|
||||||
|
|
||||||
|
// The watcher doesn't like .*/ so we need to trigger
|
||||||
|
// a change manually
|
||||||
|
FileSystemEventArgs args = new FileSystemEventArgs (WatcherChangeTypes.Changed,
|
||||||
|
notes_path, note_name);
|
||||||
|
|
||||||
|
OnFileActivity (args);
|
||||||
SparkleHelpers.DebugInfo ("Note", "Added note to " + revision);
|
SparkleHelpers.DebugInfo ("Note", "Added note to " + revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
string comments = "";
|
string comments = "";
|
||||||
if (change_set.SupportsNotes) {
|
|
||||||
comments = "<div class=\"comments\">";
|
comments = "<div class=\"comments\">";
|
||||||
|
|
||||||
if (change_set.Notes != null) {
|
if (change_set.Notes != null) {
|
||||||
|
@ -408,7 +407,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
comments += "</div>";
|
comments += "</div>";
|
||||||
}
|
|
||||||
|
|
||||||
string avatar_email = "";
|
string avatar_email = "";
|
||||||
if (File.Exists (GetAvatar (change_set.UserEmail, 48)))
|
if (File.Exists (GetAvatar (change_set.UserEmail, 48)))
|
||||||
|
@ -458,7 +456,8 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
string html = event_log_html.Replace ("<!-- $event-log-content -->", event_log)
|
string html = event_log_html.Replace ("<!-- $event-log-content -->", event_log)
|
||||||
.Replace ("<!-- $username -->", UserName);
|
.Replace ("<!-- $username -->", UserName)
|
||||||
|
.Replace ("<!-- $user-avatar-url -->", "file://" + GetAvatar (UserEmail, 48));
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,17 +12,11 @@
|
||||||
<div class="clearer"></div>
|
<div class="clearer"></div>
|
||||||
|
|
||||||
<div class="comments-section">
|
<div class="comments-section">
|
||||||
<div class="comments-wrapper">
|
|
||||||
<!-- $event-comments -->
|
<!-- $event-comments -->
|
||||||
<div class="comment-text">
|
|
||||||
<textarea class="comment-textarea"></textarea>
|
<textarea class="comment-textarea"></textarea>
|
||||||
<input class="comment-button" type="button" value="Add note"
|
<input class="comment-button" type="button" value="Add note"
|
||||||
id="<!-- $event-folder -->~<!-- $event-revision -->">
|
id="<!-- $event-folder -->~<!-- $event-revision -->">
|
||||||
<div style='clear: both'></div>
|
<div style='clear: both'></div>
|
||||||
</div>
|
</div>
|
||||||
<div style='clear: both'></div>
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
<div class="clearer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,11 +5,9 @@
|
||||||
<script type="text/javascript" src="<!-- $jquery-url -->"></script>
|
<script type="text/javascript" src="<!-- $jquery-url -->"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('.comments-wrapper').each (function () {
|
$('.comments-section').each (function () {
|
||||||
if ($(this).find ('.comments').children ().size () < 1) {
|
if ($(this).find ('.comments').children ().size () < 1) {
|
||||||
$(this).hide ();
|
$(this).hide ();
|
||||||
} else {
|
|
||||||
$(this).css ('cursor', 'default');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,8 +19,7 @@
|
||||||
|
|
||||||
// Show the form when 'Add note' is clicked
|
// Show the form when 'Add note' is clicked
|
||||||
$('.note').click(function () {
|
$('.note').click(function () {
|
||||||
$(this).parent ().find ('.comments-wrapper').show ();
|
$(this).parent ().find ('.comments-section').show ();
|
||||||
//$(this).parent ().find ('.comments-wrapper').css ('cursor', 'default');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide the 'Show all' link when there are less than 10 events
|
// Hide the 'Show all' link when there are less than 10 events
|
||||||
|
@ -50,19 +47,23 @@
|
||||||
if (text == '')
|
if (text == '')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Clear the textarea
|
||||||
textarea.val ('');
|
textarea.val ('');
|
||||||
|
|
||||||
table = $(this).parent ().find ("table");
|
table = $(this).parent ().find (".comments");
|
||||||
comments = table.html ();
|
comments = table.html ();
|
||||||
comments += '<tr>' +
|
|
||||||
' <td class=\"comment-author\"><!-- $username --></td>' +
|
// Add the note to the html
|
||||||
' <td class=\"comment-timestamp\">just now</td>' +
|
comments += '<div class="comment-text">' +
|
||||||
'</tr>' +
|
'<p class="comment-author"' +
|
||||||
'<tr>' +
|
' style="background-image: url(\'<!-- $user-avatar-url -->\');">' +
|
||||||
' <td class=\"comment-text\" colspan=\"2\">' + text + '</td>' +
|
'<!-- $username --></p>' +
|
||||||
'</tr>';
|
text +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
table.html (comments);
|
table.html (comments);
|
||||||
|
|
||||||
|
// Feed the note to the backend
|
||||||
location = this.id + '~' + text;
|
location = this.id + '~' + text;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -297,10 +298,6 @@
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comments-section:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment-text {
|
.comment-text {
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue