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 1/6] =?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} %>