From 38f148be2f130e1f924ee082ba5ad02cf437426e Mon Sep 17 00:00:00 2001 From: tmont Date: Thu, 24 Feb 2011 21:11:21 +0000 Subject: [PATCH] separated quote form stuff from vgquotes.js --- .../VideoGameQuotes.Web.csproj | 1 + Src/VideoGameQuotes.Web/Views/Quote/Edit.aspx | 3 + .../Views/Quote/Submit.aspx | 3 + Src/VideoGameQuotes.Web/media/js/quoteform.js | 538 ++++++++++++++++++ Src/VideoGameQuotes.Web/media/js/vgquotes.js | 518 ----------------- 5 files changed, 545 insertions(+), 518 deletions(-) create mode 100644 Src/VideoGameQuotes.Web/media/js/quoteform.js 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($("