From f52b0c1cc69c30820d90567f73cae64f6651db21 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jan 2016 10:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E8=AE=B0=E7=B2=BE=E5=93=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=EF=BC=8C=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B=E6=8E=A8?= =?UTF-8?q?=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 5 +++ app/views/courses/_recommendation.html.erb | 41 ++++++++++++++++++++++ app/views/layouts/_project_info.html.erb | 4 +-- app/views/layouts/base_courses.html.erb | 40 +-------------------- config/locales/zh.yml | 4 ++- db/schema.rb | 3 +- 6 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 app/views/courses/_recommendation.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07f7a0ed8..336c6937b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,11 @@ module ApplicationHelper end end + # 判断课程是否为精品课程 + def is_excellent_course course + course.is_excellent? ? true : false + end + # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb new file mode 100644 index 000000000..8e14e1130 --- /dev/null +++ b/app/views/courses/_recommendation.html.erb @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 60fc6f96d..9a9d34e54 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -3,14 +3,14 @@ <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count%>
<%= @course.is_public == 0 ? "私有课程" : "公开课程" %> - <% if @course.id == 370 %> + <% if is_excellent_course(@course) %> 精品课程 <% end %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index b57e9ac54..9d61a6fbb 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -205,45 +205,7 @@
- + <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 34a526734..d5b249e8d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2106,4 +2106,6 @@ zh: label_org_name: 组织名称: label_blank_user_lists_for_org: 用户不能为空 - + # 课程推荐 + label_homework_commont: 作业 + label_homework_recommendation: 课程推荐 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index bac1882c5..601b09561 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160115125217) do +ActiveRecord::Schema.define(:version => 20160118014219) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -499,6 +499,7 @@ ActiveRecord::Schema.define(:version => 20160115125217) do t.integer "is_delete", :default => 0 t.integer "end_time" t.string "end_term" + t.integer "is_excellent", :default => 0 end create_table "custom_fields", :force => true do |t|