improve users admin page

This commit is contained in:
Torsten Ruger 2017-06-08 17:06:15 +03:00
parent 373e947fbf
commit 52d3a17d4e
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,11 @@
module Admin
module UsersHelper
def application_link(user)
return "" unless user.application
link_to user.application.primary_choice_course.start_date ,
admin_apply_path(user.application) ,
title: user.application.summary
end
end
end

View File

@ -14,4 +14,15 @@ class Apply < ActiveRecord::Base
def plan_name
PLANS[self.plan.to_sym]
end
def plan_price
plan_name.split(" - ").first
end
def summary
sum = "Comment: #{self.comment}\n"
sum += "Discount: #{self.discount_code}\n" unless self.discount_code.blank?
sum +="Secondary: #{self.secondary_choice_course.name}" if self.secondary_choice_course_id
sum + plan_name
end
end

View File

@ -21,7 +21,7 @@
%tr{:class => "line-#{cycle("1","2")}"}
%td= link_to user.email , admin_user_path(user), :title => "#{user.street}\n#{user.city}\n#{user.country}"
%td= link_to "#{user.resume.percent} %" , admin_resume_path(user.resume)
%td= link_to user.application.primary_choice_course.start_date , admin_apply_path(user.application) if user.application
%td= application_link(user)
=will_paginate @users
.col-md-3
= search_form_for [:admin , @q], :html => { :class => "form-horizontal" }, :method => :get do |f|