Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Fluid instead of DotLiquid #823

Merged
merged 4 commits into from Jun 15, 2017
Merged

Using Fluid instead of DotLiquid #823

merged 4 commits into from Jun 15, 2017

Conversation

sebastienros
Copy link
Member

An example to test the feature:

{% assign year = 0 %}

{% assign archives = 'Archives' | query %}
<ul class="achives-year">
{% for archive in archives %}
  {% if year != archive.Year %}
  	<li>
      <h3>{{ archive.Year }}</h3>
      <ul class="archive-months">
  {% endif %}
	
	    <li>
        {% case archive.Month %}
          {% when 1 %}January
          {% when 2 %}February
          {% when 3 %}March
          {% when 4 %}April
          {% when 5 %}May
          {% when 6 %}June
          {% when 7 %}July
          {% when 8 %}August
          {% when 9 %}September
          {% when 10 %}October
          {% when 11 %}November
          {% when 12 %}December
      	{% endcase %}
        ({{ archive.Count }})
  
  {% if year != archive.Year %}
      </ul>
  	</li>
    {% assign year = archive.Year %}
  {% endif %}

{% endfor %}
	</li>
</ul>

With this sql query

select 
    month(CreatedUtc) as [Month], 
    year(CreatedUtc) as [Year],
    day(CreatedUtc) as [Day],
    count(*) as [Count]
from ContentItemIndex 
where Published = true
group by day(CreatedUtc), month(CreatedUtc), year(CreatedUtc)

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26505.0
VisualStudioVersion = 15.0.26606.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they really need to remove this from VS..

public WhereDrop Where => new WhereDrop(this);
public SkipDrop Skip => new SkipDrop(this);
public TakeDrop Take => new TakeDrop(this);
//using System;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

{
throw new ArgumentException("Content Item was expected");
}
var contentItem = input.ToObjectValue() as ContentItem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not have a ToObjectValue() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input is a FluidValue it wraps any CLR object. So yes we want to get the wrapped content item then cast it.

{
_contentDefinitionManager = contentDefinitionManager;
_liquidManager = liquidManager;
}

public override void GetContentItemAspect(ContentItemAspectContext context, LiquidPart part)
{
context.For<BodyAspect>(bodyAspect =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use async await on the lambda of the For?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because GetContentItemAspect is not async.
That doesn't matter right now as I create this #822 which will solve it.

context.MemberAccessStrategy.Register(model.GetType());

var html = await template.RenderAsync(context);
@Html.Raw(html ?? "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" or HtmlString.Empty ?

Copy link
Member

@Jetski5822 Jetski5822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - a few comments, but no show stoppers.

@sebastienros sebastienros merged commit 92f8a3d into master Jun 15, 2017
@Jetski5822 Jetski5822 deleted the fluid branch June 15, 2017 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants