Skip to content

Commit 7437563

Browse files
committed
Update of buttons
1 parent d156740 commit 7437563

File tree

17 files changed

+312
-176
lines changed

17 files changed

+312
-176
lines changed

BookCollection/BookCollection.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@
548548
<Content Include="Views\Publishers\Index.cshtml" />
549549
<Content Include="Views\Home\_CategoryBooks.cshtml" />
550550
<Content Include="Views\Shared\_RelatedBooks.cshtml" />
551+
<Content Include="Views\NewBooks\Create.cshtml" />
552+
<Content Include="Views\NewBooks\Delete.cshtml" />
553+
<Content Include="Views\NewBooks\Details.cshtml" />
554+
<Content Include="Views\NewBooks\Edit.cshtml" />
555+
<Content Include="Views\NewBooks\Index.cshtml" />
551556
</ItemGroup>
552557
<ItemGroup>
553558
<Folder Include="App_Data\" />

BookCollection/DAL/BookInitializer.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Text;
1010
using GBUtils.Extension;
1111
using System.Data.Entity.Validation;
12+
using BookCollection.Helpers;
1213

1314
namespace BookCollection.DAL
1415
{
@@ -144,7 +145,8 @@ private IEnumerable<Book> GetBooks(IEnumerable<Publisher> pubs, IEnumerable<Auth
144145
var cat = cats.FirstOrDefault(c => c.Title == catName.FirstCharacterUppercaseRestLowercase());
145146
if (cat == null)
146147
cat = cats.FirstOrDefault(c => c.Title == "?");
147-
148+
149+
148150
DateTime date;
149151
DateTime? nullDate = null;
150152

@@ -196,8 +198,10 @@ private IEnumerable<Book> GetBooks(IEnumerable<Publisher> pubs, IEnumerable<Auth
196198
Publisher = pub,
197199
MainSubject = mainSub,
198200
Subjects = otherSub,
199-
Code = item.Contents
200-
201+
Code = item.Contents,
202+
Condition = Condition.Used,
203+
CodeWithinSerie = Converters.ExtractSerieNr(item.Type),
204+
Rating = 0
201205
};
202206

203207
if (auth != null)
@@ -307,7 +311,7 @@ private IEnumerable<Subject> GetSubjects()
307311
var name = i.Trim().FirstCharacterUppercase();
308312
if (!IsBlacklistedSubject(name) && list.Count(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) == 0)
309313
{
310-
list.Add(new Subject() { Name = name });
314+
list.Add(new Subject() { Name = name.Replace("\"", "") });
311315
}
312316
}
313317

@@ -317,7 +321,7 @@ private IEnumerable<Subject> GetSubjects()
317321
var name = i.Trim().FirstCharacterUppercase();
318322
if (!IsBlacklistedSubject(name) && list.Count(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) == 0)
319323
{
320-
list.Add(new Subject() { Name = name });
324+
list.Add(new Subject() { Name = name.Replace("\"", "") });
321325
}
322326
}
323327

@@ -383,7 +387,7 @@ private string CleanUpCategory(string orig)
383387
if (string.IsNullOrWhiteSpace(orig))
384388
return "?";
385389

386-
return orig.Replace("NULL", "?")
390+
string temp = orig.Replace("NULL", "?")
387391
.Replace("romannetje", "roman")
388392
.Replace("anecdotes", "anekdotes")
389393
.Replace("biogr. studies", "biografieën")
@@ -397,6 +401,8 @@ private string CleanUpCategory(string orig)
397401
.Replace("sutdie", "studie")
398402
.Replace("studies", "studie")
399403
.Replace("toneelstukken", "toneelstuk");
404+
405+
return Converters.RemoveSerieNr(temp);
400406
}
401407
}
402408
}

BookCollection/Helpers/BC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static MvcHtmlString IconButton(string action, string iconname, string li
3434
public static MvcHtmlString IconButton(string controller, string action, string iconname, string linktext, int ID = -1)
3535
{
3636
object routeVal = (ID == -1 ? null : new { id = ID });
37-
return IconButton("", action, iconname, linktext, routeVal);
37+
return IconButton(controller, action, iconname, linktext, routeVal);
3838
}
3939

4040
public static MvcHtmlString IconButton(string controller, string action, string iconname, string linktext, object routeValues)

BookCollection/Views/Authors/Details.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
<div>
1010
<p>
11-
@Html.ActionLink("Edit", "Edit", new { id = Model.AuthorID }) |
12-
@Html.ActionLink("Back to List", "Index")
11+
@BC.IconButton("Authors", "Edit", "pencil", "Edit", new { id = Model.AuthorID })
12+
@BC.IconButton("Authors", "Index", "th-list", "Back to List")
1313
</p>
1414
<hr />
1515
<dl class="dl-horizontal">

BookCollection/Views/Authors/Index.cshtml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
ViewBag.Title = "Authors";
88
}
99

10-
<h2>Authors</h2>
11-
12-
<p>
13-
@Html.ActionLink("Create New", "Create")
14-
</p>
10+
<div class="row">
11+
<div class="col-md-6"><h2>@ViewBag.Title</h2></div>
12+
<div class="col-md-6">
13+
<div class="pull-right" style="margin:25px 5px 0 0">
14+
@BC.IconButton("Authors","Create", "plus", "Add new author")
15+
</div>
16+
</div>
17+
</div>
1518

1619
@using (Html.BeginForm("Index", "Authors", FormMethod.Get))
1720
{
@@ -41,15 +44,15 @@
4144
@Html.DisplayFor(modelItem => item.Firstname)
4245
</td>
4346
<td class="text-nowrap">
44-
@BC.IconButton("Edit", "pencil", "Edit", item.BookID)
45-
@BC.IconButton("Details", "eye-open", "Details", item.BookID)
46-
@BC.IconButton("Delete", "remove", "Delete", item.BookID)
47+
@BC.IconButton("Authors","Edit", "pencil", "Edit", item.AuthorID)
48+
@BC.IconButton("Authors", "Details", "eye-open", "Details", item.AuthorID)
49+
@BC.IconButton("Authors", "Delete", "remove", "Delete", item.AuthorID)
4750
</td>
4851
</tr>
4952
}
5053

5154
</table>
52-
<br />
55+
5356
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
5457

5558
@Html.PagedListPager(Model, page => Url.Action("Index",

BookCollection/Views/Books/Create.cshtml

Lines changed: 102 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
@{
44
ViewBag.Title = "Create";
5-
Layout = "~/Views/Shared/_Layout.cshtml";
65
}
76

8-
<h2>Create</h2>
7+
<h2>Create new book</h2>
98

10-
11-
@using (Html.BeginForm())
9+
@using (Html.BeginForm())
1210
{
1311
@Html.AntiForgeryToken()
14-
12+
1513
<div class="form-horizontal">
1614
<h4>Book</h4>
1715
<hr />
@@ -33,18 +31,10 @@
3331
</div>
3432

3533
<div class="form-group">
36-
<label class="control-label col-md-2" for="AuthorID">Author</label>
37-
<div class="col-md-10">
38-
@Html.DropDownList("AuthorID", null, htmlAttributes: new { @class = "form-control" })
39-
@Html.ValidationMessageFor(model => model.AuthorID, "", new { @class = "text-danger" })
40-
</div>
41-
</div>
42-
43-
<div class="form-group">
44-
<label class="control-label col-md-2" for="CategoryID">Category</label>
34+
@Html.LabelFor(model => model.CreationDate, htmlAttributes: new { @class = "control-label col-md-2" })
4535
<div class="col-md-10">
46-
@Html.DropDownList("CategoryID", null, htmlAttributes: new { @class = "form-control" })
47-
@Html.ValidationMessageFor(model => model.CategoryID, "", new { @class = "text-danger" })
36+
@Html.EditorFor(model => model.CreationDate, new { htmlAttributes = new { @class = "form-control" } })
37+
@Html.ValidationMessageFor(model => model.CreationDate, "", new { @class = "text-danger" })
4838
</div>
4939
</div>
5040

@@ -80,6 +70,62 @@
8070
</div>
8171
</div>
8272

73+
<div class="form-group">
74+
@Html.LabelFor(model => model.Condition, htmlAttributes: new { @class = "control-label col-md-2" })
75+
<div class="col-md-10">
76+
@Html.EnumDropDownListFor(model => model.Condition, htmlAttributes: new { @class = "form-control" })
77+
@Html.ValidationMessageFor(model => model.Condition, "", new { @class = "text-danger" })
78+
</div>
79+
</div>
80+
81+
<div class="form-group">
82+
@Html.LabelFor(model => model.Location, htmlAttributes: new { @class = "control-label col-md-2" })
83+
<div class="col-md-10">
84+
@Html.EditorFor(model => model.Location, new { htmlAttributes = new { @class = "form-control" } })
85+
@Html.ValidationMessageFor(model => model.Location, "", new { @class = "text-danger" })
86+
</div>
87+
</div>
88+
89+
<div class="form-group">
90+
@Html.LabelFor(model => model.Rating, htmlAttributes: new { @class = "control-label col-md-2" })
91+
<div class="col-md-10">
92+
@Html.EditorFor(model => model.Rating, new { htmlAttributes = new { @class = "form-control" } })
93+
@Html.ValidationMessageFor(model => model.Rating, "", new { @class = "text-danger" })
94+
</div>
95+
</div>
96+
97+
<div class="form-group">
98+
@Html.LabelFor(model => model.Serie, htmlAttributes: new { @class = "control-label col-md-2" })
99+
<div class="col-md-10">
100+
@Html.EditorFor(model => model.Serie, new { htmlAttributes = new { @class = "form-control" } })
101+
@Html.ValidationMessageFor(model => model.Serie, "", new { @class = "text-danger" })
102+
</div>
103+
</div>
104+
105+
<div class="form-group">
106+
@Html.LabelFor(model => model.CodeWithinSerie, htmlAttributes: new { @class = "control-label col-md-2" })
107+
<div class="col-md-10">
108+
@Html.EditorFor(model => model.CodeWithinSerie, new { htmlAttributes = new { @class = "form-control" } })
109+
@Html.ValidationMessageFor(model => model.CodeWithinSerie, "", new { @class = "text-danger" })
110+
</div>
111+
</div>
112+
113+
<div class="form-group">
114+
@Html.LabelFor(model => model.Code, htmlAttributes: new { @class = "control-label col-md-2" })
115+
<div class="col-md-10">
116+
@Html.EditorFor(model => model.Code, new { htmlAttributes = new { @class = "form-control" } })
117+
@Html.ValidationMessageFor(model => model.Code, "", new { @class = "text-danger" })
118+
</div>
119+
</div>
120+
121+
<div class="form-group">
122+
@Html.LabelFor(model => model.SortField, htmlAttributes: new { @class = "control-label col-md-2" })
123+
<div class="col-md-10">
124+
@Html.EditorFor(model => model.SortField, new { htmlAttributes = new { @class = "form-control" } })
125+
@Html.ValidationMessageFor(model => model.SortField, "", new { @class = "text-danger" })
126+
</div>
127+
</div>
128+
83129
<div class="form-group">
84130
@Html.LabelFor(model => model.Read, htmlAttributes: new { @class = "control-label col-md-2" })
85131
<div class="col-md-10">
@@ -122,6 +168,46 @@
122168
</div>
123169
</div>
124170

171+
<div class="form-group">
172+
@Html.LabelFor(model => model.ReviewNote, htmlAttributes: new { @class = "control-label col-md-2" })
173+
<div class="col-md-10">
174+
@Html.EditorFor(model => model.ReviewNote, new { htmlAttributes = new { @class = "form-control" } })
175+
@Html.ValidationMessageFor(model => model.ReviewNote, "", new { @class = "text-danger" })
176+
</div>
177+
</div>
178+
179+
<div class="form-group">
180+
@Html.LabelFor(model => model.AuthorID, htmlAttributes: new { @class = "control-label col-md-2" })
181+
<div class="col-md-10">
182+
@Html.EditorFor(model => model.AuthorID, new { htmlAttributes = new { @class = "form-control" } })
183+
@Html.ValidationMessageFor(model => model.AuthorID, "", new { @class = "text-danger" })
184+
</div>
185+
</div>
186+
187+
<div class="form-group">
188+
@Html.LabelFor(model => model.CategoryID, "CategoryID", htmlAttributes: new { @class = "control-label col-md-2" })
189+
<div class="col-md-10">
190+
@Html.DropDownList("CategoryID", null, htmlAttributes: new { @class = "form-control" })
191+
@Html.ValidationMessageFor(model => model.CategoryID, "", new { @class = "text-danger" })
192+
</div>
193+
</div>
194+
195+
<div class="form-group">
196+
@Html.LabelFor(model => model.PublisherID, "PublisherID", htmlAttributes: new { @class = "control-label col-md-2" })
197+
<div class="col-md-10">
198+
@Html.DropDownList("PublisherID", null, htmlAttributes: new { @class = "form-control" })
199+
@Html.ValidationMessageFor(model => model.PublisherID, "", new { @class = "text-danger" })
200+
</div>
201+
</div>
202+
203+
<div class="form-group">
204+
@Html.LabelFor(model => model.MainSubjectID, htmlAttributes: new { @class = "control-label col-md-2" })
205+
<div class="col-md-10">
206+
@Html.EditorFor(model => model.MainSubjectID, new { htmlAttributes = new { @class = "form-control" } })
207+
@Html.ValidationMessageFor(model => model.MainSubjectID, "", new { @class = "text-danger" })
208+
</div>
209+
</div>
210+
125211
<div class="form-group">
126212
<div class="col-md-offset-2 col-md-10">
127213
<input type="submit" value="Create" class="btn btn-default" />
@@ -133,7 +219,3 @@
133219
<div>
134220
@Html.ActionLink("Back to List", "Index")
135221
</div>
136-
137-
@section Scripts {
138-
@Scripts.Render("~/bundles/jqueryval")
139-
}

BookCollection/Views/Books/Delete.cshtml

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -20,94 +20,6 @@
2020
@Html.DisplayFor(model => model.Title)
2121
</dd>
2222

23-
<dt>
24-
@Html.DisplayNameFor(model => model.AlternativeTitle)
25-
</dt>
26-
27-
<dd>
28-
@Html.DisplayFor(model => model.AlternativeTitle)
29-
</dd>
30-
31-
<dt>
32-
@Html.DisplayNameFor(model => model.CreationDate)
33-
</dt>
34-
35-
<dd>
36-
@Html.DisplayFor(model => model.CreationDate)
37-
</dd>
38-
39-
<dt>
40-
@Html.DisplayNameFor(model => model.InitialPrintedYear)
41-
</dt>
42-
43-
<dd>
44-
@Html.DisplayFor(model => model.InitialPrintedYear)
45-
</dd>
46-
47-
<dt>
48-
@Html.DisplayNameFor(model => model.ActualPrintYear)
49-
</dt>
50-
51-
<dd>
52-
@Html.DisplayFor(model => model.ActualPrintYear)
53-
</dd>
54-
55-
<dt>
56-
@Html.DisplayNameFor(model => model.Language)
57-
</dt>
58-
59-
<dd>
60-
@Html.DisplayFor(model => model.Language)
61-
</dd>
62-
63-
<dt>
64-
@Html.DisplayNameFor(model => model.Material)
65-
</dt>
66-
67-
<dd>
68-
@Html.DisplayFor(model => model.Material)
69-
</dd>
70-
71-
<dt>
72-
@Html.DisplayNameFor(model => model.Read)
73-
</dt>
74-
75-
<dd>
76-
@Html.DisplayFor(model => model.Read)
77-
</dd>
78-
79-
<dt>
80-
@Html.DisplayNameFor(model => model.Pages)
81-
</dt>
82-
83-
<dd>
84-
@Html.DisplayFor(model => model.Pages)
85-
</dd>
86-
87-
<dt>
88-
@Html.DisplayNameFor(model => model.ISBN)
89-
</dt>
90-
91-
<dd>
92-
@Html.DisplayFor(model => model.ISBN)
93-
</dd>
94-
95-
<dt>
96-
@Html.DisplayNameFor(model => model.Website)
97-
</dt>
98-
99-
<dd>
100-
@Html.DisplayFor(model => model.Website)
101-
</dd>
102-
103-
<dt>
104-
@Html.DisplayNameFor(model => model.CoverLink)
105-
</dt>
106-
107-
<dd>
108-
@Html.DisplayFor(model => model.CoverLink)
109-
</dd>
110-
11123
</dl>
11224

11325
@using (Html.BeginForm()) {

0 commit comments

Comments
 (0)