|
|
@ -1,14 +1,103 @@ |
|
|
Trestle.resource(:users) do |
|
|
Trestle.resource(:users) do |
|
|
menu do |
|
|
menu do |
|
|
item :users, icon: "fa fa-user", priority: 1 |
|
|
item :resumes, icon: "fa fa-file-alt", priority: 1 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
form do |item| |
|
|
form do |item| |
|
|
|
|
|
tab :details, label: "Details" do |
|
|
concat Trestle::Form::Automatic.new(admin).render(self, item) |
|
|
concat Trestle::Form::Automatic.new(admin).render(self, item) |
|
|
|
|
|
|
|
|
text_area :objective |
|
|
text_area :objective |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
tab :work_experiences, badge: (item.persisted? ? item.work_experiences.size : 0) do |
|
|
|
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
|
|
|
if item.persisted? |
|
|
|
|
|
concat link_to("Add Work Experience", WorkExperiencesAdmin.path(:new, user_id: item.id)) |
|
|
|
|
|
|
|
|
|
|
|
table item.work_experiences do |
|
|
|
|
|
column :employer |
|
|
|
|
|
column :title |
|
|
|
|
|
column :period |
|
|
|
|
|
column :reference_date, align: :center |
|
|
|
|
|
column :actions, align: :right do |experience| |
|
|
|
|
|
# TODO: The redirect after succesful delete goes back to the index page.. it should go back to the user page |
|
|
|
|
|
safe_join([ |
|
|
|
|
|
link_to("Edit", WorkExperiencesAdmin.path(:edit, id: experience.id), class: "btn btn-secondary has-icon"), |
|
|
|
|
|
link_to("Delete", work_experiences_admin_path(experience), class: "btn btn-danger has-icon", method: :delete, data: { confirm: "Are you sure?" }) |
|
|
|
|
|
], " | ") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
else |
|
|
|
|
|
concat content_tag(:p, "Save the user before adding work experiences.") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
tab :education_entries, badge: (item.persisted? ? item.education_entries.size : 0) do |
|
|
|
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
|
|
|
if item.persisted? |
|
|
|
|
|
concat link_to("Add Education Entry", EducationEntriesAdmin.path(:new, user_id: item.id)) |
|
|
|
|
|
|
|
|
|
|
|
table item.education_entries do |
|
|
|
|
|
column :institution |
|
|
|
|
|
column :title |
|
|
|
|
|
column :period |
|
|
|
|
|
column :location |
|
|
|
|
|
column :actions, align: :right do |entry| |
|
|
|
|
|
safe_join([ |
|
|
|
|
|
link_to("Edit", EducationEntriesAdmin.path(:edit, id: entry.id), class: "btn btn-secondary has-icon"), |
|
|
|
|
|
link_to("Delete", EducationEntriesAdmin.path(:destroy, id: entry.id), class: "btn btn-danger has-icon", method: :delete, data: { confirm: "Are you sure?" }) |
|
|
|
|
|
], " | ") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
else |
|
|
|
|
|
concat content_tag(:p, "Save the user before adding education entries.") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
tab :skills, badge: (item.persisted? ? item.skills.size : 0) do |
|
|
|
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
|
|
|
if item.persisted? |
|
|
|
|
|
concat link_to("Add Skill", SkillsAdmin.path(:new, user_id: item.id)) |
|
|
|
|
|
|
|
|
|
|
|
table item.skills do |
|
|
|
|
|
column :title |
|
|
|
|
|
column :detail |
|
|
|
|
|
column :order, align: :center |
|
|
|
|
|
column :actions, align: :right do |skill| |
|
|
|
|
|
safe_join([ |
|
|
|
|
|
link_to("Edit", SkillsAdmin.path(:edit, id: skill.id), class: "btn btn-secondary has-icon"), |
|
|
|
|
|
link_to("Delete", SkillsAdmin.path(:destroy, id: skill.id), class: "btn btn-danger has-icon", method: :delete, data: { confirm: "Are you sure?" }) |
|
|
|
|
|
], " | ") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
else |
|
|
|
|
|
concat content_tag(:p, "Save the user before adding skills.") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
tab :cover_letters, badge: (item.persisted? ? item.cover_letters.size : 0) do |
|
|
|
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
|
|
|
if item.persisted? |
|
|
|
|
|
concat link_to("Add Cover Letter", CoverLettersAdmin.path(:new, user_id: item.id)) |
|
|
|
|
|
|
|
|
|
|
|
table item.cover_letters do |
|
|
|
|
|
column :title |
|
|
|
|
|
column :company_name |
|
|
|
|
|
column :job_application |
|
|
|
|
|
column :order, align: :center |
|
|
|
|
|
column :actions, align: :right do |cover_letter| |
|
|
|
|
|
safe_join([ |
|
|
|
|
|
link_to("Edit", CoverLettersAdmin.path(:edit, id: cover_letter.id), class: "btn btn-secondary has-icon"), |
|
|
|
|
|
link_to("Delete", CoverLettersAdmin.path(:destroy, id: cover_letter.id), class: "btn btn-danger has-icon", method: :delete, data: { confirm: "Are you sure?" }) |
|
|
|
|
|
], " | ") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
else |
|
|
|
|
|
concat content_tag(:p, "Save the user before adding cover letters.") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
# Customize the table columns shown on the index view. |
|
|
# Customize the table columns shown on the index view. |
|
|
table do |
|
|
table do |
|
|
column :name |
|
|
column :name |
|
|
|