Installation
ASP.net Core
installation video tutorial here 1) We recommend you download the MinSetupCoreDemo to use as an example, and you can also copy the dll/js/css files from it. 2) Copy and put in the same folders in your solution the following:libs folder: Omu.AwesomeMvc.dll/xml, Omu.Awem.dll/xml3) Add nuget package reference to
wwwroot/js: AwesomeMvc.js, awem.js, aweUtils.js
wwwroot/css: themes folder
Newtonsoft.Json13 or higher (if you don't have it already). 4) Add Reference to
Omu.AwesomeMvc.dlland
Omu.Awem.dll(right click your project -> Add -> Project Reference -> Browse -> Select dlls -> OK). 5) Add the following to
Views\_ViewImports.cshtml:
@using Omu.AwesomeMvc6) Open
@using Omu.Awem.Helpers
_Layout.cshtmland add references to jQuery and Awesome css and js files after declare the
@Html.Awe().Init()html helper, example:
<link href="~/css/themes/gui3/AwesomeMvc.css" rel="stylesheet" type="text/css"/>At this point you should be able to write
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="~/js/AwesomeMvc.js" type="text/javascript"></script>
<script src="~/js/awem.js" type="text/javascript"></script>
<script src="~/js/aweUtils.js" type="text/javascript"></script>
@Html.Awe().Init()
@Html.Awe().Button().Text("hi").OnClick("awem.notif('hi')")in your
Index.cshtmland it should work. 7) In
Program.csadd or merge the following (this is for the metadata attributes):
var provider = new AweMetaProvider();If you're using
builder.Services.AddControllersWithViews(o => o.ModelMetadataDetailsProviders.Add(provider));
Startup.cs, in
Startup.cs -> ConfigureSerices:
var provider = new AweMetaProvider();Optional steps (utils used in our grid crud demos): 8) From the MinSetupCoreDemo copy the
services.AddMvc(o =>
{
o.ModelMetadataDetailsProviders.Add(provider);
});
Utilsand
Helpersfolder, and
ViewModel/Input/DeleteConfirmInput.cs, edit the namespaces in the copied
.csfiles to match your project. 9) Copy/merge the content of
Views\_ViewImports.cshtml, you need to modify some lines to match the namespaces of your project (e.g.
MyProject.Helpersinstead of
MinSetupCore.Helpers). 10) Copy
Shared/Delete.cshtml,
Shared/_FieldLayout.cshtml, and
Shared/EditorTemplatesfolder. ASP.net Core _Layout.cshtml example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] </title>
<link href="~/css/themes/gui3/AwesomeMvc.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div class="main">
@RenderBody()
</div>
<script src="~/js/AwesomeMvc.js" type="text/javascript"></script>
<script src="~/js/awem.js" type="text/javascript"></script>
<script src="~/js/aweUtils.js" type="text/javascript"></script>
@*call init after aweUtils.js *@
@Html.Awe().Init()
</body>
</html>
ASP.net MVC 5
1) Download the MinSetupDemo, 2) Copy from it and put in the same folders in your solution the following:libs folder: Omu.AwesomeMvc.dll/xml, Omu.Awem.dll/xml3) Reference
Scripts folder: AwesomeMvc.js, awem.js, aweUtils.js
Content/themes folder: copy the whole folder
Omu.AwesomeMvc.dlland
Omu.Awem.dllin your web project. 4) Open
Views\web.configand in
<system.web.webPages.razor> -> <pages> -> <namespaces>add:
<add namespace="Omu.AwesomeMvc" />If you're using aspx, ascx views you would add the same in the main web.config in
<add namespace="Omu.Awem.Helpers" />
<system.web> -> <pages> -> <namespaces>5) Open
_Layout.cshtmland copy the references to the js and css files ( keep the same order ), and the call to
@Html.Awe().Init(). At this point you should be able to write
@Html.Awe().Button().Text("hi").OnClick("awem.notif('awesome')")in your
Index.cshtmland it will work. Optional (utils used in our grid crud demos): 6) Copy the
Utilsand
Helpersfolder, and
ViewModel/Input/DeleteConfirmInput.cs, include them in your project, edit the namespaces in the copied cs files to match your project. 7) add the new namespaces to the
Views\web.config
<add namespace="YourAppNamespace.Utils" />8) You can also copy the
<add namespace="YourAppNamespace.Helpers.Awesome" />
Views/Shared/EditorTemplatesfolder and
Views/Shared/Delete.cshtml, if you're following/copying from our demos it is likely that you're going to need them.
aweui
If you want to add aweui to an app that already hasAwesomeMvc.jsreferenced, you must not add
awef.jsand
awe.jsbecause
AwesomeMvc.jscontains both of them. All you need to add is:
awedict.js(or
awedict.fr.jsfor example) and
aweui.js.
@Html.Awe().Init()will call
aweui.init()if it finds
aweuipresent so there no need to call it again. For an example you can download our AweMySql demo, it uses both ASP.net Core Awesome and aweui.
Include jQuery at the bottom of the page
jQuery needs to be referenced before any awesome helper is called, however you can avoid that using theAwejQuery()helper, call it in the
headtag instead of jquery:
@Html.Awe().AwejQuery()and now you can include the script reference to jQuery at the bottom of the page, but still before the awesome js files, you can see this helper being used in our main demo's
</head>
_Layout.cshtml.
Inline styles and js
By default our html helpers will generate an inline script for each helper declaration, if your application needs to avoid that you can call inProgram.cs(or
Startup.cs) the following:
Settings.UseInlineStyleAndJS = false;Instead of the
Awe().Init()helper we will use the
Awe().InitTag()and reference
aweinit.jsafter we've referenced all awe js files:
@Html.Awe().InitTag()
<script src="~/js/aweinit.js" type="text/javascript"></script>
Comments