Skip to content

Commit

Permalink
mobile navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne committed Sep 30, 2016
1 parent 318927f commit 08d9d6a
Show file tree
Hide file tree
Showing 75 changed files with 173 additions and 175 deletions.
Binary file modified DataBase/InitialData/dbo.Navigation.Table.sql
Binary file not shown.
Binary file modified DataBase/Tables/dbo.Navigation.Table.sql
Binary file not shown.
27 changes: 27 additions & 0 deletions DataBase/Update/2.3/Script.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
IF NOT EXISTS ( SELECT 1
FROM sys.syscolumns
WHERE id = OBJECT_ID(N'Navigation')
AND name = N'IsMobile' )
BEGIN
ALTER TABLE dbo.Navigation ADD IsMobile BIT NULL;
END;
GO
IF NOT EXISTS ( SELECT 1
FROM dbo.Language
WHERE LanKey = N'NavigationEntity@IsMobile' )
BEGIN
INSERT INTO dbo.Language
( LanKey ,
LanID ,
LanValue ,
Module ,
LanType
)
VALUES ( N'NavigationEntity@IsMobile' ,
2052 ,
N'ÊÖ»úµ¼º½' ,
N'NavigationEntity' ,
N'EntityProperty'
);
END;
GO
3 changes: 2 additions & 1 deletion Easy.CMS.Web/Modules/Common/Models/NavigationEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class NavigationEntity : EditorEntity
{
public string ID { get; set; }
public int? DisplayOrder { get; set; }

public bool? IsMobile { get; set; }
public string ParentId { get; set; }
public string Url { get; set; }
public bool IsCurrent { get; set; }
Expand All @@ -31,6 +31,7 @@ protected override void ViewConfigure()
ViewConfig(m => m.DisplayOrder).AsHidden();
ViewConfig(m => m.Title).AsTextBox().Required().Order(1);
ViewConfig(m => m.Url).AsTextBox().Required().Order(2).AddClass("select").AddProperty("data-url", Urls.SelectPage);
ViewConfig(m => m.IsMobile).AsCheckBox();
ViewConfig(m => m.IsCurrent).AsHidden();
}
}
Expand Down
22 changes: 14 additions & 8 deletions Easy.CMS.Web/Modules/Common/Views/Widget.Navigation.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
</ul>
}
}
@helper MobileLi(string parentId = "#")
{
foreach (var item in Model.Navigations.Where(m => m.ParentId == parentId))
{
if (item.IsMobile ?? false)
{
<li class="pull-left @(item.IsCurrent ? "active" : "")">
@Html.SmartLink(Url.PathContent(item.Url), item.Title)
</li>
}
@MobileLi(item.ID)
}
}
<div class="navigation">
<div class="navbar navbar-default @(Model.Widget.IsTopFix?"navbar-fixed-top":"")" role="navigation">
<div class="@(Model.Widget.CustomerClass??"container")">
Expand All @@ -52,15 +65,8 @@
</a>
}
@{
var top = Model.Navigations.Where(m => m.ParentId == "#").Skip(1).Take(2);
<ul class="nav navbar-nav nav-mobile visible-xs">
@foreach (var item in top)
{
<li class="pull-left @(item.IsCurrent ? "active" : "")">
@Html.SmartLink(Url.PathContent(item.Url), item.Title)
</li>

}
@MobileLi()
</ul>
}
</div>
Expand Down
53 changes: 26 additions & 27 deletions Easy.CMS.Web/Modules/Common/Views/Widget.Video.cshtml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
@using System.Text.RegularExpressions
@model Easy.CMS.Common.Models.VideoWidget

@if (Model.Url.IsNotNullAndWhiteSpace())
{
<video controls="controls"
name="media"
src="@Url.Content(Model.Url)"
style="width:@(Model.Width.HasValue?Model.Width+"px":"auto");height:@(Model.Height.HasValue?Model.Height+"px":"auto")">
您的浏览器不支持播放该视频
</video>
}
else if (Model.Code.IsNotNullAndWhiteSpace())
{
if (Model.Width.HasValue)
<div class="widget-video">
@if (Model.Url.IsNotNullAndWhiteSpace())
{
Model.Code = Regex.Replace(Model.Code, @"width=""(\d+)""", "width=\"" + Model.Width + "\"");
Model.Code = Regex.Replace(Model.Code, @"width=(\d+)", "width=" + Model.Width);
Model.Code = Regex.Replace(Model.Code, @"width:(\d+)", "width:" + Model.Width);
<video controls="controls"
name="media"
src="@Url.Content(Model.Url)"
style="width:@(Model.Width.HasValue?Model.Width+"px":"auto");height:@(Model.Height.HasValue?Model.Height+"px":"auto")">
您的浏览器不支持播放该视频
</video>
}
else
else if (Model.Code.IsNotNullAndWhiteSpace())
{
Model.Code = Regex.Replace(Model.Code, @"width=""(\d+)""", "width=\"100%\"");
Model.Code = Regex.Replace(Model.Code, @"width=(\d+)", "width=100%");
Model.Code = Regex.Replace(Model.Code, @"width:(\d+)", "width:100%");
if (Model.Width.HasValue)
{
Model.Code = Regex.Replace(Model.Code, @"("")?width("")?=("")?(\d+)("")?", "width=\"" + Model.Width.Value + "\"");
Model.Code = Regex.Replace(Model.Code, @"("")?width("")?:("")?(\d+)("")?", "width:" + Model.Width);
}
else
{
Model.Code = Regex.Replace(Model.Code, @"("")?width("")?=("")?(\d+)("")?", "width=\"100%\"");
Model.Code = Regex.Replace(Model.Code, @"width:(\d+)(px|%)", "width:100%");
}
if (Model.Height.HasValue)
{
Model.Code = Regex.Replace(Model.Code, @"("")?height("")?=("")?(\d+)("")?", "height=" + Model.Height.Value);
Model.Code = Regex.Replace(Model.Code, @"("")?height("")?:("")?(\d+)("")?", "height:" + Model.Height.Value);
}
@Html.Raw(Model.Code)
}
if (Model.Height.HasValue)
{
Model.Code = Regex.Replace(Model.Code, @"height=""(\d+)""", "height=\"" + Model.Height + "\"");
Model.Code = Regex.Replace(Model.Code, @"height=(\d+)", "height=" + Model.Height);
Model.Code = Regex.Replace(Model.Code, @"height:(\d+)", "height:" + Model.Height);
}
@Html.Raw(Model.Code)
}
</div>
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cerulean/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cerulean/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cerulean/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cerulean/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cosmo/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cosmo/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cosmo/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cosmo/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cyborg/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Cyborg/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cyborg/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Cyborg/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Darkly/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Darkly/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Darkly/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Darkly/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Default/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Default/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Default/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Default/css/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Flatly/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Flatly/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Flatly/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Flatly/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Journal/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Journal/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Journal/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Journal/css/Theme.min.css

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Lumen/css/Navigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
margin: -@margin-base;

.nav.nav-mobile {
margin: 5px auto;
margin: 0 auto;
float: left;

> li > a {
padding-left: 10px;
padding-right: 10px;
padding:15px 10px;
}
}
.navbar {
Expand Down
5 changes: 2 additions & 3 deletions Easy.CMS.Web/Themes/Lumen/css/Theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Lumen/css/Theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Easy.CMS.Web/Themes/Lumen/css/Theme.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 08d9d6a

Please sign in to comment.