|
|
@ -9,6 +9,14 @@ Trestle.resource(:users) do |
|
|
text_area :objective |
|
|
text_area :objective |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
tab :export, label: "Export Resume" do |
|
|
|
|
|
safe_join([ |
|
|
|
|
|
link_to("Export as PDF", generate_users_admin_path(item), class: "btn btn-primary has-icon", target: "_blank"), |
|
|
|
|
|
link_to("Export as TeX", generate_cls_users_admin_path(item), class: "btn btn-secondary has-icon", target: "_blank"), |
|
|
|
|
|
link_to("Export as JSON", generate_json_users_admin_path(item), class: "btn btn-secondary has-icon", target: "_blank") |
|
|
|
|
|
], " ") |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
tab :work_experiences, badge: (item.persisted? ? item.work_experiences.size : 0) do |
|
|
tab :work_experiences, badge: (item.persisted? ? item.work_experiences.size : 0) do |
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
concat content_tag(:p, "User: #{item.to_s}") |
|
|
if item.persisted? |
|
|
if item.persisted? |
|
|
@ -106,9 +114,6 @@ Trestle.resource(:users) do |
|
|
actions do |toolbar, instance, admin| |
|
|
actions do |toolbar, instance, admin| |
|
|
toolbar.edit if admin && admin.actions.include?(:edit) |
|
|
toolbar.edit if admin && admin.actions.include?(:edit) |
|
|
toolbar.delete if admin && admin.actions.include?(:destroy) |
|
|
toolbar.delete if admin && admin.actions.include?(:destroy) |
|
|
toolbar.link 'CV', instance, action: :generate, method: :get, style: :primary, icon: "fa fa-file-pdf", target: "_blank" |
|
|
|
|
|
toolbar.link 'CLS', instance, action: :generate_cls, method: :get, style: :secondary, icon: "fa", target: "_blank" |
|
|
|
|
|
toolbar.link 'JSON', instance, action: :generate_json, method: :get, style: :secondary, icon: "fa", target: "_blank" |
|
|
|
|
|
toolbar.link 'Clone', instance, action: :clone, method: :post, style: :secondary, icon: "fa fa-copy" |
|
|
toolbar.link 'Clone', instance, action: :clone, method: :post, style: :secondary, icon: "fa fa-copy" |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
@ -135,11 +140,8 @@ Trestle.resource(:users) do |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def generate_json |
|
|
def generate_json |
|
|
generate_json_resume |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def generate_json_resume |
|
|
|
|
|
@user = admin.find_instance(params) |
|
|
@user = admin.find_instance(params) |
|
|
|
|
|
response.headers["Content-Disposition"] = "attachment; filename=resume.json" |
|
|
render template: "users/show", formats: [:json], layout: false |
|
|
render template: "users/show", formats: [:json], layout: false |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|