add link to member's front page for both index and show views
This commit is contained in:
parent
7771a2e6a6
commit
09f3131eae
|
@ -2,12 +2,14 @@ class PersonalCoursesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
courses = Course.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
courses = Course.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
courses_list = courses.collect do |course|
|
courses_list = courses.collect do |course|
|
||||||
|
member = course.member_profile
|
||||||
|
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
|
||||||
{
|
{
|
||||||
"year" => course.year,
|
"year" => course.year,
|
||||||
"title" => course.title,
|
"title" => course.title,
|
||||||
"category" => (course.course_category.title rescue ""),
|
"category" => (course.course_category.title rescue ""),
|
||||||
"semester" => (course.course_semester.title rescue ""),
|
"semester" => (course.course_semester.title rescue ""),
|
||||||
"authors" => (course.member_profile.name rescue ""),
|
"authors" => ("<a href='#{path}'>" + member.name + "</a>"),
|
||||||
"link_to_show" => OrbitHelper.url_to_show(course.to_param)
|
"link_to_show" => OrbitHelper.url_to_show(course.to_param)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -45,4 +47,4 @@ class PersonalCoursesController < ApplicationController
|
||||||
|
|
||||||
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,6 +108,9 @@ class Course
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
value = files.join("")
|
value = files.join("")
|
||||||
|
when "authors"
|
||||||
|
path = OrbitHelper.url_to_plugin_show(self.member_profile.to_param, 'member') rescue '#'
|
||||||
|
value = "<a href='#{path}'>#{self.member_profile.name}</a>"
|
||||||
else
|
else
|
||||||
value = self.send(field) rescue ""
|
value = self.send(field) rescue ""
|
||||||
end
|
end
|
||||||
|
@ -123,4 +126,4 @@ class Course
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue