Permalink
Browse files

Misc fixes

  • Loading branch information...
synhershko committed Sep 19, 2011
1 parent 29b4089 commit ec86415d0986cf8c163382efcd7c96bd7aba37f5
@@ -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);
@@ -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)
@@ -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
@@ -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.
@@ -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>
+}
@@ -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>
@@ -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")
@@ -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>
@@ -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>
@@ -43,12 +40,9 @@
<td>
@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>
@@ -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>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\Orev\packages.config" />
+ <repository path="..\Orev.CorpusReaders\packages.config" />
</repositories>

0 comments on commit ec86415

Please sign in to comment.