mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Language Override; RTL styling; Migration tooling
This commit is contained in:
parent
650248a95a
commit
302a9cc690
|
@ -2,36 +2,44 @@
|
|||
var bfsTimeout;
|
||||
|
||||
$(function () {
|
||||
$("#page-navigation-search").click(function (event) {
|
||||
event.preventDefault();
|
||||
$("#search-modal").modal('show');
|
||||
});
|
||||
$("#search-input").keyup(function () {
|
||||
var search = $(this);
|
||||
$(this).parent().find(".list-group").remove();
|
||||
$("#page-navigation-search").click(function (event) {
|
||||
event.preventDefault();
|
||||
$("#search-modal").modal('show');
|
||||
});
|
||||
$("#search-input").keyup(function () {
|
||||
var search = $(this);
|
||||
$(this).parent().find(".list-group").remove();
|
||||
|
||||
if (typeof bfsTimeout != 'undefined') {
|
||||
clearTimeout(bfsTimeout);
|
||||
}
|
||||
if (typeof bfsTimeout != 'undefined') {
|
||||
clearTimeout(bfsTimeout);
|
||||
}
|
||||
|
||||
if (typeof bfsAjax != 'undefined' && bfsAjax.readyState != 4) {
|
||||
bfsAjax.abort();
|
||||
}
|
||||
if (typeof bfsAjax != 'undefined' && bfsAjax.readyState != 4) {
|
||||
bfsAjax.abort();
|
||||
}
|
||||
|
||||
bfsTimeout = setTimeout(function (object) {
|
||||
bfsAjax = $.ajax("/api/GetSearchResult/?query=" + $("#search-input").val()).done(function (data) {
|
||||
var template = $.templates("#result-template");
|
||||
var content = $("<div class='list-group'></div>");
|
||||
bfsTimeout = setTimeout(function (object) {
|
||||
bfsAjax = $.ajax("/api/GetSearchResult/?query=" + $("#search-input").val()).done(function (data) {
|
||||
var template = $.templates("#result-template");
|
||||
var content = $("<div class='list-group'></div>");
|
||||
|
||||
var item = template.render(data);
|
||||
content.append(item);
|
||||
var item = template.render(data);
|
||||
content.append(item);
|
||||
|
||||
$("#search-results").html(content);
|
||||
$("#search-results").html(content);
|
||||
|
||||
$("#search-results a.list-group-item").click(function () {
|
||||
ga('send', 'pageview', '/api/GetSearchResult/?query=' + $("#search-input").val());
|
||||
});
|
||||
$("#search-results a.list-group-item").click(function () {
|
||||
ga('send', 'pageview', '/api/GetSearchResult/?query=' + $("#search-input").val());
|
||||
});
|
||||
}, 200);
|
||||
});
|
||||
});
|
||||
}, 200);
|
||||
});
|
||||
|
||||
$("#lang-switcher a").click(function (event) {
|
||||
event.preventDefault();
|
||||
var lang = $(this).data("lang");
|
||||
document.cookie = "lang=" + lang + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
|
||||
|
||||
location.reload(true);
|
||||
});
|
||||
});
|
|
@ -1,4 +1,5 @@
|
|||
@{
|
||||
@using System.Globalization;
|
||||
@{
|
||||
bool IsRTL = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
|
@ -16,9 +17,9 @@
|
|||
<meta name="application-name" content="@BuildFeed.Local.Common.SiteName" />
|
||||
|
||||
@Styles.Render("~/content/css")
|
||||
@if(IsRTL)
|
||||
@if (IsRTL)
|
||||
{
|
||||
Styles.Render("~/content/rtl");
|
||||
@Styles.Render("~/content/rtl")
|
||||
}
|
||||
<title>@ViewBag.Title</title>
|
||||
@RenderSection("head", false)
|
||||
|
@ -78,10 +79,36 @@
|
|||
<li><a href="@Url.Action("addBuild", new { controller = "front", area = "" })" title="@BuildFeed.Local.Common.AddBuild"><i class="fa fa-fw fa-plus-square"></i> @BuildFeed.Local.Common.AddBuild</a></li>
|
||||
<li><a href="@Url.Action("logout", new { controller = "support", area = "" })" title="@BuildFeed.Local.Common.LogOut"><i class="fa fa-fw fa-user"></i> @BuildFeed.Local.Common.LogOut</a></li>
|
||||
}
|
||||
<li><a href="#" title="Search" id="page-navigation-search" title="@BuildFeed.Local.Common.Search"><i class="fa fa-fw fa-search"></i> @BuildFeed.Local.Common.Search</a></li>
|
||||
<li><a href="#" id="page-navigation-search" title="@BuildFeed.Local.Common.Search"><i class="fa fa-fw fa-search"></i> @BuildFeed.Local.Common.Search</a></li>
|
||||
<li><a href="@Url.Action("stats", new { controller = "support", area = "" })" title="@BuildFeed.Local.Common.Statistics"><i class="fa fa-fw fa-line-chart"></i> @BuildFeed.Local.Common.Statistics</a></li>
|
||||
<li><a href="@Url.Action("rss", new { controller = "support", area = "" })" title="@BuildFeed.Local.Common.RssFeeds"><i class="fa fa-fw fa-rss"></i> @BuildFeed.Local.Common.RssFeeds</a></li>
|
||||
<li><a href="https://twitter.com/buildfeed" title="@BuildFeed.Local.Common.Twitter" target="_blank"><i class="fa fa-fw fa-twitter"></i> @BuildFeed.Local.Common.Twitter</a></li>
|
||||
<li>
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-globe"></i> <span class="caret"></span></a>
|
||||
<ul id="lang-switcher" class="dropdown-menu">
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ar" ? "active" : "")"><a href="#" data-lang="ar">@CultureInfo.GetCultureInfo("ar").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "bn" ? "active" : "")"><a href="#" data-lang="bn">@CultureInfo.GetCultureInfo("bn").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "cs" ? "active" : "")"><a href="#" data-lang="cs">@CultureInfo.GetCultureInfo("cs").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "de" ? "active" : "")"><a href="#" data-lang="de">@CultureInfo.GetCultureInfo("de").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "el" ? "active" : "")"><a href="#" data-lang="el">@CultureInfo.GetCultureInfo("el").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "en" ? "active" : "")"><a href="#" data-lang="en">@CultureInfo.GetCultureInfo("en").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "es" ? "active" : "")"><a href="#" data-lang="es">@CultureInfo.GetCultureInfo("es").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fi" ? "active" : "")"><a href="#" data-lang="fi">@CultureInfo.GetCultureInfo("fi").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr" ? "active" : "")"><a href="#" data-lang="fr">@CultureInfo.GetCultureInfo("fr").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "hr" ? "active" : "")"><a href="#" data-lang="hr">@CultureInfo.GetCultureInfo("hr").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "it" ? "active" : "")"><a href="#" data-lang="it">@CultureInfo.GetCultureInfo("it").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "nl" ? "active" : "")"><a href="#" data-lang="nl">@CultureInfo.GetCultureInfo("nl").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "pt" ? "active" : "")"><a href="#" data-lang="pt">@CultureInfo.GetCultureInfo("pt").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "pt-br" ? "active" : "")"><a href="#" data-lang="pt-br">@CultureInfo.GetCultureInfo("pt-br").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "qps-ploc" ? "active" : "")"><a href="#" data-lang="qps-ploc">@CultureInfo.GetCultureInfo("qps-ploc").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ru" ? "active" : "")"><a href="#" data-lang="ru">@CultureInfo.GetCultureInfo("ru").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "sk" ? "active" : "")"><a href="#" data-lang="sk">@CultureInfo.GetCultureInfo("sk").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "sl" ? "active" : "")"><a href="#" data-lang="en">@CultureInfo.GetCultureInfo("sl").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "sv" ? "active" : "")"><a href="#" data-lang="en">@CultureInfo.GetCultureInfo("sv").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "zh-cn" ? "active" : "")"><a href="#" data-lang="zh-cn">@CultureInfo.GetCultureInfo("zh-cn").NativeName</a></li>
|
||||
<li class="@(CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "zh-tw" ? "active" : "")"><a href="#" data-lang="zh-tw">@CultureInfo.GetCultureInfo("zh-tw").NativeName</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,41 @@
|
|||
.form-horizontal .form-control-static
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination > li > a,
|
||||
.pagination > li > span
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
h1[dir=ltr]
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media (min-width: 768px)
|
||||
{
|
||||
.navbar-header
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.navbar-nav > li
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.navbar-right
|
||||
{
|
||||
float: left !important;
|
||||
margin-left: -15px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.navbar-right .dropdown-menu
|
||||
{
|
||||
right: auto;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
using RBuild = RedisMongoMigration.Redis.Build;
|
||||
using MongoLevelOfFlight = RedisMongoMigration.Mongo.MongoLevelOfFlight;
|
||||
using RedisLevelOfFlight = RedisMongoMigration.Redis.RedisLevelOfFlight;
|
||||
using MMember = RedisMongoMigration.Mongo.MongoMember;
|
||||
using RMember = RedisMongoMigration.Redis.RedisMember;
|
||||
using RRole = RedisMongoMigration.Redis.RedisRole;
|
||||
using MRole = RedisMongoMigration.Mongo.MongoRole;
|
||||
|
||||
namespace RedisMongoMigration
|
||||
{
|
||||
|
@ -16,30 +20,58 @@ class Program
|
|||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var builds = RBuild.Select();
|
||||
var newBuilds = from b in builds
|
||||
select new MBuildModel()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LegacyId = b.Id,
|
||||
var builds = from b in RBuild.Select()
|
||||
select new MBuildModel()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LegacyId = b.Id,
|
||||
|
||||
MajorVersion = b.MajorVersion,
|
||||
MinorVersion = b.MinorVersion,
|
||||
Number = b.Number,
|
||||
Revision = b.Revision,
|
||||
Lab = b.Lab,
|
||||
BuildTime = b.BuildTime,
|
||||
MajorVersion = b.MajorVersion,
|
||||
MinorVersion = b.MinorVersion,
|
||||
Number = b.Number,
|
||||
Revision = b.Revision,
|
||||
Lab = b.Lab,
|
||||
BuildTime = b.BuildTime,
|
||||
|
||||
Added = b.Added,
|
||||
Modified = b.Modified,
|
||||
SourceType = b.SourceType,
|
||||
SourceDetails = b.SourceDetails,
|
||||
LeakDate = b.LeakDate,
|
||||
FlightLevel = ExchangeFlights(b.FlightLevel)
|
||||
};
|
||||
Added = b.Added,
|
||||
Modified = b.Modified,
|
||||
SourceType = b.SourceType,
|
||||
SourceDetails = b.SourceDetails,
|
||||
LeakDate = b.LeakDate,
|
||||
FlightLevel = ExchangeFlights(b.FlightLevel)
|
||||
};
|
||||
MBuild m = new MBuild();
|
||||
m.InsertAll(newBuilds);
|
||||
m.InsertAll(builds);
|
||||
Console.WriteLine("Builds: Complete");
|
||||
|
||||
var members = from r in RMember.Select()
|
||||
select new MMember()
|
||||
{
|
||||
CreationDate = r.CreationDate,
|
||||
EmailAddress = r.EmailAddress,
|
||||
Id = r.Id,
|
||||
IsApproved = r.IsApproved,
|
||||
IsLockedOut = r.IsLockedOut,
|
||||
LastActivityDate = r.LastActivityDate,
|
||||
LastLockoutDate = r.LastLockoutDate,
|
||||
LastLoginDate = r.LastLoginDate,
|
||||
LockoutWindowAttempts = r.LockoutWindowAttempts,
|
||||
LockoutWindowStart = r.LockoutWindowStart,
|
||||
PassHash = r.PassHash,
|
||||
PassSalt = r.PassSalt,
|
||||
UserName = r.UserName
|
||||
};
|
||||
Console.WriteLine("Members: Complete");
|
||||
|
||||
var roles = from r in RRole.Select()
|
||||
select new MRole()
|
||||
{
|
||||
Id = r.Id,
|
||||
RoleName = r.RoleName,
|
||||
Users = r.Users
|
||||
};
|
||||
Console.WriteLine("Roles: Complete");
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,36 +1,48 @@
|
|||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace RedisMongoMigration.Redis
|
||||
{
|
||||
|
||||
[DataObject]
|
||||
public class RedisMember : IHasId<Guid>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
public Guid Id { get; set; }
|
||||
[DataObject]
|
||||
public class RedisMember : IHasId<Guid>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Key]
|
||||
public string UserName { get; set; }
|
||||
public byte[] PassHash { get; set; }
|
||||
public byte[] PassSalt { get; set; }
|
||||
[Key]
|
||||
public string UserName { get; set; }
|
||||
public byte[] PassHash { get; set; }
|
||||
public byte[] PassSalt { get; set; }
|
||||
|
||||
[Key]
|
||||
public string EmailAddress { get; set; }
|
||||
[Key]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public bool IsApproved { get; set; }
|
||||
public bool IsLockedOut { get; set; }
|
||||
public bool IsApproved { get; set; }
|
||||
public bool IsLockedOut { get; set; }
|
||||
|
||||
public DateTime CreationDate { get; set; }
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
public DateTime LastLockoutDate { get; set; }
|
||||
public DateTime LastLoginDate { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
public DateTime LastLockoutDate { get; set; }
|
||||
public DateTime LastLoginDate { get; set; }
|
||||
|
||||
public DateTime LockoutWindowStart { get; set; }
|
||||
public int LockoutWindowAttempts { get; set; }
|
||||
}
|
||||
public DateTime LockoutWindowStart { get; set; }
|
||||
public int LockoutWindowAttempts { get; set; }
|
||||
|
||||
public static IEnumerable<RedisMember> Select()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient("localhost", 6379, db: 1))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
return client.GetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
|
@ -17,5 +19,14 @@ public class RedisRole : IHasId<Guid>
|
|||
public string RoleName { get; set; }
|
||||
|
||||
public Guid[] Users { get; set; }
|
||||
}
|
||||
|
||||
public static IEnumerable<RedisRole> Select()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient("localhost", 6379, db: 1))
|
||||
{
|
||||
var client = rClient.As<RedisRole>();
|
||||
return client.GetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user