Assign colors to folders
This commit is contained in:
parent
c2a38157ab
commit
e6c759857a
|
@ -105,7 +105,7 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
string name = Path.GetFileName (LocalPath);
|
||||
Title = String.Format ("Events in ‘{0}’", name);
|
||||
Title = "Recent Events";
|
||||
|
||||
Separator = new NSBox (new RectangleF (0, 58, 480, 1)) {
|
||||
BorderColor = NSColor.LightGray,
|
||||
|
@ -152,7 +152,7 @@ namespace SparkleShare {
|
|||
private void GenerateHTML ()
|
||||
{
|
||||
string folder_name = Path.GetFileName (LocalPath);
|
||||
HTML = SparkleShare.Controller.GetHTMLLog (folder_name);
|
||||
HTML = SparkleShare.Controller.GetHTMLLog ();
|
||||
|
||||
HTML = HTML.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
||||
HTML = HTML.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||
|
|
|
@ -243,15 +243,15 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
public List<SparkleChangeSet> GetLog ()
|
||||
{Console.WriteLine ("PPPPPPPPPPP");
|
||||
{
|
||||
List<SparkleChangeSet> list = new List<SparkleChangeSet> ();
|
||||
|
||||
foreach (SparkleRepoBase repo in Repositories) {
|
||||
foreach (SparkleRepoBase repo in Repositories)
|
||||
list.AddRange (repo.GetChangeSets (10));
|
||||
Console.WriteLine (">>>" + repo.Name);
|
||||
}
|
||||
|
||||
list.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp)));
|
||||
list.Reverse ();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -275,9 +275,9 @@ namespace SparkleShare {
|
|||
public abstract string EventEntryHTML { get; }
|
||||
|
||||
|
||||
public string GetHTMLLog (string name)
|
||||
public string GetHTMLLog ()
|
||||
{
|
||||
List <SparkleChangeSet> change_sets = GetLog (name);
|
||||
List <SparkleChangeSet> change_sets = GetLog ();
|
||||
List <ActivityDay> activity_days = new List <ActivityDay> ();
|
||||
|
||||
if (change_sets.Count == 0)
|
||||
|
@ -325,7 +325,7 @@ namespace SparkleShare {
|
|||
|
||||
foreach (string file_path in change_set.Edited) {
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
change_set.Folder, file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path))
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||
|
@ -339,7 +339,7 @@ namespace SparkleShare {
|
|||
|
||||
foreach (string file_path in change_set.Added) {
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
change_set.Folder, file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path))
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||
|
@ -353,7 +353,7 @@ namespace SparkleShare {
|
|||
|
||||
foreach (string file_path in change_set.Deleted) {
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
change_set.Folder, file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path))
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||
|
@ -369,9 +369,9 @@ namespace SparkleShare {
|
|||
foreach (string file_path in change_set.MovedFrom) {
|
||||
string to_file_path = change_set.MovedTo [i];
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
change_set.Folder, file_path);
|
||||
string absolute_to_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, to_file_path);
|
||||
change_set.Folder, to_file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path))
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a><br/>" +
|
||||
|
@ -394,7 +394,9 @@ namespace SparkleShare {
|
|||
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
||||
.Replace ("<!-- $event-user-name -->", change_set.UserName)
|
||||
.Replace ("<!-- $event-avatar-url -->", "file://" + GetAvatar (change_set.UserEmail, 36) )
|
||||
.Replace ("<!-- $event-time -->", change_set.Timestamp.ToString ("H:mm"));
|
||||
.Replace ("<!-- $event-time -->", change_set.Timestamp.ToString ("H:mm"))
|
||||
.Replace ("<!-- $event-folder -->", change_set.Folder)
|
||||
.Replace ("<!-- $event-folder-color -->", AssignColor (change_set.Folder));
|
||||
}
|
||||
|
||||
string day_entry = "";
|
||||
|
@ -1030,6 +1032,21 @@ namespace SparkleShare {
|
|||
|
||||
web_client.DownloadStringAsync (uri);
|
||||
}
|
||||
|
||||
|
||||
private string [] tango_palette = new string [] {"#fce94f", "#edd400",
|
||||
"#c4a000", "#8ae234", "#73d216", "#4e9a06", "#fcaf3e", "#f57900",
|
||||
"#ce5c00", "#e9b96e", "#c17d11", "#8f5902", "#729fcf", "#3465a4",
|
||||
"#204a87", "#ad7fa8", "#75507b", "#5c3566", "#888a85", "#555753",
|
||||
"#2e3436", "#ef2929", "#cc0000", "#a40000"};
|
||||
|
||||
private string AssignColor (string s)
|
||||
{
|
||||
string hash = GetMD5 (s).Substring (0, 6);
|
||||
string numbers = Regex.Replace (hash, "[a-z]", "");
|
||||
int number = int.Parse (numbers);
|
||||
return this.tango_palette [number % this.tango_palette.Length];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class='event-entry'>
|
||||
|
||||
<div class='event-entry-content' style='border-bottom: 3px #8ae234 solid'>
|
||||
<div class='event-entry-content' style='border-bottom: 3px <!-- $event-folder-color --> solid'>
|
||||
|
||||
<div class='no-buddy-icon'>
|
||||
<div class='buddy-icon' style='background-image: url("<!-- $event-avatar-url -->");'></div>
|
||||
|
@ -11,7 +11,7 @@
|
|||
<!-- $event-entry-content -->
|
||||
</div>
|
||||
|
||||
<div class='event-time' style='position: relative;float: right'>gnome-design • <!-- $event-time --></div>
|
||||
<div class='event-time' style='position: relative;float: right'><!-- $event-folder --> • <!-- $event-time --></div>
|
||||
|
||||
<div style='clear: both'></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue