Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
⚡ Split js in two files (application.js and game_page.js) (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephannv authored Sep 2, 2022
1 parent b0eddaa commit fe1a4cd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ jobs:
- name: Install Yarn packages
run: yarn install --check-files --pure-lockfile

- name: Compile Assets
run: |
bin/rails css:build
bin/rails javascript:build
- name: Create database structure
run: RAILS_ENV=test bundle exec rails db:reset

Expand Down
6 changes: 0 additions & 6 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@

import { application } from "./application"

import ItemThumbnailsController from "./item_thumbnails_controller.js"
application.register("item-thumbnails", ItemThumbnailsController)

import MoneyInputController from "./money_input_controller.js"
application.register("money-input", MoneyInputController)

import PriceHistoryChartController from "./price_history_chart_controller.js"
application.register("price-history-chart", PriceHistoryChartController)

import SortSelectController from "./sort_select_controller.js"
application.register("sort-select", SortSelectController)
7 changes: 7 additions & 0 deletions app/javascript/game_page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { application } from "controllers/application"

import ItemThumbnailsController from "controllers/item_thumbnails_controller.js"
application.register("item-thumbnails", ItemThumbnailsController)

import PriceHistoryChartController from "controllers/price_history_chart_controller.js"
application.register("price-history-chart", PriceHistoryChartController)
4 changes: 4 additions & 0 deletions app/pages/games/show_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<% content_for :page_title, game.title %>
<% content_for :head do %>
<%= javascript_include_tag "game_page", defer: true, "data-turbo-track": "reload" %>
<% end %>

<div class="w-full flex justify-center pb-4">
<div class="w-full md:w-4/5 lg:w-3/4 xl:w-1/2 flex flex-col gap-4">
<%= render ItemDetails::ThumbnailsSectionComponent.new(item: game) %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<% if Rails.env.production? %>
<script data-domain="nindika.com" src="https://analytics.nindika.com/js/plausible.js" async defer></script>
<% end %>
<%= yield :head %>
</head>

<body>
Expand Down

0 comments on commit fe1a4cd

Please sign in to comment.