diff --git a/app/controllers/admin/activities_controller.rb b/app/controllers/admin/activities_controller.rb index 59047e1..5da8ae8 100644 --- a/app/controllers/admin/activities_controller.rb +++ b/app/controllers/admin/activities_controller.rb @@ -16,6 +16,23 @@ class Admin::ActivitiesController < OrbitMemberController end end + def new + @activity = Activity.new + end + + def create + if !activity_params['member_profile_id'].blank? + @member = MemberProfile.find(activity_params['member_profile_id']) rescue nil + elsif !params[:author_members].blank? + activity_params['member_profile_id'] = params[:author_members] + else + activity_params['member_profile_id'] = current_user.member_profile_id + end + @activity = Activity.new(activity_params) + @activity.save + redirect_to params['referer_url'] + end + def edit end @@ -39,6 +56,6 @@ class Admin::ActivitiesController < OrbitMemberController end def activity_params - params.require(:activity).permit(:activity_name, :activity_organizer, :activity_area, :year, :activity_start_date, :activity_end_date, :note) + params.require(:activity).permit! rescue nil end end diff --git a/app/views/admin/activities/_activity.html.erb b/app/views/admin/activities/_activity.html.erb index f0dba5f..15f7be8 100644 --- a/app/views/admin/activities/_activity.html.erb +++ b/app/views/admin/activities/_activity.html.erb @@ -1,5 +1,5 @@ <% @activities.each do |activity| %> - + <%= activity.member_profile.name %> <%= activity.year %> <%= activity.activity_name %> diff --git a/app/views/admin/activities/index.html.erb b/app/views/admin/activities/index.html.erb index d70b9f6..4cafc3f 100644 --- a/app/views/admin/activities/index.html.erb +++ b/app/views/admin/activities/index.html.erb @@ -14,6 +14,13 @@
+ + +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_activity_path, :class => 'btn btn-primary' %> +
+ + diff --git a/app/views/admin/activities/new.html.erb b/app/views/admin/activities/new.html.erb new file mode 100644 index 0000000..d957ed6 --- /dev/null +++ b/app/views/admin/activities/new.html.erb @@ -0,0 +1,5 @@ +<%= form_for @activity, url: admin_activities_path, html: { class: "form-horizontal main-forms previewable" } do |f| %> +
+ <%= render partial: 'form', locals: {f: f} %> +
+<% end %> diff --git a/app/views/plugin/personal_activity/_profile.html.erb b/app/views/plugin/personal_activity/_profile.html.erb new file mode 100644 index 0000000..3292ce3 --- /dev/null +++ b/app/views/plugin/personal_activity/_profile.html.erb @@ -0,0 +1,87 @@ +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/list-check" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/list-check" %> +<% end %> + +<% +#@activities = Activity.where(member_profile_id: current_user.member_profile.id).desc(:year).page(params[:page]).per(10) +if has_access? + @activities = Activity.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) +else + @activities = Activity.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) +end +%> + + + + + <% if has_access? %> + + <% end %> + + + <% if not @user%> + + <% end %> + + + + + <% @activities.each do |activity| %> + + "> + <% if has_access? %> + + <% end %> + + + + + + <% end %> + + +
<%= t('personal_activity.year') %><%= t('personal_activity.activity_name') %><%= t('personal_activity.activity_area') %>
+ <%= check_box_tag 'to_change[]', activity.id.to_s, false, :class => "list-check" %> + <%= activity.year %> + <%#= link_to activity.create_link, OrbitHelper.url_to_plugin_show(activity.to_param,'personal_activity'), target: "blank"%> + <% activity.activity_name %> + <% if has_access? %> +
+ +
+ <% end %> + +
<%= activity.activity_area %>
+ + +
+ <% if has_access? %> +
+ <%#= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/books/frontend_setting', :class => 'btn btn-primary' %> + <%#= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), + '/admin/members/'+@member.to_param+'/books/new', :class => 'btn btn-primary' %> +
+ <% end %> + +
+ +