1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added new Url Extension to generate a url with subdomain

This commit is contained in:
Uncled1023 2015-12-21 23:54:22 -08:00
parent 7367d889e9
commit e534a58a7b
20 changed files with 272 additions and 76 deletions

View File

@ -8,7 +8,7 @@ namespace Teknik
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = false;
BundleTable.EnableOptimizations = true;
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

View File

@ -66,30 +66,7 @@ namespace Teknik
object subdomainParam = requestContext.HttpContext.Request.Params["sub"];
if (subdomainParam != null)
values["sub"] = subdomainParam;
var data = base.GetVirtualPath(requestContext, values); // we now have the route based on subdomain
if (data != null)
{
// we should generate the URL now
var split = requestContext.HttpContext.Request.Url.Host.Split('.'); // split the host by '.'
if (split.Count() > 0 && !split[0].ToLower().Contains("dev")) // fire only if the hostname doesn't contain the 'dev' subdomain
{
// Get the current domain
string domain = requestContext.HttpContext.Request.Url.Host;
if (split.Count() > 2)
{
domain = split[1] + "." + split[2];
}
// now let's replace the subdomain
if (data.VirtualPath.StartsWith("/"))
data.VirtualPath = data.VirtualPath.Substring(1);
// generate the full URL, not just relevent path
data.VirtualPath = string.Format("{0}.{1}/{2}", subdomainParam, domain, data.VirtualPath);
}
}
return data;
return base.GetVirtualPath(requestContext, values); // we now have the route based on subdomain
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Teknik.Areas.About.ViewModels;
using Teknik.Controllers;
namespace Teknik.Areas.About.Controllers
@ -10,14 +11,14 @@ namespace Teknik.Areas.About.Controllers
public class AboutController : DefaultController
{
//[AllowAnonymous]
[Authorize(Roles = "Admin")]
[AllowAnonymous]
// GET: About/About
public ActionResult Index()
{
ViewBag.Title = "About - " + Config.Title;
ViewBag.Message = "What is Teknik?";
return View();
return View(new AboutViewModel());
}
}
}

View File

@ -9,24 +9,24 @@
Teknik was created to provide our users free services that they can trust. All of our services are treated with the utmost care to provide you with the best experience possible, and the best security with your data that we can give.
</p>
<p>
You can view our complete activity and statistics by visiting the @Html.ActionLink("Transparency", "Index", "Transparency", new { area = "Transparency" }, null) page.
You can view our complete activity and statistics by visiting the <a href="@Url.SubAction("transparency", "Index", "Transparency", new { area = "Transparency" })">Transparency</a> page.
</p>
<h2 class="text-center">What we Offer</h2>
<hr>
<div class="row">
<div class="col-sm-4 col-sm-offset-2 text-center">
<h4>@Html.ActionLink("Fast and Secure Pastebin", "Index", "Paste", new { area = "Paste" }, null)</h4>
<h4>@Html.ActionLink("Encrypted File Uploads", "Index", "Upload", new { area = "Upload" }, null)</h4>
<h4>@Html.ActionLink("Free Email Address", "Index", "Mail", new { area = "Mail" }, null)</h4>
<h4>@Html.ActionLink("Easy to Use API", "Api", "Help", new { area = "Help" }, null)</h4>
<h4>@Html.ActionLink("Personal Git Repositories", "Index", "Git", new { area = "Git" }, null)</h4>
<h4><a href="@Url.SubAction("paste", "Index", "Paste", new { area = "Paste" })">Fast and Secure Pastebin</a></h4>
<h4><a href="@Url.SubAction("upload", "Index", "Upload", new { area = "Upload" })">Encrypted File Uploads</a></h4>
<h4><a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Mail" })">Free Email Address</a></h4>
<h4><a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Api" })">Easy to Use API</a></h4>
<h4><a href="@Url.SubAction("git", "Index", "Git", new { area = "Git" })">Personal Git Repositories</a></h4>
</div>
<div class="col-sm-4 text-center">
<h4>@Html.ActionLink("Personal Blog", "Blog", "Blog", new { area = "Blog" }, null)</h4>
<h4>@Html.ActionLink("Entertaining Podcasts", "Index", "Podcast", new { area = "Podcast" }, null)</h4>
<h4>@Html.ActionLink("Mumble Server", "Mumble", "Help", new { area = "Help" }, null)</h4>
<h4>@Html.ActionLink("Full Transparency", "Index", "Transparency", new { area = "Transparency" }, null)</h4>
<h4>@Html.ActionLink("Completely Open Source", "Index", "Git", new { area = "Git" }, null)</h4>
<h4><a href="@Url.SubAction("blog", "Blog", "Blog", new { area = "Blog" })">Personal Blog</a></h4>
<h4><a href="@Url.SubAction("podcast", "Index", "Podcast", new { area = "Podcast" })">Entertaining Podcasts</a></h4>
<h4><a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Mumble" })">Mumble Server</a></h4>
<h4><a href="@Url.SubAction("transparency", "Index", "Transparency", new { area = "Transparency" })">Full Transparency</a></h4>
<h4><a href="@Url.SubAction("git", "Index", "Git", new { area = "Git" })">Completely Open Source</a></h4>
</div>
</div>
@ -36,7 +36,7 @@
Teknik's source code can be located on our <a href="http://git.teknik.io/Teknikode/">Git Repository</a> as well as all our internal tools and projects.
<br />
<br />
Have a cool suggestion for the site? Just submit it using the @Html.ActionLink("Feedback Form", "Index", "Contact", new { area = "Contact" }, null)!
Have a cool suggestion for the site? Just submit it using the <a href="@Url.SubAction("contact", "Index", "Contact", new { area = "Contact" })">Feedback Form</a>!
</p>
<div class="alert alert-info">
<div class="text-center">

View File

@ -37,7 +37,7 @@
<div class="row">
<div class="col-sm-12 text-center">
<p>
<a href="@Url.Action("Blog", "RSS", new { area = "RSS", username = (Model.BlogId == Constants.SERVERBLOGID) ? string.Empty : Model.User.Username })"><i class="fa fa-rss fa-2x fa-border"></i></a>
<a href="@Url.SubAction("rss", "Blog", "RSS", new { area = "RSS", username = (Model.BlogId == Constants.SERVERBLOGID) ? string.Empty : Model.User.Username })"><i class="fa fa-rss fa-2x fa-border"></i></a>
</p>
</div>
</div>

View File

@ -16,7 +16,7 @@
<div class="col-sm-8 col-sm-offset-2">
<div class="post-comment">
<p class="post-comment-meta text-muted">
<a href="@Url.Action("Index", "Profile", new { area = "Profile", username = Model.Post.Blog.User.Username })">@Model.Post.Blog.User.Username</a> replied at @Model.DatePosted.ToString("HH:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")
<a href="@Url.SubAction("profile", "Index", "Profile", new { area = "Profile", username = Model.Post.Blog.User.Username })">@Model.Post.Blog.User.Username</a> replied at @Model.DatePosted.ToString("HH:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")
@if (Model.Post.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

View File

@ -14,9 +14,9 @@
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="blog-post">
<h2 class="blog-post-title text-center"><a href="@Url.Action("Post", "Blog", new { area = "Blog", username = Model.Blog.User.Username, id = Model.PostId })" id="title_@Model.PostId">@Model.Title</a></h2>
<h2 class="blog-post-title text-center"><a href="@Url.SubAction("blog", "Post", "Blog", new { area = "Blog", username = Model.Blog.User.Username, id = Model.PostId })" id="title_@Model.PostId">@Model.Title</a></h2>
<p class="blog-post-meta text-center text-muted">
Posted on @Model.DatePublished.ToString("MMMM dd, yyyy") by <a href="@Url.Action("Index", "Profile", new { area = "Profile", username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
Posted on @Model.DatePublished.ToString("MMMM dd, yyyy") by <a href="@Url.SubAction("profile", "Index", "Profile", new { area = "Profile", username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
@if (Model.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

View File

@ -65,7 +65,7 @@
}
<ol class="breadcrumb">
<li><a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = (Model.BlogId == Constants.SERVERBLOGID) ? string.Empty : Model.Blog.User.Username })">@((Model.BlogId == Constants.SERVERBLOGID) ? Model.Config.BlogConfig.Title : Model.Blog.Title)</a></li>
<li><a href="@Url.SubAction("blog", "Blog", "Blog", new { area = "Blog", username = (Model.BlogId == Constants.SERVERBLOGID) ? string.Empty : Model.Blog.User.Username })">@((Model.BlogId == Constants.SERVERBLOGID) ? Model.Config.BlogConfig.Title : Model.Blog.Title)</a></li>
<li class="active"><a href="#">@Model.Title</a></li>
</ol>

View File

@ -20,7 +20,7 @@
<br />
<div class="container">
<div class="row">
<a href="@Url.Action("Index", "Upload", new { area = "Upload"})">
<a href="@Url.SubAction("upload", "Index", "Upload", new { area = "Upload"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br />
@ -31,7 +31,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Paste", new { area = "Paste"})">
<a href="@Url.SubAction("paste", "Index", "Paste", new { area = "Paste"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br />
@ -42,7 +42,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Podcast", new { area = "Podcast"})">
<a href="@Url.SubAction("podcast", "Index", "Podcast", new { area = "Podcast"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br />
@ -53,7 +53,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Help", new { area = "Help"})/#Mumble">
<a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Mumble"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br />
@ -73,7 +73,7 @@
</div>
<br/>
<div class="row">
<a href="@Url.Action("Index", "Help", new { area = "Help"})/#Mail">
<a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Mail"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br/>
@ -84,7 +84,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Git", new { area = "Git"})">
<a href="@Url.SubAction("git", "Index", "Git", new { area = "Git"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br/>
@ -95,7 +95,7 @@
</div>
</div>
</a>
<a href="@Url.Action("blog", "Blog", new { area = "Blog"})">
<a href="@Url.SubAction("blog", "blog", "Blog", new { area = "Blog"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br/>
@ -106,7 +106,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Help", new { area = "Help"})/#IRC">
<a href="@Url.SubAction("help", "Index", "Help", new { area = "Help", section = "Irc"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br/>
@ -146,10 +146,10 @@
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.Action("Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
<a href="@Url.SubAction("blog", "Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.Action("Index", "Profile", new { area = "Profile", username = post.Blog.User.Username })">@post.Blog.User.Username</a>
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.SubAction("profile", "Index", "Profile", new { area = "Profile", username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>
@ -197,7 +197,7 @@
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.Action("Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
<a href="@Url.SubAction("podcast", "View", "Podcast", new { area = "Podcast", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on @post.DatePosted.ToString("MMMM dd, yyyy")
@ -247,10 +247,10 @@
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="@Url.Action("Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
<h2 class="blog-post-title-sm text-left"><a href="@Url.SubAction("blog", "Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.Action("Index", "Profile", new { area = "Profile", username = post.Blog.User.Username })">@post.Blog.User.Username</a>
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.SubAction("profile", "Index", "Profile", new { area = "Profile", username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>

View File

@ -25,7 +25,7 @@ namespace Teknik.Areas.Profile.Controllers
ViewBag.Title = Config.Title + " - Profile";
ViewBag.Message = "View Your Profile";
return View();
return View(new ProfileViewModel());
}
[HttpGet]

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.ViewModels;
namespace Teknik.Areas.Profile.ViewModels
{
public class ProfileViewModel : ViewModelBase
{
}
}

View File

@ -1 +1 @@
@using Teknik.Models
@model Teknik.Areas.Profile.ViewModels.ProfileViewModel

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Teknik.Areas.Upload.ViewModels;
using Teknik.Controllers;
namespace Teknik.Areas.Upload.Controllers
{
public class UploadController : DefaultController
{
// GET: Upload/Upload
[HttpGet]
[AllowAnonymous]
public ActionResult Index()
{
return View(new UploadViewModel());
}
// GET: Upload/Upload
[HttpGet]
[AllowAnonymous]
public ActionResult Download(string url)
{
return View(new UploadViewModel());
}
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Upload(string uploadID)
{
return Json(new { result = "tempURL.png" });
}
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Delete(string url, string deleteKey)
{
return Json(new { result = true });
}
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult GenerateDeleteKey(string uploadID)
{
return Json(new { result = "temp-delete-key" });
}
}
}

View File

@ -0,0 +1,57 @@
@model Teknik.Areas.Upload.ViewModels.UploadViewModel
<script>
var generateDeleteKeyURL = '@Url.Action("GenerateDeleteKey", "Upload", new { area = "Upload" })';
var uploadURL = '@Url.Action("Download", "Upload", new { area = "Upload", url = string.Empty })';
var maxUploadSize = @(Model.Config.UploadConfig.MaxUploadSize / 100000);
</script>
@Styles.Render("~/Content/upload")
<div class="container">
<div class="row text-center">
<form action="@Url.Action("Upload", "Upload", new { area = "Upload" })" class="dropzone" id="TeknikUpload" name="TeknikUpload">
@Html.AntiForgeryToken()
<div class="dz-message text-center" id="upload_message">
<div class="row">
<div class="col-sm-12">
<h1>Drop your files here</h1>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<h2>Or just click here</h2>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<h3>Your Choice</h3>
</div>
</div>
</div>
<div class="fallback text-center">
<div class="row">
<div class="col-sm-12">
<input name="file" type="file" class="form-control" multiple />
</div>
</div>
</div>
</form>
</div>
<br />
<div class="progress">
<div class="progress-bar progress-bar-success" id="progressBar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 0%">0%</div>
</div>
<div class="container" id="upload-links">
</div>
<br />
<div class="well text-center">Each file is encrypted on upload using an AES-256-CBC cipher. If you wish to view the file decrypted, you must use the direct Teknik link.</div>
<div class="text-center">
Useful Tools: <a href="http://git.teknik.io/Teknikode/Tools/src/master/Upload">Upload Scripts and Utilities</a> | <a href="https://github.com/jschx/poomf">Poomf Uploader</a>
<br />
<br />
You can now upload your screenshots automatically using <a href="https://github.com/KittyKatt/screenFetch">Screenfetch</a>!
</div>
</div>
@Scripts.Render("~/bundles/upload")

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Teknik
{
public static class UrlExtensions
{
/// <summary>
/// Generates a full URL given the specified sub domain.
/// If the subdomain is not 'dev', the Controller will be removed
/// </summary>
/// <param name="url"></param>
/// <param name="sub"></param>
/// <param name="action"></param>
/// <param name="controller"></param>
/// <param name="routeValues"></param>
/// <returns></returns>
public static string SubAction(this UrlHelper url, string sub, string action, string controller, object routeValues)
{
Uri requestUrl = url.RequestContext.HttpContext.Request.Url;
string host = url.RequestContext.HttpContext.Request.Url.Authority;
string firstSub = string.Empty;
string paramSub = string.Empty;
string domain = host;
string rightUrl = string.Empty;
// get current subdomain
string curSub = string.Empty;
var split = host.Split('.'); // split the host by '.'
if (split.Count() > 2)
{
curSub = split[0];
int index = host.IndexOf('.') + 1;
if (index >= 0 && index < host.Length)
domain = host.Substring(index, (host.Length - index));
}
// Grab the sub from parameters if it exists
string subParam = url.RequestContext.HttpContext.Request.Params["sub"]; // A subdomain specified as a query parameter takes precedence over the hostname.
// If the param is not being used, we will use the curSub
if (string.IsNullOrEmpty(subParam))
{
// If we are in dev, we need to keep it in dev
firstSub = (curSub == "dev") ? "dev" : sub;
}
else
{
// sub within param will always be on the dev subdomain
firstSub = (string.IsNullOrEmpty(curSub)) ? string.Empty : "dev";
}
rightUrl = url.Action(action, controller, routeValues);
domain = (string.IsNullOrEmpty(firstSub)) ? domain : firstSub + "." + domain;
string absoluteAction = string.Format("{0}://{1}{2}", url.RequestContext.HttpContext.Request.Url.Scheme, domain, rightUrl);
return absoluteAction;
}
}
}

29
Teknik/Helpers/Utility.cs Normal file
View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web;
namespace Teknik
{
public static class Utility
{
public static dynamic Merge(object item1, object item2)
{
if (item1 == null || item2 == null)
return item1 ?? item2 ?? new ExpandoObject();
dynamic expando = new ExpandoObject();
var result = expando as IDictionary<string, object>;
foreach (System.Reflection.PropertyInfo fi in item1.GetType().GetProperties())
{
result[fi.Name] = fi.GetValue(item1, null);
}
foreach (System.Reflection.PropertyInfo fi in item2.GetType().GetProperties())
{
result[fi.Name] = fi.GetValue(item2, null);
}
return result;
}
}
}

View File

@ -160,6 +160,7 @@
<Compile Include="Areas\Privacy\ViewModels\PrivacyViewModel.cs" />
<Compile Include="Areas\Profile\Controllers\ProfileController.cs" />
<Compile Include="Areas\Profile\ProfileAreaRegistration.cs" />
<Compile Include="Areas\Profile\ViewModels\ProfileViewModel.cs" />
<Compile Include="Areas\Upload\Controllers\UploadController.cs" />
<Compile Include="Areas\Upload\Models\Upload.cs" />
<Compile Include="Areas\Upload\UploadAreaRegistration.cs" />
@ -181,6 +182,8 @@
<Compile Include="Areas\Profile\Models\PermissionType.cs" />
<Compile Include="Areas\Blog\Models\Post.cs" />
<Compile Include="Areas\Profile\Models\Role.cs" />
<Compile Include="Helpers\UrlExtensions.cs" />
<Compile Include="Helpers\Utility.cs" />
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\TeknikEntities.cs" />
<Compile Include="Areas\Profile\Models\User.cs" />

View File

@ -9,7 +9,7 @@
string version = fileVersionInfo.ProductVersion;
}
<p class="text-muted">
&copy; Teknik 2013-2015 | @Html.ActionLink("Privacy", "Index", "Privacy", new { area = "Privacy"}, htmlAttributes: new { title = "Privacy" }) | @Html.ActionLink("Transparency", "Index", "Transparency", new { area = "Transparency" }, htmlAttributes: new { title = "Transparency" }) | @Html.ActionLink("Server", "Index", "Server", new { area = "Server" }, htmlAttributes: new { title = "Server" })
&copy; Teknik 2013-2015 | <a href="@Url.SubAction("privacy", "Index", "Privacy", new { area = "Privacy"})">Privacy</a> | <a href="@Url.SubAction("transparency", "Index", "Transparency", new { area = "Transparency" })">Transparency</a> | <a href="@Url.SubAction("server", "Index", "Server", new { area = "Server" })">Server</a>
<br />
@string.Format("{0}", version)
</p>

View File

@ -7,19 +7,19 @@
<a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name <strong class="caret"></strong></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="user_menu">
<li>
<a href="@Url.Action("Index", "Profile", new { area = "Profile", username = User.Identity.Name })">Profile</a>
<a href="@Url.SubAction("profile", "Index", "Profile", new { area = "Profile", username = User.Identity.Name })">Profile</a>
</li>
<li>
<a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = User.Identity.Name })">Blog</a>
<a href="@Url.SubAction("blog", "Blog", "Blog", new { area = "Blog", username = User.Identity.Name })">Blog</a>
</li>
@if (User.IsInRole("Admin"))
{
<li>
<a href="@Url.Action("Index", "Admin", new { area = "Admin" })">Administration</a>
<a href="@Url.SubAction("admin", "Index", "Admin", new { area = "Admin" })">Administration</a>
</li>
}
<li>
@Html.ActionLink("Sign Out", "Logout", "Profile", new { area = "Profile" }, null)
<a href="@Url.SubAction("profile", "Logout", "Profile", new { area = "Profile" })"></a>
</li>
</ul>
</li>

View File

@ -8,50 +8,50 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="@Url.Action("Index", "Home", new { area = "Home" })"><img src="/Images/logo-black.svg" height="20" alt="Teknik"></a>
<a class="navbar-brand" href="@Url.SubAction("www", "Index", "Home", new { area = "Home" })"><img src="/Images/logo-black.svg" height="20" alt="Teknik"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="@Url.Action("Index", "Home", new { area = "Home" })">Home</a></li>
<li><a href="@Url.Action("Index", "About", new { area = "About" })">About</a></li>
<li><a href="@Url.SubAction("www", "Index", "Home", new { area = "Home" })">Home</a></li>
<li><a href="@Url.SubAction("about", "Index", "About", new { area = "About" })">About</a></li>
<li class="divider-vertical"></li>
<li class="dropdown">
<a href="#" id="services_menu" class="dropdown-toggle" data-toggle="dropdown">Services <strong class="caret"></strong></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="services_menu">
<li>
<a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = string.Empty })">Blog</a>
<a href="@Url.SubAction("blog", "Blog", "Blog", new { area = "Blog", username = string.Empty })">Blog</a>
</li>
<li>
<a href="@Url.Action("Index", "Podcast", new { area = "Podcast" })">Podcast</a>
<a href="@Url.SubAction("podcast", "Index", "Podcast", new { area = "Podcast" })">Podcast</a>
</li>
<li class="divider"></li>
<li>
<a href="@Url.Action("Index", "Upload", new { area = "Upload" })">Upload</a>
<a href="@Url.SubAction("upload", "Index", "Upload", new { area = "Upload" })">Upload</a>
</li>
<li>
<a href="@Url.Action("Index", "Paste", new { area = "Paste" })">Paste</a>
<a href="@Url.SubAction("paste", "Index", "Paste", new { area = "Paste" })">Paste</a>
</li>
<li>
<a href="@Url.Action("Index", "Git", new { area = "Git" })">Git</a>
<a href="@Url.SubAction("git", "Index", "Git", new { area = "Git" })">Git</a>
</li>
<li>
<a href="@Url.Action("Index", "Mail", new { area = "Mail" })" target="_blank">Mail</a>
<a href="@Url.SubAction("mail", "Index", "Mail", new { area = "Mail" })" target="_blank">Mail</a>
</li>
<li>
<a href="mumble://mumble.@(Model.Config.Host):64738/?version=1.2.5" target="_blank">Mumble</a>
</li>
<li class="divider"></li>
<li>
<a href="@Url.Action("Index", "Ricehalla", new { area = "Ricehalla" })">Ricehalla</a>
<a href="@Url.SubAction("ricehalla", "Index", "Ricehalla", new { area = "Ricehalla" })">Ricehalla</a>
</li>
</ul>
</li>
<li>
<a href="@Url.Action("Index", "Contact", new { area = "Contact" })">Contact</a>
<a href="@Url.SubAction("contact", "Index", "Contact", new { area = "Contact" })">Contact</a>
</li>
<li>
<a href="@Url.Action("Index", "Help", new { area = "Help" })">Help</a>
<a href="@Url.SubAction("help", "Index", "Help", new { area = "Help" })">Help</a>
</li>
</ul>
@Html.Partial("_LoginPartial")