diff --git a/.gitignore b/.gitignore index b06e864..f80f9a4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ *.user *.userosscache *.sln.docstates - +*.pubxml +*.pubxml.user # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/lmltfy/App_Start/BundleConfig.cs b/lmltfy/App_Start/BundleConfig.cs index 99d2b15..97e3d7c 100644 --- a/lmltfy/App_Start/BundleConfig.cs +++ b/lmltfy/App_Start/BundleConfig.cs @@ -23,10 +23,20 @@ namespace lmltfy bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); + bundles.Add(new ScriptBundle("~/bundles/home") + .Include( + "~/Scripts/app/highlight.js", + "~/Scripts/app/Home.js")); + bundles.Add(new ScriptBundle("~/bundles/search") + .Include( + "~/Scripts/underscore.min.js", + "~/Scripts/app/Search.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css")); + + } } } diff --git a/lmltfy/Content/Site.css b/lmltfy/Content/Site.css index 6ea5d8f..b4b51b5 100644 --- a/lmltfy/Content/Site.css +++ b/lmltfy/Content/Site.css @@ -15,10 +15,6 @@ .dl-horizontal dt { white-space: normal; } - -/* Set width on the form input elements since they're 100% wide by default */ -input, -select, -textarea { - max-width: 280px; -} +footer { + padding-top: 100px; +} \ No newline at end of file diff --git a/lmltfy/Controllers/HomeController.cs b/lmltfy/Controllers/HomeController.cs index 3b77f0b..dcda353 100644 --- a/lmltfy/Controllers/HomeController.cs +++ b/lmltfy/Controllers/HomeController.cs @@ -1,55 +1,57 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text.RegularExpressions; +using System.Linq; using System.Web; using System.Web.Mvc; -using CsQuery; -using lmltfy.Models; using lmltfy.Factories; +using lmltfy.Models; +using lmltfy.Util; + namespace lmltfy.Controllers { public class HomeController : Controller { private lmltfyContext db = new lmltfyContext(); - private Regex reg = new Regex(@"(\$\('#keyvol'\).val\('(?.*)\'\)\;)", RegexOptions.Compiled); + [Route("")] - public ActionResult Index() + [Route("h/{application}")] + public ActionResult Index(string application = AppNames.Lycos) { - return View(); + var app = application.ToAppEnum(); + if (!app.HasValue) + { + return new HttpStatusCodeResult(404); + } + return View(new ApplicationBrandingFactory().ResoleBrand(app.Value)); } [HttpPost] [Route("")] - public string Index([Bind(Include = "Search")] SearchModel searchModel) + public string Index([Bind(Include = "Search,Brand")] SearchModel searchModel) { searchModel.Url = new UrlGeneration().Generate(); while (db.SearchModels.Any(a => a.Url == searchModel.Url)) { searchModel.Url = new UrlGeneration().Generate(); } - + if (!ModelState.IsValid) throw new HttpException(500, "Error parsing query"); db.SearchModels.Add(searchModel); db.SaveChanges(); - return Url.Action("Search", "Home", new { url = searchModel.Url}, Request.Url.Scheme); + return Url.Action("Search", "Home", new { url = searchModel.Url }, Request.Url.Scheme); } [HttpGet] [Route("{url}")] + // [OutputCache(Duration = 86400, Location = System.Web.UI.OutputCacheLocation.ServerAndClient, VaryByParam = "url")] public ActionResult Search(string url) { var model = db.SearchModels.FirstOrDefault(a => a.Url == url); - if(model == null) + if (model == null) { return new HttpStatusCodeResult(404, "Not found"); } - WebClient client = new WebClient(); - string downloadString = client.DownloadString("http://lycos.com"); - var key = reg.Match(downloadString).Groups["key"].Value; - return View(new SearchResultsViewModel(model, key)); + + return View(new SearchResultsViewModel(model, new UrlResolverFactory().UrlGenerate(model.Brand, model.Search), new ApplicationBrandingFactory().ResoleBrand(model.Brand))); } protected override void Dispose(bool disposing) diff --git a/lmltfy/Factories/ApplicationBrandingFactory.cs b/lmltfy/Factories/ApplicationBrandingFactory.cs new file mode 100644 index 0000000..c5375eb --- /dev/null +++ b/lmltfy/Factories/ApplicationBrandingFactory.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using lmltfy.Models; + +namespace lmltfy.Factories +{ + public class ApplicationBrandingFactory + { + public ApplicationBrandingModel ResoleBrand(ApplicationBrandEnum application) + { + + if (application == ApplicationBrandEnum.Ask) + { + return new ApplicationBrandingModel { LogoImageUrl = "/Images/ask.png", Brand = application, LogoImageAlt= "Ask Jeeves" }; + } + if (application == ApplicationBrandEnum.Lycos) + { + return new ApplicationBrandingModel {LogoImageUrl = "/Images/logo-homepage.png", Brand = application, LogoImageAlt = "Lycos" }; + } + if(application == ApplicationBrandEnum.DuckDuckGo) + { + return new ApplicationBrandingModel { LogoImageUrl = "/Images/ddgo.png", Brand = application, LogoImageAlt = "Duck Duck go" }; + } + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/lmltfy/Factories/UrlGeneration.cs b/lmltfy/Factories/UrlGeneration.cs index 1f5cb1a..a75194d 100644 --- a/lmltfy/Factories/UrlGeneration.cs +++ b/lmltfy/Factories/UrlGeneration.cs @@ -7,12 +7,12 @@ namespace lmltfy.Factories { public class UrlGeneration { + private static readonly List EnumedChars = Enumerable.Repeat("abcdefghijklmnopqrstuvwxyz0123456789", 8).ToList(); public string Generate() { - var chars = "abcdefghijklmnopqrstuvwxyz0123456789"; var random = new Random(); return new string( - Enumerable.Repeat(chars, 8) + EnumedChars .Select(s => s[random.Next(s.Length)]) .ToArray()); } diff --git a/lmltfy/Factories/UrlResolverFactory.cs b/lmltfy/Factories/UrlResolverFactory.cs new file mode 100644 index 0000000..0382ec2 --- /dev/null +++ b/lmltfy/Factories/UrlResolverFactory.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text.RegularExpressions; +using System.Web; +using lmltfy.Models; + +namespace lmltfy.Factories +{ + public class UrlResolverFactory + { + Regex lycosRegex = new Regex(@"(\$\('#keyvol'\).val\('(?.*)\'\)\;)", RegexOptions.Compiled); + + /// + /// Generates a url for a given application + /// + /// + /// + /// + public RedirectModel UrlGenerate(ApplicationBrandEnum app, string query) + { + if (app == ApplicationBrandEnum.Lycos) + { + return GenerateLycosUrl(query); + } + if (app == ApplicationBrandEnum.Ask) + { + return new RedirectModel($"http://www.ask.com/web?q={query}"); + } + if(app == ApplicationBrandEnum.DuckDuckGo) + { + return new RedirectModel($"https://duckduckgo.com/?q={query}"); + } + + throw new NotImplementedException("Unknown app passed"); + } + + public RedirectModel GenerateLycosUrl(string query) + { + using (WebClient client = new WebClient()) + { + var downloadString = client.DownloadString("http://lycos.com"); + var key = lycosRegex.Match(downloadString).Groups["key"].Value; + return new RedirectModel($"http://search.lycos.com/web/?q={query}", $"&keyvol={key}"); + } + + } + } +} \ No newline at end of file diff --git a/lmltfy/Global.asax.cs b/lmltfy/Global.asax.cs index 6d6a2f3..5640c5a 100644 --- a/lmltfy/Global.asax.cs +++ b/lmltfy/Global.asax.cs @@ -5,6 +5,8 @@ using System.Web; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; +using lmltfy.Factories; +using lmltfy.Models; namespace lmltfy { @@ -16,6 +18,14 @@ namespace lmltfy FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); + //Access the db to JIT the EF dll, and generate a URL to JIT parts of our DLL (improve page loads on subsequent first time app starts) + using (var db = new lmltfyContext()) + { + var res = db.SearchModels.FirstOrDefault(); + res = res ?? new SearchModel() ; + Console.Write(new UrlGeneration().Generate() + res); + } + } } } diff --git a/lmltfy/Images/ajax-loader.gif b/lmltfy/Images/ajax-loader.gif new file mode 100644 index 0000000..3da47fd Binary files /dev/null and b/lmltfy/Images/ajax-loader.gif differ diff --git a/lmltfy/Images/ask.png b/lmltfy/Images/ask.png new file mode 100644 index 0000000..27cd891 Binary files /dev/null and b/lmltfy/Images/ask.png differ diff --git a/lmltfy/Images/ddgo.png b/lmltfy/Images/ddgo.png new file mode 100644 index 0000000..a5af1a3 Binary files /dev/null and b/lmltfy/Images/ddgo.png differ diff --git a/lmltfy/Images/ddgo.svg b/lmltfy/Images/ddgo.svg new file mode 100644 index 0000000..4457478 --- /dev/null +++ b/lmltfy/Images/ddgo.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lmltfy/Migrations/201507270340540_2.Designer.cs b/lmltfy/Migrations/201507270340540_2.Designer.cs new file mode 100644 index 0000000..473b366 --- /dev/null +++ b/lmltfy/Migrations/201507270340540_2.Designer.cs @@ -0,0 +1,29 @@ +// +namespace lmltfy.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")] + public sealed partial class _2 : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(_2)); + + string IMigrationMetadata.Id + { + get { return "201507270340540_2"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/lmltfy/Migrations/201507270340540_2.cs b/lmltfy/Migrations/201507270340540_2.cs new file mode 100644 index 0000000..6691641 --- /dev/null +++ b/lmltfy/Migrations/201507270340540_2.cs @@ -0,0 +1,18 @@ +namespace lmltfy.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class _2 : DbMigration + { + public override void Up() + { + AddColumn("dbo.lmltfy_SearchModel", "Brand", c => c.Int(nullable: false)); + } + + public override void Down() + { + DropColumn("dbo.lmltfy_SearchModel", "Brand"); + } + } +} diff --git a/lmltfy/Migrations/201507270340540_2.resx b/lmltfy/Migrations/201507270340540_2.resx new file mode 100644 index 0000000..9bd5eb4 --- /dev/null +++ b/lmltfy/Migrations/201507270340540_2.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAEAM1X224bNxB9L9B/WOyzI0ryS2qsEiiyVRi17CBr57Wgd0cyEV62JNfQflsf8kn9hQ73fpMsOwFa+MVLzpyZOTwcjv75+3vwcS+49wzaMCUX/mwy9T2QkYqZ3C381G7fvfc/fvj1l+AqFnvva2V37uzQU5qF/2RtckGIiZ5AUDMRLNLKqK2dREoQGisyn05/I7MZAYTwEcvzgi+ptExA/oGfKyUjSGxK+UbFwE25jjthjurdUgEmoREsfC643WaTwtD3lpxRTCIEvvU9KqWy1GKKFw8GQquV3IUJLlB+nyWAdlvKDZSpXzTmp1YxnbsqSONYQUWpsUq8EnB2XtJC+u5vItevaUPirpBgm7mqc/IcQ1RHTzltvtePd7Hi2tn26J20nM68YuusVgGKxf2deauU21TDQkJqNUXLz+kjZ9EfkN2rbyAXMuW8nRymh3udBVz6rFUC2mZfYFum/KAxVdJ1JH3P2q/tVNSCAkAZ+96G7m9A7uwTCnz+3vfWbA9xtVIq4kEyVD06WZ3i5y2mTB851PvkaNCCpyNx8ZimJwU+HueTpjKuw6DmJ8skQarzQ8w3r2QqXkg/II04upJJRUsw48jXZs3prrlJpyppDO1HJYXcxaB5hmQXIa+lPZ/3lLYB8Qi6rOkmixQ2ja+Up/g1HdDdMV6ab7XpbEhhQdbwzmEzs5TJGqao0a3C3o4Qhp2q5MyUIujmVKCGYIcXGUtpjrIUROeejx17nV/TZUnRZqt2TA7042BDkwTJbvXncsULi+a8ehe+vnWJAoNEZqSD1dnWkazSdAe9XQyNma6ZNvaSWvpInTZXsRiYdU/jANNVrBHC+12r4b9ycv+3T36kl/ZRGiLXWJsAafMyoU6o274H3vlDSTnVY71wpXgq5MGOesy/amttiGrtdJSyabVByqUhRkB6RPT5JgPCe+9D/xCP3YC+SR29vgk9xQel+l4eUwZyLEx8D8l5ZrGTYpgZC2LiDCbhX3zFGdbbGGyoZFswtmh4+ILM5r1x5/8zehBjYn76/PEfzALy2YWnejgN/NBTPwpbPPYN7qtfduZ08MY3fOwJGvbGk5+Yl16YQtYLP35UmH2Rb9H3/vwZL9HwvgWk/eMhuATDdg2E+ykhIXJCbkArm2u5VRXtWGw7o8qkdyobsDRGzpbasi2NLG5HYEw+3ZWTwRVODPG1vEttktqlMThB8Kxdb0COx8+f227OwV3ivszPKAHTZFgC3MlPKeNxnfd6RFQHIJx8fgdczxsETrcIt8tqpFslTwQq6buEBHByk/YeRMIRzNzJkD7DW3LD6ekGdjTKqrZ5GOTlg+jSHlwyutNUmBKj8Xc/iIn7RfzhX4LHP3FDDwAA + + + dbo + + \ No newline at end of file diff --git a/lmltfy/Models/ApplicationBrandEnum.cs b/lmltfy/Models/ApplicationBrandEnum.cs new file mode 100644 index 0000000..75ef1c4 --- /dev/null +++ b/lmltfy/Models/ApplicationBrandEnum.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace lmltfy.Models +{ + public enum ApplicationBrandEnum + { + Lycos = 0, + Ask = 1, + DuckDuckGo = 2 + } + +} \ No newline at end of file diff --git a/lmltfy/Models/ApplicationBrandingModel.cs b/lmltfy/Models/ApplicationBrandingModel.cs new file mode 100644 index 0000000..29780f0 --- /dev/null +++ b/lmltfy/Models/ApplicationBrandingModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace lmltfy.Models +{ + public class ApplicationBrandingModel : IApplicationBrandingModel + { + public string LogoImageUrl { get; set; } + + public string LogoImageAlt { get; set; } + + public ApplicationBrandEnum Brand { get; set; } + + public IList StyleSheetUrl { get; set; } = new List(); + + public IList ScriptUrls { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/lmltfy/Models/IApplicationBrandingModel.cs b/lmltfy/Models/IApplicationBrandingModel.cs new file mode 100644 index 0000000..f9bf681 --- /dev/null +++ b/lmltfy/Models/IApplicationBrandingModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace lmltfy.Models +{ + public interface IApplicationBrandingModel + { + string LogoImageUrl { get; set; } + + string LogoImageAlt { get; set; } + + ApplicationBrandEnum Brand { get; set; } + + IList StyleSheetUrl { get; set; } + + IList ScriptUrls { get; set; } + } +} \ No newline at end of file diff --git a/lmltfy/Models/RedirectModel.cs b/lmltfy/Models/RedirectModel.cs new file mode 100644 index 0000000..a6b958a --- /dev/null +++ b/lmltfy/Models/RedirectModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace lmltfy.Models +{ + public class RedirectModel + { + public string RedirectUrl { get; set; } + public string Key { get; set; } + + public RedirectModel(string redirectUrl, string redirectKey = "") + { + RedirectUrl = redirectUrl; + Key = redirectKey; + } + } +} \ No newline at end of file diff --git a/lmltfy/Models/SearchModel.cs b/lmltfy/Models/SearchModel.cs index cff9e35..74b9d9f 100644 --- a/lmltfy/Models/SearchModel.cs +++ b/lmltfy/Models/SearchModel.cs @@ -6,9 +6,12 @@ namespace lmltfy.Models public class SearchModel { [AllowHtml] - [StringLength(maximumLength: 2000, ErrorMessage = "No more than 2000 characters", MinimumLength = 1)] + [StringLength(2000, ErrorMessage = "No more than 2000 characters", MinimumLength = 1)] public string Search { get; set; } [Key] public string Url { get; set; } + + [Required] + public ApplicationBrandEnum Brand { get; set; } } } \ No newline at end of file diff --git a/lmltfy/Models/SearchResultsViewModel.cs b/lmltfy/Models/SearchResultsViewModel.cs index 14ebdf8..03f05f1 100644 --- a/lmltfy/Models/SearchResultsViewModel.cs +++ b/lmltfy/Models/SearchResultsViewModel.cs @@ -8,8 +8,11 @@ namespace lmltfy.Models public class SearchResultsViewModel { public SearchModel SearchModel { get; set; } - public string LycosToken { get; set; } - public SearchResultsViewModel(SearchModel searchModel, string lycosToken) + public RedirectModel RedirectModel { get; set; } + + public IApplicationBrandingModel BrandingModel { get; set; } + + public SearchResultsViewModel(SearchModel searchModel, RedirectModel redirectModel, IApplicationBrandingModel brandingModel) { if (string.IsNullOrWhiteSpace(searchModel.Search)) { @@ -19,12 +22,13 @@ namespace lmltfy.Models { throw new ArgumentNullException(); } - if (string.IsNullOrWhiteSpace(lycosToken)) + if (redirectModel == null) { throw new ArgumentNullException(); } SearchModel = searchModel; - LycosToken = lycosToken; + RedirectModel = redirectModel; + BrandingModel = brandingModel; } } diff --git a/lmltfy/Scripts/_references.js b/lmltfy/Scripts/_references.js index db66ef3..6589147 100644 Binary files a/lmltfy/Scripts/_references.js and b/lmltfy/Scripts/_references.js differ diff --git a/lmltfy/Scripts/app/Home.js b/lmltfy/Scripts/app/Home.js new file mode 100644 index 0000000..aec998f --- /dev/null +++ b/lmltfy/Scripts/app/Home.js @@ -0,0 +1,11 @@ +function showResults(data) { + $("#mainGrp").hide(); + $("#resultsDiv").show(); + $("#results").val(data.responseText); + $("#resultsDiv").highlight(); + +} +function disableBtn() { + $("#submitBtn").prop("disabled", true); + $("#LoadingGif").show(); +} \ No newline at end of file diff --git a/lmltfy/Scripts/app/Search.js b/lmltfy/Scripts/app/Search.js new file mode 100644 index 0000000..1163362 --- /dev/null +++ b/lmltfy/Scripts/app/Search.js @@ -0,0 +1,27 @@ +$(document).ready(function () { + var playSearch = function () { + var txt = $("#SearchQuery").val(); + var txtLength = txt.length; + + var currentText = $("#Search").val(); + var currentTextLength = currentText.length; + $("#Search").val(txt.substr(0, currentTextLength + 1)); + + if (txtLength > currentTextLength) { + _.delay(function () { + $("#Search").focus(); + playSearch(); + $("#Search").focus(); + }, 200); + } else { + _.delay(function () { + window.location.href = $("#RedirUrl").val() + $("#Key").val(); + }, 300); + } + + } + + playSearch(); + + +}); \ No newline at end of file diff --git a/lmltfy/Scripts/app/highlight.js b/lmltfy/Scripts/app/highlight.js new file mode 100644 index 0000000..475f296 --- /dev/null +++ b/lmltfy/Scripts/app/highlight.js @@ -0,0 +1,15 @@ +jQuery.fn.highlight = function () { + $(this).each(function () { + var el = $(this); + el.before("
"); + el.prev() + .width(el.width()) + .height(el.height()) + .css({ + "position": "absolute", + "background-color": "#ffff99", + "opacity": ".9" + }) + .fadeOut(1200); + }); +} \ No newline at end of file diff --git a/lmltfy/Util/AppNames.cs b/lmltfy/Util/AppNames.cs new file mode 100644 index 0000000..ef819bf --- /dev/null +++ b/lmltfy/Util/AppNames.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace lmltfy.Util +{ + public struct AppNames + { + public const string Lycos = "Lycos"; + public const string Ask = "Ask"; + public const string DuckDuckGo = "DuckDuckGo"; + } +} \ No newline at end of file diff --git a/lmltfy/Util/Extensions.cs b/lmltfy/Util/Extensions.cs new file mode 100644 index 0000000..6214594 --- /dev/null +++ b/lmltfy/Util/Extensions.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using lmltfy.Models; + +namespace lmltfy.Util +{ + public static class Extensions + { + public static ApplicationBrandEnum? ToAppEnum(this string current) + { + //don't use enum.parse as its slow (reflection and all) + if (string.Equals(current, AppNames.Lycos, StringComparison.CurrentCultureIgnoreCase)) + { + return ApplicationBrandEnum.Lycos; + } + if (string.Equals(current, AppNames.Ask, StringComparison.CurrentCultureIgnoreCase)) + { + return ApplicationBrandEnum.Ask; + } + if(string.Equals(current, AppNames.DuckDuckGo, StringComparison.CurrentCultureIgnoreCase)) + { + return ApplicationBrandEnum.DuckDuckGo; + } + return null; + } + } +} \ No newline at end of file diff --git a/lmltfy/Views/Home/Index.cshtml b/lmltfy/Views/Home/Index.cshtml index 77dfa1c..7d73829 100644 --- a/lmltfy/Views/Home/Index.cshtml +++ b/lmltfy/Views/Home/Index.cshtml @@ -1,10 +1,11 @@ -@model lmltfy.Models.SearchModel +@using lmltfy.Models +@model ApplicationBrandingModel -@using (Ajax.BeginForm(new AjaxOptions() { OnComplete = "showResults", OnBegin = "disableBtn"})) +@using (Ajax.BeginForm("Index",new AjaxOptions() { OnComplete = "showResults", OnBegin = "disableBtn" })) { - - @Html.Partial("SearchBarParitalView") + @Html.DisplayFor(a=>a) + @Html.Partial("SearchBarParitalView", new SearchModel() {Brand = Model.Brand}) } @@ -19,31 +20,5 @@ @section Scripts { @Scripts.Render("~/bundles/jqueryval") - + @Scripts.Render("~/bundles/home") } diff --git a/lmltfy/Views/Home/Search.cshtml b/lmltfy/Views/Home/Search.cshtml index 6452703..a1a2c5c 100644 --- a/lmltfy/Views/Home/Search.cshtml +++ b/lmltfy/Views/Home/Search.cshtml @@ -1,39 +1,16 @@ @using lmltfy.Models @model lmltfy.Models.SearchResultsViewModel +@Html.DisplayFor(a=>a.BrandingModel) @Html.Partial("SearchBarParitalView", new SearchModel()) @Html.HiddenFor(a=>a.SearchModel.Search, new {@Id = "SearchQuery"}) -@Html.HiddenFor(a=>a.LycosToken, new { @Id = "LycosToken" }) +@Html.HiddenFor(a=>a.RedirectModel.RedirectUrl, new { @Id = "RedirUrl" }) +@Html.HiddenFor(a => a.RedirectModel.Key, new { @Id = "Key" }) + @section Scripts { - - + @Scripts.Render("~/bundles/search") } diff --git a/lmltfy/Views/Shared/DisplayTemplates/ApplicationBrandingModel.cshtml b/lmltfy/Views/Shared/DisplayTemplates/ApplicationBrandingModel.cshtml new file mode 100644 index 0000000..2f6e081 --- /dev/null +++ b/lmltfy/Views/Shared/DisplayTemplates/ApplicationBrandingModel.cshtml @@ -0,0 +1,21 @@ +@model lmltfy.Models.ApplicationBrandingModel + +

Let Me @Model.LogoImageAlt That for you

+ +@section styles +{ + @foreach (var sheet in Model.StyleSheetUrl) + { + + } +} + +@section scripts +{ + @foreach (var script in Model.ScriptUrls) + { + + + } + +} diff --git a/lmltfy/Views/Shared/SearchBarParitalView.cshtml b/lmltfy/Views/Shared/SearchBarParitalView.cshtml index 059edbf..32845f4 100644 --- a/lmltfy/Views/Shared/SearchBarParitalView.cshtml +++ b/lmltfy/Views/Shared/SearchBarParitalView.cshtml @@ -1,14 +1,18 @@ @model lmltfy.Models.SearchModel -

Let Me lycos That for you

-
-
-
- @Html.EditorFor(model => model.Search, new { htmlAttributes = new { @class = "form-control", @placeholder = "Search" } }) -
- +
+
+
+ @Html.EditorFor(model => model.Search, new {htmlAttributes = new {@class = "form-control", @placeholder = "Search"}}) +
+
+ + @Html.ValidationMessageFor(model => model.Search) + @Html.HiddenFor(a=>a.Brand) +
+
\ No newline at end of file diff --git a/lmltfy/Views/Shared/_Layout.cshtml b/lmltfy/Views/Shared/_Layout.cshtml index 9ba891f..1e18336 100644 --- a/lmltfy/Views/Shared/_Layout.cshtml +++ b/lmltfy/Views/Shared/_Layout.cshtml @@ -3,22 +3,27 @@ + lmltfy @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") + @RenderSection("styles", required: false)
@RenderBody() -
+
+

© @DateTime.Now.Year

diff --git a/lmltfy/google2ad737791aece819.html b/lmltfy/google2ad737791aece819.html new file mode 100644 index 0000000..39c8fb4 --- /dev/null +++ b/lmltfy/google2ad737791aece819.html @@ -0,0 +1 @@ +google-site-verification: google2ad737791aece819.html \ No newline at end of file diff --git a/lmltfy/lmltfy.csproj b/lmltfy/lmltfy.csproj index f4395eb..05baaf9 100644 --- a/lmltfy/lmltfy.csproj +++ b/lmltfy/lmltfy.csproj @@ -45,10 +45,6 @@ 4 - - ..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll - True - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll True @@ -158,7 +154,9 @@ + + Global.asax @@ -166,11 +164,21 @@ 201507251954543_1.cs + + + 201507270340540_2.cs + + + + + + + @@ -179,7 +187,15 @@ + + + + + + + + @@ -215,9 +231,11 @@ + + @@ -230,6 +248,9 @@ 201507251954543_1.cs + + 201507270340540_2.cs + diff --git a/lmltfy/packages.config b/lmltfy/packages.config index b088df0..3563ede 100644 --- a/lmltfy/packages.config +++ b/lmltfy/packages.config @@ -2,7 +2,6 @@ - diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..36525a2 --- /dev/null +++ b/readme.md @@ -0,0 +1,4 @@ +## What is this? + + +This is the code for [Let me lycos that for you](http://lmltfy.xyz)