private static void AddToBundles(BundleCollection bundles, ContentStatus contentStatus) { // Get Domain Path var currentDirectory = HttpRuntime.AppDomainAppPath + "\\Content"; // Get content folder. Depends on content status var directories = Directory.GetDirectories(currentDirectory).Where(x => x.Contains(contentStatus.ToString())); foreach (var folder in directories) { var subFolders = Directory.GetDirectories(folder); // Get content sub folders foreach (var subFolder in subFolders) { string subFolderName = subFolder.Split('\\').Last(); // Create bundle Bundle bundle = null; if (contentStatus.ToString() == "css") { bundle = new Bundle("~/Content/" + contentStatus.ToString() + "/" + subFolderName + ""); } else if (contentStatus.ToString() == "js") { bundle = new Bundle("~/bundles/" + contentStatus.ToString() + "/" + subFolderName + ""); } // Get sub folder files and include to bundle foreach (var files in Directory.GetFiles(subFolder)) { string fileName = files.Split('\\').Last(); bundle.Include("~/Content/" + contentStatus.ToString() + "/" + subFolderName + "/" + fileName + ""); } // Add to bundles bundles.Add(bundle); } } }
public static IHtmlContent ToHtml(this ContentStatus status) { switch (status) { case ContentStatus.Published: return(new HtmlString($"<span class='badge rounded-pill bg-success'>{status.ToString()}</span>")); case ContentStatus.Draft: return(new HtmlString($"<span class='badge rounded-pill bg-warning'>{status.ToString()}</span>")); case ContentStatus.Archived: return(new HtmlString($"<span class='badge rounded-pill bg-info'>{status.ToString()}</span>")); case ContentStatus.Private: return(new HtmlString($"<span class='badge rounded-pill bg-dark'><i class='fa fa-lock mr-2'></i>{status.ToString()}</span>")); case ContentStatus.Deleted: return(new HtmlString($"<span class='badge rounded-pill bg-danger'>{status.ToString()}</span>")); default: return(new HtmlString($"<span class='badge rounded-pill bg-light'>{status.ToString()}</span>")); } }
public static string ToGhostString(ContentStatus status) { return status.ToString().ToLower(); }
public static string ToGhostString(ContentStatus status) { return(status.ToString().ToLower()); }