Browse Source

Added support for NoJS.

Changed login and registration to use Modal popups.
tags/2.0.3
Teknikode 3 years ago
parent
commit
99d2f3ffa3

+ 15
- 5
Teknik/Areas/Transparency/Controllers/TransparencyController.cs View File

@@ -83,18 +83,28 @@ namespace Teknik.Areas.Transparency.Controllers
}
}

model.Bills = db.Transactions.OfType<Bill>().OrderByDescending(b => b.DateSent).ToList();
model.OneTimes = db.Transactions.OfType<OneTime>().OrderByDescending(b => b.DateSent).ToList();
model.Donations = db.Transactions.OfType<Donation>().OrderByDescending(b => b.DateSent).ToList();
List<Bill> bills = db.Transactions.OfType<Bill>().OrderByDescending(b => b.DateSent).ToList();
model.Bills = (bills != null) ? bills : new List<Bill>();

model.Takedowns = db.Takedowns.OrderByDescending(b => b.DateRequested).ToList();
List<OneTime> oneTimes = db.Transactions.OfType<OneTime>().OrderByDescending(b => b.DateSent).ToList();
model.OneTimes = (oneTimes != null) ? oneTimes : new List<OneTime>();

List<Donation> donations = db.Transactions.OfType<Donation>().OrderByDescending(b => b.DateSent).ToList();
model.Donations = (donations != null) ? donations : new List<Donation>();


List<Takedown> takedowns = db.Takedowns.OrderByDescending(b => b.DateRequested).ToList();
model.Takedowns = (takedowns != null) ? takedowns : new List<Takedown>();

// Grab canary file
if (System.IO.File.Exists(Config.TransparencyConfig.CanaryPath))
{
model.Canary = System.IO.File.ReadAllText(Config.TransparencyConfig.CanaryPath);
}

else
{
model.Canary = string.Empty;
}
}
return View(model);
}

+ 6
- 0
Teknik/Areas/Transparency/Scripts/Transparency.js View File

@@ -0,0 +1,6 @@
$(document).ready(function () {
$('#bills-section').collapse('hide');
$('#oneTime-section').collapse('hide');
$('#donations-section').collapse('hide');
$('#takedowns-section').collapse('hide');
});

+ 5
- 0
Teknik/Areas/Transparency/TransparencyAreaRegistration.cs View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;

namespace Teknik.Areas.Transparency
@@ -25,6 +26,10 @@ namespace Teknik.Areas.Transparency
new { controller = "Transparency", action = "Index" },
new[] { typeof(Controllers.TransparencyController).Namespace }
);

// Register Script Bundle
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/transparency").Include(
"~/Areas/Transparency/Scripts/Transparency.js"));
}
}
}

+ 204
- 191
Teknik/Areas/Transparency/Views/Transparency/Index.cshtml View File

@@ -3,259 +3,272 @@
@using Teknik.Helpers
@using Teknik.Areas.Transparency.Models

@Scripts.Render("~/bundles/transparency")

<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="text-center"><b>Behind the Scenes</b></h2>
<hr>
<p>
Here you can view all of Teknik's financial information, takedown requests and the actions we took, as well as some general statistics for the site's services.
</p>
<p>
If you would like to request additional information about Teknik, please feel free to contact us through our <a href="@Url.SubRouteUrl("contact", "Contact.Index")" target="_blank">Contact Form</a> or by emailing us at <a href="mailto:@Model.Config.SupportEmail">@Model.Config.SupportEmail</a>.
</p>
<p>
Want to make a donation? Visit our <a href="@Url.SubRouteUrl("about", "About.Index")" target="_blank">About Page</a> and choose a donation method at the bottom.
</p>
<br />
<h2 class="text-center"><b>Statistics</b></h2>
<hr>
<div class="row">
<div class="col-sm-6">
<h3>Uploads</h3>
<p>Number of Uploads: @Model.UploadCount</p>
<p>Total Size: @Utility.GetBytesReadable(Model.UploadSize)</p>
</div>
<div class="col-sm-6">
<h3>Pastes</h3>
<p>Number of Pastes: @Model.PasteCount</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<h3>Users</h3>
<p>Number of Users: @Model.UserCount</p>
</div>
<div class="col-sm-6">
<h3>Shortened Urls</h3>
<p>Number of Shortened Urls: @Model.ShortenedUrlCount</p>
</div>
</div>
<br />
<h2 class="text-center"><b>Transactions</b></h2>
<hr>
<h3 class="text-center">Total Amounts</h3>
<div class="row">
<div class="col-sm-3 text-center">
<h4>Donations</h4>
@foreach (var val in Model.TotalDonations)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>Bills</h4>
@foreach (var val in Model.TotalBills)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>One-Time Payments</h4>
@foreach (var val in Model.TotalOneTimes)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>Net Profit</h4>
@foreach (var val in Model.TotalNet)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
@if (Model.Config.TransparencyConfig.Enabled)
{
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="text-center"><b>Behind the Scenes</b></h2>
<hr>
<p>
Here you can view all of Teknik's financial information, takedown requests and the actions we took, as well as some general statistics for the site's services.
</p>
<p>
If you would like to request additional information about Teknik, please feel free to contact us through our <a href="@Url.SubRouteUrl("contact", "Contact.Index")" target="_blank">Contact Form</a> or by emailing us at <a href="mailto:@Model.Config.SupportEmail">@Model.Config.SupportEmail</a>.
</p>
<p>
Want to make a donation? Visit our <a href="@Url.SubRouteUrl("about", "About.Index")" target="_blank">About Page</a> and choose a donation method at the bottom.
</p>
<br />
<h2 class="text-center"><b>Statistics</b></h2>
<hr>
<div class="row">
<div class="col-sm-6">
<h3>Uploads</h3>
<p>Number of Uploads: @Model.UploadCount</p>
<p>Total Size: @Utility.GetBytesReadable(Model.UploadSize)</p>
</div>
<div class="col-sm-6">
<h3>Pastes</h3>
<p>Number of Pastes: @Model.PasteCount</p>
</div>
</div>
</div>
@if (Model.Bills != null && Model.Bills.Any())
{
<h3>Bills</h3>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#bills-section">View Bills</button>
<div class="col-sm-6">
<h3>Users</h3>
<p>Number of Users: @Model.UserCount</p>
</div>
<div class="col-sm-6">
<h3>Shortened Urls</h3>
<p>Number of Shortened Urls: @Model.ShortenedUrlCount</p>
</div>
</div>
<br />
<div id="bills-section" class="collapse">
<h2 class="text-center"><b>Transactions</b></h2>
<hr>
<h3 class="text-center">Total Amounts</h3>
<div class="row">
<div class="col-sm-3 text-center">
<h4>Donations</h4>
@foreach (var val in Model.TotalDonations)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>Bills</h4>
@foreach (var val in Model.TotalBills)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>One-Time Payments</h4>
@foreach (var val in Model.TotalOneTimes)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
<div class="col-sm-3 text-center">
<h4>Net Profit</h4>
@foreach (var val in Model.TotalNet)
{
<p>@Math.Round(val.Value, 2) @val.Key</p>
}
</div>
</div>
@if (Model.Bills != null && Model.Bills.Any())
{
<h3>Bills</h3>
<div class="row">
<div class="col-sm-3">
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-7">
<h4><strong>Description</strong></h4>
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#bills-section">View Bills</button>
</div>
</div>
@foreach (Bill bill in Model.Bills)
{
<br />
<div id="bills-section">
<div class="row">
<div class="col-sm-3">
@bill.DateSent.ToString("MMMM dd, yyyy")
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
@bill.Amount <var>@bill.Currency</var>
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-7">
@bill.Reason
<h4><strong>Description</strong></h4>
</div>
</div>
}
</div>
}
@if (Model.OneTimes != null && Model.OneTimes.Any())
{
<h3>One Time Payments</h3>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#oneTime-section">View Payments</button>
@foreach (Bill bill in Model.Bills)
{
<div class="row">
<div class="col-sm-3">
@bill.DateSent.ToString("MMMM dd, yyyy")
</div>
<div class="col-sm-2">
@bill.Amount <var>@bill.Currency</var>
</div>
<div class="col-sm-7">
@bill.Reason
</div>
</div>
}
</div>
</div>
<br />
<div id="oneTime-section" class="collapse">
}
@if (Model.OneTimes != null && Model.OneTimes.Any())
{
<h3>One Time Payments</h3>
<div class="row">
<div class="col-sm-3">
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-7">
<h4><strong>Reason for Payment</strong></h4>
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#oneTime-section">View Payments</button>
</div>
</div>
@foreach (OneTime oneTime in Model.OneTimes)
{
<br />
<div id="oneTime-section">
<div class="row">
<div class="col-sm-3">
@oneTime.DateSent.ToString("MMMM dd, yyyy")
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
@oneTime.Amount <var>@oneTime.Currency</var>
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-7">
@oneTime.Reason
<h4><strong>Reason for Payment</strong></h4>
</div>
</div>
}
</div>
}
@if (Model.Donations != null && Model.Donations.Any())
{
<h3>Donations</h3>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#donations-section">View Donations</button>
@foreach (OneTime oneTime in Model.OneTimes)
{
<div class="row">
<div class="col-sm-3">
@oneTime.DateSent.ToString("MMMM dd, yyyy")
</div>
<div class="col-sm-2">
@oneTime.Amount <var>@oneTime.Currency</var>
</div>
<div class="col-sm-7">
@oneTime.Reason
</div>
</div>
}
</div>
</div>
<br />
<div id="donations-section" class="collapse">
}
@if (Model.Donations != null && Model.Donations.Any())
{
<h3>Donations</h3>
<div class="row">
<div class="col-sm-3">
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Donor</strong></h4>
</div>
<div class="col-sm-5">
<h4><strong>Reason for Donation</strong></h4>
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#donations-section">View Donations</button>
</div>
</div>
@foreach (Donation donation in Model.Donations)
{
<br />
<div id="donations-section">
<div class="row">
<div class="col-sm-3">
@donation.DateSent.ToString("MMMM dd, yyyy")
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
@donation.Amount <var>@donation.Currency</var>
<h4><strong>Amount</strong></h4>
</div>
<div class="col-sm-2">
@donation.Sender
<h4><strong>Donor</strong></h4>
</div>
<div class="col-sm-5">
@donation.Reason
<h4><strong>Reason for Donation</strong></h4>
</div>
</div>
}
</div>
}
<br />
<h2 class="text-center"><b>Takedowns</b></h2>
<hr>
@if (Model.Takedowns != null && Model.Takedowns.Any())
{
<h3>Takedowns</h3>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#takedowns-section">View Takedowns</button>
@foreach (Donation donation in Model.Donations)
{
<div class="row">
<div class="col-sm-3">
@donation.DateSent.ToString("MMMM dd, yyyy")
</div>
<div class="col-sm-2">
@donation.Amount <var>@donation.Currency</var>
</div>
<div class="col-sm-2">
@donation.Sender
</div>
<div class="col-sm-5">
@donation.Reason
</div>
</div>
}
</div>
</div>
}
<br />
<div id="takedowns-section" class="collapse">
<h2 class="text-center"><b>Takedowns</b></h2>
<hr>
@if (Model.Takedowns != null && Model.Takedowns.Any())
{
<h3>Takedowns</h3>
<div class="row">
<div class="col-sm-2">
<h4><strong>Requester</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Contact</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Reason</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Action Taken</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Date Requested</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Date Of Action</strong></h4>
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#takedowns-section">View Takedowns</button>
</div>
</div>
@foreach (Takedown takedown in Model.Takedowns)
{
<br />
<div id="takedowns-section">
<div class="row">
<div class="col-sm-2">
@takedown.Requester
<h4><strong>Requester</strong></h4>
</div>
<div class="col-sm-2">
@takedown.RequesterContact
<h4><strong>Contact</strong></h4>
</div>
<div class="col-sm-2">
@takedown.Reason
<h4><strong>Reason</strong></h4>
</div>
<div class="col-sm-2">
@takedown.ActionTaken
<h4><strong>Action Taken</strong></h4>
</div>
<div class="col-sm-2">
@takedown.DateRequested.ToString("MMMM dd, yyyy")
<h4><strong>Date Requested</strong></h4>
</div>
<div class="col-sm-2">
@takedown.DateActionTaken.ToString("MMMM dd, yyyy")
<h4><strong>Date Of Action</strong></h4>
</div>
</div>
}
</div>
}
<br />
@foreach (Takedown takedown in Model.Takedowns)
{
<div class="row">
<div class="col-sm-2">
@takedown.Requester
</div>
<div class="col-sm-2">
@takedown.RequesterContact
</div>
<div class="col-sm-2">
@takedown.Reason
</div>
<div class="col-sm-2">
@takedown.ActionTaken
</div>
<div class="col-sm-2">
@takedown.DateRequested.ToString("MMMM dd, yyyy")
</div>
<div class="col-sm-2">
@takedown.DateActionTaken.ToString("MMMM dd, yyyy")
</div>
</div>
}
</div>
}
<br />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<pre>@Model.Canary</pre>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<pre>@Model.Canary</pre>
</div>
</div>
}
else
{
<div class="row">
<div class="col-sm-8 col-sm-offset-2 text-center">
<h3>Transparency Information has been disabled</h3>
</div>
</div>
</div>
}
</div>

+ 3
- 3
Teknik/Areas/User/Controllers/UserController.cs View File

@@ -138,12 +138,12 @@ namespace Teknik.Areas.Users.Controllers
LoginViewModel model = new LoginViewModel();
model.ReturnUrl = ReturnUrl;

return View("/Areas/Users/Views/User/ViewLogin.cshtml", model);
return View("/Areas/User/Views/User/ViewLogin.cshtml", model);
}

[HttpPost]
[AllowAnonymous]
public ActionResult Login(LoginViewModel model)
public ActionResult Login([Bind(Prefix = "Login")]LoginViewModel model)
{
if (ModelState.IsValid)
{
@@ -212,7 +212,7 @@ namespace Teknik.Areas.Users.Controllers

[HttpPost]
[AllowAnonymous]
public ActionResult Register(RegisterViewModel model)
public ActionResult Register([Bind(Prefix="Register")]RegisterViewModel model)
{
if (ModelState.IsValid)
{

+ 21
- 16
Teknik/Areas/User/Views/User/Login.cshtml View File

@@ -2,23 +2,28 @@

@if (Model.Config.UserConfig.LoginEnabled)
{
<form role="form" id="loginForm" action="@Url.SubRouteUrl("user", "User.Login")" method="post" accept-charset="UTF-8">
<input name="ReturnUrl" id="ReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true" />
<div class="row">
<div class="col-sm-12 text-center">
<div id="loginStatus"></div>
</div>
</div>
<div class="form-group">
<input type="password" class="form-control" id="Password" value="" placeholder="Password" name="Password" data-val-required="The Password field is required." data-val="true" />
</div>
<div class="checkbox">
<label>
<input id="RememberMe" type="checkbox" value="true" name="RememberMe" data-val-required="The Remember Me field is required." data-val="true" /><input name="RememberMe" type="hidden" value="false"> Remember Me
</label>
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="login_submit" type="submit" name="submit">Sign In</button>
</div>
</form>
<form role="form" id="loginForm" action="@Url.SubRouteUrl("user", "User.Login")" method="post" accept-charset="UTF-8">
<input name="Login.ReturnUrl" id="loginReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="loginUsername" value="" placeholder="Username" name="Login.Username" data-val-required="The Username field is required." data-val="true" />
</div>
<div class="form-group">
<input type="password" class="form-control" id="loginPassword" value="" placeholder="Password" name="Login.Password" data-val-required="The Password field is required." data-val="true" />
</div>
<div class="checkbox">
<label>
<input id="loginRememberMe" type="checkbox" value="true" name="Login.RememberMe" data-val-required="The Remember Me field is required." data-val="true" /><input name="Login.RememberMe" type="hidden" value="false"> Remember Me
</label>
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="loginSubmit" type="submit" name="Login.Submit">Sign In</button>
</div>
</form>
}
else
{

+ 22
- 17
Teknik/Areas/User/Views/User/Register.cshtml View File

@@ -2,24 +2,29 @@

@if (Model.Config.UserConfig.RegistrationEnabled)
{
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("user", "User.Register")" method="post" accept-charset="UTF-8">
<input name="ReturnUrl" id="ReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true"/>
<div class="row">
<div class="col-sm-12 text-center">
<div id="registerStatus"></div>
</div>
</div>
<div class="form-group">
<input type="password" class="form-control" id="Password" value="" placeholder="Password" name="Password" data-val-required="The Password field is required." data-val="true"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="ConfirmPassword" value="" placeholder="Confirm Password" name="ConfirmPassword" data-val-required="The Confirm Password field is required." data-val="true" />
</div>
<p>
By registering for Teknik, you agree to the <a href="@Url.SubRouteUrl("tos", "TOS.Index")">Terms of Service</a>.
</p>
<div class="form-group text-center">
<button class="btn btn-primary" id="reg_submit" type="submit" name="submit">Sign Up</button>
</div>
</form>
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("user", "User.Register")" method="post" accept-charset="UTF-8">
<input name="Register.ReturnUrl" id="registerReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="registerUsername" value="" placeholder="Username" name="Register.Username" data-val-required="The Username field is required." data-val="true"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="registerPassword" value="" placeholder="Password" name="Register.Password" data-val-required="The Password field is required." data-val="true"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="registerConfirmPassword" value="" placeholder="Confirm Password" name="Register.ConfirmPassword" data-val-required="The Confirm Password field is required." data-val="true" />
</div>
<p class="text-center">
By registering for Teknik, you agree to the <a href="@Url.SubRouteUrl("tos", "TOS.Index")">Terms of Service</a>.
</p>
<div class="form-group text-center">
<button class="btn btn-primary" id="registerSubmit" type="submit" name="Register.Submit">Sign Up</button>
</div>
</form>
}
else
{

+ 35
- 0
Teknik/Areas/User/Views/User/_LoginModalPartial.cshtml View File

@@ -0,0 +1,35 @@
@model Teknik.ViewModels.ViewModelBase

@if (Model.Config.UserConfig.RegistrationEnabled)
{
<div class="modal fade" id="registerModal" tabindex="-1" role="dialog" aria-labelledby="registerModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="registerModalLabel">Teknik Registration</h4>
</div>
<div class="modal-body">
@Html.Partial("../../Areas/User/Views/User/Register", new Teknik.Areas.Users.ViewModels.RegisterViewModel())
</div>
</div>
</div>
</div>
}

@if (Model.Config.UserConfig.LoginEnabled)
{
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="loginModalLabel">Teknik Login</h4>
</div>
<div class="modal-body">
@Html.Partial("../../Areas/User/Views/User/Login", new Teknik.Areas.Users.ViewModels.LoginViewModel())
</div>
</div>
</div>
</div>
}

Teknik/Views/Shared/_LoginPartial.cshtml → Teknik/Areas/User/Views/User/_LoginPartial.cshtml View File

@@ -4,7 +4,7 @@

@if (Model.Config.UserConfig.RegistrationEnabled || Model.Config.UserConfig.LoginEnabled)
{
<ul class="nav navbar-nav pull-right">
<div class="nav navbar-nav pull-right">
@if (Request.IsAuthenticated)
{
<li class="dropdown">
@@ -35,25 +35,29 @@
{
if (Model.Config.UserConfig.RegistrationEnabled)
{
<li>
<p class="navbar-btn">
<a href="@Url.SubRouteUrl("user", "User.Register", new { returnUrl = Request.Url.AbsoluteUri })" class="btn btn-default">Sign Up</a>
</p>
<button id="registerButton" data-toggle="modal" data-target="#registerModal" class="btn btn-default navbar-btn hide">Sign Up</button>
<noscript>
<a href="@Url.SubRouteUrl("user", "User.Register")" class="btn btn-default navbar-btn">Sign Up</a>
</noscript>
@*<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="reg_dropdown">Sign Up <strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px; min-width: 100px;">
@Html.Partial("../../Areas/User/Views/User/Register", new Teknik.Areas.Users.ViewModels.RegisterViewModel())
</div>*@
</li>
}
if (Model.Config.UserConfig.LoginEnabled)
{
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="login_dropdown">Sign In <strong class="caret"></strong></a>
if (Model.Config.UserConfig.RegistrationEnabled)
{
}
<button id="loginButton" data-toggle="modal" data-target="#loginModal" class="btn btn-default navbar-btn hide">Sign In</button>
<noscript>
<a href="@Url.SubRouteUrl("user", "User.Login")" class="btn btn-default navbar-btn">Sign In</a>
</noscript>
@*<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="login_dropdown">Sign In <strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
@Html.Partial("../../Areas/User/Views/User/Login", new Teknik.Areas.Users.ViewModels.LoginViewModel())
</div>
</li>
</div>*@
}
}
</ul>
</div>
}

+ 18
- 12
Teknik/Scripts/Common.js View File

@@ -1,12 +1,15 @@
$(document).ready(function () {
$("#top_msg").css('display', 'none', 'important');

$("#login_dropdown").click(function () {
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
$('#loginButton').removeClass('hide');

$('#loginModal').on('shown.bs.modal', function (e) {
$("#loginStatus").css('display', 'none', 'important');
$("#loginStatus").html('');
$('#loginUsername').focus();
});

$("#login_submit").click(function () {
$("#loginSubmit").click(function () {
var form = $('#loginForm');
$.ajax({
type: "POST",
@@ -20,20 +23,23 @@
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#loginStatus").css('display', 'inline', 'important');
$("#loginStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
return false;
});

$("#reg_dropdown").click(function () {
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
$('#registerButton').removeClass('hide');

$('#registerModal').on('shown.bs.modal', function (e) {
$("#registerStatus").css('display', 'none', 'important');
$("#registerStatus").html('');
$('#registerUsername').focus();
});

$("#reg_submit").click(function () {
$("#registerSubmit").click(function () {
var form = $('#registrationForm');
$.ajax({
type: "POST",
@@ -47,8 +53,8 @@
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#registerStatus").css('display', 'inline', 'important');
$("#registerStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});

BIN
Teknik/Scripts/_references.js View File


+ 3
- 1
Teknik/Teknik.csproj View File

@@ -314,6 +314,7 @@
<Content Include="Areas\Paste\Scripts\SyntaxWorker.js" />
<Content Include="Areas\Podcast\Content\Podcast.css" />
<Content Include="Areas\Podcast\Scripts\Podcast.js" />
<Content Include="Areas\Transparency\Scripts\Transparency.js" />
<Content Include="Areas\User\Scripts\User.js" />
<Content Include="Areas\Shortener\Scripts\Shortener.js" />
<Content Include="Areas\Upload\Scripts\Download.js" />
@@ -581,13 +582,14 @@
<Content Include="Views\Web.config" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Shared\_LoginPartial.cshtml" />
<Content Include="Areas\User\Views\User\_LoginPartial.cshtml" />
<Content Include="Views\Shared\_Navbar.cshtml" />
<Content Include="Views\Shared\_Footer.cshtml" />
<Content Include="Areas\User\Views\User\Login.cshtml" />
<Content Include="Areas\User\Views\User\Register.cshtml" />
<Content Include="Areas\Dev\Views\Dev\Index.cshtml" />
<Content Include="Scripts\jquery-2.2.3.min.map" />
<Content Include="Areas\User\Views\User\_LoginModalPartial.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\About\Models\" />

+ 2
- 1
Teknik/Views/Shared/_Navbar.cshtml View File

@@ -1,5 +1,6 @@
@model Teknik.ViewModels.ViewModelBase

@Html.Partial("../../Areas/User/Views/User/_LoginModalPartial", Model)
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
@@ -53,7 +54,7 @@
<a href="@Url.SubRouteUrl("help", "Help.Index")">Help</a>
</li>
</ul>
@Html.Partial("_LoginPartial", Model)
@Html.Partial("../../Areas/User/Views/User/_LoginPartial", Model)
</div>
</div>
</div>

Loading…
Cancel
Save