Skip to content

Commit eb463b4

Browse files
committed
Refactored theme list.
1 parent ed9f0f2 commit eb463b4

File tree

18 files changed

+330
-229
lines changed

18 files changed

+330
-229
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Threading.Tasks;
2+
using Abp.Authorization;
3+
using Abp.Runtime.Session;
4+
using AbpCompanyName.AbpProjectName.Configuration.Dto;
5+
6+
namespace AbpCompanyName.AbpProjectName.Configuration
7+
{
8+
[AbpAuthorize]
9+
public class ConfigurationAppService : AbpProjectNameAppServiceBase, IConfigurationAppService
10+
{
11+
public async Task ChangeUiTheme(ChangeUiThemeInput input)
12+
{
13+
await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), AppSettingNames.UiTheme, input.Theme);
14+
}
15+
}
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace AbpCompanyName.AbpProjectName.Configuration.Dto
4+
{
5+
public class ChangeUiThemeInput
6+
{
7+
[Required]
8+
[MaxLength(32)]
9+
public string Theme { get; set; }
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Threading.Tasks;
2+
using AbpCompanyName.AbpProjectName.Configuration.Dto;
3+
4+
namespace AbpCompanyName.AbpProjectName.Configuration
5+
{
6+
public interface IConfigurationAppService
7+
{
8+
Task ChangeUiTheme(ChangeUiThemeInput input);
9+
}
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace AbpCompanyName.AbpProjectName.Configuration.Ui
2+
{
3+
public class UiThemeInfo
4+
{
5+
public string Name { get; }
6+
public string CssClass { get; }
7+
8+
public UiThemeInfo(string name, string cssClass)
9+
{
10+
Name = name;
11+
CssClass = cssClass;
12+
}
13+
}
14+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Collections.Generic;
2+
3+
namespace AbpCompanyName.AbpProjectName.Configuration.Ui
4+
{
5+
public static class UiThemes
6+
{
7+
public static List<UiThemeInfo> All { get; }
8+
9+
static UiThemes()
10+
{
11+
All = new List<UiThemeInfo>
12+
{
13+
new UiThemeInfo("Red", "red"),
14+
new UiThemeInfo("Pink", "pink"),
15+
new UiThemeInfo("Purple", "purple"),
16+
new UiThemeInfo("Deep Purple", "deep-purple"),
17+
new UiThemeInfo("Indigo", "indigo"),
18+
new UiThemeInfo("Blue", "blue"),
19+
new UiThemeInfo("Light Blue", "light-blue"),
20+
new UiThemeInfo("Cyan", "cyan"),
21+
new UiThemeInfo("Teal", "teal"),
22+
new UiThemeInfo("Green", "green"),
23+
new UiThemeInfo("Light Green", "light-green"),
24+
new UiThemeInfo("Lime", "lime"),
25+
new UiThemeInfo("Yellow", "yellow"),
26+
new UiThemeInfo("Amber", "amber"),
27+
new UiThemeInfo("Orange", "orange"),
28+
new UiThemeInfo("Deep Orange", "deep-orange"),
29+
new UiThemeInfo("Brown", "brown"),
30+
new UiThemeInfo("Grey", "grey"),
31+
new UiThemeInfo("Blue Grey", "blue-grey"),
32+
new UiThemeInfo("Black", "black")
33+
};
34+
}
35+
}
36+
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/AbpProjectNameCoreModule.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using AbpCompanyName.AbpProjectName.MultiTenancy;
88
using AbpCompanyName.AbpProjectName.Authorization.Roles;
99
using AbpCompanyName.AbpProjectName.Authorization.Users;
10+
using AbpCompanyName.AbpProjectName.Configuration;
1011
using AbpCompanyName.AbpProjectName.Timing;
1112

1213
namespace AbpCompanyName.AbpProjectName
@@ -30,6 +31,8 @@ public override void PreInitialize()
3031

3132
//Configure roles
3233
AppRoleConfig.Configure(Configuration.Modules.Zero().RoleManagement);
34+
35+
Configuration.Settings.Providers.Add<AppSettingProvider>();
3336
}
3437

3538
public override void Initialize()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace AbpCompanyName.AbpProjectName.Configuration
2+
{
3+
public static class AppSettingNames
4+
{
5+
public const string UiTheme = "App.UiTheme";
6+
}
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Collections.Generic;
2+
using Abp.Configuration;
3+
4+
namespace AbpCompanyName.AbpProjectName.Configuration
5+
{
6+
public class AppSettingProvider : SettingProvider
7+
{
8+
public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
9+
{
10+
return new[]
11+
{
12+
new SettingDefinition(AppSettingNames.UiTheme, "red", scopes: SettingScopes.Application | SettingScopes.Tenant | SettingScopes.User, isVisibleToClients: true),
13+
};
14+
}
15+
}
16+
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/AbpCompanyName.AbpProjectName.Web.Mvc.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<DefineConstants>FEATURE_SIGNALR</DefineConstants>
1616
</PropertyGroup>
1717

18+
<ItemGroup>
19+
<Content Include="wwwroot\view-resources\Views\Shared\_Layout.js" />
20+
</ItemGroup>
21+
1822
<ItemGroup>
1923
<None Include="app.config" />
2024
<None Update="Dockerfile">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@using AbpCompanyName.AbpProjectName.Configuration.Ui
2+
@model AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.RightSideBar.RightSideBarViewModel
3+
<aside id="rightsidebar" class="right-sidebar">
4+
<ul class="nav nav-tabs tab-nav-right" role="tablist">
5+
<li role="presentation" class="active"><a href="#skins" data-toggle="tab">SKINS</a></li>
6+
<li role="presentation"><a href="#settings" data-toggle="tab">SETTINGS</a></li>
7+
</ul>
8+
<div class="tab-content">
9+
<div role="tabpanel" class="tab-pane fade in active in active" id="skins">
10+
<ul class="demo-choose-skin">
11+
@foreach (var theme in UiThemes.All)
12+
{
13+
<li data-theme="@theme.CssClass" class="@(theme.CssClass == Model.CurrentTheme.CssClass ? "active" : "")">
14+
<div class="@theme.CssClass"></div>
15+
<span>@theme.Name</span>
16+
</li>
17+
}
18+
</ul>
19+
</div>
20+
<div role="tabpanel" class="tab-pane fade" id="settings">
21+
<div class="demo-settings">
22+
<p>GENERAL SETTINGS</p>
23+
<ul class="setting-list">
24+
<li>
25+
<span>Report Panel Usage</span>
26+
<div class="switch">
27+
<label><input type="checkbox" checked><span class="lever"></span></label>
28+
</div>
29+
</li>
30+
<li>
31+
<span>Email Redirect</span>
32+
<div class="switch">
33+
<label><input type="checkbox"><span class="lever"></span></label>
34+
</div>
35+
</li>
36+
</ul>
37+
<p>SYSTEM SETTINGS</p>
38+
<ul class="setting-list">
39+
<li>
40+
<span>Notifications</span>
41+
<div class="switch">
42+
<label><input type="checkbox" checked><span class="lever"></span></label>
43+
</div>
44+
</li>
45+
<li>
46+
<span>Auto Updates</span>
47+
<div class="switch">
48+
<label><input type="checkbox" checked><span class="lever"></span></label>
49+
</div>
50+
</li>
51+
</ul>
52+
<p>ACCOUNT SETTINGS</p>
53+
<ul class="setting-list">
54+
<li>
55+
<span>Offline</span>
56+
<div class="switch">
57+
<label><input type="checkbox"><span class="lever"></span></label>
58+
</div>
59+
</li>
60+
<li>
61+
<span>Location Permission</span>
62+
<div class="switch">
63+
<label><input type="checkbox" checked><span class="lever"></span></label>
64+
</div>
65+
</li>
66+
</ul>
67+
</div>
68+
</div>
69+
</div>
70+
</aside>

0 commit comments

Comments
 (0)