Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/grandnode/grandnode into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
PatrykPorabik committed Jun 14, 2019
2 parents 95ecae0 + 997372f commit 5a39ae3
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 25 deletions.
6 changes: 6 additions & 0 deletions Grand.Core/Configuration/GrandConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public GrandConfig()
/// </summary>
public bool UseRoslynScripts { get; set; }

/// <summary>
/// Enable minimal Progressive Web App.
/// </summary>
public bool EnableProgressiveWebApp { get; set; }
public int ServiceWorkerStrategy { get; set; }

/// <summary>
/// Gets or sets a value of "Cache-Control" header value for static content
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Grand.Framework/Grand.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.9.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.5.0" />
<PackageReference Include="Wangkanai.Detection.Device" Version="2.0.0-beta11" />
<PackageReference Include="WebEssentials.AspNetCore.PWA" Version="1.0.49" />
<PackageReference Include="WebMarkupMin.AspNetCore2" Version="2.5.0" />
<PackageReference Include="WebMarkupMin.Core" Version="2.5.7" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,5 +422,24 @@ public static void AddDetectionDevice(this IServiceCollection services)
{
services.AddDetectionCore().AddDevice();
}

/// <summary>
/// Add Progressive Web App
/// </summary>
/// <param name="services">Collection of service descriptors</param>
public static void AddPWA(this IServiceCollection services)
{
if (!DataSettingsHelper.DatabaseIsInstalled())
return;

var config = services.BuildServiceProvider().GetRequiredService<GrandConfig>();
if (config.EnableProgressiveWebApp)
{
var options = new WebEssentials.AspNetCore.Pwa.PwaOptions {
Strategy = (WebEssentials.AspNetCore.Pwa.ServiceWorkerStrategy)config.ServiceWorkerStrategy
};
services.AddProgressiveWebApp(options);
}
}
}
}
3 changes: 3 additions & 0 deletions Grand.Framework/Infrastructure/GrandMvcStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
//add and configure MVC feature
services.AddGrandMvc();

//add pwa
services.AddPWA();

//add custom redirect result executor
services.AddGrandRedirectResultExecutor();
}
Expand Down
9 changes: 9 additions & 0 deletions Grand.Web/App_Data/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
//https://github.com/dotnet/roslyn/wiki/Roslyn-Overview
"UseRoslynScripts": false,

///Enable minimal Progressive Web App.
"EnableProgressiveWebApp": false,
//CacheFirst = 0,
//CacheFirstSafe = 1,
//CacheFingerprinted = 2,
//Minimal = 3,
//NetworkFirst = 4
"ServiceWorkerStrategy": 3,

//Use my request localization culture
"UseRequestLocalization": false,
"DefaultRequestCulture": "en-US",
Expand Down
12 changes: 6 additions & 6 deletions Grand.Web/Areas/Admin/Views/Customer/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<div class="btn-group btn-group-devided util-btn-margin-bottom-5">
<button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @T("Admin.Common.Save") </button>
<button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @T("Admin.Common.SaveContinue") </button>
<input type="button" id="sendemail" class="btn yellow" value="@T("Admin.Customers.Customers.SendEmail")" />
<input type="button" id="sendprivatemessage" class="btn blue" value="@T("Admin.Customers.Customers.SendPM")" />
<button class="btn btn-info" type="submit" id="sendemail"><i class="fa fa-paper-plane" aria-hidden="true"></i> &nbsp;@T("Admin.Customers.Customers.SendEmail") </button>
<button class="btn btn-warning" type="submit" id="sendprivatemessage"><i class="fa fa-paper-plane" aria-hidden="true"></i> &nbsp;@T("Admin.Customers.Customers.SendPM") </button>
@if (Model.AllowSendingOfWelcomeMessage)
{
<input type="submit" name="send-welcome-message" class="btn default" value="@T("Admin.Customers.Customers.SendWelcomeMessage")" onclick="return confirm('@T("Admin.Common.AreYouSure")');" />
<button class="btn btn-primary" type="submit" name="send-welcome-message" onclick="return confirm('@T("Admin.Common.AreYouSure")');"><span class="k-icon k-i-rotate"></span> &nbsp;@T("Admin.Customers.Customers.SendWelcomeMessage") </button>
}
@if (Model.AllowReSendingOfActivationMessage)
{
<input type="submit" name="resend-activation-message" class="btn default" value="@T("Admin.Customers.Customers.ReSendActivationMessage")" onclick="return confirm('@T("Admin.Common.AreYouSure")');" />
<button class="btn btn-primary" type="submit" name="resend-activation-message" onclick="return confirm('@T("Admin.Common.AreYouSure")');"><span class="k-icon k-i-rotate"></span> &nbsp;@T("Admin.Customers.Customers.ReSendActivationMessage") </button>
}
<span id="customer-delete" class="btn red"><i class="fa fa-trash-o"></i><span class="hidden-xs"> @T("Admin.Common.Delete")</span></span>
<vc:admin-widget widget-zone="customer_details_buttons" additional-data="Model" />
Expand Down Expand Up @@ -80,7 +80,7 @@
</div>
<div class="form-actions">
<div class="col-md-offset-3 col-sm-offset-3 col-md-6 col-sm-6">
<input type="submit" class="btn default" value="@T("Admin.Customers.Customers.SendEmail")" />
<button type="submit" class="k-button"><span class="k-icon k-i-email"></span>&nbsp;@T("Admin.Customers.Customers.SendEmail")</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -129,7 +129,7 @@
</div>
<div class="form-actions">
<div class="col-md-offset-3 col-sm-offset-3 col-md-6 col-sm-6">
<input type="submit" class="btn default" value="@T("Admin.Customers.Customers.SendPM")" />
<button type="submit" class="k-button"><span class="k-icon k-i-email-box"></span>&nbsp;@T("Admin.Customers.Customers.SendPM")</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ $(document).ready(function () {
field: "Id",
title: "@T("Admin.Common.Edit")",
width: 100,
template: '<a class="k-link" href="@Url.Content("~/Admin/Customer/AddressEdit?customerId=")@Model.Id&addressid=#=Id#">@T("Admin.Common.Edit")</a>'
template: '<a class="k-button" href="@Url.Content("~/Admin/Customer/AddressEdit?customerId=")@Model.Id&addressid=#=Id#"><span class="k-icon k-i-edit"></span>&nbsp;&nbsp;@T("Admin.Common.Edit")</a>'
}, {
command: { name: "destroy", text: "@T("Admin.Common.Delete")" },
title: "@T("Admin.Common.Delete")",
Expand Down
14 changes: 7 additions & 7 deletions Grand.Web/Areas/Admin/Views/Customer/_CustomerAttributes.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
case AttributeControlType.DropdownList:
{
<select class="control-label" name="@(controlId)" id="@(controlId)">
<select class="form-control k-input" name="@(controlId)" id="@(controlId)">
@if (!attribute.IsRequired)
{
<option value="0">---</option>
Expand Down Expand Up @@ -45,22 +45,22 @@
<div class="checkbox-list">
@foreach (var attributeValue in attribute.Values)
{
<div>
<input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />
<label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>
</div>
<div>
<input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />
<label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>
</div>
}
</div>
}
break;
case AttributeControlType.TextBox:
{
<input name="@(controlId)" type="text" class="text-box single-line control-label" id="@(controlId)" value="@attribute.DefaultValue" />
<input name="@(controlId)" type="text" class="form-control k-input text-box single-line" id="@(controlId)" value="@attribute.DefaultValue" />
}
break;
case AttributeControlType.MultilineTextbox:
{
<textarea id="@(controlId)" style="Height: 150px;" class="control-label" name="@(controlId)">@attribute.DefaultValue</textarea>
<textarea id="@(controlId)" style="Height: 150px;" class="form-control k-input" name="@(controlId)">@attribute.DefaultValue</textarea>
}
break;
case AttributeControlType.Datepicker:
Expand Down
4 changes: 2 additions & 2 deletions Grand.Web/Areas/Admin/Views/Product/BulkEdit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
}, {
field: "ProductId",
title: "@T("Admin.Common.View")",
width: 50,
template: '<a class="k-link" href="@Url.Content("~/Admin/Product/Edit/")#=Id#">@T("Admin.Common.View")</a>'
width: 75,
template: '<a class="k-button" href="@Url.Content("~/Admin/Product/Edit/")#=Id#"><i class="fa fa-eye" aria-hidden="true"></i>&nbsp;&nbsp;@T("Admin.Common.View")</a>'
},{
field: "Sku",
title: "@T("Admin.Catalog.BulkEdit.Fields.Sku")",
Expand Down
8 changes: 5 additions & 3 deletions Grand.Web/Areas/Admin/Views/Setting/Media.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
@T("Admin.Configuration.Settings.Media.PicturesStoredIntoDatabase.FileSystem")
}
</div>
<input type="submit" name="change-picture-storage" class="k-button" onclick="return confirm('@T("Admin.Common.AreYouSure")');" value="@T("Admin.Configuration.Settings.Media.PicturesStoredIntoDatabase.Change")" />
<br />
<span>@T("Admin.Configuration.Settings.Media.PicturesStoredIntoDatabase.Note")</span>
<button type="submit" name="change-picture-storage" onclick="return confirm('@T("Admin.Common.AreYouSure")');" class="k-button"><span class="k-icon k-i-rotate"></span>&nbsp;@T("Admin.Configuration.Settings.Media.PicturesStoredIntoDatabase.Change")</button>
<p>&nbsp;</p>
<div class="note note-warning">
<span>@T("Admin.Configuration.Settings.Media.PicturesStoredIntoDatabase.Note")</span>
</div>
</div>
</div>
<div class="form-group">
Expand Down
12 changes: 6 additions & 6 deletions Grand.Web/Areas/Admin/Views/Shipment/ShipmentDetails.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
@if (Model.ShippedDateUtc.HasValue)
{
<div id="divShippedDate" style="display: inline-block;"><admin-input asp-for="ShippedDate" /> &nbsp;@T("Admin.Orders.Shipments.ShippedDate.Enter")</div>
<input type="submit" value="@T("Admin.Common.Edit")" onclick=" toggleShippedDate(true);return false; " id="btnEditShippedDate" class="btn default" />
<input type="submit" value="@T("Admin.Common.Save")" id="btnSaveShippedDate" name="saveshippeddate" class="btn default" onclick=" return confirm('@T("Admin.Common.AreYouSure")'); " />
<input type="submit" value="@T("Admin.Common.Cancel")" onclick=" toggleShippedDate(false);return false; " id="btnCancelShippedDate" class="btn default" />
<button type="submit" id="btnEditShippedDate" onclick=" toggleShippedDate(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@T("Admin.Common.Edit")</button>
<button type="submit" id="btnSaveShippedDate" name="saveshippeddate" onclick=" return confirm('@T("Admin.Common.AreYouSure")'); " class="k-button"><span class="k-icon k-i-save"></span>&nbsp;@T("Admin.Common.Save")</button>
<button type="submit" id="btnCancelShippedDate" onclick=" toggleShippedDate(false);return false; " class="k-button"><span class="k-icon k-i-cancel"></span>&nbsp;@T("Admin.Common.Cancel")</button>
}
</div>
</div>
Expand All @@ -161,9 +161,9 @@
@if (Model.DeliveryDateUtc.HasValue)
{
<div id="divDeliveryDate" style="display: inline-block;"><admin-input asp-for="DeliveryDate" /> &nbsp;@T("Admin.Orders.Shipments.DeliveryDate.Enter")</div>
<input type="submit" value="@T("Admin.Common.Edit")" onclick=" toggleDeliveryDate(true);return false; " id="btnEditDeliveryDate" class="btn default" />
<input type="submit" value="@T("Admin.Common.Save")" id="btnSaveDeliveryDate" name="savedeliverydate" class="btn default" onclick=" return confirm('@T("Admin.Common.AreYouSure")'); " />
<input type="submit" value="@T("Admin.Common.Cancel")" onclick=" toggleDeliveryDate(false);return false; " id="btnCancelDeliveryDate" class="btn default" />
<button type="submit" id="btnEditDeliveryDate" onclick=" toggleDeliveryDate(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@T("Admin.Common.Edit")</button>
<button type="submit" id="btnSaveDeliveryDate" name="savedeliverydate" onclick=" return confirm('@T("Admin.Common.AreYouSure")'); " class="k-button"><span class="k-icon k-i-save"></span>&nbsp;@T("Admin.Common.Save")</button>
<button type="submit" id="btnCancelDeliveryDate" onclick=" toggleDeliveryDate(false);return false; " class="k-button"><span class="k-icon k-i-cancel"></span>&nbsp;@T("Admin.Common.Cancel")</button>
}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions Grand.Web/Views/Shared/_Root.Head.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<meta name="keywords" content="@(Html.GrandMetaKeywords())">
<meta name="generator" content="grandnode">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
@*<link rel="manifest" href="/manifest.webmanifest" />*@
@Html.GrandHeadCustom()
@*This is used so that themes can inject content into the header*@
<partial name="Head" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Grand.Web/wwwroot/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Grandnode Application",
"short_name": "GrandNode",
"description": "Open Source Cross Platform E-Commerce Solution based on .NET Core and MondoDB",
"icons": [{
"src": "content/images/icons/144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "content/images/icons/512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "content/images/icons/192x192.png",
"sizes": "192x192",
"type": "image/png"
}
],
"display": "standalone",
"start_url": "/",
"background_color": "#fff",
"theme_color": "#fff"
}

0 comments on commit 5a39ae3

Please sign in to comment.