diff --git a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj index fe12e6d..0738da9 100644 --- a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj +++ b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj @@ -153,6 +153,7 @@ + diff --git a/Src/VideoGameQuotes.Web/Views/Quote/Edit.aspx b/Src/VideoGameQuotes.Web/Views/Quote/Edit.aspx index f92124b..ede0cd5 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/Edit.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/Edit.aspx @@ -5,4 +5,7 @@ <%= Html.ValidationSummary("Some errors occurred while trying to save your edit:") %> <% Html.RenderPartial("EditQuoteForm", Model); %> + + + \ No newline at end of file diff --git a/Src/VideoGameQuotes.Web/Views/Quote/Submit.aspx b/Src/VideoGameQuotes.Web/Views/Quote/Submit.aspx index de3955e..86cfa25 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/Submit.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/Submit.aspx @@ -5,4 +5,7 @@ <%= Html.ValidationSummary("Some errors occurred while trying to submit your quote:") %> <% Html.RenderPartial("EditQuoteForm", Model); %> + + + \ No newline at end of file diff --git a/Src/VideoGameQuotes.Web/media/js/quoteform.js b/Src/VideoGameQuotes.Web/media/js/quoteform.js new file mode 100644 index 0000000..abbfef2 --- /dev/null +++ b/Src/VideoGameQuotes.Web/media/js/quoteform.js @@ -0,0 +1,538 @@ +(function($, window, undefined){ + + var toggleFormAndLink = function(type) { + return function() { + $("#create-" + type + "-form") + .find("input[type='text']").val("").end() + .find("input[type='checkbox']").removeAttr("checked").end() + .find("> .edit-mode").val(0).end() + .find("> fieldset > legend").text("Create new " + type).end() + .clearModelErrors() + .toggle(); + + $("#" + type + "-select").toggle(); + return false; + } + }; + + var addNewCheckbox = function($table, name, value, text, cellsPerRow) { + var $row = $table.find("tr:last"); + if ($row.find("td").length === cellsPerRow) { + $row = $(""); + $table.append($row); + } + + var $cell = $("").append($("").attr({ + type: "checkbox", + name: name, + value: value, + id: name + "_" + value, + checked: "checked" + })).append($("