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

More PagerTagHelper attributes #9

Closed
wesleyegbertsen opened this issue May 22, 2016 · 8 comments
Closed

More PagerTagHelper attributes #9

wesleyegbertsen opened this issue May 22, 2016 · 8 comments

Comments

@wesleyegbertsen
Copy link

wesleyegbertsen commented May 22, 2016

It would be nice to have these extra features:

  • add a class to page numbers that are not active or not non-active (so basically normal page numbers).
  • In cs-previous-page-text & cs-next-page-text the ability to use HTML, would be really handy for this: http://materializecss.com/pagination.html etc.
  • The ability to add a class to the previous page active/non-active & next page active/non-active
@joeaudette
Copy link
Collaborator

these seem like reasonable ideas. I had not looked at materializecss before but it looks like a nice alternative to bootstrap and I do think this project should be able to support that.
I will look into this when I get a chance, let me know if you are interested in doing it yourself and making a pull request.

seems like their 3 states active, not active, and disabled map to ours like this:

IsCurrent = their active
Active = false = their disabled
Active = true = their not active (what you called not non active)

@joeaudette
Copy link
Collaborator

I've just added support in the source code for LiOtherCssClass which would map to their not active, not disabled

Adding support for markup for next/prev I think we will have to check if the PaginationLink text matches the NextPageText/PrevPageText and then check for other new properties to see if override markup was provided, in which case we would just use that inside the li lement instead of adding an a element

@wesleyegbertsen
Copy link
Author

wesleyegbertsen commented May 23, 2016

Commenting on this point: "In cs-previous-page-text & cs-next-page-text the ability to use HTML"

This is some code out of, PagerTagHelper.cs. For example, when you use HTML in the cs-previous-page-text attribute. It would use the Append() method. If it would use the AppendHtml() method then it would display the HTML correct. I am not sure what the best way to go is. Append() encodes the text so HTML attributes are encoded, but if you would do AppendHtml() instead of Append() then HTML would not be encoded anymore so real HTML is shown.

This seems to me like a design decision for you, or some extra attribute could be added so that text would append as HTML instead of the Append() that encodes HTML.

if (link.Text == "«")
{
    a.InnerHtml.AppendHtml("«");

}
else if (link.Text == "»")
{
    a.InnerHtml.AppendHtml("»");
}
else
{
    a.InnerHtml.Append(link.Text);
}

@joeaudette
Copy link
Collaborator

joeaudette commented May 23, 2016

I've just published a nuget that should support this though I have not tried it with the needed css it appears to render the desired markup. Might take a few minutes before that nuget is indexed and available but it should work like this:

<cs-pager cs-paging-pagesize="@Model.PageSize"
  cs-paging-pagenumber="@Model.PageNumber"
  cs-paging-totalitems="@Model.TotalItemCount"
  cs-pagenumber-param="page"
  cs-show-first-last="true"
  cs-suppress-empty-nextprev="true"
  cs-suppress-inactive-firstlast="true"
  cs-first-page-text="First"
  cs-last-page-text="Last"
  cs-pager-li-current-class="active"
  cs-pager-li-non-active-class="disabled"
  cs-pager-li-other-class="waves-effect"
  cs-previous-page-html="<a href='#!'><i class='material-icons'>chevron_left</i></a>"
  cs-next-page-html="<a href='#!'><i class='material-icons'>chevron_right</i></a>"
  asp-controller="Paging"
  asp-action="Index"></cs-pager>

@wesleyegbertsen
Copy link
Author

Is it normal that I get reference errors at DNX 4.5.1 and DNX Core 5.0 with the new 1.0.1-beta5?
error

I also get this with 1.0.1-beta4, but not with versions lower than 1.0.1-beta4.

@joeaudette
Copy link
Collaborator

you are still using rc1/dnx, you need to install rc2 from http://dot.net
my projects have all been updated to rc2, you will need to do the same for your projects
dnx no longer exists in rc2

@wesleyegbertsen
Copy link
Author

Okay, I see. Unfortunately I can't upgrade to rc2, because I am using this project on a school project where we are using rc1.

@joeaudette
Copy link
Collaborator

seems like if the project is educational then upgrading and dealing with the breaking changes would be a good learning exercise. rc1 was really more like beta9 and there are lots of breaking changes but also a lot of fixed bugs in rc2

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

No branches or pull requests

2 participants