1、修改删除TAG后js刷新页面

2、删除课程TAG时增加提示
This commit is contained in:
sw 2015-03-19 16:02:02 +08:00
parent 308568d668
commit 46410c8e8d
4 changed files with 20 additions and 17 deletions

View File

@ -73,7 +73,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
@ -109,7 +109,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)

View File

@ -18,17 +18,6 @@
<% else %>
<div id="tags_show">
<%= render :partial => "tags/new_tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
<% if User.current.logged?%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
<%= f.text_field :name ,:id => "tags_name",:size=>"20",: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"%>
<input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" />
<% end %>
</span>
<% end%>
</div>
<% end %>
</div>

View File

@ -9,9 +9,21 @@
<span class="re_tag f_l " id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
<span class="del">
<%= 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 %>
<%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %>
</span>
</span>
<% end %>
<% end %>
<% end %>
<% end %>
<% if User.current.logged?%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
<%= f.text_field :name ,:id => "tags_name",:size=>"20",: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"%>
<input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" />
<% end %>
</span>
<% end%>

View File

@ -6,8 +6,10 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false, :object_flag => @object_flag}) %>');
<% else %>
<% elsif @object_flag == '9'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
<% else%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
<% end %>