Skip to content

Commit

Permalink
Updated Nancy, messed around with the shift UI. Modified config for r…
Browse files Browse the repository at this point in the history
…azor

--HG--
rename : CodeProse.Shifter/partials/controls/LabeledCheckBoxModel.cs => CodeProse.Shifter/partials/controls/WeekDayCheckBoxModel.cs
rename : CodeProse.Shifter/partials/controls/labeled-checkbox.cshtml => CodeProse.Shifter/partials/controls/weekday-checkbox.cshtml
  • Loading branch information
Ryan@Ryan-HP authored and Ryan@Ryan-HP committed Mar 18, 2012
1 parent 0bb7643 commit c3d8048
Show file tree
Hide file tree
Showing 39 changed files with 330 additions and 75 deletions.
40 changes: 28 additions & 12 deletions CodeProse.Shifter/CodeProse.Shifter.csproj
Expand Up @@ -40,17 +40,21 @@
<HintPath>..\packages\DapperExtensions.1.3.0\lib\net40\DapperExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.0.9.0\lib\net40\Nancy.dll</HintPath>
<Reference Include="Nancy, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.0.10.0\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Authentication.Forms">
<HintPath>..\packages\Nancy.Authentication.Forms.0.9.0\lib\net40\Nancy.Authentication.Forms.dll</HintPath>
<Reference Include="Nancy.Authentication.Forms, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Authentication.Forms.0.10.0\lib\net40\Nancy.Authentication.Forms.dll</HintPath>
</Reference>
<Reference Include="Nancy.Hosting.Aspnet">
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.9.0\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
<Reference Include="Nancy.Hosting.Aspnet, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.10.0\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
</Reference>
<Reference Include="Nancy.ViewEngines.Razor">
<HintPath>..\packages\Nancy.Viewengines.Razor.0.9.0\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
<Reference Include="Nancy.ViewEngines.Razor, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.10.0\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite, Version=1.0.79.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<HintPath>..\packages\System.Data.SQLite.1.0.79.0\lib\net40\System.Data.SQLite.dll</HintPath>
Expand All @@ -66,8 +70,8 @@
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Razor">
<HintPath>..\packages\Nancy.Viewengines.Razor.0.9.0\lib\net40\System.Web.Razor.dll</HintPath>
<Reference Include="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Viewengines.Razor.0.10.0\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
Expand All @@ -81,7 +85,10 @@
<Content Include="content\base.css" />
<Content Include="content\data-service.js" />
<Content Include="content\jquery.deletebutton.js" />
<Content Include="content\string-extensions.js" />
<Content Include="content\themeroller-icon-set-vector-32px.png" />
<Content Include="content\number-picker.js" />
<Content Include="content\time-selector.js" />
<Content Include="content\topnav.js" />
<Content Include="wireframes\assign-shifts.htm" />
<Content Include="wireframes\default.htm" />
Expand All @@ -96,7 +103,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<None Include="partials\controls\labeled-checkbox.cshtml" />
<None Include="partials\controls\weekday-checkbox.cshtml" />
<None Include="partials\controls\number-picker.cshtml" />
<None Include="partials\controls\time-selector.cshtml" />
<None Include="partials\shifts\shift-form.cshtml" />
<None Include="partials\shifts\shift-list.cshtml" />
Expand All @@ -120,7 +128,10 @@
<ItemGroup>
<Compile Include="models\ShiftsModel.cs" />
<Compile Include="modules\ShiftsModule.cs" />
<Compile Include="partials\controls\LabeledCheckBoxModel.cs" />
<Compile Include="partials\controls\WeekDayCheckBoxModel.cs" />
<Compile Include="partials\controls\NumberPickerModel.cs" />
<Compile Include="utility\Day.cs" />
<Compile Include="utility\Days.cs" />
<Compile Include="utility\ShifterBootStrapper.cs" />
<Compile Include="utility\AssemblyScanner.cs" />
<Compile Include="data\mapping\CustomClassMapper.cs" />
Expand Down Expand Up @@ -186,6 +197,11 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<PostBuildEvent>
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.10.0\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.10.0\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
20 changes: 18 additions & 2 deletions CodeProse.Shifter/Web.config
Expand Up @@ -4,9 +4,22 @@
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="razor" type="Nancy.ViewEngines.Razor.RazorConfigurationSection, Nancy.ViewEngines.Razor" />
</configSections>
<razor disableAutoIncludeModelNamespace="false">
<assemblies>
<add assembly="CodeProse.Shifter" />
</assemblies>
</razor>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0">
<buildProviders>
<add extension=".cshtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyCSharpRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
<add extension=".vbhtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyVisualBasicRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
</buildProviders>
</compilation>
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</httpHandlers>
Expand All @@ -17,4 +30,7 @@
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers>
</system.webServer>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings>
</configuration>
9 changes: 9 additions & 0 deletions CodeProse.Shifter/content/base.css
Expand Up @@ -152,4 +152,13 @@ li.user
.ui-widget-content
{
padding: 10px;
}

.time-selector > * {
display: inline;
}

.number-picker input[type=button], .number-picker input[type=text], .number-picker select {
width: 40px;
height: 40px;
}
46 changes: 46 additions & 0 deletions CodeProse.Shifter/content/number-picker.js
@@ -0,0 +1,46 @@
(function ($) {
$(document).ready(function () {
$('.number-picker').each(function () {
var picker = $(this);
var max = picker.data('maximum');
var min = picker.data('minimum');

var number = picker.children(':input').first();
var incrementor = number.next();
var decrementor = incrementor.next();

if (number.val() === '') {
number.val(min);
}

incrementor.click(function () {
var current = parseInt(number.val());

if (current === max) {
current = min;
} else {
current++;
}

number.val(current);
});

decrementor.click(function () {
var current = parseInt(number.val());

if (current === min) {
current = max;
} else {
current--;
}

number.val(current);
});
});
});

$.fn.number = function () {
return this.children(':input').first().val();
};

})(jQuery);
8 changes: 8 additions & 0 deletions CodeProse.Shifter/content/string-extensions.js
@@ -0,0 +1,8 @@
(function () {
String.prototype.padLeft = function (padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
};
})();
29 changes: 29 additions & 0 deletions CodeProse.Shifter/content/time-selector.js
@@ -0,0 +1,29 @@
(function ($) {
$(document).ready(function () {

});

$.fn.time = function () {
var numbers = this.children('.number-picker');

var hour = numbers.first().number();
var minute = numbers.first().next().number();
var ampm = this.children('select').children('option:selected').val();

var formatted = function () {
var minutePart = '';
if (minute > 0) {
minutePart = ':' + minute.toString().padLeft('0', 2);
};

return hour.toString() + minutePart + ' ' + ampm;
};

return {
hour: hour,
minute: minute,
ampm: ampm,
formatted: formatted
};
};
})(jQuery);
11 changes: 7 additions & 4 deletions CodeProse.Shifter/layouts/base.cshtml
@@ -1,15 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
@RenderSection("Title")
<link rel="stylesheet" type="text/css" href="@Url.Content("~/content/base.css")" />
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/sunny/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="@Url.Content("~/content/fullcalendar.css")" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="@Url.Content("~/content/string-extensions.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/fullcalendar.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/data-service.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/jquery.deletebutton.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/jquery.deletebutton.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/number-picker.js")"></script>
<script type="text/javascript" src="@Url.Content("~/content/time-selector.js")"></script>
</head>
<body>
@Html.Partial("partials/topnav.cshtml", Model)
Expand Down
6 changes: 1 addition & 5 deletions CodeProse.Shifter/modules/HomeModule.cs
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy;
using CodeProse.Shifter.models;

namespace CodeProse.Shifter.modules
Expand Down
8 changes: 4 additions & 4 deletions CodeProse.Shifter/packages.config
Expand Up @@ -2,9 +2,9 @@
<packages>
<package id="Dapper" version="1.8" />
<package id="DapperExtensions" version="1.3.0" />
<package id="Nancy" version="0.9.0" />
<package id="Nancy.Authentication.Forms" version="0.9.0" />
<package id="Nancy.Hosting.Aspnet" version="0.9.0" />
<package id="Nancy.Viewengines.Razor" version="0.9.0" />
<package id="Nancy" version="0.10.0" />
<package id="Nancy.Authentication.Forms" version="0.10.0" />
<package id="Nancy.Hosting.Aspnet" version="0.10.0" />
<package id="Nancy.Viewengines.Razor" version="0.10.0" />
<package id="System.Data.SQLite" version="1.0.79.0" />
</packages>
14 changes: 14 additions & 0 deletions CodeProse.Shifter/partials/controls/NumberPickerModel.cs
@@ -0,0 +1,14 @@
namespace CodeProse.Shifter.partials.controls
{
public class NumberPickerModel
{
public NumberPickerModel(int minValue, int maxValue)
{
MaxValue = maxValue;
MinValue = minValue;
}

public int MaxValue { get; private set; }
public int MinValue { get; private set; }
}
}
@@ -1,14 +1,16 @@
namespace CodeProse.Shifter.partials.controls
{
public class LabeledCheckBoxModel
public class WeekDayCheckBoxModel
{
public LabeledCheckBoxModel(string name, bool @checked)
public WeekDayCheckBoxModel(string name, string abbreviation, bool @checked)
{
Name = name;
Checked = @checked;
Abbreviation = abbreviation;
}

public string Name { get; private set; }
public bool Checked { get; private set; }
public string Abbreviation { get; private set; }
}
}
5 changes: 5 additions & 0 deletions CodeProse.Shifter/partials/controls/number-picker.cshtml
@@ -0,0 +1,5 @@
<div class="number-picker" data-minimum="@Model.MinValue" data-maximum="@Model.MaxValue">
<input type="text" readonly="readonly" />
<input type="button" value="+" />
<input type="button" value="-" />
</div>
13 changes: 5 additions & 8 deletions CodeProse.Shifter/partials/controls/time-selector.cshtml
@@ -1,12 +1,9 @@
<div>
@using CodeProse.Shifter.partials.controls
<div class="time-selector">
<label>@Model</label>
<input type="text" class="hours" />
<input type="button" value="+" class="increment" />
<input type="button" value="-" class="decrement" />
<input type="text" class="minutes" />
<input type="button" value="+" class="increment" />
<input type="button" value="-" class="decrement" />
<select class="am-pm">
@Html.Partial("partials/controls/number-picker", new NumberPickerModel(1, 12))
@Html.Partial("partials/controls/number-picker", new NumberPickerModel(0, 59))
<select>
<option>AM</option>
<option>PM</option>
</select>
Expand Down
Expand Up @@ -8,5 +8,5 @@

<div>
<label for="@Model.Name">@Model.Name</label>
<input type="checkbox" @checkedAttribute id="@Model.Name" />
<input type="checkbox" @checkedAttribute id="@Model.Name" data-abbreviation="@Model.Abbreviation" />
</div>

0 comments on commit c3d8048

Please sign in to comment.