Skip to content

Commit

Permalink
Added ability to run start/end methods in a global controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jamietre committed Jul 18, 2012
1 parent 6fcc8b2 commit 0f66e95
Show file tree
Hide file tree
Showing 28 changed files with 13,101 additions and 4,719 deletions.
118 changes: 82 additions & 36 deletions distribution/CsQuery.XML

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified distribution/CsQuery.dll
Binary file not shown.
Binary file modified distribution/CsQuery.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Web;
using System.Web.Mvc;
using CsQuery.Mvc;

namespace CsQuery.MvcApp.Controllers
{
public class HomeController : CsQueryController
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CsQuery.Mvc;

namespace CsQuery.MvcApp.Controllers
{
public class LayoutController : CsQueryController
{


public void Cq_Start()
{
Doc["body"].Append("<hr /><div>A footer. This has a red border around it because it was created before the code that adds the red border.</div>");
}

public void Cq_End()
{
Doc["body"].Append("<hr /><div>A late-bound footer. This is the last method to execute, so there's no border.</div>");
}

}
}
13 changes: 6 additions & 7 deletions examples/CsQuery.MvcApp/CsQuery.MvcApp/CsQuery.MvcApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CsQuery, Version=1.1.2.22634, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="CsQuery, Version=1.1.3.30725, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CsQuery.1.1.2.1\lib\net40\CsQuery.dll</HintPath>
<HintPath>..\packages\CsQuery.1.1.3.2\lib\net40\CsQuery.dll</HintPath>
</Reference>
<Reference Include="CsQuery.Mvc, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CsQuery.Mvc.1.0.5\lib\net40\CsQuery.Mvc.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.Entity" />
Expand Down Expand Up @@ -66,16 +69,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\Shared\LayoutController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="CsQueryView\CsQueryController.cs" />
<Compile Include="CsQueryView\ICsQueryController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\AccountModels.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CsQueryView\CsQueryView.cs" />
<Compile Include="CsQueryView\CsQueryViewEngine.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\themes\base\images\ui-bg_flat_0_aaaaaa_40x100.png" />
Expand Down Expand Up @@ -148,7 +148,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Controllers\Shared\" />
<Folder Include="Controllers\Sub\" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/CsQuery.MvcApp/CsQuery.MvcApp/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void Application_Start()
// [CsQuery] The following code must be added to enable to CsQuery engine

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new CsQueryViewEngine());
ViewEngines.Engines.Add(new CsQueryViewEngine<Controllers.LayoutController>());
}
}
}
3 changes: 2 additions & 1 deletion examples/CsQuery.MvcApp/CsQuery.MvcApp/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CsQuery" version="1.1.2.1" />
<package id="CsQuery" version="1.1.3.2" targetFramework="net40" />
<package id="CsQuery.Mvc" version="1.0.5" targetFramework="net40" />
<package id="EntityFramework" version="4.1.10331.0" />
<package id="jQuery" version="1.5.1" />
<package id="jQuery.UI.Combined" version="1.8.11" />
Expand Down
Loading

0 comments on commit 0f66e95

Please sign in to comment.