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

This commit is contained in:
sw 2014-12-18 14:53:21 +08:00
parent 7f153ac982
commit 3dfb0358c1
3 changed files with 91 additions and 96 deletions

View File

@ -2,22 +2,21 @@
<% attachmenttypes = @project.attachmenttypes %>
<% 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">
<%#= 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 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_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>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend>搜索</legend>
@ -48,16 +47,23 @@
</div>
<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? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= 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]),
<label for="attachment_browse_label">
<%= 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)" %>
<% end %>
<% if sufixtypes.any? %>
&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),
:onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
@ -65,20 +71,14 @@
</div>
<%= 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) %>
<div id="all_browse_div" class="all_browse_div">
<%#= render :partial => 'show_all_attachment' %>
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
<%= render partial: "show_all_attachment"%>
<%= render partial: "show_all_attachment"%>
<%else%>
<%= render partial: "sort_by_attachtypel"%>
<%= render partial: "sort_by_attachtypel"%>
<%end%>
</div>

View File

@ -1,6 +1,6 @@
<div id="tags">
<%#begin
1 代表是user类型
1 代表是user类型
2 代表是project类型
3 代表是issue类型
4 代表是bid类型
@ -44,14 +44,14 @@
<span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);',
: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? %>
</span>
&nbsp;&nbsp;
<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} %>
</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 } %>
</div>
<% else %>

View File

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