From 1fdd562bd312a1c0e8eba8adc2793abab2f9100c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 31 Mar 2016 19:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=8A=9F=E8=83=BDjibug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org_newstyle.html.erb | 55 ++++--------- .../_org_new_course_pic.html.erb | 78 +++++++++++++++++++ 2 files changed, 95 insertions(+), 38 deletions(-) create mode 100644 app/views/organizations/_org_new_course_pic.html.erb diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb index 36e404a42..489f014b3 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -111,44 +111,23 @@ <% when 'course' %>
<% if field.status == 0 %> -
-

课程动态

- <% if @course_acts.nil? %> - - <% else %> -
-
    - <% unless @course_acts_homework.nil? %> -
  • - <% @course_acts_homework.each do |act| %> - <%= render :partial => 'org_new_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :course_activity => 0} %> - <% end %> -
  • - <% end %> - <% unless @course_acts_message.nil? %> -
  • - <% @course_acts_message.each do |act| %> - <%= render :partial => 'org_new_course_message', :locals => {:activity => Message.find(act.org_act_id), :user_activity_id =>act.id} %> - <% end %> -
  • - <% end %> - <% unless @course_acts_news.nil? %> -
  • - <% @course_acts_news.each do |act| %> - <%= render :partial => 'org_new_course_news', :locals => {:activity => News.find(act.org_act_id), :user_activity_id =>act.id} %> - <% end %> -
  • - <% end %> -
    -
-
-
- <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> -
- <% end %> - - -
+
+

课程动态

+ <% if @course_acts.nil? %> + + <% else %> +
+
    + <% unless @course_acts.nil? %> + <%= render :partial => 'organizations/org_new_course_pic', :locals => {:activities => @course_acts.first(3)} %> + <% end %> +
    + <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
    +
+
+ <% end %> +
<% else %>

课程动态

diff --git a/app/views/organizations/_org_new_course_pic.html.erb b/app/views/organizations/_org_new_course_pic.html.erb new file mode 100644 index 000000000..26a5762bb --- /dev/null +++ b/app/views/organizations/_org_new_course_pic.html.erb @@ -0,0 +1,78 @@ +<% activities.each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + + <% end %> +
    +
    + <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %> +
    +
    + +
  • + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% end %> +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% end %> +
    +
    + +
  • + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% end %> +
    +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %> +
    +
    + +
  • + + <% end %> + +<% end %> +