#1289修复输入标签内容并点击“增加”后,标签的内容还在文本框中的BUG

解决方案:新增标签后增加js代码设置输入框内值为空
This commit is contained in:
sw 2014-10-20 14:39:39 +08:00
parent 65b80959a6
commit 4ceb0e8789
2 changed files with 30 additions and 21 deletions

View File

@ -12,10 +12,16 @@
#end%> #end%>
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 --> <!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %> <% if object_flag == '3' %>
<span><%= image_tag("/images/sidebar/tags.png") %></span> <span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span> <%= image_tag("/images/sidebar/tags.png") %>
</span>
<span class="font_title_tag">
<%= l(:label_tag) %>:
</span>
<% if User.current.logged? %> <% if User.current.logged? %>
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span> <span>
<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %>
</span>
<% end %> <% end %>
<div id="tags_show_issue"> <div id="tags_show_issue">
@ -36,7 +42,9 @@
<% elsif object_flag == '6' %> <% elsif object_flag == '6' %>
<span><%#= image_tag("/images/sidebar/tags.png") %></span> <span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span> <span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %> <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);',
:class => "tags_icona",
:onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
</span> </span>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -47,21 +55,24 @@
<%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %> <%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
</div> </div>
<% else %> <% else %>
<span>
<span><%= image_tag("/images/sidebar/tags.png") %></span> <%= image_tag("/images/sidebar/tags.png") %>
<span class="font_title_tag"><%= l(:label_tag) %>:</span> </span>
<span class="font_title_tag">
<%= l(:label_tag) %>:
</span>
<% if User.current.logged? %> <% if User.current.logged? %>
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %></span> <span>
<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %>
</span>
<% end %> <% end %>
<div id="tags_show"> <div id="tags_show">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div> </div>
<div id="put-tag-form" style="display: none"> <div id="put-tag-form" style="display: none">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path, <%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show", :update => "tags_show",
:complete => '$("#put-tag-form").hide();' do |f| %> :complete => '$("#put-tag-form").hide();' do |f| %>
<%= f.text_field :name ,:id => "tags_name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %> <%= f.text_field :name ,:id => "tags_name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>

View File

@ -1,20 +1,18 @@
<% if @obj_flag == '3'%> <% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide(); //$('#put-tag-form-issue').hide();
$('#name-issue').val(""); $('#name-issue').val("");
<% elsif @obj_flag == '6'%> <% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%>").hide(); //$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val(""); $("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %> <% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); $('#tags_name').val("");
$('#put-tag-form #name').val("");
//$('#put-tag-form').hide(); //$('#put-tag-form').hide();
<% end %> <% end %>