diff --git a/app/controllers/personal_activities_controller.rb b/app/controllers/personal_activities_controller.rb new file mode 100644 index 0000000..252047a --- /dev/null +++ b/app/controllers/personal_activities_controller.rb @@ -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' => ("" + member.name + ""), + '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 diff --git a/app/views/personal_activities/index.html.erb b/app/views/personal_activities/index.html.erb new file mode 100644 index 0000000..9f04326 --- /dev/null +++ b/app/views/personal_activities/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> diff --git a/app/views/personal_activities/show.html.erb b/app/views/personal_activities/show.html.erb new file mode 100644 index 0000000..9f04326 --- /dev/null +++ b/app/views/personal_activities/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 590e732..95b837c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,7 @@ en: activity: "Activity" personal_activity: "Activity" personal_activity: + attendee: "Attendee" participant: "Participant" year: "Year" activity_name: "Activity Name" diff --git a/config/routes.rb b/config/routes.rb index 2963af3..d3ba3ba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,6 +15,14 @@ Rails.application.routes.draw do get 'download_excel' end end + + resources :members do + collection do + scope '(:name-:uid)' do + resources :activities, :only => [:new] + end + end + end end end end