From 9905f912284c4e635420de6b4fa6b9e9a1a57d89 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 09:46:22 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9TAG=E4=BA=91=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 1e67e5f8d..b24c9d366 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -508,8 +508,13 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px .vi_zan{color:#28be6c;} .newwork_btn a{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; display:block; text-align:center; float:right;} .newwork_btn a:hover{ background:#329cbd;} -a.files_tag_icon{ background:#dcdcdc; color:#fff; border:1px solid #c8c8c8; padding:1px 10px; float:left; margin-right:10px; margin-bottom:10px;} -a:hover.files_tag_icon{ background:#64bdd9; color:#fff; border:1px solid #54aeca; } +.files_tag{ width:670px; height:22px; overflow:hidden; margin-bottom:10px;} +a.files_tag_icon{ background:#64bdd9; color:#fff; border:1px solid #54aeca; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; } +a:hover.files_tag_icon{ background:#54aeca;} + + + + From 94ca6cd2f9d305c2504509a4a39142fd3ccdc0f4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 10:49:58 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=AF=86=E7=A0=81=E4=B8=8E=E8=AF=BE?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 +-- app/services/courses_service.rb | 2 +- app/views/courses/new.html.erb | 3 +- public/javascripts/course.js | 40 ++++++++++++++++++++++++--- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8710b624e..c12f59f21 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -423,7 +423,7 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if @course.new_record? respond_to do |format| - format.html { render :action => 'new', :layout => 'base' } #Added by young + format.html { render :action => 'new', :layout => 'new_base' } #Added by young format.api { render_validation_errors(@course) } end else @@ -493,7 +493,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'new_base' } format.api { } diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index aa216d755..95bf5feba 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -198,7 +198,7 @@ class CoursesService @course.school_id = current_user.user_extensions.school_id @course.setup_time = params[:setup_time] @course.endup_time = params[:endup_time] - @course.class_period = params[:class_period] + @course.class_period = params[:class_period].to_i params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0 params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0 end diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index 0ea51d5f4..75979d9f3 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -25,8 +25,9 @@
  • - + 显示明码 +
    学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
  • diff --git a/public/javascripts/course.js b/public/javascripts/course.js index c2a5da03d..74ec4f362 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -80,9 +80,18 @@ function regex_course_class_period() return false; } else if (regex.test(class_period)) { - $("#course_class_period_notice").html(""); - $("#course_class_period_notice").hide(); - return true; + if(parseInt(class_period) > 0) + { + $("#course_class_period_notice").html(""); + $("#course_class_period_notice").hide(); + return true; + } + else + { + $("#course_class_period_notice").html("学时总数必须大于0"); + $("#course_class_period_notice").show(); + return false; + } } else { @@ -91,10 +100,33 @@ function regex_course_class_period() return false; } } + +function regex_course_password() +{ + var class_period = $.trim($("#course_course_password").val()); + var regex = /^\w+$/; + if(class_period.length == 0) + { + $("#course_course_password_notice").html("课程密码不能为空"); + $("#course_course_password_notice").show(); + return false; + } + else if (regex.test(class_period)) { + $("#course_course_password_notice").html(""); + $("#course_course_password_notice").hide(); + return true; + } + else + { + $("#course_course_password_notice").html("课程密码有非法字符"); + $("#course_course_password_notice").show(); + return false; + } +} //提交新建课程 function submit_new_course() { - if(regex_course_name()&®ex_course_class_period()) + if(regex_course_name()&®ex_course_class_period()&®ex_course_class_period()&®ex_course_password()) { $("#new_course").submit(); } From 2db3ab9d1385a01a310de5b408dcd8e321edc671 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 10:56:48 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=AF=86=E7=A0=81=E4=B8=8E=E8=AF=BE?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 2 +- app/views/courses/settings.html.erb | 3 ++- public/javascripts/course.js | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 95bf5feba..6f207d76d 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -245,7 +245,7 @@ class CoursesService #course.safe_attributes = params[:course] course.time = params[:time] course.term = params[:term] - course.class_period = params[:class_period] + course.class_period = params[:class_period].to_i params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0 params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0 if course.save diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index acc6c12a5..2907ee0ac 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -39,8 +39,9 @@
  • - + 显示明码 +
    学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
  • diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 74ec4f362..8a16def1d 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -100,7 +100,7 @@ function regex_course_class_period() return false; } } - +//验证密码 function regex_course_password() { var class_period = $.trim($("#course_course_password").val()); @@ -126,7 +126,7 @@ function regex_course_password() //提交新建课程 function submit_new_course() { - if(regex_course_name()&®ex_course_class_period()&®ex_course_class_period()&®ex_course_password()) + if(regex_course_name()&®ex_course_class_period()&®ex_course_password()) { $("#new_course").submit(); } @@ -134,7 +134,7 @@ function submit_new_course() function submit_edit_course(id) { - if(regex_course_name()&®ex_course_class_period()) + if(regex_course_name()&®ex_course_class_period()&®ex_course_password()) { $("#edit_course_"+id).submit(); } From e334dd69f8852ebf61de5b91357b0149d795a6cd Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 11:14:06 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=AF=BE=E4=BB=B6?= =?UTF-8?q?=E5=90=8ETAG=E4=BA=91=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 12d1f6856..1e51d7dd2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -387,6 +387,7 @@ class FilesController < ApplicationController @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] show_attachments @containers + @tag_list = attachment_tag_list @all_attachments @attachtype = 0 @contenttype = 0 From b7e9442800ea2f4f931fca5e7b8556507189fbb5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 14:01:58 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4TAG=E4=BA=91=E6=97=B6TAG=E4=BA=91=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tags_controller.rb | 17 +++++++++++++++++ app/helpers/application_helper.rb | 9 +++++++++ app/helpers/files_helper.rb | 8 -------- app/views/files/_course_list.html.erb | 8 ++------ app/views/files/_tag_yun.html.erb | 5 +++++ app/views/tags/remove_tag_new.js.erb | 2 ++ app/views/tags/tag_save.js.erb | 12 +++++++----- 7 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 app/views/files/_tag_yun.html.erb diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index e26901320..d4399e464 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -220,6 +220,15 @@ class TagsController < ApplicationController @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) @tag.delete unless @tag.nil? end + + if @obj && @object_flag == '6' && @obj.container.kind_of?(Course) + @course = @obj.container + all_attachments = @course.attachments.select{|attachment| attachment.is_public? || + (attachment.container_type == "Course" && User.current.member_of_course?(@course))|| + attachment.author_id == User.current.id + } + @tag_list = attachment_tag_list all_attachments + end # end end end @@ -263,6 +272,14 @@ class TagsController < ApplicationController else logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}" end + if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) + @course = @obj.container + all_attachments = @course.attachments.select{|attachment| attachment.is_public? || + (attachment.container_type == "Course" && User.current.member_of_course?(@course))|| + attachment.author_id == User.current.id + } + @tag_list = attachment_tag_list all_attachments + end respond_to do |format| format.js format.html diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 095d0ada5..5782d4bc8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2097,4 +2097,13 @@ module ApplicationHelper request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/ end + + #获取指定资源列表的TAG的集合以及每个TAG的数量,降序排序 + def attachment_tag_list attachments + tag_list = Hash.new + attachments.each do |attachment| + attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1} + end + tag_list.sort {|a,b| b[1]<=>a[1]} + end end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 0be59c0da..d69f13a29 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -120,14 +120,6 @@ module FilesHelper result end - def attachment_tag_list attachments - tag_list = Hash.new - attachments.each do |attachment| - attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1} - end - tag_list.sort {|a,b| b[1]<=>a[1]} - end - def get_attachments_by_tag attachments,tag attachments.each do |attachment| attachment.tag_list.include?(tag) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 5bbb8757d..c726d63e7 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -15,12 +15,8 @@
    -
    - <% unless @tag_list.nil?%> - <% @tag_list.each do |k,v|%> - <%= k%>(<%= v%> - <% end%> - <% end%> +
    + <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course}%>
    diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb new file mode 100644 index 000000000..f78ea6cdf --- /dev/null +++ b/app/views/files/_tag_yun.html.erb @@ -0,0 +1,5 @@ +<% unless tag_list.nil?%> + <% tag_list.each do |k,v|%> + <%= k%>(<%= v%> + <% end%> +<% end%> \ No newline at end of file diff --git a/app/views/tags/remove_tag_new.js.erb b/app/views/tags/remove_tag_new.js.erb index 01edf3e1c..35361fc7d 100644 --- a/app/views/tags/remove_tag_new.js.erb +++ b/app/views/tags/remove_tag_new.js.erb @@ -3,6 +3,8 @@ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); + +$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course}) %>"); <% end %> <% if @object_flag == "10"%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index c7dbec65d..31ee40a42 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -5,11 +5,13 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n //$('#put-tag-form-issue').hide(); $('#name-issue').val(""); <% elsif @obj_flag == '6'%> -$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); -$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', - :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); -$("#tags_name_<%=@obj.id%>").val(""); -$("#add_tag_<%=@obj.id%>").hide(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + $("#tags_name_<%=@obj.id%>").val(""); + $("#add_tag_<%=@obj.id%>").hide(); + + $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course}) %>"); <% elsif @obj_flag == '9'%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); From a2b529b38bf918bf750aba2f8f86a6f1ec62170c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 14:12:37 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0TAG?= =?UTF-8?q?=E5=90=8E=E5=88=A0=E9=99=A4TAG=E6=8C=89=E9=92=AE=E6=B6=88?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/tags/tag_save.js.erb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 31ee40a42..2c0c398f4 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -5,13 +5,19 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n //$('#put-tag-form-issue').hide(); $('#name-issue').val(""); <% elsif @obj_flag == '6'%> - $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); - $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', - :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + <%if @course%> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', + :locals => {:obj => @obj,:object_flag => @obj_flag}) %>'); + $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course}) %>"); + <%else%> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + <%end%> + $("#tags_name_<%=@obj.id%>").val(""); $("#add_tag_<%=@obj.id%>").hide(); - - $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course}) %>"); <% elsif @obj_flag == '9'%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); From 5649f4c5a166afac906ca5b5b1b2eefdf0635b6a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 14:21:05 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E6=89=80=E6=9C=89=E7=9A=84TAG=E4=BA=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 5 +++-- app/controllers/tags_controller.rb | 12 ++---------- app/helpers/application_helper.rb | 10 ++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1e51d7dd2..8b1c8ba32 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -79,7 +79,8 @@ class FilesController < ApplicationController @result = find_course_attache q,@course,sort @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 - @tag_list = attachment_tag_list @result + + @tag_list = get_course_tag_list @course end #rescue Exception => e # #render 'stores' @@ -541,7 +542,7 @@ class FilesController < ApplicationController @result = visable_attachemnts @result @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} @searched_attach = paginateHelper @result,10 - @tag_list = attachment_tag_list @result + @tag_list = get_course_tag_list @course respond_to do |format| format.js diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index d4399e464..f1c9451bf 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -223,11 +223,7 @@ class TagsController < ApplicationController if @obj && @object_flag == '6' && @obj.container.kind_of?(Course) @course = @obj.container - all_attachments = @course.attachments.select{|attachment| attachment.is_public? || - (attachment.container_type == "Course" && User.current.member_of_course?(@course))|| - attachment.author_id == User.current.id - } - @tag_list = attachment_tag_list all_attachments + @tag_list = get_course_tag_list @course end # end end @@ -274,11 +270,7 @@ class TagsController < ApplicationController end if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) @course = @obj.container - all_attachments = @course.attachments.select{|attachment| attachment.is_public? || - (attachment.container_type == "Course" && User.current.member_of_course?(@course))|| - attachment.author_id == User.current.id - } - @tag_list = attachment_tag_list all_attachments + @tag_list = @tag_list = get_course_tag_list @course end respond_to do |format| format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5782d4bc8..9c9c96ce5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2106,4 +2106,14 @@ module ApplicationHelper end tag_list.sort {|a,b| b[1]<=>a[1]} end + + #获取课程资源的TAG云 + def get_course_tag_list course + all_attachments = course.attachments.select{|attachment| attachment.is_public? || + (attachment.container_type == "Course" && User.current.member_of_course?(course))|| + attachment.author_id == User.current.id + } + tag_list = attachment_tag_list all_attachments + tag_list + end end From 05c74960a8f2773eaefb6e26fc3338f1bf264337 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 16 Apr 2015 15:01:37 +0800 Subject: [PATCH 08/21] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=80=89=E6=8B=A9=E7=9A=84TAG=E4=BA=91=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=202=E3=80=81=E5=BD=93=E9=80=89=E6=8B=A9TAG?= =?UTF-8?q?=E4=BA=91=E8=BF=87=E6=BB=A4=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?TAG=E8=BF=9B=E8=A1=8C=E6=B7=BB=E5=8A=A0=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=93=8D=E4=BD=9C=E6=97=B6=E7=BB=A7=E7=BB=AD=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E8=AF=A5TAG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tags_controller.rb | 2 ++ app/views/files/_course_list.html.erb | 6 +++--- app/views/files/_tag_yun.html.erb | 6 +++++- app/views/tags/_tag_add.html.erb | 2 ++ app/views/tags/_tag_list.html.erb | 3 ++- app/views/tags/_tag_new.html.erb | 3 ++- app/views/tags/remove_tag_new.js.erb | 4 ++-- app/views/tags/tag_save.js.erb | 4 ++-- 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index f1c9451bf..253faa2b1 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -224,12 +224,14 @@ class TagsController < ApplicationController if @obj && @object_flag == '6' && @obj.container.kind_of?(Course) @course = @obj.container @tag_list = get_course_tag_list @course + @select_tag_name = params[:select_tag_name] end # end end end def tag_save + @select_tag_name = params[:tag_for_save][:tag_name] @tags = params[:tag_for_save][:name] @obj_id = params[:tag_for_save][:object_id] @obj_flag = params[:tag_for_save][:object_flag] diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index c726d63e7..42f51e07a 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -16,7 +16,7 @@
    - <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course}%> + <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
    @@ -52,8 +52,8 @@
    - <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
    diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index f78ea6cdf..c9ac1999f 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -1,5 +1,9 @@ <% unless tag_list.nil?%> <% tag_list.each do |k,v|%> - <%= k%>(<%= v%> + <% if tag_name && tag_name == k%> + <%= k%>(<%= v%> + <% else%> + <%= k%>(<%= v%> + <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/tags/_tag_add.html.erb b/app/views/tags/_tag_add.html.erb index f8cac7c0d..ad97cd693 100644 --- a/app/views/tags/_tag_add.html.erb +++ b/app/views/tags/_tag_add.html.erb @@ -9,6 +9,8 @@ <%= f.text_field :name ,:id => "tags_name_#{obj.id}",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class => "isTxt w90 f_l" %> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> + <% tag_name ||= ""%> + <%= f.text_field :tag_name,:value=> tag_name,:style=>"display:none"%> <%= f.submit "",:class => "submit f_l" %> <% end %> diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index e18dafd7d..b512f1ef3 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -12,8 +12,9 @@ <% end %> <% when '6' %> <% if obj.author_id == User.current.id || User.current.admin?%> + <% select_tag_name ||= ""%> <%= link_to 'x', :controller => "tags", :action => "remove_tag_new", :remote => true, :tag_name => tag, - :taggable_id => obj.id, :taggable_type => object_flag %> + :taggable_id => obj.id, :taggable_type => object_flag, :select_tag_name => select_tag_name %> <% end %> <% end %> diff --git a/app/views/tags/_tag_new.html.erb b/app/views/tags/_tag_new.html.erb index 0d5d371e3..bbedaff78 100644 --- a/app/views/tags/_tag_new.html.erb +++ b/app/views/tags/_tag_new.html.erb @@ -21,7 +21,8 @@ <% elsif object_flag == '6' %>
    - <%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag} %> + <% tag_name ||= ""%> + <%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag,:select_tag_name => tag_name} %>
    + <% if User.current.login? %> - <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> - , - - <%= l(:label_welcome_trustie_course_description) %> - - <% else %> - <% if @school_id == "0" %> - + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> <% else %> + <% if @school_id == "0" %> + <% else %> <% if @school_id.nil? %> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
    @@ -61,10 +52,20 @@ <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
    <% end %> + <% end %> <% end %> - <% end %>
    - <% unless @course_page.nil? %> + + + <%= l(:label_welcome_trustie_course) %> + + <% else %> + <% unless @course_page.nil? %> <%= l(:label_welcome_trustie_course) %> - + , + + <%= l(:label_welcome_trustie_course_description) %> + + <% end %> <% end %> +