forked from PureKrome/RavenOverflow
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Started adding in Asking a Question.
- Loading branch information
Showing
9 changed files
with
210 additions
and
15 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
Code/RavenOverflow.Web/Areas/Question/Controllers/QuestionsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Web.Mvc; | ||
using Raven.Client; | ||
using RavenOverflow.Web.Areas.Question.Models.ViewModels; | ||
using RavenOverflow.Web.Controllers; | ||
|
||
namespace RavenOverflow.Web.Areas.Question.Controllers | ||
{ | ||
public class QuestionsController : AbstractController | ||
{ | ||
public QuestionsController(IDocumentSession documentSession) : base(documentSession) | ||
{ | ||
} | ||
|
||
public ActionResult Details(int id) | ||
{ | ||
return View(); | ||
} | ||
|
||
public ActionResult Create() | ||
{ | ||
var viewModel = new CreateViewModel(User.Identity) | ||
{ | ||
Header = "Ask a Question" | ||
}; | ||
return View(); | ||
} | ||
|
||
[HttpPost] | ||
public ActionResult Create(FormCollection collection) | ||
{ | ||
try | ||
{ | ||
// TODO: Add insert logic here | ||
|
||
return RedirectToAction("Index"); | ||
} | ||
catch | ||
{ | ||
return View(); | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Code/RavenOverflow.Web/Areas/Question/Models/ViewModels/CreateViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using RavenOverflow.Web.Models; | ||
using RavenOverflow.Web.Models.Authentication; | ||
|
||
namespace RavenOverflow.Web.Areas.Question.Models.ViewModels | ||
{ | ||
public class CreateViewModel : _LayoutViewModel | ||
{ | ||
public CreateViewModel(ICustomIdentity customIdentity) : base(customIdentity) | ||
{ | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Code/RavenOverflow.Web/Areas/Question/QuestionAreaRegistration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Web.Mvc; | ||
|
||
namespace RavenOverflow.Web.Areas.Question | ||
{ | ||
public class QuestionAreaRegistration : AreaRegistration | ||
{ | ||
public override string AreaName | ||
{ | ||
get { return "Question"; } | ||
} | ||
|
||
public override void RegisterArea(AreaRegistrationContext context) | ||
{ | ||
context.MapRoute( | ||
"Question - ask", | ||
"Question/ask", | ||
new { controller = "Questions", action = "Create" } | ||
); | ||
|
||
context.MapRoute( | ||
"Question_default", | ||
"Question/{action}/{id}", | ||
new { controller = "Questions", action = "Index", id = UrlParameter.Optional } | ||
); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Code/RavenOverflow.Web/Areas/Question/Views/Questions/Create.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@using RavenOverflow.Web.Areas.Question.Models.ViewModels | ||
@model CreateViewModel | ||
@{ | ||
Layout = "~/Views/Shared/_Layout.cshtml"; | ||
} | ||
|
||
@section Header | ||
{ | ||
@Model.Header | ||
} | ||
|
||
@section SideBar | ||
{ | ||
<div>How to Ask a Question</div> | ||
} | ||
|
||
@using (Html.BeginForm()) | ||
{ | ||
<div class="form-item ask-title"> | ||
<table class="ask-title-table"> | ||
<tbody> | ||
<tr> | ||
<td class="ask-title-cell-key"> | ||
<label for="title">Title</label> | ||
</td> | ||
<td class="ask-title-cell-value"> | ||
<input type="text" maxlength="300" tabindex="100" class="actual-edit-overlay" value="" style="position: absolute; background-color: white; color: black; -webkit-text-fill-color: black; opacity: 1; width: 610px; height: 16px; line-height: normal; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto; border-left-style: solid; border-right-style: solid; border-top-style: solid; border-bottom-style: solid; border-left-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-top-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; " disabled="disabled"><input id="title" name="title" type="text" maxlength="300" tabindex="100" class="ask-title-field edit-field-overlayed" value="" style="z-index: 1; position: relative; opacity: 0.4; "> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<div id="question-suggestions"> | ||
</div> | ||
</div> | ||
<div id="post-editor" class="post-editor"> | ||
<textarea id="wmd-input" class="wmd-input processed" name="post-text" cols="92" rows="15" tabindex="101"></textarea> | ||
</div> | ||
<div class="form-item"> | ||
<label>Tags</label> | ||
<input id="tagnames" name="tagnames" type="text" size="60" value="" tabindex="103" style="display: none; "> | ||
<div class="actual-edit-overlay" style="position: absolute; background-color: white; color: black; -webkit-text-fill-color: black; opacity: 1; width: 666px; height: 28px; line-height: 28px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto; border-left-style: solid; border-right-style: solid; border-top-style: solid; border-bottom-style: solid; border-left-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-top-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; " disabled="disabled"> at least one tag such as (asp.net xml c++), max 5 tags</div><div class="tag-editor edit-field-overlayed" style="width: 666px; height: 28px; opacity: 0.4; z-index: 1; position: relative; "><span style=""></span><input type="text" tabindex="103" style="width: 658px; "><span></span></div> | ||
<span class="edit-field-overlay">at least one tag such as (asp.net xml c++), max 5 tags</span> | ||
</div> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0"?> | ||
|
||
<configuration> | ||
<configSections> | ||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | ||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | ||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
|
||
<system.web.webPages.razor> | ||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | ||
<pages pageBaseType="System.Web.Mvc.WebViewPage"> | ||
<namespaces> | ||
<add namespace="System.Web.Mvc" /> | ||
<add namespace="System.Web.Mvc.Ajax" /> | ||
<add namespace="System.Web.Mvc.Html" /> | ||
<add namespace="System.Web.Routing" /> | ||
</namespaces> | ||
</pages> | ||
</system.web.webPages.razor> | ||
|
||
<appSettings> | ||
<add key="webpages:Enabled" value="false" /> | ||
</appSettings> | ||
|
||
<system.web> | ||
<httpHandlers> | ||
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/> | ||
</httpHandlers> | ||
|
||
<!-- | ||
Enabling request validation in view pages would cause validation to occur | ||
after the input has already been processed by the controller. By default | ||
MVC performs request validation before a controller processes the input. | ||
To change this behavior apply the ValidateInputAttribute to a | ||
controller or action. | ||
--> | ||
<pages | ||
validateRequest="false" | ||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" | ||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" | ||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | ||
<controls> | ||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> | ||
</controls> | ||
</pages> | ||
</system.web> | ||
|
||
<system.webServer> | ||
<validation validateIntegratedModeConfiguration="false" /> | ||
|
||
<handlers> | ||
<remove name="BlockViewHandler"/> | ||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> | ||
</handlers> | ||
</system.webServer> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters