Skip to content

Commit

Permalink
Implement first yet not usable version of modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelMoeri committed Feb 27, 2024
1 parent e9e2714 commit f8bc716
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
20 changes: 10 additions & 10 deletions app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ def show
super
end

private

def fetch_entries
Person.includes(:company).list
end

def person
@person ||= Person.find(params[:person_id])
end

def export
anon = params[:anon].presence || 'false'
odt_file = Odt::Cv.new(entry, params).export
Expand All @@ -48,4 +38,14 @@ def export
type: 'application/vnd.oasis.opendocument.text',
disposition: content_disposition('attachment', filename)
end

private

def fetch_entries
Person.includes(:company).list
end

def person
@person ||= Person.find(params[:person_id])
end
end
4 changes: 2 additions & 2 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

import { application } from "./application"

import Remote_modal_controller from "./remote_modal_controller"
application.register("remote-modal", Remote_modal_controller)
import RemoteModalController from "./remote_modal_controller"
application.register("remote-modal", RemoteModalController)
7 changes: 7 additions & 0 deletions app/views/application/_export_modal.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.modal
.modal-background
.modal-content
.box
%h2 Modal Title
%p This is a simple modal example implemented in Haml.
%button.button.is-primary.close-modal Close Modal
8 changes: 7 additions & 1 deletion app/views/people/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@
%div.border.border-dark-subtle.mt-1.p-2.rounded
- @person.language_skills.each do |language|
%div.mb-1= "#{language.language}: #{language.level} - #{language.certificate}"
= link_to "Show all", people_path
= link_to "Show all", people_path

//%div{"data-controller"=>"remote-modal"}
// %button{"data-action"=>"click->remote-modal#maxVerstappen"} Export CV
%div
%button Export
6 changes: 5 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
get 'readiness', to: 'status#readiness'
end

resources :people
resources :people do
member do
get 'export', to: 'people#export'
end
end
resources :skills

namespace :api do
Expand Down

0 comments on commit f8bc716

Please sign in to comment.