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

highlight current page #25

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/helpers/handlebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,13 @@ export const repoName = (v1: string): string => {

export const ifContains = (a: string, b: string): boolean => {
return a.slice(-1).includes(b);
}


export const portContains = (a: string, b:string): boolean => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export const portContains = (a: string, b:string): boolean => {
export const portContains = (a: string, b: string): boolean => {

return a.includes(b);
}

export const not = (a: string): boolean=> {
return (!(a));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return (!(a));
return !a;

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @elhmn. i will make the changes right away!!!

}
15 changes: 13 additions & 2 deletions src/views/partials/pagination.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<li class="disabled page-item"><a class="page-link">...</a></li>
{{/if}}
{{#each (displayPagesNumber interval current pages)}}
{{#if (ifEqual . current 0)}}
{{#if (ifEqual . current 1 0)}}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{{#if (ifEqual . current 1 0)}}
{{#if (ifEqual . current 1)}}

<li class="active page-item"><a class="page-link">{{ . }}</a></li>
{{else}}
{{#if @root.hasParams}}
Expand All @@ -31,7 +31,18 @@
<li class="page-item"><a href="{{@root.fullUrl}}&page={{.}}" class="page-link">{{ . }}</a></li>
{{/if}}
{{else}}
<li class="page-item"><a href="{{@root.fullUrl}}?page={{.}}" class="page-link">{{ . }}</a></li>
{{#if (portContains @root.fullUrl "3000") }}
Copy link
Member

Choose a reason for hiding this comment

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

This won't work in production, as the fullUrl will be something different and probably won't use a port

{{#if (not (contains @root.fullUrl "page"))}}
{{#if (contains @root.fullUrl 0 ) }}
{{#if (ifEqual . 1 0)}}
<li class="page-item active"><a href="{{@root.fullUrl}}?page={{.}}" class="page-link">{{ . }}</a></li>
{{else}}<li class="page-item"><a href="{{@root.fullUrl}}?page={{.}}" class="page-link">{{ . }}</a></li>
{{/if}}
{{/if}}
{{/if}}
{{else}}
<li class="page-item"><a href="{{@root.fullUrl}}?page={{.}}" class="page-link">s{{ . }}</a></li>
{{/if}}
{{/if}}
{{/if}}
{{#if (ifEqual . current 4)}}
Expand Down