【发布时间】:2014-08-19 13:16:00
【问题描述】:
我想在我的 MVC 5 应用程序中包含对 bootswatch 主题的主题支持。
我希望在用户登录时保存和加载用户主题。
我已扩展我的用户类以包含主题,并且可以在编辑用户页面上成功设置和保存主题。
public class User : IdentityUser
{
public string BootstrapTheme {get;set;}
}
在 BootstrapTheme 属性中,我将保存引导 css 链接的 href 属性。例如"~/Content/bootstrap.flatly.min.css"
计划是在布局页面中设置主题。
<link href="~/Content/bootstrap.spacelab.min.css" rel="stylesheet" />
如何在不在每次页面加载时查询数据库的情况下做到这一点?
能够做像<link href="@User.BootstrapTheme" rel="stylesheet" /> 这样的事情是理想的。
这是一个关于如何使用 localstorage http://wdtz.org/bootswatch-theme-selector.html 将其保存为一页的链接
【问题讨论】:
标签: asp.net-mvc twitter-bootstrap asp.net-identity owin