improving admin usability
lots of cross links and just more info
This commit is contained in:
parent
4de52153fd
commit
0769e42ebe
|
@ -0,0 +1,14 @@
|
|||
module Admin
|
||||
module AdminHelper
|
||||
|
||||
def admin_course_applicants_path(course)
|
||||
admin_applies_path( { q: { primary_choice_course_id_eq: course.id} })
|
||||
end
|
||||
|
||||
def course_applicants_link(course)
|
||||
return "" unless course
|
||||
link = link_to course.name , admin_course_path(course) + " "
|
||||
link + link_to( "(#{course.applications.length})" , admin_course_applicants_path(course))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
module Admin
|
||||
module ApplicationHelper
|
||||
|
||||
def format_text_field data
|
||||
return "" unless data
|
||||
raw( data.to_s.gsub("\n" , "<br>"))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,16 +1,6 @@
|
|||
module ResumesHelper
|
||||
|
||||
|
||||
|
||||
|
||||
def percent
|
||||
fields = [:school, :uni, :internship, :work, :projects, :tech_skills, :soft_skills,
|
||||
:interests, :motivation, :finance, :other]
|
||||
total = fields.length
|
||||
filled = fields.collect{|f| @resume.send(f).blank? ? 0 : 1 }.sum * 100
|
||||
"#{filled/total}%"
|
||||
end
|
||||
|
||||
# define a bunch of defaults for the best_in_place call
|
||||
def resume_in_place field , attributes = {}
|
||||
txt = I18n.t("resumes.#{field}")
|
||||
|
|
|
@ -22,6 +22,9 @@ class Course < ActiveRecord::Base
|
|||
I18n.l(self.start.to_date , format: :long)
|
||||
end
|
||||
|
||||
def applications
|
||||
Apply.where( primary_choice_course_id: self.id)
|
||||
end
|
||||
def name_id
|
||||
"#{name}(#{id})"
|
||||
end
|
||||
|
|
|
@ -9,7 +9,6 @@ class Resume < ActiveRecord::Base
|
|||
(non_nil * 100) / attribs.length
|
||||
end
|
||||
|
||||
private
|
||||
def percent_attributes
|
||||
Resume.column_names - ["id" , "user_id" , "created_at", "updated_at"]
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.col-md-9.applies
|
||||
.row
|
||||
.col-md-10
|
||||
%h2= @apply_scope.length.to_s + " Applies"
|
||||
%h2= @apply_scope.length.to_s + " Applications"
|
||||
=will_paginate @applies
|
||||
.col-md-3
|
||||
.row
|
||||
|
@ -12,6 +12,7 @@
|
|||
%thead
|
||||
%tr
|
||||
%th=sort_link [:admin,@q], :user_id , title: "Applicant"
|
||||
%th Resume %
|
||||
%th Course
|
||||
%th Secondary
|
||||
%th Plan
|
||||
|
@ -21,8 +22,9 @@
|
|||
- @applies.each do |apply|
|
||||
%tr{:class => "line-#{cycle("1","2")}"}
|
||||
%td= link_to apply.user.name , admin_user_path(apply.user)
|
||||
%td= apply.primary_choice_course.name_id
|
||||
%td= apply.secondary_choice_course.name_id if apply.secondary_choice_course
|
||||
%td= link_to( "#{apply.user.resume.percent} %" , admin_resume_path(apply.user.resume))
|
||||
%td= course_applicants_link apply.primary_choice_course
|
||||
%td= course_applicants_link apply.secondary_choice_course
|
||||
%td= apply.plan
|
||||
%td= apply.comment.to_s
|
||||
%td= apply.discount_code.to_s
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
%thead
|
||||
%tr
|
||||
%th=sort_link [:admin,@q], :name
|
||||
%th Applications
|
||||
%th Extra
|
||||
%th Start
|
||||
%th{:colspan => "2"}
|
||||
|
@ -25,6 +26,7 @@
|
|||
- @courses.each do |course|
|
||||
%tr{:class => "line-#{cycle("1","2")}"}
|
||||
%td.name=course.name
|
||||
%td=link_to course.applications.count.to_s , admin_course_applicants_path(course)
|
||||
%td=course.extra
|
||||
%td=course.start
|
||||
%td= link_to "Show" , admin_course_path(course), :title => "Show"
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
%h2.courses_show_start
|
||||
%h2
|
||||
Course :
|
||||
= @course.name
|
||||
= @course.name
|
||||
|
||||
%h4
|
||||
=link_to "#{@course.applications.count} Applicants" , admin_course_applicants_path(@course)
|
||||
|
||||
|
||||
.col-md-12
|
||||
%p
|
||||
|
@ -15,5 +19,3 @@
|
|||
|
||||
= link_to "Edit", edit_admin_course_path(@course), :class => "btn btn-success"
|
||||
= link_to "Back", admin_courses_path, :class => "btn btn-warning"
|
||||
|
||||
.courses_show_end
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
%h2.resumes_show_start
|
||||
= "Resume : #{@resume.id}"
|
||||
%h2
|
||||
= "Resume : "
|
||||
= link_to @resume.user.name , admin_user_path(@resume.user)
|
||||
= "#{@resume.percent} %"
|
||||
|
||||
- @resume.attributes.each do |name , value|
|
||||
%h4
|
||||
-if app = @resume.user.application
|
||||
= link_to "Applied" , admin_applies_path(app)
|
||||
for
|
||||
= link_to app.primary_choice_course.name , admin_course_path(app.primary_choice_course)
|
||||
on
|
||||
= app.created_at.to_date
|
||||
-else
|
||||
Not applied
|
||||
|
||||
- @resume.percent_attributes.each do |name |
|
||||
%p
|
||||
%b= "#{name} : " + value.to_s
|
||||
%b= "#{name} : "
|
||||
= @resume.send(name).to_s
|
||||
|
||||
= link_to "Back", admin_resumes_path, :class => "btn btn-warning"
|
||||
.resumes_show_end
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
%h2.users_show_start
|
||||
= "User : " + @user.email
|
||||
%h2
|
||||
= @user.name
|
||||
\:
|
||||
= @user.email
|
||||
-if @user.admin?
|
||||
(Admin)
|
||||
%h4
|
||||
= "Resume : "
|
||||
= link_to "#{@user.resume.percent} %" , admin_resume_path(@user.resume)
|
||||
|
||||
%h4
|
||||
-if app = @user.application
|
||||
= link_to "Applied" , admin_applies_path(app)
|
||||
for
|
||||
= link_to app.primary_choice_course.name , admin_course_path(app.primary_choice_course)
|
||||
on
|
||||
= app.created_at.to_date
|
||||
-else
|
||||
Not applied
|
||||
|
||||
%p
|
||||
%b= "Name : " + @user.name.to_s
|
||||
%p
|
||||
|
@ -12,4 +28,3 @@
|
|||
%b= "Country : " + @user.country.to_s
|
||||
|
||||
= link_to "Back", admin_users_path, :class => "btn btn-warning"
|
||||
.users_show_end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- if percent == "100%"
|
||||
- if @resume.percent == 100
|
||||
- if current_user.application
|
||||
.callout.alert.alert-default.margin-top-50.margin-bottom-50
|
||||
.row
|
||||
|
|
|
@ -9,6 +9,7 @@ feature 'Resume edit' do
|
|||
sign_new
|
||||
visit resume_path()
|
||||
expect(page).to have_content("Resume")
|
||||
expect(page).to have_content("Resume")
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue