Skip to content

Commit

Permalink
Merge pull request #119 from RaythaHQ/templates_upload_assets
Browse files Browse the repository at this point in the history
Convenience dropzone for Templates
  • Loading branch information
apexdodge committed Apr 15, 2023
2 parents 84883d0 + 3d6aee2 commit 645235f
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 30 deletions.
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,46 @@

![rsz_color_logo_with_background](https://user-images.githubusercontent.com/777005/210120197-61101dee-91c7-4628-8fb4-c0d701843704.png)

Introducing Raytha, the ultimate content management system for .NET developers!
Raytha is a versatile and lightweight general purpose content management system. Create any type of website by easily configuring custom content types and HTML templates that can be directly edited within the platform.

With Raytha, you'll be able to quickly and easily kickstart the development of your .NET applications. Its lightweight, fast, and self-hosted design makes it perfect for rapid development and deployment.
<details>
<summary>See it in action (2 min 📹)</summary>

[![Quick silent demo](https://user-images.githubusercontent.com/777005/232171420-35104db8-4c19-46b5-bbe0-87e4b19316fe.mp4)](https://user-images.githubusercontent.com/777005/232171420-35104db8-4c19-46b5-bbe0-87e4b19316fe.mp4)
</details>

* Create custom content types without any code
* Integrated Template Engine using popular Liquid syntax
* Audit logs, role-based access controls, and single sign-on options (SAML and Json Web Token)
* Supports local file system storage, Azure Blob, and S3-compatible providers
* REST API automatically generated based on content types
<strong>🌐 [Raytha.com](https://raytha.com) 📹 [Intro Video](https://www.youtube.com/watch?v=k6VrvqH8PBY) 📖 [User Guide](https://raytha.com/user-guide) 👨‍💻 [Developer Docs](https://docs.raytha.com)</strong>

[Learn more about Raytha on our website.](https://raytha.com) and the [Raytha Youtube channel](https://www.youtube.com/channel/UCuQtF2WwODs2DfZ4pV-2SfA).
![image](https://user-images.githubusercontent.com/777005/232172756-4c1ffd34-ea4f-4dbd-bffc-8a7a22ef9e75.png)

## Getting Started
## Feature Highlights

* <strong>Content Types:</strong> Effortlessly create and customize content types, no code changes required.
* <strong>Role Based Access Control:</strong> Design customized roles with specific access permissions and assign them to individual users.
* <strong>Built In Template Engine</strong>: Easily modify templates within the platform using the popular Liquid templating engine.
* <strong>Headless Mode:</strong> Instant access to a REST API based on your content, automatically generated for you.
* <strong>Audit Logs:</strong> Built-in audit trail that tracks all edits made for enhanced security.
* <strong>Single Sign On:</strong> SAML and Json Web Token authentication are available out of the box for both administrators and public users.
* <strong>Revisions:</strong> Revisions of all content and templates are stored, enabling you to go back and revert to a previous version if needed.
* <strong>File Storage:</strong> The platform supports local file storage by default, but cloud storage options such as Azure Blob or S3-Compatible can be enabled if desired.

👀 [Learn more about Raytha on our website.](https://raytha.com) and the [Raytha Youtube channel](https://www.youtube.com/channel/UCuQtF2WwODs2DfZ4pV-2SfA) 📺.

## Why Raytha?

### Content Managers Love It

📝 Content managers love Raytha not only for its minimal learning curve, simplicity, and self-evident UI, but also for its ease of granting different permission levels and roles to various admins, as well as its ability to revert back to previous versions of articles effortlessly. Raytha's audit logs functionality is also highly valued by content administrators, allowing them to keep track of all changes made to the content, and ensuring greater transparency and accountability across the organization.

### Rapid Prototyping

👨‍💻 Know HTML? Raytha makes it easy for project managers and tech-savvy individuals to create custom websites in a snap. You can go the distance with just a basic understanding of HTML. From blogs and corporate sites to photo and video galleries, event websites, job boards, and beyond, Raytha can help you rapidly prototype a new concept.

### Starter Kit for Developers

🚀 If you're a .NET developer looking to jumpstart your web application development, Raytha's boilerplate template can save you valuable time. Raytha offers a host of features including user management, role-based access control (RBAC), single sign-on, and audit logs functionality, as well as interfaces for file storage with Azure Blob and S3-compatible providers. Its architecture is built on the well-known [CleanArchitecture](https://github.com/jasontaylordev/CleanArchitecture) template, which means that any .NET developer can easily familiarize themselves with the backend functionality. With Raytha, you can hit the ground running and get your web application up and running in no time.

## Developer Quick Start

A priority of Raytha is to keep the technology footprint small for getting up and running as quickly as possible. However, you do need the minimum requirements listed below:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public async Task<IActionResult> Edit(string id)
DeveloperName = response.Result.DeveloperName,
Cc = response.Result.Cc,
Bcc = response.Result.Bcc,
TemplateVariables = templateVariableDictionary
TemplateVariables = templateVariableDictionary,
AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes,
MaxFileSize = FileStorageProviderSettings.MaxFileSize,
UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud,
PathBase = CurrentOrganization.PathBase
};

return View("~/Areas/Admin/Views/Templates/Email/Edit.cshtml", model);
Expand Down Expand Up @@ -91,7 +95,10 @@ public async Task<IActionResult> Edit(EmailTemplatesEdit_ViewModel model, string
{
var templateVariableDictionary = GetInsertVariablesViewModel(model.DeveloperName);
model.TemplateVariables = templateVariableDictionary;

model.AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes;
model.MaxFileSize = FileStorageProviderSettings.MaxFileSize;
model.UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud;
model.PathBase = CurrentOrganization.PathBase;
SetErrorMessage("There was an error attempting to update this template. See the error below.", response.GetErrors());
return View("~/Areas/Admin/Views/Templates/Email/Edit.cshtml", model);
}
Expand Down
21 changes: 18 additions & 3 deletions src/Raytha.Web/Areas/Admin/Controllers/WebTemplatesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ public async Task<IActionResult> Create()
{
ParentTemplates = baseLayoutsDictionary,
TemplateAccessToModelDefinitions = templateAccessList.ToArray(),
TemplateVariables = templateVariableDictionary
TemplateVariables = templateVariableDictionary,
AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes,
MaxFileSize = FileStorageProviderSettings.MaxFileSize,
UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud,
PathBase = CurrentOrganization.PathBase
};

return View("~/Areas/Admin/Views/Templates/Web/Create.cshtml", viewModel);
Expand Down Expand Up @@ -121,6 +125,10 @@ public async Task<IActionResult> Create(WebTemplatesCreate_ViewModel model)
var contentTypes = await Mediator.Send(new GetContentTypes.Query { PageSize = int.MaxValue });
var templateVariableDictionary = GetInsertVariablesViewModel(model.DeveloperName, false, contentTypes.Result.Items);
model.TemplateVariables = templateVariableDictionary;
model.AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes;
model.MaxFileSize = FileStorageProviderSettings.MaxFileSize;
model.UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud;
model.PathBase = CurrentOrganization.PathBase;

SetErrorMessage("There was an error attempting to update this template. See the error below.", response.GetErrors());
return View("~/Areas/Admin/Views/Templates/Web/Create.cshtml", model);
Expand Down Expand Up @@ -168,7 +176,11 @@ public async Task<IActionResult> Edit(string id)
IsBuiltInTemplate = response.Result.IsBuiltInTemplate,
TemplateAccessToModelDefinitions = templateAccessChoiceItems.ToArray(),
TemplateVariables = templateVariableDictionary,
AllowAccessForNewContentTypes = response.Result.AllowAccessForNewContentTypes
AllowAccessForNewContentTypes = response.Result.AllowAccessForNewContentTypes,
AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes,
MaxFileSize = FileStorageProviderSettings.MaxFileSize,
UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud,
PathBase = CurrentOrganization.PathBase
};

if (WebTemplateExtensions.HasRenderBodyTag(response.Result.Content) && !response.Result.IsBaseLayout)
Expand Down Expand Up @@ -218,7 +230,10 @@ public async Task<IActionResult> Edit(WebTemplatesEdit_ViewModel model, string i
var contentTypes = await Mediator.Send(new GetContentTypes.Query { PageSize = int.MaxValue });
var templateVariableDictionary = GetInsertVariablesViewModel(templateResponse.Result.DeveloperName, templateResponse.Result.IsBuiltInTemplate, contentTypes.Result.Items);
model.TemplateVariables = templateVariableDictionary;

model.AllowedMimeTypes = FileStorageProviderSettings.AllowedMimeTypes;
model.MaxFileSize = FileStorageProviderSettings.MaxFileSize;
model.UseDirectUploadToCloud = FileStorageProviderSettings.UseDirectUploadToCloud;
model.PathBase = CurrentOrganization.PathBase;
SetErrorMessage("There was an error attempting to update this template. See the error below.", response.GetErrors());
return View("~/Areas/Admin/Views/Templates/Web/Edit.cshtml", model);
}
Expand Down
23 changes: 23 additions & 0 deletions src/Raytha.Web/Areas/Admin/Views/Templates/Email/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@
<div class="@Model.HasError("Content")" id="editorContainer" style="height:500px;" data-templates--codehighlighting-target="editor"></div>
<input type="hidden" asp-for="Content" data-templates--codehighlighting-target="textarea" />
<div class="invalid-feedback">@Model.ErrorMessageFor("Content")</div>
<div id="uploadAssets"
data-controller="templates--uploadasset"
data-templates--uploadasset-fieldid-value="uploadAssets"
data-templates--uploadasset-mimetypes-value="@Model.AllowedMimeTypes"
data-templates--uploadasset-usedirectuploadtocloud-value="@Model.UseDirectUploadToCloud"
data-templates--uploadasset-maxfilesize-value="@Model.MaxFileSize" ,
data-templates--uploadasset-pathbase-value="@Model.PathBase">

<div id="uploadAssets-uppy" data-templates--uploadasset-target="uppyContainer"></div>
<div>
<div class="toast align-items-center text-white bg-success border-0" role="alert" aria-live="assertive"
aria-atomic="true" data-templates--uploadasset-target="toast">
<div class="d-flex">
<div class="toast-body">
Successfully copied to the clipboard!
</div>
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<ul id="uploadAssets-uppy-copyurls" class="list-group" data-templates--uploadasset-target="uppyCopyUrls">
</ul>
</div>
</div>
</div>
</div>
<input type="hidden" asp-for="Id">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class EmailTemplatesEdit_ViewModel : FormSubmit_ViewModel
public string Bcc { get; set; }

//helpers
public long MaxFileSize { get; set; }
public string AllowedMimeTypes { get; set; }
public bool UseDirectUploadToCloud { get; set; }
public string PathBase { get; set; }
public Dictionary<string, IEnumerable<InsertVariableListItem_ViewModel>> TemplateVariables { get; set; }
}

Expand Down
24 changes: 24 additions & 0 deletions src/Raytha.Web/Areas/Admin/Views/Templates/Web/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@
<div class="@Model.HasError("Content")" id="editorContainer" style="height:500px;" data-templates--codehighlighting-target="editor"></div>
<input type="hidden" asp-for="Content" data-templates--codehighlighting-target="textarea" />
<div class="invalid-feedback">@Model.ErrorMessageFor("Content")</div>
<div id="uploadAssets"
data-controller="templates--uploadasset"
data-templates--uploadasset-fieldid-value="uploadAssets"
data-templates--uploadasset-mimetypes-value="@Model.AllowedMimeTypes"
data-templates--uploadasset-usedirectuploadtocloud-value="@Model.UseDirectUploadToCloud"
data-templates--uploadasset-maxfilesize-value="@Model.MaxFileSize" ,
data-templates--uploadasset-pathbase-value="@Model.PathBase">

<div id="uploadAssets-uppy" data-templates--uploadasset-target="uppyContainer"></div>
<div>
<div class="toast align-items-center text-white bg-success border-0" role="alert" aria-live="assertive"
aria-atomic="true" data-templates--uploadasset-target="toast">
<div class="d-flex">
<div class="toast-body">
Successfully copied to the clipboard!
</div>
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<ul id="uploadAssets-uppy-copyurls" class="list-group" data-templates--uploadasset-target="uppyCopyUrls">

</ul>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-success mt-4">Publish changes</button>
Expand Down
23 changes: 23 additions & 0 deletions src/Raytha.Web/Areas/Admin/Views/Templates/Web/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,29 @@
<div class="@Model.HasError("Content")" id="editorContainer" style="height:500px;" data-templates--codehighlighting-target="editor"></div>
<input type="hidden" asp-for="Content" data-templates--codehighlighting-target="textarea" />
<div class="invalid-feedback">@Model.ErrorMessageFor("Content")</div>
<div id="uploadAssets"
data-controller="templates--uploadasset"
data-templates--uploadasset-fieldid-value="uploadAssets"
data-templates--uploadasset-mimetypes-value="@Model.AllowedMimeTypes"
data-templates--uploadasset-usedirectuploadtocloud-value="@Model.UseDirectUploadToCloud"
data-templates--uploadasset-maxfilesize-value="@Model.MaxFileSize" ,
data-templates--uploadasset-pathbase-value="@Model.PathBase">

<div id="uploadAssets-uppy" data-templates--uploadasset-target="uppyContainer"></div>
<div>
<div class="toast align-items-center text-white bg-success border-0" role="alert" aria-live="assertive"
aria-atomic="true" data-templates--uploadasset-target="toast">
<div class="d-flex">
<div class="toast-body">
Successfully copied to the clipboard!
</div>
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<ul id="uploadAssets-uppy-copyurls" class="list-group" data-templates--uploadasset-target="uppyCopyUrls">
</ul>
</div>
</div>
</div>
</div>
<input type="hidden" asp-for="Id">
Expand Down
8 changes: 8 additions & 0 deletions src/Raytha.Web/Areas/Admin/Views/Templates/Web/ViewModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public class WebTemplatesCreate_ViewModel : FormSubmit_ViewModel
public bool AllowAccessForNewContentTypes { get; set; } = true;

//helpers
public long MaxFileSize { get; set; }
public string AllowedMimeTypes { get; set; }
public bool UseDirectUploadToCloud { get; set; }
public string PathBase { get; set; }
public Dictionary<string, string> ParentTemplates { get; set; }
public Dictionary<string, IEnumerable<InsertVariableListItem_ViewModel>> TemplateVariables { get; set; }
}
Expand Down Expand Up @@ -88,6 +92,10 @@ public class WebTemplatesEdit_ViewModel : FormSubmit_ViewModel
public bool AllowAccessForNewContentTypes { get; set; }

//helpers
public long MaxFileSize { get; set; }
public string AllowedMimeTypes { get; set; }
public bool UseDirectUploadToCloud { get; set; }
public string PathBase { get; set; }
public Dictionary<string, string> ParentTemplates { get; set; }
public bool IsBuiltInTemplate { get; set; }
public Dictionary<string, IEnumerable<InsertVariableListItem_ViewModel>> TemplateVariables { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Raytha.Web/Raytha.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<UptoDateCheckInput Remove="wwwroot\raytha_admin\js\src\controllers\contentitems\wysiwyg_controller.js" />
<UptoDateCheckInput Remove="wwwroot\raytha_admin\js\src\controllers\roles\autodisable_controller.js" />
<UptoDateCheckInput Remove="wwwroot\raytha_admin\js\src\controllers\templates\codehighlighting_controller.js" />
<UptoDateCheckInput Remove="wwwroot\raytha_admin\js\src\controllers\templates\uploadasset_controller.js" />
<UptoDateCheckInput Include="$(JsApplicationRoot)package.json" />
<UpToDateCheckBuilt Include="$(JsApplicationBundleFile)" />
</ItemGroup>
Expand Down

0 comments on commit 645235f

Please sign in to comment.