summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsotoudeh <matthewsot@outlook.com>2017-04-19 23:58:03 -0700
committermatthewsotoudeh <matthewsot@outlook.com>2017-04-19 23:58:03 -0700
commit3f6d81409cd8e2ac6bbe738d49ce2bf8cf802d99 (patch)
tree31a10e99383c50304f87413a482ac3ebaedd2785
parent684fa02b99d5dd01fd27e8a945015d73a0b31ac7 (diff)
updated for freshman campaignsfresh-start
-rw-r--r--LHSCampaign/LHSCampaign/Content/Scripts/home.js2
-rw-r--r--LHSCampaign/LHSCampaign/Content/Scripts/update-cookies.js6
-rw-r--r--LHSCampaign/LHSCampaign/Content/Styles/Site/home.css2
-rw-r--r--LHSCampaign/LHSCampaign/Controllers/AccountAPIController.cs13
-rw-r--r--LHSCampaign/LHSCampaign/Controllers/ManageController.cs3
-rw-r--r--LHSCampaign/LHSCampaign/Models/IdentityModels.cs1
-rw-r--r--LHSCampaign/LHSCampaign/Views/Account/Register.cshtml5
-rw-r--r--LHSCampaign/LHSCampaign/Views/Candidates/Class.cshtml8
-rw-r--r--LHSCampaign/LHSCampaign/Views/Manage/Candidate.cshtml10
9 files changed, 31 insertions, 19 deletions
diff --git a/LHSCampaign/LHSCampaign/Content/Scripts/home.js b/LHSCampaign/LHSCampaign/Content/Scripts/home.js
index 1a44413..4ce8b91 100644
--- a/LHSCampaign/LHSCampaign/Content/Scripts/home.js
+++ b/LHSCampaign/LHSCampaign/Content/Scripts/home.js
@@ -28,7 +28,7 @@ if ($.cookie("last-tab") !== undefined) {
$.cookie.json = true;
function setSelected(val) {
$.cookie("selected-attendees", val, { path: "/", expires: 365 });
- $.cookie("class-elections", true, { path: "/", expires: 365 });
+ $.cookie("fresh-elections", true, { path: "/", expires: 365 });
}
function getSelected() {
var selected = $.cookie("selected-attendees");
diff --git a/LHSCampaign/LHSCampaign/Content/Scripts/update-cookies.js b/LHSCampaign/LHSCampaign/Content/Scripts/update-cookies.js
index f97114d..1f6bf8b 100644
--- a/LHSCampaign/LHSCampaign/Content/Scripts/update-cookies.js
+++ b/LHSCampaign/LHSCampaign/Content/Scripts/update-cookies.js
@@ -1,6 +1,6 @@
-if ($.cookie("2017-class") === undefined) {
+if ($.cookie("2017-fresh") === undefined) {
$.removeCookie("selected-attendees");
$.removeCookie("has-shown");
- $.removeCookie("2017-class");
- $.cookie("2017-class", true, { path: "/", expires: 365 });
+ $.removeCookie("2017-fresh");
+ $.cookie("2017-fresh", true, { path: "/", expires: 365 });
} \ No newline at end of file
diff --git a/LHSCampaign/LHSCampaign/Content/Styles/Site/home.css b/LHSCampaign/LHSCampaign/Content/Styles/Site/home.css
index c243146..c3e2c1a 100644
--- a/LHSCampaign/LHSCampaign/Content/Styles/Site/home.css
+++ b/LHSCampaign/LHSCampaign/Content/Styles/Site/home.css
@@ -188,7 +188,7 @@ header {
#class-options a {
display: inline-block;
padding: 10px 0;
- width: 100px;
+ width: 150px;
margin: 10px 10px 25px;
border: 1px solid #1394ee;
background-color: #fff;
diff --git a/LHSCampaign/LHSCampaign/Controllers/AccountAPIController.cs b/LHSCampaign/LHSCampaign/Controllers/AccountAPIController.cs
index f12c333..e845e8a 100644
--- a/LHSCampaign/LHSCampaign/Controllers/AccountAPIController.cs
+++ b/LHSCampaign/LHSCampaign/Controllers/AccountAPIController.cs
@@ -82,8 +82,8 @@ namespace LHSCampaign.Controllers
return Ok("no user");
}
- candidate.Platform = model.reasons;
- db.SaveChanges();
+ //candidate.Platform = model.reasons;
+ //db.SaveChanges();
return Ok("set");
}
@@ -104,6 +104,7 @@ namespace LHSCampaign.Controllers
if (existingFacebook != null)
{
candidate.ExternalLinks.Remove(existingFacebook);
+ db.ExternalLinks.Remove(existingFacebook);
}
if (model.facebook != null)
@@ -115,10 +116,11 @@ namespace LHSCampaign.Controllers
});
}
- var existingYoutube = candidate.ExternalLinks.FirstOrDefault(link => link.Label == "FB EVENT");
+ var existingYoutube = candidate.ExternalLinks.FirstOrDefault(link => link.Label == "CAMPAIGN VIDEO");
if (existingYoutube != null)
{
candidate.ExternalLinks.Remove(existingYoutube);
+ db.ExternalLinks.Remove(existingYoutube);
}
if (model.youtube != null)
@@ -157,6 +159,7 @@ namespace LHSCampaign.Controllers
return Ok(string.Join(",", errors) + ",");
}
+ model.Email = model.Email.ToLower();
var candidate = new Candidate
{
UserName = model.Username,
@@ -166,8 +169,8 @@ namespace LHSCampaign.Controllers
Name = model.FullName,
IsConfirmed = false
};
-
- var preConf = db.PreConfs.FirstOrDefault(conf => conf.Email.ToLower() == model.Email.ToLower());
+
+ var preConf = db.PreConfs.FirstOrDefault(conf => conf.Email == model.Email);
if (preConf != null)
{
candidate.IsConfirmed = true;
diff --git a/LHSCampaign/LHSCampaign/Controllers/ManageController.cs b/LHSCampaign/LHSCampaign/Controllers/ManageController.cs
index e7bf504..3f8cdb9 100644
--- a/LHSCampaign/LHSCampaign/Controllers/ManageController.cs
+++ b/LHSCampaign/LHSCampaign/Controllers/ManageController.cs
@@ -24,6 +24,9 @@ namespace LHSCampaign.Controllers
var existingFacebook = candidate.ExternalLinks.FirstOrDefault(link => link.Label == "FB EVENT")?.Link;
ViewBag.SocialLink = string.IsNullOrWhiteSpace(existingFacebook) ? "" : existingFacebook;
+ var existingYoutube = candidate.ExternalLinks.FirstOrDefault(link => link.Label == "CAMPAIGN VIDEO")?.Link;
+ ViewBag.YTLink = string.IsNullOrWhiteSpace(existingYoutube) ? "" : existingYoutube;
+
if (TempData.ContainsKey("Uploaded"))
{
ViewBag.Uploaded = (bool)TempData["Uploaded"];
diff --git a/LHSCampaign/LHSCampaign/Models/IdentityModels.cs b/LHSCampaign/LHSCampaign/Models/IdentityModels.cs
index 51737db..293be1e 100644
--- a/LHSCampaign/LHSCampaign/Models/IdentityModels.cs
+++ b/LHSCampaign/LHSCampaign/Models/IdentityModels.cs
@@ -66,6 +66,7 @@ namespace LHSCampaign.Models
public DbSet<Setting> Config { get; set; }
public DbSet<LogEntry> Log { get; set; }
public DbSet<PreConfirmation> PreConfs { get; set; }
+ public DbSet<ExternalLink> ExternalLinks { get; set; }
public LCDb()
: base("LCDb", throwIfV1Schema: false)
diff --git a/LHSCampaign/LHSCampaign/Views/Account/Register.cshtml b/LHSCampaign/LHSCampaign/Views/Account/Register.cshtml
index bab658d..e384128 100644
--- a/LHSCampaign/LHSCampaign/Views/Account/Register.cshtml
+++ b/LHSCampaign/LHSCampaign/Views/Account/Register.cshtml
@@ -37,6 +37,11 @@
$("#username").change(function () {
var nm = $(this).val();
if (nm != "") {
+ if (nm.indexOf(" ") > -1) {
+ $("#usernm-err").text("Usernames should not contain spaces.");
+ } else if ($("usernm-err").text() == "Usernames should not contain spaces.") {
+ $("#usernm-err").hide();
+ }
$.post("/API/Account/CheckName", {
username: nm
}, function (data) {
diff --git a/LHSCampaign/LHSCampaign/Views/Candidates/Class.cshtml b/LHSCampaign/LHSCampaign/Views/Candidates/Class.cshtml
index 7b15e7d..83f88be 100644
--- a/LHSCampaign/LHSCampaign/Views/Candidates/Class.cshtml
+++ b/LHSCampaign/LHSCampaign/Views/Candidates/Class.cshtml
@@ -92,12 +92,12 @@
<div>president</div>
</div>*@
- <div class="tab-content" data-tab="no-peeps">
- @*<h1>No one has signed up for this position yet.</h1>*@
- <h1>Campaigning will begin soon</h1>
+ <div class="tab-content" data-tab="no-peeps" style="display: none;">
+ <h1>No one has signed up for this position yet.</h1>
+ @*<h1>Campaigning will begin soon</h1>*@
</div>
- @if (false)
+ @if (true)
{
foreach (var position in Model.Positions)
{
diff --git a/LHSCampaign/LHSCampaign/Views/Manage/Candidate.cshtml b/LHSCampaign/LHSCampaign/Views/Manage/Candidate.cshtml
index 3f71949..c8426e6 100644
--- a/LHSCampaign/LHSCampaign/Views/Manage/Candidate.cshtml
+++ b/LHSCampaign/LHSCampaign/Views/Manage/Candidate.cshtml
@@ -92,19 +92,19 @@
What would you like to share with voters?
<br /><br />
<!-- Thanks! http://stackoverflow.com/questions/4220381/replace-line-break-characters-with-br-in-asp-net-mvc-razor-view -->
- <textarea id="campaign-reasons" class="small-font default-input standard-input" style="text-align: left; width: 90%; height: 300px; white-space: pre-wrap;">@Model.Platform</textarea>
+ <textarea id="campaign-reasons" class="small-font default-input standard-input" style="text-align: left; width: 90%; height: 300px; white-space: pre-wrap;" disabled>@Model.Platform</textarea>
<br />
- <button class="default-btn standard-btn" id="save-reasons">Save Reasons</button>
+ <button class="default-btn standard-btn" id="save-reasons">Continue</button>
</div>
<div class="tab-content" data-tab="social">
YouTube video:
<br /><br />
- <input type="text" id="campaign-social-video" class="default-input standard-input" style="width: 400px;" placeholder="http://youtube.com/example..." value="" />
+ <input type="text" id="campaign-social-video" class="default-input standard-input" style="width: 400px;" placeholder="http://youtube.com/example..." value="@(ViewBag.YTLink)" />
<br/>
Facebook page/event link:
<br /><br />
- <input type="text" id="campaign-social" class="default-input standard-input" style="width: 400px;" placeholder="http://facebook.com/example..." value="" />
+ <input type="text" id="campaign-social" class="default-input standard-input" style="width: 400px;" placeholder="http://facebook.com/example..." value="@(ViewBag.SocialLink)" />
<br />
<button class="default-btn standard-btn" id="save-social">Save</button>
<br />
@@ -200,7 +200,7 @@
$("#save-social").click(function () {
var fb = $("#campaign-social").val().trim().toLowerCase();
- var yt = $("#campaign-social-video").val().trim().toLowerCase();
+ var yt = $("#campaign-social-video").val().trim();
if (fb == $("#campaign-social").attr("placeholder")) {
fb = '';
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback