#1718 修复作品下载添加标签框不能正常显示

zh
sw 11 years ago
parent 7f153ac982
commit 3dfb0358c1

@ -2,22 +2,21 @@
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% sufixtypes = @project.contenttypes %> <% sufixtypes = @project.contenttypes %>
<span class="borad-title"><%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span> <span class="borad-title">
<%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>
资源共享区
</span>
<div class="content-title-top"> <div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="file_buttons" class="nhidden"> <div id="file_buttons" class="nhidden">
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<p></p> <p></p>
<div id="upload_file_div" class="relation_file_div hidden"> <div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %> <%= render :partial => 'new', locals: {project: @project} %>
</div> </div>
<div id="relation_file_div" class="relation_file_div hidden"> <div id="relation_file_div" class="relation_file_div hidden">
<fieldset> <fieldset>
<legend>搜索</legend> <legend>搜索</legend>
@ -48,16 +47,23 @@
</div> </div>
<div class="box" id="files-box"> <div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label> <label for="files-box" style="font-weight:bold;">
&nbsp;&nbsp;
<%= l(:label_files_filter) %>
</label>
<% if attachmenttypes.any? %> <% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label> <label for="attachment_browse_label">
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName",params[:type]), <%= l(:attachment_browse) %>
</label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName",params[:type]),
:onchange => "attachmenttypes_searchex(this.value)" %> :onchange => "attachmenttypes_searchex(this.value)" %>
<% end %> <% end %>
<% if sufixtypes.any? %> <% if sufixtypes.any? %>
&nbsp; &nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label> <label for="attach_sufix_browse_label">
<%= l(:attachment_sufix_browse) %>
</label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "attachment_contenttypes_searchex(this.value)" %> :onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %> <% end %>
@ -65,20 +71,14 @@
</div> </div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %> <%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<div id="all_browse_div" class="all_browse_div"> <div id="all_browse_div" class="all_browse_div">
<%#= render :partial => 'show_all_attachment' %> <%#= render :partial => 'show_all_attachment' %>
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %> <% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
<%= render partial: "show_all_attachment"%>
<%= render partial: "show_all_attachment"%>
<%else%> <%else%>
<%= render partial: "sort_by_attachtypel"%>
<%= render partial: "sort_by_attachtypel"%>
<%end%> <%end%>
</div> </div>

@ -44,14 +44,14 @@
<span> <span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);',
:class => "tags_icona", :class => "tags_icona",
:onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').slideToggle(); readmore(this);" if User.current.logged? %> :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;
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; "> <div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
<%= 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-<%=obj.class%>-<%=obj.id%>" style="display: none;height: 100px;"> <div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none;">
<%= 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 %>

@ -9,108 +9,103 @@
</script> </script>
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程--> <!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程-->
<% @tags = obj.reload.tag_list %> <% @tags = obj.reload.tag_list %>
<% if non_list_all and (@tags.size > 0) %> <% if non_list_all and (@tags.size > 0) %>
<!-- 这里是显示的非主页的tag 所以当tag数量较多时 不必全部显示 用“更多”代替 --> <!-- 这里是显示的非主页的tag 所以当tag数量较多时 不必全部显示 用“更多”代替 -->
<% if @tags.size > Setting.show_tags_length.to_i then %> <% if @tags.size > Setting.show_tags_length.to_i then %>
<% i = 0 %> <% i = 0 %>
<% until i>Setting.show_tags_length.to_i do %> <% until i>Setting.show_tags_length.to_i do %>
<div id="tag"> <div id="tag">
<%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %> <%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %>
</div> </div>
<% i += 1 %> <% i += 1 %>
<% end %> <% end %>
<%= more_tags(obj.id,object_flag)%> <%= more_tags(obj.id,object_flag)%>
<% else %> <% else %>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<div id="tag"> <div id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<% else %> <% else %>
<!-- 用来显示三大对象的主页中的tag 故是全部显示 --> <!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %> <% if @tags.size > 0 %>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<div id="tag"> <div id="tag">
<span class="tag_show"> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <span class="tag_show">
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 --> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<% case object_flag %> <!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% when '1' %> <% case object_flag %>
<% when '1' %>
<% if User.current.eql?(obj) %> <% if User.current.eql?(obj) %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <span class='del'>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
<% end %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span>
<% when '2' %> <% end %>
<% when '2' %>
<% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> <% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <span class='del'>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
<% end %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span>
<% when '3' %> <% end %>
<% when '3' %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %> <% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <span class='del'>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
<% end %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span>
<% when '4' %> <% end %>
<% if obj.author_id == User.current.id %> <% when '4' %>
<% if obj.author_id == User.current.id %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <span class='del'>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %>
<% end %> </span>
<% when '5' %> <% end %>
<% test = Forum.find(obj.id) %> <% when '5' %>
<% if test && test.creator_id == User.current.id %> <% test = Forum.find(obj.id) %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <% if test && test.creator_id == User.current.id %>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
<% end %> :taggable_id => obj.id, :taggable_type => object_flag %>
<% when '6' %> </span>
<%# if (User.current.logged? && <% end %>
User.current.admin? <% when '6' %>
# && (@project && User.current.member_of?(@project)) <%# if (User.current.logged? &&
) User.current.admin?
%> # && (@project && User.current.member_of?(@project))
<% if obj.author_id == User.current.id || User.current.admin?%> )
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, %>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <% if obj.author_id == User.current.id || User.current.admin?%>
<% end %> <span class='del'>
<% when '7' %> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
<% if obj.author_id == User.current.id %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <% end %>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <% when '7' %>
<% if obj.author_id == User.current.id %>
<% end %> <span class='del'>
<% when '9' %> <%= 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 %> </span>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <% end %>
:taggable_id => obj.id, :taggable_type => object_flag %> </span> <% when '9' %>
<% end %> <% if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %>
<% end %> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %>
<% end %>
</span>
</div> </div>
<% end %> <% end %>
<% else %> <% else %>
<span style="color:#8c8a8a"> <span style="color:#8c8a8a">
&nbsp;&nbsp;&nbsp;<%= l(:label_tags_no) %> &nbsp;&nbsp;&nbsp;
</span> <%= l(:label_tags_no) %>
</span>
<% end %> <% end %>
<% end %> <% end %>
Loading…
Cancel
Save