forked from fixin.me/fixin.me
Replace the toggle-view approach and hidden DOM data carrier with a proper dedicated Charts page: - Move Charts out of Measurements view toggles into its own nav tab and route (GET /charts) - ChartsController serializes readout data as JSON (ordered by taken_at); the view embeds it in a <script type="application/json"> element instead of rendering a hidden copy of the measurements partial just to ferry data attributes to JS - buildCharts() reads from the JSON element directly — no DOM parsing, no sorting in JS (server already orders the data) - Turbo load handler detects the charts page via #charts-data presence - Add controller tests (authentication, data shape, ordering, data isolation between users) and system tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.4 KiB
Ruby
46 lines
1.4 KiB
Ruby
Rails.application.routes.draw do
|
|
resources :measurements
|
|
resources :charts, only: [:index]
|
|
|
|
resources :readouts, only: [:new] do
|
|
collection {get 'new/:id/discard', action: :discard, as: :discard}
|
|
end
|
|
|
|
resources :quantities, except: [:show], path_names: {new: '(/:id)/new'} do
|
|
member { post :reparent }
|
|
end
|
|
|
|
resources :units, except: [:show], path_names: {new: '(/:id)/new'} do
|
|
member { post :rebase }
|
|
end
|
|
|
|
namespace :default do
|
|
resources :units, only: [:index, :destroy] do
|
|
member { post :import, :export }
|
|
#collection { post :import_all }
|
|
end
|
|
end
|
|
|
|
# Devise does not handle properly models that require database access during loading.
|
|
# https://github.com/heartcombo/devise/issues/5786
|
|
connection = ActiveRecord::Base.connection
|
|
if connection.schema_version && connection.table_exists?(:users)
|
|
# NOTE: change helper prefix from *_registration to *_profile once possible
|
|
devise_for :users, path: '', path_names: {registration: 'profile'},
|
|
controllers: {registrations: 'user/profiles'}
|
|
end
|
|
|
|
resources :users, only: [:index, :show, :update] do
|
|
member { get :disguise }
|
|
collection { get :revert }
|
|
end
|
|
|
|
unauthenticated do
|
|
root to: redirect('/sign_in')
|
|
end
|
|
root to: redirect('/units'), as: :user_root
|
|
|
|
direct(:source_code) { 'https://gitea.michalczyk.pro/fixin.me/fixin.me' }
|
|
direct(:issue_tracker) { 'https://gitea.michalczyk.pro/fixin.me/fixin.me/issues' }
|
|
end
|