add :index and :show for template
This commit is contained in:
parent
e632168326
commit
862b4bd8df
|
@ -0,0 +1,57 @@
|
||||||
|
class PersonalActivitiesController < ApplicationController
|
||||||
|
def index
|
||||||
|
activities = Activity.where(:is_hidden => false)
|
||||||
|
.order_by(:year=>'desc')
|
||||||
|
.page(OrbitHelper.params[:page_no])
|
||||||
|
.per(OrbitHelper.page_data_count)
|
||||||
|
|
||||||
|
activities_list = activities.collect do |activity|
|
||||||
|
member = activity.member_profile
|
||||||
|
path_to_member = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
|
||||||
|
|
||||||
|
{
|
||||||
|
'attendee' => ("<a href='#{path_to_member}'>" + member.name + "</a>"),
|
||||||
|
'activity_name' => activity.activity_name,
|
||||||
|
'activity_organizer' => activity.activity_organizer,
|
||||||
|
'activity_area' => activity.activity_area,
|
||||||
|
'activity_start_date' => activity.activity_start_date,
|
||||||
|
'activity_end_date' => activity.activity_end_date,
|
||||||
|
'year' => activity.year,
|
||||||
|
'note' => activity.note,
|
||||||
|
'link_to_show' => OrbitHelper.url_to_plugin_show(activity.to_param,'personal_activity')
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# return values for template
|
||||||
|
{
|
||||||
|
'activities' => activities_list,
|
||||||
|
'extras' => {
|
||||||
|
'widget-title' => t('module_name.activity'),
|
||||||
|
'activity_name' => t('personal_activity.activity_name'),
|
||||||
|
'activity_organizer' => t('personal_activity.activity_organizer'),
|
||||||
|
'activity_area' => t('personal_activity.activity_area'),
|
||||||
|
'activity_start_date' => t('personal_activity.activity_start_date'),
|
||||||
|
'activity_end_date' => t('personal_activity.activity_end_date'),
|
||||||
|
'year' => t('personal_activity.year'),
|
||||||
|
'note' => t('personal_activity.note')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
params = OrbitHelper.params
|
||||||
|
plugin = Activity.where(:is_hidden => false).find_by(uid: params[:uid])
|
||||||
|
fields_to_show = [
|
||||||
|
'attendee',
|
||||||
|
'activity_name',
|
||||||
|
'activity_organizer',
|
||||||
|
'activity_area',
|
||||||
|
'activity_start_date',
|
||||||
|
'activity_end_date',
|
||||||
|
'year',
|
||||||
|
'note'
|
||||||
|
]
|
||||||
|
|
||||||
|
{ 'plugin_datas' => plugin.get_plugin_data(fields_to_show) }
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render_view %>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render_view %>
|
|
@ -3,6 +3,7 @@ en:
|
||||||
activity: "Activity"
|
activity: "Activity"
|
||||||
personal_activity: "Activity"
|
personal_activity: "Activity"
|
||||||
personal_activity:
|
personal_activity:
|
||||||
|
attendee: "Attendee"
|
||||||
participant: "Participant"
|
participant: "Participant"
|
||||||
year: "Year"
|
year: "Year"
|
||||||
activity_name: "Activity Name"
|
activity_name: "Activity Name"
|
||||||
|
|
|
@ -15,6 +15,14 @@ Rails.application.routes.draw do
|
||||||
get 'download_excel'
|
get 'download_excel'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :members do
|
||||||
|
collection do
|
||||||
|
scope '(:name-:uid)' do
|
||||||
|
resources :activities, :only => [:new]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue