MusicStore.Spa changes:
- Upgraded to Angular 1.3 (Fixes #267) - Fix XHR GET caching issue in IE with new NoCacheAttribute - Slight fix in admin home page (album list) to ensure initial data fetch has the sort expression in the query
This commit is contained in:
parent
6a4f49a188
commit
22ad9b9572
|
|
@ -19,6 +19,7 @@ namespace MusicStore.Apis
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[NoCache]
|
||||||
public async Task<ActionResult> Paged(int page = 1, int pageSize = 50, string sortBy = null)
|
public async Task<ActionResult> Paged(int page = 1, int pageSize = 50, string sortBy = null)
|
||||||
{
|
{
|
||||||
await _storeContext.Genres.LoadAsync();
|
await _storeContext.Genres.LoadAsync();
|
||||||
|
|
@ -36,6 +37,7 @@ namespace MusicStore.Apis
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("all")]
|
[HttpGet("all")]
|
||||||
|
[NoCache]
|
||||||
public async Task<ActionResult> All()
|
public async Task<ActionResult> All()
|
||||||
{
|
{
|
||||||
var albums = await _storeContext.Albums
|
var albums = await _storeContext.Albums
|
||||||
|
|
@ -48,6 +50,7 @@ namespace MusicStore.Apis
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("mostPopular")]
|
[HttpGet("mostPopular")]
|
||||||
|
[NoCache]
|
||||||
public async Task<ActionResult> MostPopular(int count = 6)
|
public async Task<ActionResult> MostPopular(int count = 6)
|
||||||
{
|
{
|
||||||
count = count > 0 && count < 20 ? count : 6;
|
count = count > 0 && count < 20 ? count : 6;
|
||||||
|
|
@ -61,6 +64,7 @@ namespace MusicStore.Apis
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{albumId:int}")]
|
[HttpGet("{albumId:int}")]
|
||||||
|
[NoCache]
|
||||||
public async Task<ActionResult> Details(int albumId)
|
public async Task<ActionResult> Details(int albumId)
|
||||||
{
|
{
|
||||||
await _storeContext.Genres.LoadAsync();
|
await _storeContext.Genres.LoadAsync();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
|
namespace MusicStore.Spa.Infrastructure
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
||||||
|
public sealed class NoCacheAttribute : ActionFilterAttribute
|
||||||
|
{
|
||||||
|
public override void OnResultExecuting(ResultExecutingContext context)
|
||||||
|
{
|
||||||
|
context.HttpContext.Response.Headers["Cache-Control"] = "private, max-age=0";
|
||||||
|
|
||||||
|
base.OnResultExecuting(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<DevelopmentServerPort>62635</DevelopmentServerPort>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
|
|
@ -11,4 +12,4 @@
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "~3.1.0",
|
"bootstrap": "~3.2.0",
|
||||||
"jquery-validation": "~1.13.0",
|
"jquery-validation": "~1.13.1",
|
||||||
"jquery": "~2.1.0",
|
"jquery": "~2.1.1",
|
||||||
"modernizr": "~2.7.1",
|
"modernizr": "~2.7.1",
|
||||||
"respond": "~1.4.2",
|
"respond": "~1.4.2",
|
||||||
"angular": "~1.2.15",
|
"angular": "~1.3.3",
|
||||||
"angular-route": "~1.2.15",
|
"angular-route": "~1.3.3",
|
||||||
"angular-bootstrap": "~0.11.2"
|
"angular-bootstrap": "~0.12.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dt-angular": "~1.2.16",
|
"dt-angular": "~1.2.16",
|
||||||
|
|
@ -18,23 +18,26 @@
|
||||||
"dt-jquery": "~2.0.0"
|
"dt-jquery": "~2.0.0"
|
||||||
},
|
},
|
||||||
"exportsOverride": {
|
"exportsOverride": {
|
||||||
"bootstrap": {
|
"bootstrap": {
|
||||||
"js": "dist/js/*.*",
|
"js": "dist/js/*.*",
|
||||||
"css": "dist/css/*.*",
|
"css": "dist/css/*.*",
|
||||||
"fonts": "dist/fonts/*.*"
|
"fonts": "dist/fonts/*.*"
|
||||||
},
|
},
|
||||||
"/jquery/": {
|
"/jquery/": {
|
||||||
"": "dist/*.*"
|
"": "dist/*.*"
|
||||||
},
|
},
|
||||||
"/angular/": {
|
"/angular/": {
|
||||||
"": "*.{js,map}"
|
"": "*.{js,map}"
|
||||||
},
|
},
|
||||||
"modernizr": {
|
"modernizr": {
|
||||||
"": "modernizr.js"
|
"": "modernizr.js"
|
||||||
},
|
},
|
||||||
"respond": {
|
"respond": {
|
||||||
"": "dest/*.*"
|
"": "dest/*.*"
|
||||||
},
|
},
|
||||||
"dt-*": { }
|
"dt-*": {}
|
||||||
}
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"angular": "~1.3.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,10 @@
|
||||||
|
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.pageSize = 50;
|
this.pageSize = 50;
|
||||||
this.loadPage(1);
|
|
||||||
this.sortColumn = "Title";
|
this.sortColumn = "Title";
|
||||||
|
|
||||||
|
this.loadPage(1);
|
||||||
|
|
||||||
this.showAlert(viewAlert.alert, 3000);
|
this.showAlert(viewAlert.alert, 3000);
|
||||||
viewAlert.alert = null;
|
viewAlert.alert = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -908,9 +908,10 @@ var MusicStore;
|
||||||
|
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.pageSize = 50;
|
this.pageSize = 50;
|
||||||
this.loadPage(1);
|
|
||||||
this.sortColumn = "Title";
|
this.sortColumn = "Title";
|
||||||
|
|
||||||
|
this.loadPage(1);
|
||||||
|
|
||||||
this.showAlert(viewAlert.alert, 3000);
|
this.showAlert(viewAlert.alert, 3000);
|
||||||
viewAlert.alert = null;
|
viewAlert.alert = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<DevelopmentServerPort>62634</DevelopmentServerPort>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
|
|
@ -11,4 +12,4 @@
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
Reference in New Issue