From 91ee579a2655e8e4bed4fb4637d4f0694583fd68 Mon Sep 17 00:00:00 2001 From: stormand <422171566@qq.com> Date: Wed, 23 Nov 2016 20:34:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E9=80=BB=E8=BE=91=EF=BC=8C=E5=AE=8C=E6=88=90=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=AF=A6=E6=83=85=E9=A1=B5=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/vim.iml | 150 ++++----- .idea/workspace.xml | 502 +++++++++++++++------------- app/controllers/homes_controller.rb | 5 +- app/views/courses/detail.erb | 59 +++- app/views/homes/index.html.erb | 25 +- 5 files changed, 411 insertions(+), 330 deletions(-) diff --git a/.idea/vim.iml b/.idea/vim.iml index 2c8b7b9..c40b2a2 100644 --- a/.idea/vim.iml +++ b/.idea/vim.iml @@ -119,83 +119,81 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0982118..ae51f22 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,11 @@ - - - - + + + @@ -36,81 +35,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - + + - - + + - - + + + + + + + + + + + + @@ -119,23 +75,57 @@ - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -145,14 +135,13 @@ @@ -250,6 +240,11 @@ + + + + + @@ -278,7 +273,25 @@ + + + + + + + + + @@ -344,24 +357,6 @@ - - - @@ -646,6 +678,11 @@ + + + + + 1478067100340 @@ -665,7 +702,7 @@ - @@ -680,7 +717,7 @@ - + @@ -723,42 +760,17 @@ 121 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -817,14 +829,6 @@ - - - - - - - - @@ -896,13 +900,6 @@ - - - - - - - @@ -910,6 +907,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -918,26 +1032,26 @@ - - - - - - - - - - + + - + - - + + + + + + + + + + @@ -945,71 +1059,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb index 2aae1f3..7dec516 100644 --- a/app/controllers/homes_controller.rb +++ b/app/controllers/homes_controller.rb @@ -2,8 +2,9 @@ class HomesController < ApplicationController def index @course=Course.all - @course_play=Course.order(:student_num).limit(3) - + @course_play_first=Course.order("student_num DESC").limit(1) + @course_play=Course.order("student_num DESC").limit(3)-@course_play_first + @course_play_first=@course_play_first.take end end diff --git a/app/views/courses/detail.erb b/app/views/courses/detail.erb index 50bbf38..44c04ab 100644 --- a/app/views/courses/detail.erb +++ b/app/views/courses/detail.erb @@ -7,17 +7,58 @@ <%= render "shared/sidenav" %> <% end %> - -
+ <% if logged_in? %> +
+ <% else %> +
+ <% end %>
-
-

课程: <%= @course.name %>

-
- <%= @course.course_introduction %> - <%= image_tag(@course.avatar_url(:thumb)) if !@course.avatar.blank? %> - <%= image_tag "fallback/default.jpg" if @course.avatar.blank? %> - <%= @course.avatar %> +

<%= @course.name %>

+ <%= image_tag(@course.avatar_url, class: "img-responsive" ) if !@course.avatar.blank? %> + <%= image_tag "fallback/default_original.jpg" , class: "img-responsive" if @course.avatar.blank? %> + +

课程介绍:

+

<%=@course.course_introduction if !@course.course_introduction.blank? %><%="暂无课程介绍" if @course.course_introduction.blank? %>

+ +
+
+

课程属性

+

<%=@course.course_type %>

+
+
+

授课方式

+

<%=@course.teaching_type %>

+
+
+

考试方式

+

<%=@course.exam_type %>

+
+
+

主讲教师

+

<%=@course.teacher.name %>

+
+
+ +
+
+

限选/已选

+

<%=@course.limit_num if !@course.limit_num.blank? %> <%="无限选" if @course.limit_num.blank? %>/<%=@course.student_num %>

+
+
+

课时/学分

+

<%=@course.credit %>

+
+
+

时间/周数

+

<%=@course.course_time %>/<%=@course.course_week %>

+
+
+

上课教室

+

<%=@course.class_room %>

+
+
+
diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb index b3e418c..51ba97f 100644 --- a/app/views/homes/index.html.erb +++ b/app/views/homes/index.html.erb @@ -6,18 +6,18 @@