Skip to content

Commit

Permalink
Try to get pagy inialized again
Browse files Browse the repository at this point in the history
  • Loading branch information
jahseng-lee committed Dec 12, 2023
1 parent 18344d1 commit 1379ef0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ application.register("modal", ModalController)
import NavbarLinkController from "./navbar_link_controller"
application.register("navbar-link", NavbarLinkController)

import PagyController from "./pagy_controller"
application.register("pagy", PagyController)

import SearchCountriesController from "./search_countries_controller"
application.register("search-countries", SearchCountriesController)

Expand Down
8 changes: 8 additions & 0 deletions app/javascript/controllers/pagy_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Controller } from "@hotwired/stimulus"
import Pagy from "pagy-module";

export default class extends Controller {
connect() {
Pagy.init(this.element)
}
}
4 changes: 2 additions & 2 deletions app/views/search_locations/_location_search_section.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<% end %>
</div>

<div class="pagination-nav-container">
<%== pagy_bootstrap_nav(@pagy) %>
<div data-controller="pagy" class="pagination-nav-container">
<%== pagy_bootstrap_nav_js(@pagy) %>
</div>
</div>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"sass": "^1.68.0"
},
"scripts": {
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --loader:.js=jsx",
"build": "NODE_PATH=\"$(bundle show 'pagy')/lib/javascripts\" esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --loader:.js=jsx",
"build:css:compile": "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules",
"build:css:prefix": "postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css",
"build:css": "yarn build:css:compile && yarn build:css:prefix",
Expand Down

0 comments on commit 1379ef0

Please sign in to comment.