mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Fixed blogs not showing correctly.
Added individual blog post viewing. Fixed javascript to use valid urls. Fixed Route registrations.
This commit is contained in:
parent
ff8bc3d464
commit
1bfddb9ec9
@ -29,6 +29,13 @@ namespace Teknik.Areas.Blog
|
|||||||
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.BlogController).Namespace }
|
new[] { typeof(Controllers.BlogController).Namespace }
|
||||||
);
|
);
|
||||||
|
context.MapSubdomainRoute(
|
||||||
|
"Blog_dev_post_unique", // Route name
|
||||||
|
"dev",
|
||||||
|
"Blog/Action/{controller}/{action}", // URL with parameters
|
||||||
|
new { controller = "Blog", action = "Blog" }, // Parameter defaults
|
||||||
|
new[] { typeof(Controllers.BlogController).Namespace }
|
||||||
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Blog_default_blog", // Route name
|
"Blog_default_blog", // Route name
|
||||||
"blog",
|
"blog",
|
||||||
@ -43,6 +50,13 @@ namespace Teknik.Areas.Blog
|
|||||||
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.BlogController).Namespace }
|
new[] { typeof(Controllers.BlogController).Namespace }
|
||||||
);
|
);
|
||||||
|
context.MapSubdomainRoute(
|
||||||
|
"Blog_default_post_unique", // Route name
|
||||||
|
"blog",
|
||||||
|
"Action/{controller}/{action}", // URL with parameters
|
||||||
|
new { controller = "Blog", action = "Blog" }, // Parameter defaults
|
||||||
|
new[] { typeof(Controllers.BlogController).Namespace }
|
||||||
|
);
|
||||||
|
|
||||||
// Register Bundles
|
// Register Bundles
|
||||||
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/blog").Include(
|
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/blog").Include(
|
||||||
|
@ -46,24 +46,31 @@ namespace Teknik.Areas.Blog.Controllers
|
|||||||
Models.Blog blog = null;
|
Models.Blog blog = null;
|
||||||
if (string.IsNullOrEmpty(username))
|
if (string.IsNullOrEmpty(username))
|
||||||
{
|
{
|
||||||
|
ViewBag.Title = "Teknik Blog - " + Config.Title;
|
||||||
blog = db.Blogs.Find(Constants.SERVERBLOGID);
|
blog = db.Blogs.Find(Constants.SERVERBLOGID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var blogs = db.Blogs.Include("Blog.User").Where(p => p.User.Username == username);
|
var blogs = db.Blogs.Include("User").Where(p => p.User.Username == username);
|
||||||
if (blogs.Any())
|
if (blogs.Any())
|
||||||
{
|
{
|
||||||
blog = blogs.First();
|
blog = blogs.First();
|
||||||
|
ViewBag.Title = blog.User.Username + "'s Blog - " + Config.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// find the post specified
|
// find the post specified
|
||||||
if (blog != null)
|
if (blog != null)
|
||||||
{
|
{
|
||||||
|
var foundPosts = db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.BlogId == blog.BlogId) &&
|
||||||
|
(p.Published || p.Blog.User.Username == User.Identity.Name)
|
||||||
|
);
|
||||||
BlogViewModel model = new BlogViewModel();
|
BlogViewModel model = new BlogViewModel();
|
||||||
model.BlogId = blog.BlogId;
|
model.BlogId = blog.BlogId;
|
||||||
model.UserId = blog.UserId;
|
model.UserId = blog.UserId;
|
||||||
model.User = blog.User;
|
model.User = blog.User;
|
||||||
model.Posts = blog.Posts;
|
model.Title = blog.Title;
|
||||||
|
model.Description = blog.Description;
|
||||||
|
model.Posts = (foundPosts != null && foundPosts.Any()) ? foundPosts.ToList() : null;
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
@ -79,31 +86,36 @@ namespace Teknik.Areas.Blog.Controllers
|
|||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||||
}
|
}
|
||||||
// find the post specified
|
// find the post specified
|
||||||
|
var post = db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.User.Username == username && p.PostId == id) &&
|
||||||
var post = db.Posts.Include("Blog").Include("Blog.User").Where(p => p.Blog.User.Username == username && p.PostId == id);
|
(p.Published || p.Blog.User.Username == User.Identity.Name)
|
||||||
if (post.Any())
|
);
|
||||||
|
if (post != null && post.Any())
|
||||||
{
|
{
|
||||||
Post curPost = post.First();
|
Post curPost = post.First();
|
||||||
PostViewModel model = new PostViewModel();
|
PostViewModel model = new PostViewModel(curPost);
|
||||||
model.BlogId = curPost.BlogId;
|
|
||||||
model.PostId = curPost.PostId;
|
|
||||||
model.DatePosted = curPost.DatePosted;
|
|
||||||
model.Published = curPost.Published;
|
|
||||||
model.DatePublished = curPost.DatePublished;
|
|
||||||
model.Title = curPost.Title;
|
|
||||||
model.Tags = curPost.Tags;
|
|
||||||
model.Article = curPost.Article;
|
|
||||||
|
|
||||||
return View(model);
|
ViewBag.Title = model.Title + " - " + username + "'s Blog - " + Config.Title;
|
||||||
|
return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", model);
|
||||||
}
|
}
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound);
|
return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
public ActionResult GetPosts(int blogID, int startPostID, int count)
|
public ActionResult GetPosts(int blogID, int startPostID, int count)
|
||||||
{
|
{
|
||||||
object model = null;
|
var posts = db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.BlogId == blogID && p.PostId > startPostID) &&
|
||||||
|
(p.Published || p.Blog.User.Username == User.Identity.Name)
|
||||||
return PartialView("Post", model);
|
).Take(count);
|
||||||
|
List<PostViewModel> postViews = new List<PostViewModel>();
|
||||||
|
if (posts != null)
|
||||||
|
{
|
||||||
|
foreach (Post post in posts)
|
||||||
|
{
|
||||||
|
postViews.Add(new PostViewModel(post));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PartialView("~/Areas/Blog/Views/Blog/Posts.cshtml", postViews);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Blogs/Create
|
// GET: Blogs/Create
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#blog_submit").click(function () {
|
$("#blog_submit").click(function () {
|
||||||
$('#newPost').modal('hide');
|
$('#newPost').modal('hide');
|
||||||
userID = encodeURIComponent($("#blog_userid").val());
|
|
||||||
title = encodeURIComponent($("#blog_title").val());
|
title = encodeURIComponent($("#blog_title").val());
|
||||||
post = encodeURIComponent($("#blog_post").val());
|
post = encodeURIComponent($("#blog_post").val());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../add_post.php",
|
url: addPostURL,
|
||||||
data: "userID=" + userID + "&title=" + title + "&post=" + post,
|
data: { title: title, post: post },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -23,12 +22,12 @@
|
|||||||
|
|
||||||
$('#editPost').on('show.bs.modal', function (e) {
|
$('#editPost').on('show.bs.modal', function (e) {
|
||||||
$("#edit_blog_post").val("");
|
$("#edit_blog_post").val("");
|
||||||
userID = encodeURIComponent($(e.relatedTarget).attr("id"));
|
postID = encodeURIComponent($(e.relatedTarget).attr("id"));
|
||||||
$("#edit_blog_postid").val(userID);
|
$("#edit_blog_postid").val(postID);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../get_title_content.php",
|
url: getPostTitleURL,
|
||||||
data: "id=" + userID,
|
data: { id: postID },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html) {
|
if (html) {
|
||||||
$("#edit_blog_title").val(html);
|
$("#edit_blog_title").val(html);
|
||||||
@ -37,8 +36,8 @@
|
|||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../get_post_content.php",
|
url: getPostArticleURL,
|
||||||
data: "id=" + userID,
|
data: { id: postID },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html) {
|
if (html) {
|
||||||
$("#edit_blog_post").val(html);
|
$("#edit_blog_post").val(html);
|
||||||
@ -50,13 +49,12 @@
|
|||||||
$("#edit_submit").click(function () {
|
$("#edit_submit").click(function () {
|
||||||
$('#editPost').modal('hide');
|
$('#editPost').modal('hide');
|
||||||
postID = encodeURIComponent($("#edit_blog_postid").val());
|
postID = encodeURIComponent($("#edit_blog_postid").val());
|
||||||
userID = encodeURIComponent($("#edit_blog_userid").val());
|
|
||||||
title = encodeURIComponent($("#edit_blog_title").val());
|
title = encodeURIComponent($("#edit_blog_title").val());
|
||||||
post = encodeURIComponent($("#edit_blog_post").val());
|
post = encodeURIComponent($("#edit_blog_post").val());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../edit_post.php",
|
url: editPostURL,
|
||||||
data: "userID=" + userID + "&postID=" + postID + "&title=" + title + "&post=" + post,
|
data: { postID: postID, title: title, post: post },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -76,8 +74,8 @@
|
|||||||
post = encodeURIComponent($("#comment_post").val());
|
post = encodeURIComponent($("#comment_post").val());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../includes/add_comment.php",
|
url: addCommentURL,
|
||||||
data: "postID=" + postID + "&service=blog&comment=" + post,
|
data: { postID: postID, service: 'blog', comment: post },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -97,8 +95,8 @@
|
|||||||
$("#edit_comment_postid").val(commentID);
|
$("#edit_comment_postid").val(commentID);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../includes/get_comment_content.php",
|
url: getCommentContentURL,
|
||||||
data: "id=" + commentID,
|
data: { id: commentID },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html) {
|
if (html) {
|
||||||
$("#edit_comment_post").val(html);
|
$("#edit_comment_post").val(html);
|
||||||
@ -113,8 +111,8 @@
|
|||||||
post = encodeURIComponent($("#edit_comment_post").val());
|
post = encodeURIComponent($("#edit_comment_post").val());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../includes/edit_comment.php",
|
url: editCommentURL,
|
||||||
data: "commentID=" + postID + "&post=" + post,
|
data: { commentID: postID, post: post },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -130,7 +128,7 @@
|
|||||||
|
|
||||||
var imageUpload = $('#upload_image').upload({
|
var imageUpload = $('#upload_image').upload({
|
||||||
name: 'file',
|
name: 'file',
|
||||||
action: '../../../includes/upload.php',
|
action: uploadURL,
|
||||||
enctype: 'multipart/form-data',
|
enctype: 'multipart/form-data',
|
||||||
params: {},
|
params: {},
|
||||||
autoSubmit: true,
|
autoSubmit: true,
|
||||||
@ -153,8 +151,8 @@ function loadMorePosts(start, count) {
|
|||||||
blog_id = encodeURIComponent($(".blog-main").attr("id"));
|
blog_id = encodeURIComponent($(".blog-main").attr("id"));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../get_post.php",
|
url: getPostsURL,
|
||||||
data: "userID=" + blog_id + "&postCount=" + count + "&startPost=" + start,
|
data: { blogID: blog_id, count: count, startPostID: start },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html) {
|
if (html) {
|
||||||
$(".blog-main").append(html);
|
$(".blog-main").append(html);
|
||||||
@ -171,8 +169,8 @@ function loadMoreComments(start, count) {
|
|||||||
post_id = encodeURIComponent($(".post-comments").attr("id"));
|
post_id = encodeURIComponent($(".post-comments").attr("id"));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../includes/get_comment.php",
|
url: getCommentsURL,
|
||||||
data: "postID=" + post_id + "&service=blog&postCount=" + count + "&startPost=" + start,
|
data: { postID: post_id, service: 'blog', postCount: count, startPost: start },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html) {
|
if (html) {
|
||||||
$(".post-comments").append(html);
|
$(".post-comments").append(html);
|
||||||
@ -205,8 +203,8 @@ function linkPostUnpublish(selector) {
|
|||||||
post_id = encodeURIComponent(object.attr("id"));
|
post_id = encodeURIComponent(object.attr("id"));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../publish_post.php",
|
url: publishPostURL,
|
||||||
data: "publish=0&id=" + post_id,
|
data: { publish: false, id: post_id },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -226,8 +224,8 @@ function linkPostPublish(selector) {
|
|||||||
post_id = encodeURIComponent(object.attr("id"));
|
post_id = encodeURIComponent(object.attr("id"));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../publish_post.php",
|
url: publishPostURL,
|
||||||
data: "publish=1&id=" + post_id,
|
data: { publish: true, id: post_id },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -249,8 +247,8 @@ function linkPostDelete(selector) {
|
|||||||
if (result) {
|
if (result) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../delete_post.php",
|
url: deletePostURL,
|
||||||
data: "id=" + post_id,
|
data: { id: post_id },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -274,8 +272,8 @@ function linkCommentDelete(selector) {
|
|||||||
if (result) {
|
if (result) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "../../../includes/delete_comment.php",
|
url: deleteCommentURL,
|
||||||
data: "id=" + post_id,
|
data: { id: post_id },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (html == 'true') {
|
if (html == 'true') {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Teknik.Areas.Blog.Models;
|
using Teknik.Areas.Blog.Models;
|
||||||
|
using System.Security.Principal;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
@ -12,6 +13,8 @@ namespace Teknik.Areas.Blog.ViewModels
|
|||||||
|
|
||||||
public int BlogId { get; set; }
|
public int BlogId { get; set; }
|
||||||
|
|
||||||
|
public Models.Blog Blog { get; set; }
|
||||||
|
|
||||||
public DateTime DatePosted { get; set; }
|
public DateTime DatePosted { get; set; }
|
||||||
|
|
||||||
public DateTime DatePublished { get; set; }
|
public DateTime DatePublished { get; set; }
|
||||||
@ -23,5 +26,23 @@ namespace Teknik.Areas.Blog.ViewModels
|
|||||||
public string Article { get; set; }
|
public string Article { get; set; }
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
public PostViewModel(Post post)
|
||||||
|
{
|
||||||
|
BlogId = post.BlogId;
|
||||||
|
PostId = post.PostId;
|
||||||
|
Blog = post.Blog;
|
||||||
|
DatePosted = post.DatePosted;
|
||||||
|
Published = post.Published;
|
||||||
|
DatePublished = post.DatePublished;
|
||||||
|
Title = post.Title;
|
||||||
|
Tags = post.Tags;
|
||||||
|
Article = post.Article;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanView(IPrincipal user)
|
||||||
|
{
|
||||||
|
return (Published || Blog.User.Username == user.Identity.Name || user.IsInRole("Admin"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,29 +1,48 @@
|
|||||||
@model Teknik.Areas.Blog.ViewModels.BlogViewModel
|
@model Teknik.Areas.Blog.ViewModels.BlogViewModel
|
||||||
|
|
||||||
|
@using Teknik.Helpers
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// We need to define the action URLs for the script
|
||||||
|
|
||||||
|
var uploadURL = '@Url.Action("UploadFile", "Upload", new { area = "Upload" })';
|
||||||
|
|
||||||
|
var getPostsURL = '@Url.Action("GetPosts", "Blog", new { area = "Blog" })';
|
||||||
|
var getPostTitleURL = '@Url.Action("GetPostTitle", "Blog", new { area = "Blog" })';
|
||||||
|
var getPostArticleURL = '@Url.Action("GetPostArticle", "Blog", new { area = "Blog" })';
|
||||||
|
var publishPostURL = '@Url.Action("PublishPost", "Blog", new { area = "Blog" })';
|
||||||
|
var addPostURL = '@Url.Action("CreatePost", "Blog", new { area = "Blog" })';
|
||||||
|
var editPostURL = '@Url.Action("EditPost", "Blog", new { area = "Blog" })';
|
||||||
|
var deletePostURL = '@Url.Action("DeletePost", "Blog", new { area = "Blog" })';
|
||||||
|
|
||||||
|
var getCommentsURL = '@Url.Action("GetComments", "Blog", new { area = "Blog" })';
|
||||||
|
var getCommentArticleURL = '@Url.Action("GetCommentArticle", "Blog", new { area = "Blog" })';
|
||||||
|
var addCommentURL = '@Url.Action("CreatePost", "Blog", new { area = "Blog" })';
|
||||||
|
var editCommentURL = '@Url.Action("EditPost", "Blog", new { area = "Blog" })';
|
||||||
|
var deleteCommentURL = '@Url.Action("DeleteComment", "Blog", new { area = "Blog" })';
|
||||||
|
</script>
|
||||||
|
|
||||||
@Scripts.Render("~/bundles/blog")
|
@Scripts.Render("~/bundles/blog")
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php
|
@if (Model.BlogId != Constants.SERVERBLOGID)
|
||||||
if ($blog_id >= 0)
|
|
||||||
{
|
{
|
||||||
?>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 blog-heading">
|
<div class="col-sm-12 blog-heading">
|
||||||
<h1 class="blog-title text-center"><?php echo $blog_title; ?></h1>
|
<h1 class="blog-title text-center">@Model.Title</h1>
|
||||||
<p class="lead blog-description text-center text-muted"><?php echo $blog_desc; ?></p>
|
<p class="lead blog-description text-center text-muted">@Model.Description</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 text-center">
|
<div class="col-sm-12 text-center">
|
||||||
<p>
|
<p>
|
||||||
<a href="<?php echo get_page_url('rss', $CONF).'/blog/'.$blog_author; ?>"><i class="fa fa-rss fa-2x fa-border"></i></a>
|
<a href="@Url.Action("Blog", "RSS", new { area = "RSS", username = Model.User.Username })"><i class="fa fa-rss fa-2x fa-border"></i></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
if ($own_blog)
|
@if (Model.User.Username == User.Identity.Name)
|
||||||
{
|
{
|
||||||
?>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 text-center">
|
<div class="col-sm-12 text-center">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newPost">Create Post</button>
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newPost">Create Post</button>
|
||||||
@ -38,7 +57,6 @@
|
|||||||
<h4 class="modal-title" id="newPostLabel">Create a New Post</h4>
|
<h4 class="modal-title" id="newPostLabel">Create a New Post</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input name="blog_userid" id="blog_userid" type="hidden" value="<?php echo $blog_id; ?>" />
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-12">
|
<div class="form-group col-sm-12">
|
||||||
<label for="blog_title"><h4>Title</h4></label>
|
<label for="blog_title"><h4>Title</h4></label>
|
||||||
@ -69,7 +87,6 @@
|
|||||||
<h4 class="modal-title" id="editPostLabel">Edit Your Post</h4>
|
<h4 class="modal-title" id="editPostLabel">Edit Your Post</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input name="edit_blog_userid" id="edit_blog_userid" type="hidden" value="<?php echo $blog_id; ?>" />
|
|
||||||
<input name="edit_blog_postid" id="edit_blog_postid" type="hidden" />
|
<input name="edit_blog_postid" id="edit_blog_postid" type="hidden" />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-12">
|
<div class="form-group col-sm-12">
|
||||||
@ -92,30 +109,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error))
|
<div class="blog-main" id="@Model.BlogId"></div>
|
||||||
{
|
|
||||||
?>
|
|
||||||
<div class="blog-main" id="<?php echo $blog_id; ?>"></div>
|
|
||||||
<script>
|
<script>
|
||||||
var posts = <?php echo $posts_per_load; ?>;
|
var posts = @ViewBag.Config.PostsToLoad;
|
||||||
var start_post = 0;
|
var start_post = 0;
|
||||||
loadMorePosts(start_post, posts);
|
loadMorePosts(start_post, posts);
|
||||||
start_post = start_post + posts;
|
start_post = start_post + posts;
|
||||||
</script>
|
</script>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 text-center">
|
|
||||||
<h2><?php echo $error; ?></h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
@ -1,53 +1,38 @@
|
|||||||
@model Teknik.Areas.Blog.Models.Post
|
@model Teknik.Areas.Blog.ViewModels.PostViewModel
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var converter = new Markdown.getSanitizingConverter();
|
var converter = new Markdown.getSanitizingConverter();
|
||||||
// Title Conversion
|
// Title Conversion
|
||||||
var old_post = $("#title_@Model.PostId").text();
|
var old_post = $("#title_@Model.PostId").text();
|
||||||
var new_post = converter.makeHtml(old_post);
|
var new_post = converter.makeHtml(old_post);
|
||||||
$("#title_@Model.PostId").html(new_post);
|
$("#title_@Model.PostId").html(new_post);
|
||||||
// Post Conversion
|
// Post Conversion
|
||||||
var old_post = $("#post_@Model.PostId").text();
|
var old_post = $("#post_@Model.PostId").text();
|
||||||
var new_post = converter.makeHtml(old_post);
|
var new_post = converter.makeHtml(old_post);
|
||||||
$("#post_@Model.PostId").html(new_post);
|
$("#post_@Model.PostId").html(new_post);
|
||||||
</script>
|
</script>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-10 col-sm-offset-1">
|
<div class="col-sm-10 col-sm-offset-1">
|
||||||
<div class="blog-post">
|
<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.Action("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">
|
<p class="blog-post-meta text-center text-muted">
|
||||||
Posted on @Model.DatePublished.ToString("F d, Y") by <a href="@Url.Action("Index", "Profile", new { area = "Profile" })/@Model.Blog.User.Username">@Model.Blog.User.Username</a>
|
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>
|
||||||
<?php
|
@if (Model.Blog.User.Username == User.Identity.Name)
|
||||||
if ($own_blog)
|
{
|
||||||
{
|
<br />
|
||||||
?>
|
<button type="button" class="btn btn-info edit_post" id="@Model.PostId" data-toggle="modal" data-target="#editPost">Edit</button>
|
||||||
<br />
|
if (Model.Published)
|
||||||
<button type="button" class="btn btn-info edit_post" id="<?php echo $post_id; ?>" data-toggle="modal" data-target="#editPost">Edit</button>
|
{
|
||||||
<?php
|
<button type="button" class="btn btn-warning unpublish_post" id="@Model.PostId">Unpublish</button>
|
||||||
if ($published)
|
}
|
||||||
{
|
else
|
||||||
?>
|
{
|
||||||
<button type="button" class="btn btn-warning unpublish_post" id="<?php echo $post_id; ?>">Unpublish</button>
|
<button type="button" class="btn btn-success publish_post" id="@Model.PostId">Publish</button>
|
||||||
<?php
|
}
|
||||||
|
<button type="button" class="btn btn-danger delete_post" id="@Model.PostId">Delete</button>
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<button type="button" class="btn btn-success publish_post" id="<?php echo $post_id; ?>">Publish</button>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<button type="button" class="btn btn-danger delete_post" id="<?php echo $post_id; ?>">Delete</button>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</p>
|
</p>
|
||||||
<p id="post_@Model.PostId">@Model.Article</p>
|
<p id="post_@Model.PostId">@Model.Article</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<!-- NO POSTS -->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 text-center">
|
|
||||||
<h2>There are currently no articles.</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
17
Teknik/Areas/Blog/Views/Blog/Posts.cshtml
Normal file
17
Teknik/Areas/Blog/Views/Blog/Posts.cshtml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@model List<Teknik.Areas.Blog.ViewModels.PostViewModel>
|
||||||
|
|
||||||
|
@if (Model.Any())
|
||||||
|
{
|
||||||
|
foreach (var post in Model)
|
||||||
|
{
|
||||||
|
@Html.Partial("Post", post)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 text-center">
|
||||||
|
<h2>There are currently no articles.</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
164
Teknik/Areas/Blog/Views/Blog/ViewPost.cshtml
Normal file
164
Teknik/Areas/Blog/Views/Blog/ViewPost.cshtml
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
@model Teknik.Areas.Blog.ViewModels.PostViewModel
|
||||||
|
|
||||||
|
@using Teknik.Helpers
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// We need to define the action URLs for the script
|
||||||
|
|
||||||
|
var uploadURL = '@Url.Action("UploadFile", "Upload", new { area = "Upload" })';
|
||||||
|
|
||||||
|
var getPostsURL = '@Url.Action("GetPosts", "Blog", new { area = "Blog" })';
|
||||||
|
var getPostTitleURL = '@Url.Action("GetPostTitle", "Blog", new { area = "Blog" })';
|
||||||
|
var getPostArticleURL = '@Url.Action("GetPostArticle", "Blog", new { area = "Blog" })';
|
||||||
|
var publishPostURL = '@Url.Action("PublishPost", "Blog", new { area = "Blog" })';
|
||||||
|
var addPostURL = '@Url.Action("CreatePost", "Blog", new { area = "Blog" })';
|
||||||
|
var editPostURL = '@Url.Action("EditPost", "Blog", new { area = "Blog" })';
|
||||||
|
var deletePostURL = '@Url.Action("DeletePost", "Blog", new { area = "Blog" })';
|
||||||
|
|
||||||
|
var getCommentsURL = '@Url.Action("GetComments", "Blog", new { area = "Blog" })';
|
||||||
|
var getCommentContentURL = '@Url.Action("GetCommentContent", "Blog", new { area = "Blog" })';
|
||||||
|
var addCommentURL = '@Url.Action("CreatePost", "Blog", new { area = "Blog" })';
|
||||||
|
var editCommentURL = '@Url.Action("EditPost", "Blog", new { area = "Blog" })';
|
||||||
|
var deleteCommentURL = '@Url.Action("DeleteComment", "Blog", new { area = "Blog" })';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@Scripts.Render("~/bundles/blog")
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
@if (Model != null)
|
||||||
|
{
|
||||||
|
if (Model.Blog.User.Username == User.Identity.Name)
|
||||||
|
{
|
||||||
|
<div class="modal fade" id="editPost" tabindex="-1" role="dialog" aria-labelledby="editPostLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form class="form" action="##" method="post" id="editPostForm">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cancel</span></button>
|
||||||
|
<h4 class="modal-title" id="editPostLabel">Edit Your Post</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input name="edit_blog_userid" id="edit_blog_userid" type="hidden" value="@Model.Blog.User.UserId" />
|
||||||
|
<input name="edit_blog_postid" id="edit_blog_postid" type="hidden" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-12">
|
||||||
|
<label for="edit_blog_title"><h4>Title</h4></label>
|
||||||
|
<input class="form-control" name="edit_blog_title" id="edit_blog_title" placeholder="generic click bait" title="enter a title for your post." type="text" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-12">
|
||||||
|
<label for="edit_blog_post"><h4>Article</h4></label>
|
||||||
|
<textarea class="form-control" name="edit_blog_post" id="edit_blog_post" placeholder="I ate a burger today." title="enter any information you want to share with the world." data-provide="markdown" rows="10"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="edit_submit">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li><a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = Model.Blog.User.Username })">@Model.Blog.User.Username</a></li>
|
||||||
|
<li class="active"><a href="#">@Model.Title</a></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
@Html.Partial("../../Areas/Blog/Views/Blog/Post", Model)
|
||||||
|
|
||||||
|
if (Request.IsAuthenticated)
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-10 col-sm-offset-1">
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newComment">Add Comment</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="modal fade" id="newComment" tabindex="-1" role="dialog" aria-labelledby="newCommentLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form class="form" action="##" method="post" id="publishComment">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cancel</span></button>
|
||||||
|
<h4 class="modal-title" id="newCommentLabel">Add a New Comment</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input name="post_id" id="post_id" type="hidden" value="@Model.PostId" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-12">
|
||||||
|
<label for="comment_post"><h4>Comment</h4></label>
|
||||||
|
<textarea class="form-control wmd-input" name="comment_post" id="comment_post" placeholder="Nice post!" title="enter what you think about the post." data-provide="markdown" rows="10"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="comment_submit">Publish</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="editComment" tabindex="-1" role="dialog" aria-labelledby="editCommentLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form class="form" action="##" method="post" id="editCommentForm">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cancel</span></button>
|
||||||
|
<h4 class="modal-title" id="editCommentLabel">Edit Your Comment</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input name="edit_comment_postid" id="edit_comment_postid" type="hidden" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-12">
|
||||||
|
<label for="edit_comment_post"><h4>Comment</h4></label>
|
||||||
|
<textarea class="form-control" name="edit_comment_post" id="edit_comment_post" placeholder="What an interesting article!" title="enter what you thought about the article." data-provide="markdown" rows="10"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="edit_comment_submit">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<a name="replies"></a>
|
||||||
|
<div class="post-comments" id="<?php echo $post_id; ?>"></div>
|
||||||
|
<script>
|
||||||
|
var converter = new Markdown.getSanitizingConverter();
|
||||||
|
// Title Conversion
|
||||||
|
var old_post = $("#title_@Model.PostId").text();
|
||||||
|
var new_post = converter.makeHtml(old_post);
|
||||||
|
$("#title_@Model.PostId").html(new_post);
|
||||||
|
// Post Conversion
|
||||||
|
var old_post = $("#post_@Model.PostId").text();
|
||||||
|
var new_post = converter.makeHtml(old_post);
|
||||||
|
$("#post_@Model.PostId").html(new_post);
|
||||||
|
|
||||||
|
linkPostDelete('.delete_post');
|
||||||
|
linkPostPublish('.publish_post');
|
||||||
|
linkPostUnpublish('.unpublish_post');
|
||||||
|
|
||||||
|
var posts = @(ViewBag.Config.CommentsToLoad);
|
||||||
|
var start_post = 0;
|
||||||
|
var view_post_id = @(Model.PostId);
|
||||||
|
loadMoreComments(start_post, posts);
|
||||||
|
start_post = start_post + posts;
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 text-center">
|
||||||
|
<h2>That post does not exist</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
@ -18,14 +18,14 @@ namespace Teknik.Areas.Contact
|
|||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Contact_dev", // Route name
|
"Contact_dev", // Route name
|
||||||
"dev",
|
"dev",
|
||||||
"Contact", // URL with parameters
|
"Contact/{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.ContactController).Namespace }
|
new[] { typeof(Controllers.ContactController).Namespace }
|
||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Contact_default", // Route name
|
"Contact_default", // Route name
|
||||||
"contact",
|
"contact",
|
||||||
"", // URL with parameters
|
"{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.ContactController).Namespace }
|
new[] { typeof(Controllers.ContactController).Namespace }
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,7 @@ namespace Teknik.Areas.Profile.Controllers
|
|||||||
private TeknikEntities db = new TeknikEntities();
|
private TeknikEntities db = new TeknikEntities();
|
||||||
|
|
||||||
// GET: Profile/Profile
|
// GET: Profile/Profile
|
||||||
public ActionResult Index()
|
public ActionResult Index(string username)
|
||||||
{
|
{
|
||||||
ViewBag.Title = Config.Title + " - Profile";
|
ViewBag.Title = Config.Title + " - Profile";
|
||||||
ViewBag.Message = "View Your Profile";
|
ViewBag.Message = "View Your Profile";
|
||||||
|
@ -17,14 +17,28 @@ namespace Teknik.Areas.Profile
|
|||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile_dev", // Route name
|
"Profile_dev", // Route name
|
||||||
"dev",
|
"dev",
|
||||||
"Profile", // URL with parameters
|
"Profile/{username}", // URL with parameters
|
||||||
|
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
|
||||||
|
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||||
|
);
|
||||||
|
context.MapSubdomainRoute(
|
||||||
|
"Profile_dev_unique", // Route name
|
||||||
|
"dev",
|
||||||
|
"Profile/{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile_default", // Route name
|
"Profile_default", // Route name
|
||||||
"profile",
|
"profile",
|
||||||
"", // URL with parameters
|
"{username}", // URL with parameters
|
||||||
|
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
|
||||||
|
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||||
|
);
|
||||||
|
context.MapSubdomainRoute(
|
||||||
|
"Profile_default_unique", // Route name
|
||||||
|
"profile",
|
||||||
|
"{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||||
);
|
);
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
@model Teknik.Areas.Profile.ViewModels.LoginViewModel
|
@model Teknik.Areas.Profile.ViewModels.LoginViewModel
|
||||||
|
|
||||||
<form role="form" id="loginForm" action="@Url.Action("Login", "Profile", new { area = "Profile" })" method="post" accept-charset="UTF-8">
|
@using (Html.BeginForm("Login", "Profile", new { area = "Profile" }, FormMethod.Post, new { id = "loginForm" }))
|
||||||
|
{
|
||||||
|
@Html.ValidationMessage("Unable to login.")
|
||||||
<div class="form-group">
|
<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" />
|
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true" />
|
||||||
|
@Html.ValidationMessageFor(u => u.Username)
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<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" />
|
<input type="password" class="form-control" id="Password" value="" placeholder="Password" name="Password" data-val-required="The Password field is required." data-val="true" />
|
||||||
|
@Html.ValidationMessageFor(u => u.Password)
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
@ -15,4 +19,4 @@
|
|||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<button class="btn btn-primary" id="login_submit" type="submit" name="submit">Sign In</button>
|
<button class="btn btn-primary" id="login_submit" type="submit" name="submit">Sign In</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
}
|
@ -1,18 +1,14 @@
|
|||||||
@model Teknik.Areas.Profile.ViewModels.RegisterViewModel
|
@model Teknik.Areas.Profile.ViewModels.RegisterViewModel
|
||||||
|
|
||||||
<form role="form" id="registrationForm" action="@Url.Action("Register", "Profile", new { area = "Profile" })" method="post" accept-charset="UTF-8">
|
<form role="form" id="registrationForm" action="@Url.Action("Register", "Profile", new { area = "Profile" })" method="post" accept-charset="UTF-8">
|
||||||
@Html.ValidationSummary(true, "Registration failed. Check your registration details.")
|
|
||||||
<div class="form-group">
|
<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"/>
|
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true"/>
|
||||||
@Html.ValidationMessageFor(u => u.Username)
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<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"/>
|
<input type="password" class="form-control" id="Password" value="" placeholder="Password" name="Password" data-val-required="The Password field is required." data-val="true"/>
|
||||||
@Html.ValidationMessageFor(u => u.Password)
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<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" />
|
<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" />
|
||||||
@Html.ValidationMessageFor(u => u.ConfirmPassword)
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<button class="btn btn-primary" id="reg_submit" type="submit" name="submit">Sign Up</button>
|
<button class="btn btn-primary" id="reg_submit" type="submit" name="submit">Sign Up</button>
|
||||||
|
@ -20,6 +20,8 @@ namespace Teknik
|
|||||||
private SMTPConfig _SMTPConfig;
|
private SMTPConfig _SMTPConfig;
|
||||||
private string _SupportEmail;
|
private string _SupportEmail;
|
||||||
private string _BitcoinAddress;
|
private string _BitcoinAddress;
|
||||||
|
private int _PostsToLoad;
|
||||||
|
private int _CommentsToLoad;
|
||||||
|
|
||||||
public bool DevEnvironment { get { return _DevEnvironment; } set { _DevEnvironment = value; } }
|
public bool DevEnvironment { get { return _DevEnvironment; } set { _DevEnvironment = value; } }
|
||||||
|
|
||||||
@ -35,6 +37,10 @@ namespace Teknik
|
|||||||
|
|
||||||
public string BitcoinAddress { get { return _BitcoinAddress; } set { _BitcoinAddress = value; } }
|
public string BitcoinAddress { get { return _BitcoinAddress; } set { _BitcoinAddress = value; } }
|
||||||
|
|
||||||
|
public int PostsToLoad { get { return _PostsToLoad; } set { _PostsToLoad = value; } }
|
||||||
|
|
||||||
|
public int CommentsToLoad { get { return _PostsToLoad; } set { _PostsToLoad = value; } }
|
||||||
|
|
||||||
public Config()
|
public Config()
|
||||||
{
|
{
|
||||||
_ConfigRWLock = new ReaderWriterLockSlim();
|
_ConfigRWLock = new ReaderWriterLockSlim();
|
||||||
@ -47,14 +53,16 @@ namespace Teknik
|
|||||||
|
|
||||||
public void SetDefaults()
|
public void SetDefaults()
|
||||||
{
|
{
|
||||||
DevEnvironment = false;
|
DevEnvironment = false;
|
||||||
Title = String.Empty;
|
Title = String.Empty;
|
||||||
Description = String.Empty;
|
Description = String.Empty;
|
||||||
Author = String.Empty;
|
Author = String.Empty;
|
||||||
Host = String.Empty;
|
Host = String.Empty;
|
||||||
SMTPConfig = new SMTPConfig();
|
SMTPConfig = new SMTPConfig();
|
||||||
SupportEmail = string.Empty;
|
SupportEmail = string.Empty;
|
||||||
BitcoinAddress = string.Empty;
|
BitcoinAddress = string.Empty;
|
||||||
|
PostsToLoad = 10;
|
||||||
|
CommentsToLoad = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Config Deserialize(string text)
|
public static Config Deserialize(string text)
|
||||||
|
@ -15,7 +15,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
|||||||
<MSDeployServiceURL>teknik.io</MSDeployServiceURL>
|
<MSDeployServiceURL>teknik.io</MSDeployServiceURL>
|
||||||
<DeployIisAppPath>Dev</DeployIisAppPath>
|
<DeployIisAppPath>Dev</DeployIisAppPath>
|
||||||
<RemoteSitePhysicalPath />
|
<RemoteSitePhysicalPath />
|
||||||
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
|
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||||
<UserName>Administrator</UserName>
|
<UserName>Administrator</UserName>
|
||||||
|
@ -235,7 +235,9 @@
|
|||||||
<Content Include="Content\bootstrap.css.map" />
|
<Content Include="Content\bootstrap.css.map" />
|
||||||
<Content Include="Content\bootstrap-theme.min.css.map" />
|
<Content Include="Content\bootstrap-theme.min.css.map" />
|
||||||
<Content Include="Content\bootstrap-theme.css.map" />
|
<Content Include="Content\bootstrap-theme.css.map" />
|
||||||
|
<Content Include="Areas\Blog\Views\Blog\Posts.cshtml" />
|
||||||
<Content Include="Areas\Blog\Views\Blog\Post.cshtml" />
|
<Content Include="Areas\Blog\Views\Blog\Post.cshtml" />
|
||||||
|
<Content Include="Areas\Blog\Views\Blog\ViewPost.cshtml" />
|
||||||
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
|
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
|
||||||
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
|
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
|
||||||
<Content Include="Scripts\bootstrap.js" />
|
<Content Include="Scripts\bootstrap.js" />
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
<a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name <strong class="caret"></strong></a>
|
<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">
|
<ul class="dropdown-menu" role="menu" aria-labelledby="user_menu">
|
||||||
<li>
|
<li>
|
||||||
<a href="@Url.Action("Index", "Profile", new { area = "Profile" })/@User.Identity.Name">Profile</a>
|
<a href="@Url.Action("Index", "Profile", new { area = "Profile", username = User.Identity.Name })">Profile</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@Url.Action("Index", "Blog", new { area = "Blog" })/@User.Identity.Name">Blog</a>
|
<a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = User.Identity.Name })">Blog</a>
|
||||||
</li>
|
</li>
|
||||||
@if (User.IsInRole("Admin"))
|
@if (User.IsInRole("Admin"))
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="@Url.Action("Index", "Home", new { area = "Home" })"><img src="/Content/Images/logo-black.svg" height="20" alt="Teknik"></a>
|
<a class="navbar-brand" href="@Url.Action("Index", "Home", new { area = "Home" })"><img src="/Images/logo-black.svg" height="20" alt="Teknik"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<a href="#" id="services_menu" class="dropdown-toggle" data-toggle="dropdown">Services <strong class="caret"></strong></a>
|
<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">
|
<ul class="dropdown-menu" role="menu" aria-labelledby="services_menu">
|
||||||
<li>
|
<li>
|
||||||
<a href="@Url.Action("Index", "Blog", new { area = "Blog" })">Blog</a>
|
<a href="@Url.Action("Blog", "Blog", new { area = "Blog" })">Blog</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@Url.Action("Index", "Podcast", new { area = "Podcast" })">Podcast</a>
|
<a href="@Url.Action("Index", "Podcast", new { area = "Podcast" })">Podcast</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user