调整了参赛应用列表布局显示样式
This commit is contained in:
parent
484d334c3c
commit
6421f02ac8
|
@ -11,6 +11,7 @@ class TagsController < ApplicationController
|
|||
include BidsHelper
|
||||
include ForumsHelper
|
||||
include AttachmentsHelper
|
||||
include ContestsHelper
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
helper :projects
|
||||
include TagsHelper
|
||||
|
@ -56,7 +57,7 @@ class TagsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
@users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num,
|
||||
@users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num,@contests_tags_num,
|
||||
@forum_tags_num, @attachments_tags_num = get_tags_size
|
||||
|
||||
# 获取搜索结果
|
||||
|
@ -65,7 +66,8 @@ class TagsController < ApplicationController
|
|||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
@attachments_results,
|
||||
@contests_tags = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
|
||||
# 这里是做tag推荐用的, 用来生产推荐的tags
|
||||
unless @obj.nil?
|
||||
|
@ -90,11 +92,13 @@ class TagsController < ApplicationController
|
|||
$related_tags.delete(@tag)
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@users_results,
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results = refresh_results(@obj_id,@show_flag)
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
# 删除已选tag
|
||||
|
@ -110,7 +114,9 @@ class TagsController < ApplicationController
|
|||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results = refresh_results(@obj_id,@show_flag)
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
def show_all
|
||||
|
@ -174,6 +180,7 @@ private
|
|||
@projects_results = nil
|
||||
@issues_results = nil
|
||||
@bids_results = nil
|
||||
@contests_results = nil
|
||||
@forums_results = nil
|
||||
attachments_results = nil
|
||||
@obj_pages = nil
|
||||
|
@ -199,10 +206,22 @@ private
|
|||
when '6'
|
||||
@obj = Attachment.find_by_id(obj_id)
|
||||
@obj_pages, attachments_results, @results_count = for_pagination(get_attachments_by_tag(selected_tags))
|
||||
when '7'
|
||||
@obj = Contest.find_by_id(obj_id)
|
||||
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
return @obj,@obj_pages,@results_count,@users_results,@projects_results,@issues_results,@bids_results,@forums_results, attachments_results
|
||||
return [@obj,
|
||||
@obj_pages,
|
||||
@results_count,
|
||||
@users_results,
|
||||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
attachments_results,
|
||||
@contests_results]
|
||||
end
|
||||
|
||||
def for_pagination(results)
|
||||
|
@ -222,7 +241,8 @@ private
|
|||
@bids_tags_num = Bid.tag_counts.size
|
||||
forum_tags_num = Forum.tag_counts.size
|
||||
attachment_tags_num = Attachment.tag_counts.size
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num
|
||||
@contests_tags_num = Contest.tag_counts.size
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num
|
||||
end
|
||||
|
||||
# 通过数字 来转换出对象的类型
|
||||
|
@ -243,6 +263,8 @@ private
|
|||
return 'Forum'
|
||||
when '6'
|
||||
return 'Attachment'
|
||||
when '7'
|
||||
return 'Contest'
|
||||
else
|
||||
render_error :message => e.message
|
||||
return
|
||||
|
|
|
@ -653,6 +653,8 @@ class UsersController < ApplicationController
|
|||
@obj = Forum.find_by_id(@obj_id)
|
||||
when '6'
|
||||
@obj = Attachment.find_by_id(@obj_id)
|
||||
when '7' then
|
||||
@obj = Contest.find_by_id(@obj_id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -14,6 +14,8 @@ module TagsHelper
|
|||
@obj = Bid.find_by_id(obj_id)
|
||||
when '6'
|
||||
@obj = Attachment.find_by_id(obj_id)
|
||||
when '7'
|
||||
@obj= Contest.find_by_id(obj_id)
|
||||
else
|
||||
raise Exception, '[TagsHelper] ===> tag type unknow.'
|
||||
end
|
||||
|
@ -40,6 +42,10 @@ module TagsHelper
|
|||
if user.id == obj_id
|
||||
@result = true
|
||||
end
|
||||
when '7'
|
||||
if user.id == obj_id
|
||||
@result = true
|
||||
end
|
||||
end
|
||||
return @result
|
||||
end
|
||||
|
|
|
@ -1,41 +1,35 @@
|
|||
|
||||
<% contesting_softapplication.each do |c_softapplication|%>
|
||||
<% if c_softapplication.softapplication %>
|
||||
<table width="90%" border="0" align='center'>
|
||||
<div style="padding-left: 18px">
|
||||
<div style="font-size: 15px">
|
||||
<tr>
|
||||
<td><strong>应用软件:</strong></td>
|
||||
<td>
|
||||
<table width="660px" border="0" align='center'>
|
||||
<tr>
|
||||
|
||||
<td width="65%" valign="top">
|
||||
<table width="100%" valign="top" align="left">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50%">
|
||||
<strong>
|
||||
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication)) %>
|
||||
</strong>
|
||||
<span class="font_lighter"><%= l(:label_joined_contest)%></span>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px">
|
||||
<tr>
|
||||
<td valign="top" width="50%" style=" word-wrap: break-word; word-break: break-all"><%= c_softapplication.softapplication.description %></td>
|
||||
</tr>
|
||||
|
||||
<td>简介:</td>
|
||||
<td>
|
||||
<%= c_softapplication.softapplication.description %>
|
||||
</td>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px; padding-bottom: 8px">
|
||||
<tr>
|
||||
<td valign="top"><span class="font_lighter">
|
||||
<td>发布时间:</td>
|
||||
<td>
|
||||
<%=format_time c_softapplication.created_at %>
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="underline-contests_three"></div>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<td width="85%">
|
||||
<div class='icon icon-add'> <!--标注我要参加及添加图标-->
|
||||
|
||||
<%= link_to(l(:button_contesting_as_application), {:controller => 'softapplications', :action => 'new'}) %>
|
||||
<%= link_to l(:button_contesting_as_application), "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %>
|
||||
</div>
|
||||
</td>
|
||||
<% end %>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<% if User.current.logged? %>
|
||||
<!--我要以发布应用的形式参加竞赛-弹出框-->
|
||||
<div id = 'flash' style="float:left; width: 100%; display: nonea" ></div>
|
||||
<div id="put-bid-form" style="display: nonea">
|
||||
<div id="put-bid-form" style="display: none">
|
||||
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add_softapplication'}, :update => "contesting_softapplication_list", :complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
|
||||
<tr>
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<table style="font-family:微软雅黑">
|
||||
<tr>
|
||||
<td>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "4"}%>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "7"}%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: 120px">
|
||||
<div style="height: 50px">
|
||||
<div style="font-size: 15px"><strong>软件评论:</strong></div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
@ -78,6 +78,5 @@
|
|||
|
||||
|
||||
<div>
|
||||
<%= link_to 'Edit', edit_softapplication_path(@softapplication) %> |
|
||||
<%= link_to 'Back', softapplications_path %>
|
||||
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(contest)) %>
|
||||
</div>
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
(<%= Bid.tagged_with("#{sg}").size %>)
|
||||
<% when '5' then %>
|
||||
(<%= Forum.tagged_with("#{sg}").size %>)
|
||||
|
||||
<% when '6' then %>
|
||||
(<%= Attachment.tagged_with("#{sg}").size %>)
|
||||
<% end %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
4 代表是bid类型
|
||||
5 代表是forum类型
|
||||
6 代表是Attachment类型
|
||||
|
||||
7 代表是contest类型
|
||||
#end%>
|
||||
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
|
||||
<% if object_flag == '3' %>
|
||||
|
|
|
@ -79,6 +79,13 @@
|
|||
<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 %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
<% when show_flag == '6'%>
|
||||
<strong><%= l(:label_attachment)%>(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_attachments",:locals => {:attachments_results => attachments_results}%>
|
||||
<% when show_flag == '7'%>
|
||||
<strong><%= l(:label_contest_innovate)%>(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%>
|
||||
<% else %>
|
||||
<strong><%= l(:label_tags_all_objects)%></strong>
|
||||
<!-- 这里为显示搜有过滤结果预留了默认设置 -->
|
||||
|
@ -26,6 +29,7 @@
|
|||
<%= render :partial => "show_users",:locals => {:users_results => users_results }%>
|
||||
<%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%>
|
||||
<%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%>
|
||||
<%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
|
|
|
@ -5,6 +5,6 @@ $('#related_tags').html('<%= j(render :partial => "related_tags",
|
|||
|
||||
$('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
|
||||
:projects_results => @projects_results,:users_results => @users_results,
|
||||
:bids_results => @bids_results ,:show_flag => @show_flag,:obj_pages => @obj_pages })%>')
|
||||
:bids_results => @bids_results,:contests_results => @contests_results,:show_flag => @show_flag,:obj_pages => @obj_pages })%>')
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ $('#related_tags').html('<%= j(render :partial => "related_tags",
|
|||
|
||||
$('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
|
||||
:projects_results => @projects_results,:users_results => @users_results,
|
||||
:bids_results => @bids_results ,:show_flag => @show_flag ,:obj_pages => @obj_pages })%>')
|
||||
:bids_results => @bids_results ,:contests_results => @contests_results ,:show_flag => @show_flag ,:obj_pages => @obj_pages })%>')
|
||||
|
||||
|
||||
|
|
|
@ -23,12 +23,20 @@
|
|||
<%= l(:label_user_plural) %>(<%= @users_tags_num %>) |
|
||||
<%= l(:label_tags_call)%>(<%= @bids_tags_num %>) |
|
||||
<%= l(:field_filename)%>(<%= @attachments_tags_num %>)
|
||||
<%= l(:label_tags_contest)%>(<%= @contests_tags_num %>) |
|
||||
</div>
|
||||
<div id="show_results">
|
||||
<%# 求工厂模式重构 %>
|
||||
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
|
||||
:projects_results => @projects_results,:users_results => @users_results ,
|
||||
:bids_results=>@bids_results,:forums_results => @forums_results, :attachments_results => @attachments_results, :show_flag => @obj_flag}%>
|
||||
<%= render :partial => "tag_search_results",
|
||||
:locals => {:issues_results => @issues_results,
|
||||
:projects_results => @projects_results,
|
||||
:users_results => @users_results,
|
||||
:bids_results => @bids_results,
|
||||
:forums_results => @forums_results,
|
||||
:attachments_results=> @attachments_results,
|
||||
:contests_results => @contests_results,
|
||||
:show_flag => @obj_flag}
|
||||
%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1844,4 +1844,8 @@ zh:
|
|||
label_contest_description_no: 暂无描述。
|
||||
label_no_contest_softapplication: 暂无参赛应用
|
||||
label_button_ok: 确定
|
||||
label_tags_contest: 竞赛标签
|
||||
label_tags_contest: 竞赛名称
|
||||
label_tags_contest_description: 竞赛描述
|
||||
|
||||
|
|
@ -2721,7 +2721,11 @@ div.repos_explain{
|
|||
border-bottom: 1px dashed rgb(204, 204, 204);
|
||||
width: 660px;
|
||||
}
|
||||
|
||||
.underline-contests_three{
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px dashed rgb(204, 204, 204);
|
||||
width: 688px;
|
||||
}
|
||||
.contest-star{
|
||||
color: #bb0000;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue