Skip to content

Commit

Permalink
Merge pull request #2 from motime/WhiteLabelProductNameAndLogo
Browse files Browse the repository at this point in the history
whitelabel - adding logo and product name to options
jlucansky authored Jan 21, 2019
2 parents 1d7e689 + 853044c commit 8f80b78
Showing 4 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Source/Quartzmin.SelfHost/QuartzminPlugin.cs
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ public class QuartzminPlugin : ISchedulerPlugin
public string DefaultDateFormat { get; set; }
public string DefaultTimeFormat { get; set; }

public string Logo { get; set; }
public string ProductName { get; set; }

private IScheduler _scheduler;
private IDisposable _webApp;

@@ -73,6 +76,10 @@ private QuartzminOptions CreateQuartzminOptions()
options.DefaultDateFormat = DefaultDateFormat;
if (!string.IsNullOrEmpty(DefaultTimeFormat))
options.DefaultTimeFormat = DefaultTimeFormat;
if (!string.IsNullOrEmpty(Logo))
options.Logo = Logo;
if (!string.IsNullOrEmpty(ProductName))
options.ProductName = ProductName;

return options;
}
10 changes: 10 additions & 0 deletions Source/Quartzmin/Helpers/HandlebarsHelpers.cs
Original file line number Diff line number Diff line change
@@ -58,6 +58,8 @@ void RegisterInternal()
h.RegisterHelper(nameof(ToBase64), ToBase64);
h.RegisterHelper(nameof(footer), footer);
h.RegisterHelper(nameof(QuartzminVersion), QuartzminVersion);
h.RegisterHelper(nameof(Logo), Logo);
h.RegisterHelper(nameof(ProductName), ProductName);
}

static bool IsTrue(object value) => value?.ToString()?.Equals("true", StringComparison.OrdinalIgnoreCase) == true;
@@ -262,5 +264,13 @@ void QuartzminVersion(TextWriter output, dynamic context, params object[] argume
output.Write(v.InformationalVersion);
}

void Logo(TextWriter output, dynamic context, params object[] arguments)
{
output.Write(_services.Options.Logo);
}
void ProductName(TextWriter output, dynamic context, params object[] arguments)
{
output.Write(_services.Options.ProductName);
}
}
}
9 changes: 9 additions & 0 deletions Source/Quartzmin/QuartzminOptions.cs
Original file line number Diff line number Diff line change
@@ -9,6 +9,15 @@ namespace Quartzmin
{
public class QuartzminOptions
{
/// <summary>
/// Supports any value that is a viable as a img src attribute value: url, or base64
/// src='data:image/jpeg;base64, LzlqLzRBQ...[end of base64 data]'
/// Defaults to the quartzmin original logo
/// </summary>
public string Logo { get; set; } = "Content/Images/logo.png";

public string ProductName { get; set; } = "";

public string VirtualPathRoot { get; set; } = "/";

public IScheduler Scheduler { get; set; }
2 changes: 1 addition & 1 deletion Source/Quartzmin/Views/Layout.hbs
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
<div class="ui top inverted stackable menu" id="top-menu">
<div class="ui container">
<div class="ui header item">
<img class="logo" src="Content/Images/logo.png">Quartzmin
<img class="logo" src="{{Logo}}">{{ProductName}} Quartzmin
</div>

{{MenuItemActionLink text='Overview' controller='Scheduler'}}

0 comments on commit 8f80b78

Please sign in to comment.