From 64b064628111f1d35571496fe13150bdd39af27d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 18 Mar 2015 15:18:06 +0800 Subject: [PATCH] =?UTF-8?q?base=5Fcourse=E5=9F=BA=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 26 +++ app/views/layouts/base_courses.html.erb | 211 +++++++----------------- app/views/tags/_new_tag.html.erb | 23 +++ app/views/tags/_new_tag_name.html.erb | 17 ++ config/locales/zh.yml | 1 + public/javascripts/course.js | 5 + public/stylesheets/leftside.css | 16 +- 7 files changed, 144 insertions(+), 155 deletions(-) create mode 100644 app/views/tags/_new_tag.html.erb create mode 100644 app/views/tags/_new_tag_name.html.erb diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index bd9901240..f9ac89692 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -33,6 +33,32 @@ module CoursesHelper @nav_dispaly_store_all_label = 1 end + #生成课程老师成员链接 + def course_teacher_link teacher_num + if User.current.member_of_course?(@course) + link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue' + else + content_tag 'span',teacher_num, :class => 'info_foot_num c_blue' + end + end + + #生成课程学生列表连接 + def course_student_link student_num + if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) + link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue' + else + content_tag 'span',student_num, :class => 'info_foot_num c_blue' + end + end + + def course_poll_count + Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}").count + end + + def course_feedback_count + @course.journals_for_messages.where('m_parent_id IS NULL').count + end + # 返回学生数量,即roles表中定义的Reporter #def studentCount project # searchStudent(project).count diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 29124c087..a9f5b8dd7 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,6 +1,7 @@ <% course_model %> <% teacher_num = teacherCount(@course) %> <% student_num = studentCount(@course) %> +<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> @@ -71,14 +72,14 @@ ID:<%= @course.id%>
- - <%= l(:label_settings)%> + + +配置 - - <%= l(:label_course_closed)%> + + +关闭 - - 复制 + + +复制
@@ -93,170 +94,86 @@
- -
教师(100学生(100资源(100
+
+ <%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>) + + <%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>) + + <%= l(:project_module_attachments)%>(<%= link_to @course.attachments.count, course_files_path(@course), :class => 'info_foot_num c_blue' %>)
-
-
-

课程简介:

该项目旨在通过对开源软件开发、发布、部署、运行过程中产生的包括源代码、缺陷跟踪、版本控制、软件标签、用户评论等等数据进行挖掘和分析,研究分析软件开发规律,构建软件开发辅助工具,从而提高软件开发效率和质量
-
展开更多信息
-
-
-

标签:

-
- 课程实验 - x - - 课程实验课 - x - - 课程实验课 - x - - + 添加标签 - + -
-
-
- - -
-
-

动态

-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4
-

发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4
-

发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4
-

发布时间 : 2014-11-26 10:19

-
-
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4
-

发布时间 : 2014-11-26 10:19

+ -
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+
+
+
+
+

<%= l(:label_course_brief_introduction)%>:

+ <%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
-
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+
+ <%= l(:label_expend_information)%> + + +
-
-
-
- -
- jacknudt 有了最新动态: 附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4附件: 2.2完成乘10运算的图灵机.mp4
-

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
发布时间 : 2014-11-26 10:19

+
+
+

<%= l(:label_tag)%>:

+
+ <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
-
+
+
- -
-
- + + <%= render :partial => 'layouts/new_footer' %>
<%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/tags/_new_tag.html.erb b/app/views/tags/_new_tag.html.erb new file mode 100644 index 000000000..7db324cd7 --- /dev/null +++ b/app/views/tags/_new_tag.html.erb @@ -0,0 +1,23 @@ +
+ <%#begin + 1 代表是user类型 + 2 代表是project类型 + 3 代表是issue类型 + 4 代表是bid类型 + 5 代表是forum类型 + 6 代表是Attachment类型 + 7 代表是contest类型 + 8 代表是OpenSourceProject类型 + 9 代表是RelativeMemo类型 + #end%> + + <% if object_flag == '3' %> + + <% elsif object_flag == '6' %> + + <% else %> +
+ <%= render :partial => "tags/new_tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
+ <% end %> +
diff --git a/app/views/tags/_new_tag_name.html.erb b/app/views/tags/_new_tag_name.html.erb new file mode 100644 index 000000000..a1fb3fa46 --- /dev/null +++ b/app/views/tags/_new_tag_name.html.erb @@ -0,0 +1,17 @@ + +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% if @tags.size > 0 %> + <% @tags.each do |tag| %> + + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> + + <%= link_to('x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag) if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %> + + + <% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 45d6a9d20..2618c8b46 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1639,6 +1639,7 @@ zh: label_course_new_homework: 新建作业 label_course_homework_list: 作业列表 label_course_homework_new: 发布作业 + label_course_news_new: 发布通知 label_fork_homework_new: 选为作业 #wang label_contest_userresponse: 用户留言 diff --git a/public/javascripts/course.js b/public/javascripts/course.js index bef6abb73..e859a0a6e 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -18,4 +18,9 @@ function regexName(content) function submitSerch(content) { if(regexName(content)){$("#course_search_form").submit();} +} + +function show_more_msg() +{ + $("#course_description").toggleClass("course_description_none"); } \ No newline at end of file diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 12d0f2c4f..895d86e8f 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -7,19 +7,19 @@ .pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} .pr_info_logo:hover{ border:1px solid #64bdd9; } .pr_info_join{} -.pr_info_join a{ color:#fff; display:block; padding:0 5px; padding-top:3px; margin-right:10px; float:left; height:19px; background:#64bdd9; text-align:center; } +.pr_info_join_a{ color:#fff; display:block; padding:0 5px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; } .pr_info_join a:hover{ background:#41a8c8;} .pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} .pr_info_name:hover{ color:#3ca5c6;} .pr_info_score{ font-size:14px; color:#3e4040; } .pr_info_score a{ color:#ff7143;} .pr_info_score a:hover{ color:#64bdd9;} -.img_private{ background:url(../images/new_project/img_project.png) 0 0 no-repeat; width:32px; height:16px; color:#fff; font-size:12px; padding-left:7px; } +.img_private{ background:url(../images/new_project/img_project.png) 0 0 no-repeat; width:33px; height:16px; color:#fff; font-size:12px; padding-left:7px; } .info_foot_num{ color:#3ca5c6; } .pr_info_foot{ color:#7f7f7f; margin-top:5px; } .info_foot_num:hover{ color:#2390b2;} -.info_box{background:#fff; padding:10px;width:222px; } -.info_box ul li{ font-size:14px; color: #3e4040; line-height:1.9;} +.info_box{background:#fff; padding:10px;width:220px; } +.info_box ul li{ font-size:12px; color: #3e4040; line-height:1.7;} /*左侧导航*/ .subNavBox{width:240px; background:#fff;margin:10px 10px 0 0;} @@ -40,19 +40,19 @@ /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} -.course_description{max-height: 110px;overflow:hidden;} +.course_description{max-height: 112px;overflow:hidden;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;} -.lg-foot:hover{ color:#787b7e;} +.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} /****标签(和资源库的tag样式一致)***/ .project_Label{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px;} a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} .submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } .isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} -.re_tag{ width: auto; padding:0 5px; padding-top:3px; height:19px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } +.re_tag{ width: auto; padding:0 5px; padding-top:2px; height:20px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } .re_tag a{ color:#0d90c3;} .tag_h{ } -.tag_h span,.tag_h a{ margin-top:5px;} +.tag_h span,.tag_h a{ margin-bottom:5px;}