Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Misc fixes

  • Loading branch information...
commit ec86415d0986cf8c163382efcd7c96bd7aba37f5 1 parent 29b4089
@synhershko synhershko authored
Showing with 78 additions and 20 deletions.
  1. +1 −2  Orev/Controllers/JudgeController.cs
  2. +9 −0 Orev/Controllers/TopicsController.cs
  3. +4 −6 Orev/Infrastructure/RavenIndexDefinitions.cs
  4. +3 −0  Orev/Orev.csproj
  5. +20 −1 Orev/Views/Judge/Index.cshtml
  6. +1 −1  Orev/Views/Judge/SelectLanguage.cshtml
  7. +1 −1  Orev/Views/Judge/SelectTopic.cshtml
  8. +1 −1  Orev/Views/Topics/Edit.cshtml
  9. +2 −8 Orev/Views/Topics/Index.cshtml
  10. +35 −0 Orev/Views/Topics/View.cshtml
  11. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Abstractions.dll
  12. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Abstractions.pdb
  13. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Debug.dll
  14. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Debug.pdb
  15. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Lightweight.dll
  16. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Lightweight.pdb
  17. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.MvcIntegration.dll
  18. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.MvcIntegration.pdb
  19. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Json.dll
  20. BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Json.pdb
  21. +1 −0  packages/repositories.config
View
3  Orev/Controllers/JudgeController.cs
@@ -50,13 +50,12 @@ public ActionResult Index(int? topicId, int? corpusId, string lang)
if (corpus == null)
{
- ViewBag.Message = "No corpus was found for the selected language";
+ ViewData.ModelState.AddModelError("NoCorpus", "No corpus was found for the selected language");
}
else
{
ViewBag.Corpus = corpus;
}
- // Another option: return RedirectToAction("SelectCorpus", new { lang = lang });
}
return View(topic);
View
9 Orev/Controllers/TopicsController.cs
@@ -16,6 +16,15 @@ public ActionResult Index()
return View(topics);
}
+ public ActionResult View(int id)
+ {
+ var topic = RavenSession.Load<Topic>(id);
+ if (topic == null)
+ return HttpNotFound();
+
+ return View(topic);
+ }
+
[HttpGet]
[Authorize]
public ActionResult Add(string lang)
View
10 Orev/Infrastructure/RavenIndexDefinitions.cs
@@ -69,7 +69,7 @@ public class ReduceResult
public CorpusDocuments_ByNextUnrated()
{
AddMap<CorpusDocument>(docs => from corpusDoc in docs
- select new { DocumentId = corpusDoc.Id, CorpusId = corpusDoc.CorpusId, Topics = new string[0] }
+ select new { DocumentId = corpusDoc.Id, CorpusId = corpusDoc.CorpusId, Topics = (string[])new string[0] }
);
AddMap<Judgment>(judgments => from j in judgments
@@ -78,18 +78,16 @@ public CorpusDocuments_ByNextUnrated()
Reduce = results => from result in results
group result by result.DocumentId
into g
- select new
+ select new
{
DocumentId = g.Key,
CorpusId = g.Select(x=>x.CorpusId).FirstOrDefault(),
Topics = g.SelectMany(x => x.Topics).Distinct().ToArray()
};
-
- /*
+
TransformResults = (db, results) => from result in results
- let doc = db.Load<CorpusDocument>(result.DocumentId)
+ let doc = db.Load<CorpusDocument>(result.DocumentId)
select doc;
- */
}
}
}
View
3  Orev/Orev.csproj
@@ -243,6 +243,9 @@
<ItemGroup>
<Content Include="Views\Judge\SelectTopic.cshtml" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="Views\Topics\View.cshtml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
21 Orev/Views/Judge/Index.cshtml
@@ -4,10 +4,28 @@
ViewBag.Title = "Index";
}
-<h2>Judgment</h2>
+<h2>Judging topic "@Html.DisplayFor(model => model.Title)"</h2>
+
+<fieldset>
+ <legend>Topic </legend>
+
+ <div class="display-label">Description</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Description)
+ </div>
+
+ <div class="display-label">Narrator</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Narrator)
+ </div>
+
+ <div class="display-label">@Html.DisplayFor(model => model.Language)</div>
+</fieldset>
<p>@Html.ValidationSummary()</p>
+@if (ViewBag.Corpus != null)
+{
<div id="judgingContainer">
<input type="button" id="relevantBtn" value="Yes, it is relevant" />
<input type="button" id="irrelevantBtn" value="No, it is off topic" />
@@ -69,3 +87,4 @@
});
</script>
+}
View
2  Orev/Views/Judge/SelectLanguage.cshtml
@@ -13,4 +13,4 @@
<div>@Html.Encode(lang) (@Html.ActionLink("Select a topic in this language", "SelectTopic", new { lang }))</div>
}
-<p>@Html.ActionLink("Create new topic", "Add", "Topics")</p>
+<p>@Html.ActionLink("Add a new topic to introduce new languages", "Add", "Topics")</p>
View
2  Orev/Views/Judge/SelectTopic.cshtml
@@ -4,7 +4,7 @@
ViewBag.Title = "SelectTopic";
}
-<h2>SelectTopic</h2>
+<h2>Select a topic to judge with</h2>
<p>
@Html.ActionLink("Create New Topic", "Add", "Topics")
View
2  Orev/Views/Topics/Edit.cshtml
@@ -4,7 +4,7 @@
ViewBag.Title = "Edit";
}
-<h2>Edit</h2>
+<h2>Edit topic</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
View
10 Orev/Views/Topics/Index.cshtml
@@ -4,7 +4,7 @@
ViewBag.Title = "Index";
}
-<h2>Index</h2>
+<h2>Topics List</h2>
<p>
@Html.ActionLink("Add New", "Add")
@@ -23,9 +23,6 @@
<th>
Language
</th>
- <th>
- UserId
- </th>
<th></th>
</tr>
@@ -44,11 +41,8 @@
@Html.DisplayFor(modelItem => item.Language)
</td>
<td>
- @Html.DisplayFor(modelItem => item.UserId)
- </td>
- <td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id.ToIntId() }) |
- @Html.ActionLink("Details", "Details", new { id = item.Id.ToIntId() }) |
+ @Html.ActionLink("View", "View", new { id = item.Id.ToIntId() }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id.ToIntId() })
</td>
</tr>
View
35 Orev/Views/Topics/View.cshtml
@@ -0,0 +1,35 @@
+@model Orev.Models.Topic
+
+@{
+ ViewBag.Title = "View";
+}
+
+<h2>View</h2>
+
+<fieldset>
+ <legend>Topic</legend>
+
+ <div class="display-label">Title</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Title)
+ </div>
+
+ <div class="display-label">Description</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Description)
+ </div>
+
+ <div class="display-label">Narrator</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Narrator)
+ </div>
+
+ <div class="display-label">Language</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Language)
+ </div>
+</fieldset>
+<p>
+ @Html.ActionLink("Edit", "Edit", new { id=Model.Id }) |
+ @Html.ActionLink("Back to List", "Index")
+</p>
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Abstractions.dll
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Abstractions.pdb
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Debug.dll
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Debug.pdb
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Lightweight.dll
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.Lightweight.pdb
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.MvcIntegration.dll
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Client.MvcIntegration.pdb
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Json.dll
Binary file not shown
View
BIN  packages/RavenDB.1.0.0.465/lib/net40/Raven.Json.pdb
Binary file not shown
View
1  packages/repositories.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\Orev\packages.config" />
+ <repository path="..\Orev.CorpusReaders\packages.config" />
</repositories>
Please sign in to comment.
Something went wrong with that request. Please try again.