From 68558c166b55daaa7bbaf8360bf3cde33f38cd0e Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 21 Sep 2017 21:49:01 +0800 Subject: [PATCH] added courses and changed name and check for login --- .../international_recruits_controller.rb | 11 ++++++++++ .../international_recruits_controller.rb | 6 +++-- .../international_recruits/courses.html.erb | 22 +++++++++++++++++++ .../international_recruits/index.html.erb | 7 +++++- .../international_recruits/index.html.erb | 13 +++++++---- config/locales/en.yml | 3 ++- config/locales/zh_tw.yml | 3 ++- 7 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 app/views/admin/international_recruits/courses.html.erb diff --git a/app/controllers/admin/international_recruits_controller.rb b/app/controllers/admin/international_recruits_controller.rb index fd0dcee..52e5679 100644 --- a/app/controllers/admin/international_recruits_controller.rb +++ b/app/controllers/admin/international_recruits_controller.rb @@ -5,4 +5,15 @@ class Admin::InternationalRecruitsController < OrbitAdminController @applications = RecruitApplication.all.desc(:created_at).page(params[:page]).per(10) end + def destroy + ra = RecruitApplication.find(params[:id]) + ra.destroy + redirect_to admin_international_recruits_path + end + + def courses + @table_fields = ["international_recruit.course_name", "international_recruit.actions"] + @courses = UniversityCourse.all.asc(:created_at) + end + end \ No newline at end of file diff --git a/app/controllers/international_recruits_controller.rb b/app/controllers/international_recruits_controller.rb index 4c627a4..fd29c95 100644 --- a/app/controllers/international_recruits_controller.rb +++ b/app/controllers/international_recruits_controller.rb @@ -6,14 +6,16 @@ class InternationalRecruitsController < ApplicationController countries << [InternationalCountry::LIST[countrykey], countrykey] end years = (0..10).collect do |x| - t = x == 10 ? x.to_s + " more years" : x.to_s + t = x == 10 ? x.to_s + " plus years" : x.to_s [t, x] end + login_url = "/#{I18n.locale.to_s}" + (Page.where(:module => "pseudo_member").first.url rescue "") { "application" => RecruitApplication.new, "countries" => countries, "years" => years, - "member" => session["current_pseudo_user_id"] + "member" => session["current_pseudo_user_id"], + "login_url" => login_url } end diff --git a/app/views/admin/international_recruits/courses.html.erb b/app/views/admin/international_recruits/courses.html.erb new file mode 100644 index 0000000..81bf936 --- /dev/null +++ b/app/views/admin/international_recruits/courses.html.erb @@ -0,0 +1,22 @@ + + + + <% @table_fields.each do |f| %> + <%= thead(f) %> + <% end %> + + + + <% @courses.each do |course| %> + + + + + <% end %> + +
<%= course.course_name %>
+
+
+ Add +
+
\ No newline at end of file diff --git a/app/views/admin/international_recruits/index.html.erb b/app/views/admin/international_recruits/index.html.erb index ac02728..f49f070 100644 --- a/app/views/admin/international_recruits/index.html.erb +++ b/app/views/admin/international_recruits/index.html.erb @@ -17,4 +17,9 @@ <% end %> - \ No newline at end of file + +<%= + content_tag :div, class: "bottomnav clearfix" do + content_tag :div, paginate(@applications), class: "pagination pagination-centered" + end +%> \ No newline at end of file diff --git a/app/views/international_recruits/index.html.erb b/app/views/international_recruits/index.html.erb index 95628c3..4c45411 100644 --- a/app/views/international_recruits/index.html.erb +++ b/app/views/international_recruits/index.html.erb @@ -4,6 +4,11 @@ data = action_data application = data["application"] %> +<% if data["member"].nil? %> + +<% end %>