From 1cfba644f572c5c0431260ec006b491f28297232 Mon Sep 17 00:00:00 2001 From: xianbo Date: Fri, 8 Nov 2013 17:19:57 +0800 Subject: [PATCH] fix show of someone who watch and fxi the show of homework exdit --- app/controllers/bids_controller.rb | 2 +- app/helpers/application_helper.rb | 6 ++++++ app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/layouts/base_contest.html.erb | 13 ++++++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 77b5d4e56..b44c2ba51 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -608,7 +608,7 @@ class BidsController < ApplicationController def edit @bid = Bid.find(params[:bid_id]) - if (User.current.admin?||User.current.id==@bid.author_id)&&(@bid.homework_type == 1) + if (User.current.admin?||User.current.id==@bid.author_id) @project_id = params[:project_id] respond_to do |format| format.html { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c689e277..8956a95cc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1426,4 +1426,10 @@ module ApplicationHelper def stringCut240(str) (str.length > 240) ? (str[0,240]<<"......") : str end + #author : xianbo + def objCut12(obj) + for obj1 in obj[0..11] + obj2 = obj1 + end + end end diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index ff7b507da..f77f90c86 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -13,7 +13,7 @@ <%= l(:field_deadline) %> : <%=bid.deadline %> - <% if (User.current.admin?||User.current.id==bid.author_id)&&(bid.homework_type == 1)%> + <% if (User.current.admin?||User.current.id==bid.author_id)%> <%= link_to( l(:button_edit), {:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id}, diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 53918720f..78445a034 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -125,19 +125,22 @@
- <%= l(:label_bidding_project) %> + <%= l(:label_bidding_project) %> + <%= link_to "更多>>", :controller => 'bids', :action => 'show_project'%>
+
- <% if @bid.projects.size>0%> - <% for project in @bid.projects%> + <% if @bid.projects.size<0%> +

<%= l(:label_no_bid_project) %>

+ + <%else%> + <% for project in objCut12(@bid.projects)%> <%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar" %> <% end%> - <%else%> -

<%= l(:label_no_bid_project) %>

<% end %>