From ea55cbe4624f13b3d22285f727a3e25f26a8eb34 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 17 Dec 2013 20:00:57 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=96=B0=E5=BB=BA=E4=B8=8D=E8=83=BD=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index d2ff856f2..a71941ee1 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -171,6 +171,10 @@ <%= link_to_attachments message, :author => false %> --> <% end %> + +<% end %> + + <% if !@topic.locked? && authorize_for('messages', 'reply') %>

<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>

<% end %> From 967fb6dc9a6d88ea70ff2e6a083de32cbe68464b Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Tue, 17 Dec 2013 20:49:23 +0800 Subject: [PATCH 02/15] =?UTF-8?q?1=E3=80=81=09=E5=AE=9E=E8=B7=B5=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B->=E2=80=9C=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E2=80=9D=E4=B8=AD=E7=9A=84=E2=80=9C=E6=8F=90=E4=BA=A4=E6=83=85?= =?UTF-8?q?=E5=86=B5=E2=80=9D,=E2=80=9D=E4=BD=9C=E4=B8=9A=E2=80=9D?= =?UTF-8?q?=E5=90=8E=E5=BA=94=E8=AF=A5=E5=8A=A0=E6=95=B0=E9=87=8F=E3=80=90?= =?UTF-8?q?=E5=85=89=E8=BE=89=20=E5=91=A8=E4=BA=8C=E3=80=91=202=E3=80=81?= =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4=BA=BA=E2=80=9D=E6=94=B9=E4=B8=BA=E2=80=9C=E5=8F=82=E8=B5=9B?= =?UTF-8?q?=E4=BA=BA=E2=80=9D=E3=80=90=E5=85=89=E8=BE=89=E5=91=A8=E4=BA=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework_list.html.erb | 2 +- app/views/bids/_list_projects.html.erb | 38 ++++++++++++++++------- app/views/bids/_project_homework.html.erb | 2 +- app/views/projects/course.html.erb | 2 +- app/views/welcome/index.html.erb | 1 + config/locales/zh.yml | 3 ++ 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index f016eafc5..0bbdc1348 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -4,7 +4,7 @@
- + - +
<%= l(:label_task_plural)%><%= l(:label_task_plural)%>(<%= @homework_list.count%>) <%= b_project.project.description %>
<%= b_project.created_at%><%= b_project.created_at %>
diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index 8c1212c46..d7235aa3f 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -25,7 +25,7 @@ - <%= link_to "forge.trustie.net/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> + <%= link_to "forge.trustie.net/project/course", :controller => 'projects', :action => 'course', :project_type => 1 %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course', :project_type => 1 %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 99f9a5c31..5d142c4f4 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -263,6 +263,7 @@

    用户动态

    + <%= link_to "更多>>", { :controller => 'users', :action => 'index'} %>
    <% find_all_activities.each do |event| %>
  • diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 245f53ec0..15c957e42 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1748,3 +1748,6 @@ zh: label_project_module_forums: 公共贴吧 label_memo_locked: 帖子已被锁定 label_downloads_list: 进入附件列表 + label_join_contest: 参与了竞赛 + label_contest_user: 参赛人: + label_contest_reason: 参赛宣言: \ No newline at end of file From c06b4f270401886c36a25902749a532061c34527 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 17 Dec 2013 21:09:20 +0800 Subject: [PATCH 03/15] bug with memo paginate. --- app/views/memos/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 5e2c83790..af02df499 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -45,7 +45,7 @@
  • <%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)

    - <% pages_count = (params['page'].to_i - 1) * 10 %> + <% pages_count = (params['page'].to_i - 1) < 0 ? 0 : ((params['page'].to_i - 1) * 10) %> <% @replies.each do |reply| %>
    ">

    <%= pages_count += 1 %>楼 :

    From 35745f3e6e952d25c5d590d125ff07aa121e6e25 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 17 Dec 2013 21:26:34 +0800 Subject: [PATCH 04/15] . --- app/views/memos/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index af02df499..6c5aae172 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -45,7 +45,7 @@

    <%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)

    - <% pages_count = (params['page'].to_i - 1) < 0 ? 0 : ((params['page'].to_i - 1) * 10) %> + <% pages_count = @reply_pages.offset %> <% @replies.each do |reply| %>
    ">

    <%= pages_count += 1 %>楼 :

    From 6bab3a95a7864e1b08fb5e0c8540e38018e72edd Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 18 Dec 2013 07:56:19 +0800 Subject: [PATCH 05/15] add analytics. --- app/views/layouts/_base_footer.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index df99cceff..8a543c517 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -4,4 +4,14 @@ -
    \ No newline at end of file +
    + \ No newline at end of file From ca9da99f7ec4a1e0345009964504886536c2dd69 Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Wed, 18 Dec 2013 20:24:01 +0800 Subject: [PATCH 06/15] =?UTF-8?q?1=E3=80=81=09=E5=AE=9E=E8=B7=B5=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B->=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=20=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=20=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA=EF=BC=88?= =?UTF-8?q?=E6=9C=89=E4=BA=86=E6=9C=80=E6=96=B0=E5=8A=A8=E6=80=81=E5=90=8E?= =?UTF-8?q?=EF=BC=89=E5=BA=94=E8=AF=A5=E4=B8=BA=EF=BC=9A=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E9=A1=B9=E7=9B=AE=E5=88=99=E6=98=BE=E7=A4=BA=E6=96=B0?= =?UTF-8?q?=E9=97=BB=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=88=99=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E3=80=90=E5=85=89=E8=BE=89=20=E5=91=A8?= =?UTF-8?q?=E4=B8=89=E3=80=91=202=E3=80=81=09=E7=B3=BB=E7=BB=9F=E4=B8=AD?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=8A=A0=E7=A9=BA=E6=A0=BC=E5=9C=B0=E6=96=B9?= =?UT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89=E8=BE=89=20=E5=91=A8=E4=B8=89=E3=80=91=204=E3=80=81?= =?UTF-8?q?=09=E7=9C=8B=E5=88=AB=E4=BA=BA=E7=9A=84=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E6=97=B6=E6=B2=A1=E6=9C=89=E6=A0=87=E7=AD=BE=E3=80=90=E5=85=89?= =?UTF-8?q?=E8=BE=89=20=E5=91=A8=E4=B8=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/projects_helper.rb | 17 ++++++++++++++++- app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/bids/_homework_list.html.erb | 2 -- app/views/issues/_list.html.erb | 4 ++-- app/views/layouts/base_contest.html.erb | 2 +- app/views/layouts/base_users.html.erb | 12 ------------ app/views/news/index.html.erb | 19 +------------------ app/views/projects/show.html.erb | 5 +++-- app/views/words/_message.html.erb | 2 +- config/locales/zh.yml | 3 ++- 10 files changed, 27 insertions(+), 41 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5921fb377..63d5fea2a 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -237,7 +237,22 @@ module ProjectsHelper when "attachment" l :label_attachment when "news" - l :label_news + l :label_news + else + "" + end + end + + def eventToLanguageCourse event_type, project + case event_type + when "issue-note" + l :label_issue + when "issue" + l :label_issue + when "attachment" + l :label_attachment + when "news" + project.project_type == 1 ? (l :label_notification) : (l :label_news) else "" end diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index d3c4d65d2..2c347fa64 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -56,7 +56,7 @@ <%= bid.description %> - <%= l(:label_create_time) %> : <%=format_time bid.created_on %> <%= l(:field_deadline) %> : <%=bid.deadline %> + <%= l(:label_create_time) %> :  <%=format_time bid.created_on %> <%= l(:field_deadline) %> :  <%=bid.deadline %> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 0bbdc1348..83f4cb45a 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -18,7 +18,6 @@ <% if homework.attachments.any?%> - diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index b4360f50c..3436d62be 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -20,7 +20,8 @@ <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> - <%= link_to "#{eventToLanguage(e.event_type)}: "<< format_activity_title(e.event_title), e.event_type.eql?("attachment") ? project_files_path(e.container) : e.event_url %> + + <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), e.event_type.eql?("attachment") ? project_files_path(e.container) : e.event_url %> @@ -30,7 +31,7 @@

    - + <% if e.event_type == "issue" %> <% end %> diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index 519f0062a..f76ffc94c 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -23,7 +23,7 @@

    - +
    <%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> @@ -28,7 +27,6 @@ - - +
    <%= l(:label_bidding_user_studentcode) %> :<%= homework.user.user_extensions.student_id%>
    <% if (User.current == homework.user) || (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',3,7, 9)).size >0) %> diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 8a82741cc..2019a7b45 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -38,12 +38,12 @@ <% end -%>
      - <%= l(:field_description)%>:<%= issue.description %> + <%= l(:field_description)%>: <%= issue.description %>
      <% unless issue.assigned_to_id.nil? %> - <%= l(:field_assigned_to)%><%= raw column_content[5] %> + <%= l(:field_assigned_to)%> <%= raw column_content[5] %>  <% end %> <%= l(:label_updated_time_on, format_date(issue.updated_on)).html_safe %>
      diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 5736f0821..44245fc9c 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -181,7 +181,7 @@
      <%= l(:label_bidding_project) %> - <%= link_to "更多>>", :controller => 'bids', :action => 'show_project'%> + <%= link_to "更多>>", :controller => 'bids', :action => 'show_project'%>
      diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 597ccd6a6..33b296bfb 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -162,24 +162,12 @@
      - - <% if User.current.logged? %> - <% if User.current.admin?||User.current.login==@user.login%>
      - - -
      <%= render :partial => 'tags/tag', :locals => {:obj => @user,:object_flag => "1"}%>
      - <% end %> - <% end %> - - - -
      diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 0e67766db..a43565cfc 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -28,23 +28,6 @@ <% end if @project %>
      - - -
      <% if @newss.empty? %> @@ -73,7 +56,7 @@
    <%= textilizable(news, :description) %>
    <%= l :label_update_time %>: <%= format_time(news.created_on) %> <%= l :label_update_time %>: <%= format_time(news.created_on) %> <%= link_to l(:label_project_newother),news_path(news)%><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %>
    <%= l :label_activity_time %>: <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= l :label_activity_time %>:  <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%>
    <%= l :label_comment_time %>: <%= format_time journal.created_on %> <%= l :label_comment_time %>:  <%= format_time journal.created_on %> <% if @user == User.current %> <%= link_to(l(:label_newfeedback_quote), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 15c957e42..3d83fbd2a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1750,4 +1750,5 @@ zh: label_downloads_list: 进入附件列表 label_join_contest: 参与了竞赛 label_contest_user: 参赛人: - label_contest_reason: 参赛宣言: \ No newline at end of file + label_contest_reason: 参赛宣言: + label_notification: 通知 \ No newline at end of file From 60be338848e595a996b760e7d9df7299ec580661 Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 19 Dec 2013 15:59:10 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98=20=E7=A6=81?= =?UTF-8?q?=E6=AD=A2js=E7=9A=84=E6=83=85=E5=86=B5=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E8=B7=AF=E7=94=B1=E9=94=99=E8=AF=AF=20ie?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 24 +++- app/models/homework_attach.rb | 5 +- app/views/attachments/upload.js.erb | 23 ++-- app/views/bids/_homework.html.erb | 24 +++- app/views/bids/_homework_list.html.erb | 1 - app/views/bids/add_homework.js.erb | 6 +- app/views/bids/new_submit_homework.html.erb | 15 +++ app/views/common/_project.html.erb | 116 +++++++++--------- app/views/issues/index.html.erb | 2 +- app/views/layouts/base_homework.html.erb | 2 +- app/views/memos/_reply_box.html.erb | 4 +- config/locales/zh.yml | 1 + config/routes.rb | 5 +- public/javascripts/attachments.js | 2 +- public/stylesheets/application.css | 2 +- .../stylesheets/application.css | 6 +- 16 files changed, 146 insertions(+), 92 deletions(-) create mode 100644 app/views/bids/new_submit_homework.html.erb diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 15e612fc5..536d0a291 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -3,7 +3,7 @@ class BidsController < ApplicationController #Added by young menu_item l(:label_homework), :only => [:edit, :udpate] menu_item :respond - menu_item :project, :only => [:show_project,:show_results] + menu_item :project, :only => [:show_project,:show_results, :new_submit_homework] menu_item :homework_respond, :only => :homework_respond menu_item :homework_statistics, :only => :homework_statistics #Ended by young @@ -713,24 +713,42 @@ class BidsController < ApplicationController render :action => 'edit' end end + + def new_submit_homework + #render html to prepare create submit homework + find_bid + render :layout => 'base_homework' + end def add_homework if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) # homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id) # homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) @homework = HomeworkAttach.new + @homework.safe_attributes = params[:homeworkattach] @homework.bid_id = @bid.id @homework.user_id = User.current.id @homework.save_attachments(params[:attachments]) - @homework.save + render_attachment_warning_if_needed(@homework) + if @homework.save + @homework_flag = l(:label_bidding_homework_succeed) + else + @homework_flag = l(:label_bidding_homework_failed) + end if @homework.attachments.empty? @homework.delete flash[:error] = l(:no_attachmens_allowed) + @homework_flag = l(:no_attachmens_allowed) # else end end @homework_list = @bid.homeworks - @homework = HomeworkAttach.new + respond_to do |format| + format.html{ + redirect_to project_for_bid_path, notice: @homework_flag.to_s + } + format.js + end end diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index aea68abb5..5ce08a0a8 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -1,9 +1,10 @@ class HomeworkAttach < ActiveRecord::Base - attr_accessible :bid_id, :user_id - + include Redmine::SafeAttributes belongs_to :user belongs_to :bid + safe_attributes "bid_id", + "user_id" acts_as_attachable end diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 04e30b569..ade73ab23 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -1,9 +1,14 @@ -var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); -$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); -fileSpan.find('a.remove-upload') - .attr({ - "data-remote": true, - "data-method": 'delete', - href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' - }) - .off('click'); +var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); +<% if @attachment.new_record? %> + fileSpan.hide(); + alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); +<% else %> +$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); +fileSpan.find('a.remove-upload') + .attr({ + "data-remote": true, + "data-method": 'delete', + href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' + }) + .off('click'); +<% end %> diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 79d10bff0..5094d0c0a 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -1,21 +1,33 @@ +<%= render_flash_messages %> <% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
    - <%= toggle_link l(:label_commit_homework), 'put-bid-form' %> + <%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
    <% end %> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 83f4cb45a..0fd2bf202 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -1,5 +1,4 @@ -<%= render_flash_messages %> <%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
    diff --git a/app/views/bids/add_homework.js.erb b/app/views/bids/add_homework.js.erb index 90085a502..42b22392e 100644 --- a/app/views/bids/add_homework.js.erb +++ b/app/views/bids/add_homework.js.erb @@ -1,5 +1,7 @@ $('#bidding_project_list').html('<%= escape_javascript(render(:partial => 'homework_list', :locals => {:homework => @homework_list})) %>'); -$('#put-bid-form-partial').html(' <%= escape_javascript( render( :partial => 'attachments/form', :locals => {:container => @homework}) )%>') +$('#put-bid-form-partial').html(' <%= escape_javascript( render( :partial => 'attachments/form') )%>') +$('#flash_notice').remove() $("#project_id").val("请选择项目"); $("#bid_message").val( "<%= l(:label_bid_reason) %>" ); -$("#put-bid-form").hide(); \ No newline at end of file +$("#put-bid-form").hide(); +alert('<%= @homework_flag %>'); \ No newline at end of file diff --git a/app/views/bids/new_submit_homework.html.erb b/app/views/bids/new_submit_homework.html.erb new file mode 100644 index 000000000..dd06af643 --- /dev/null +++ b/app/views/bids/new_submit_homework.html.erb @@ -0,0 +1,15 @@ +

    <%= l :label_bidding_homework %>

    +
    + <%= form_for HomeworkAttach.new, :method => :post, :url => {:controller => 'bids', :action => 'add_homework'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();', :html => {:multipart => true} do |f| %> +
    + + <%= l(:label_attachment_plural) %> + +

    + <%= render :partial => 'attachments/form' %> +

    +
    + <%= submit_tag l(:button_create) %> + <%= link_to (t :button_back), project_for_bid_homework_path %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/common/_project.html.erb b/app/views/common/_project.html.erb index 516ed0f5e..9109c3fd6 100644 --- a/app/views/common/_project.html.erb +++ b/app/views/common/_project.html.erb @@ -1,58 +1,58 @@ -
    -
    - <%= content_tag('div', tag('img', {:src => '../images/logo-only_med.png', :class => 'img_ta'}, false, false), :class => 'img-tag') %> -
    -
    -

    - Claimed by <%= content_tag('a', project.name) %> | Analyzed about 11 hours ago -

    -

    - <%= textilizable(project.short_description, :project => project) %> -

    -
    -
    -

    - <%= content_tag('a', "9.23M") %><%= content_tag('span', "lines of codes") %> -

    -

    - <%= content_tag('a', "963") %><%= content_tag('span', "current contributors") %> -

    -

    - <%= content_tag('a', "1 day") %><%= content_tag('span', "since last commits") %> -

    -

    - <%= content_tag('a', "12,169") %><%= content_tag('span', "users on trustie2") %> -

    -
    -
    - <%= content_tag('a', tag('img', {:src => '../images/pai.png', :class => 'img-ta'}, false, false), :class => 'img-tag3') %> - <%= content_tag('div', "Vert High Activity", :class => 'img-tag4') %> - <%= content_tag('div', tag('img', {:src => '../images/stars_ro.png', :class => 'img-ta'}, false, false), :class => 'img-tag2') %> - <%= content_tag('div', "#{WatchersOfProjects.watcher_count(project)}Reviews", :class => 'img-tag1') %> -
    -
    -
    -
    - <%= content_tag('a', 'Mostly written in C++') %> -
    -
    - <%= content_tag('a', 'Licenses:') %><%= content_tag('span', 'GPL-2.0+, LGPL, MPL-1.1') %> -
    -
    -
    - <%= tag('img', {:src => "../images/user.png"}, false, false) %> - <% tags = ProjectTags.find_tag(project.id) - tags.each do |t_tag| - content = t_tag.tag.content - description = t_tag.description -%> - <%= content_tag('a', content, :class => 'tag', :title => description) %> - <% end -%> - <%= content_tag('a', 'css', :class => 'tag') %> - <%= content_tag('a', 'web_browser', :class => 'tag') %> - <%= content_tag('a', 'development', :class => 'tag') %> - <%= content_tag('a', 'client', :class => 'tag') %> - <%= content_tag('a', 'web', :class => 'tag') %> - <%= content_tag('a', 'xhtml', :class => 'tag') %> - <%= content_tag('a', 'tabbed', :class => 'tag') %> - <%= content_tag('a', 'and more') %> -
    +
    +
    + <%= content_tag('div', tag('img', {:src => '../images/logo-only_med.png', :class => 'img_ta'}, false, false), :class => 'img-tag') %> +
    +
    +

    + Claimed by <%= content_tag('a', project.name) %> | Analyzed about 11 hours ago +

    +

    + <%= textilizable(project.short_description, :project => project) %> +

    +
    +
    +

    + <%= content_tag('a', "9.23M") %><%= content_tag('span', "lines of codes") %> +

    +

    + <%= content_tag('a', "963") %><%= content_tag('span', "current contributors") %> +

    +

    + <%= content_tag('a', "1 day") %><%= content_tag('span', "since last commits") %> +

    +

    + <%= content_tag('a', "12,169") %><%= content_tag('span', "users on trustie2") %> +

    +
    +
    + <%= content_tag('a', tag('img', {:class => 'img-ta'}, false, false), :class => 'img-tag3') %> + <%= content_tag('div', "Vert High Activity", :class => 'img-tag4') %> + <%= content_tag('div', tag('img', {:src => '../images/stars_ro.png', :class => 'img-ta'}, false, false), :class => 'img-tag2') %> + <%= content_tag('div', "#{WatchersOfProjects.watcher_count(project)}Reviews", :class => 'img-tag1') %> +
    +
    +
    +
    + <%= content_tag('a', 'Mostly written in C++') %> +
    +
    + <%= content_tag('a', 'Licenses:') %><%= content_tag('span', 'GPL-2.0+, LGPL, MPL-1.1') %> +
    +
    +
    + <%= tag('img', {:src => "../images/user.png"}, false, false) %> + <% tags = ProjectTags.find_tag(project.id) + tags.each do |t_tag| + content = t_tag.tag.content + description = t_tag.description -%> + <%= content_tag('a', content, :class => 'tag', :title => description) %> + <% end -%> + <%= content_tag('a', 'css', :class => 'tag') %> + <%= content_tag('a', 'web_browser', :class => 'tag') %> + <%= content_tag('a', 'development', :class => 'tag') %> + <%= content_tag('a', 'client', :class => 'tag') %> + <%= content_tag('a', 'web', :class => 'tag') %> + <%= content_tag('a', 'xhtml', :class => 'tag') %> + <%= content_tag('a', 'tabbed', :class => 'tag') %> + <%= content_tag('a', 'and more') %> +
    diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 5934733cd..a72eb4b41 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -4,7 +4,7 @@ :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :class => 'icon icon-add' %> <%= link_to l(:label_query), '#', :class => 'icon icon-help', - :onclick => '$("#custom_query").toggle(); ' if User.current.logged? %> + :onclick => '$("#custom_query").slideToggle(); ' if User.current.logged? %> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 82cceaaec..827874d55 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -8,7 +8,7 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> diff --git a/app/views/memos/_reply_box.html.erb b/app/views/memos/_reply_box.html.erb index 32c03d2ad..a8991b572 100644 --- a/app/views/memos/_reply_box.html.erb +++ b/app/views/memos/_reply_box.html.erb @@ -1,4 +1,4 @@ -<%= form_for(@mome_new, url: forum_memos_path) do |f| %> +<%= form_for(@mome_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %> <%= f.hidden_field :subject, :required => true, value: @memo.subject %> <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> <%= f.hidden_field :parent_id, :required => true, value: @memo.id %> @@ -8,7 +8,7 @@

    <%= l(:label_attachment_plural) %>
    - <%= render :partial => 'attachments/form', :locals => {:container => @mome_new} %> + <%= render :partial => 'attachments/form' %>

    <%= f.submit value: l(:label_reply_plural), class: "replies" %> <% end %> \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3d83fbd2a..6947fc04d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1331,6 +1331,7 @@ zh: label_bidding_succeed: 应标成功 label_bidding_contest_succeed: 竞赛提交成功 #added by bai label_bidding_homework_succeed: 作业提交成功 #added by bai + label_bidding_homework_failed: 作业提交失败 #added by bai label_bidding_fail: 应标失败,该项目已经应标 label_bidding_homework_fail: 作业提交失败,该作业已经被提交! diff --git a/config/routes.rb b/config/routes.rb index 8d1156bff..d4d9b4f92 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -466,7 +466,8 @@ RedmineApp::Application.routes.draw do match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' match 'calls/:id/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid_homework' # by huang match 'calls/:id/add', :controller => 'bids', :action => 'add' - match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework' + match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework', via: :post + match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework' match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond' match 'words/:id/leave_project_message', :controller => 'words', :action => 'leave_project_message' @@ -499,7 +500,7 @@ RedmineApp::Application.routes.draw do match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest' match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post] - match 'project/course', :to => 'projects#course', :as => 'course' #nyan + match 'project/course', :to => 'projects#course', :as => 'course' #added by william # match 'calls/:id/set_results',:controller => 'bids', :action => 'set_results',:via => [:get,:post],:as => 'set_results' diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 86bf06336..7b8394fe8 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -141,7 +141,7 @@ function uploadAndAttachFiles(files, inputEl) { var sizeExceeded = false; $.each(files, function() { - if (this.size && maxFileSize && this.size > parseInt(maxFileSize)) {sizeExceeded=true;} + if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;} }); if (sizeExceeded) { window.alert(maxFileSizeExceeded); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 9ae70566f..9f0f648ba 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -211,7 +211,7 @@ div.forums-line{ } div.forums-info{ - background-image: url(../images/sidebar/forums.png); + /*background-image: url(../images/sidebar/forums.png); */ border-bottom: solid 1px #15bccf; height: 100px; width: 214px; diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index c8870221c..cf1a76d72 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -36,7 +36,7 @@ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { #header > h1 { - background-image:ol url(../images/logo-2x.png); + /*background-image:ol url(../images/logo-2x.png);*/ background-size: 43px 30px; } } @@ -1251,7 +1251,7 @@ a.root { a.img-tag3{ float: left; - background-image: url("../images/pai.png"); + /*background-image: url("../images/pai.png");*/ background-position: 0px 0px; background-repeat: no-repeat; position: absolute; @@ -1891,7 +1891,7 @@ div.tableline{ * * @2013-09-27 /*added by bai*/ -input[type="submit"] { +input[type="submit"], .button_submit { padding-bottom: 5px; width: auto; height: 25px; From 7068359e9e6832cb9a1eb7b28982a07f167f8537 Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 19 Dec 2013 16:04:01 +0800 Subject: [PATCH 08/15] attachment.nil? --- app/views/attachments/upload.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index ade73ab23..4761f4635 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -1,5 +1,5 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); -<% if @attachment.new_record? %> +<% if(!@attachment.nil? && @attachment.new_record?) %> fileSpan.hide(); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); <% else %> From 2db1067158a904bd51f0f0b677899bdbdd2cbf51 Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Thu, 19 Dec 2013 19:54:39 +0800 Subject: [PATCH 09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=E7=AB=9E=E8=B5=9B=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E7=9A=84bug.=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=80=85=E9=83=A8=E5=88=86=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=80=85=E4=B9=9F=E4=B8=8D=E4=BC=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8F=90=E7=A4=BA=E7=9A=84bug=E3=80=82=207.=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AB=9E=E8=B5=9B=E4=B8=AD=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E4=B8=80=E6=A0=8F=E7=9A=84=E2=80=9Dmore=E2=80=9D=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E3=80=82=207.=20=E9=87=8D=E6=9E=84=E7=AB=9E=E8=B5=9Bl?= =?UTF-8?q?ayouts=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 48 ++++++++++++--- app/views/bids/_list_projects.html.erb | 6 +- app/views/bids/contest.html.erb | 8 ++- app/views/bids/index.html.erb | 27 ++------- app/views/bids/show_bid_user.html.erb | 2 +- app/views/forums/index.html.erb | 7 ++- app/views/layouts/_no_content.html.erb | 10 ++++ app/views/layouts/base_contest.html.erb | 78 ++++++++----------------- app/views/projects/search.html.erb | 35 ++--------- app/views/users/search.html.erb | 2 +- config/locales/zh.yml | 4 +- 11 files changed, 102 insertions(+), 125 deletions(-) create mode 100644 app/views/layouts/_no_content.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ac0165f79..97e76a0c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1378,6 +1378,39 @@ module ApplicationHelper html.html_safe end +#display bid project + def show_more_bid_project?(bid) + if bid.projects.where('is_public = 1').count > 12 + return true + else + return false + end + end + + def show_bid_project(bid) + html = '' + if bid.projects.where('is_public = 1').count == 0 + html << (content_tag "p", l(:label_no_bid_project), :class => "font_lighter") + else + bid.projects.where('is_public = 1').take(12).each do |project| + html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar") + end + end + html.html_safe + end + + def show_bid_fans_picture(obj) + html = '' + if obj.watcher_users.count == 0 + html << (content_tag "span", l(:label_project_no_follow)) + else + obj.watcher_users.take(12).each do |user| + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name) + end + end + html.html_safe + end + #display fans picture def show_more_fans?(obj) if obj.watcher_users.count > 12 @@ -1389,23 +1422,19 @@ module ApplicationHelper def show_fans_picture(obj) html = '' - count = 0 if obj.watcher_users.count == 0 html << (content_tag "span", l(:label_no_current_fans)) + else + obj.watcher_users.take(12).each do |user| + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name) + end end - for user in obj.watcher_users - html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.show_name}") - count = count + 1 - if count >= 12 - break - end - end html.html_safe end # added by bai def show_more_participate?(obj) - if obj.join_in_contests.count > 0 + if obj.join_in_contests.count > 12 return true else return false @@ -1427,6 +1456,7 @@ module ApplicationHelper end html.html_safe end + #end # add by huang diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index 6663ab6e2..dafec4d77 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -32,15 +32,15 @@ diff --git a/app/views/bids/contest.html.erb b/app/views/bids/contest.html.erb index 57aabf2b4..6cd3df16e 100644 --- a/app/views/bids/contest.html.erb +++ b/app/views/bids/contest.html.erb @@ -30,7 +30,7 @@ -<%= sort_contest(@s_state)%> + - +<% if @bids.size > 0%> +<%= sort_contest(@s_state)%>
    <%= render :partial => 'contest_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
    +<% else %> + <%= render :partial => "layouts/no_content"%> +<% end %> diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 4c1daec49..bf405e6b5 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -27,27 +27,12 @@
    <%= link_to(b_project.project.name, project_path(b_project.project)) %> - + <% if @bid.reward_type == 2 %> - <%= l(:label_join_contest)%> + <%= l(:label_joined_contest)%> <% end %> <% if @bid.reward_type == 1 %> <%= l(:label_join_bidding)%> <% end %> - +
    <% end %>
    - - - - - <%= sort_bid(@s_state, @project_type)%> - - - - + <% if @bids.size > 0 %>
    - <%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> + <%= sort_bid(@s_state, @project_type)%> + <%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
    + <% else %> + <%= render :partial => "layouts/no_content"%> + <% end %> diff --git a/app/views/bids/show_bid_user.html.erb b/app/views/bids/show_bid_user.html.erb index 2fd6205d0..f4d7b2642 100644 --- a/app/views/bids/show_bid_user.html.erb +++ b/app/views/bids/show_bid_user.html.erb @@ -1,5 +1,5 @@
    - <% for user in @users %> + <% for user in @bid.watcher_users %>
    • diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index f6546778a..dc7c97b36 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -24,5 +24,8 @@
    - -<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> +<% if @forums.size > 0 %> + <%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> +<% else %> + <%= render :partial => "layouts/no_content" %> +<% end %> diff --git a/app/views/layouts/_no_content.html.erb b/app/views/layouts/_no_content.html.erb new file mode 100644 index 000000000..990b85bae --- /dev/null +++ b/app/views/layouts/_no_content.html.erb @@ -0,0 +1,10 @@ +
    +

    没有搜索到相关的内容!

    +
    +

    建议您 :

    +
    重新设置搜索关键词
    +
    不要使用太长的关键词
    +
    不要使用特殊符号,如"^&%$#@*%"等
    +
    清除关键词之间的空格
    +
    +
    diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 44245fc9c..cbc2173b1 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -21,20 +21,19 @@
    <%=render :partial => 'layouts/base_header'%>
    -
    - - + + @@ -46,9 +45,7 @@
    创新竞赛社区<%= l(:label_user_location) %> : 创新竞赛社区<%= l(:label_user_location) %> :
    - -
    - - - <%if User.current.logged? %> + <% if User.current.logged? %> <% if @bid.author.id == User.current.id %> - <%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %> + <%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %> <% end %> <% end %>
    -
    @@ -98,7 +92,6 @@
    -
    @@ -112,20 +105,13 @@
    <%= l(:label_limit_time) %> : <%= @bid.deadline%>
    -
    - <%= link_to l(:label_x_followers, :count => @bid.watcher_users.count)+"("+@bid.watcher_users.count.to_s+")", respond_path(@bid) %>   - <%= link_to l(:label_bidding_project)+"("+@bid.biding_projects.count.to_s+")", project_for_bid_path(@bid) %>  - <%= link_to l(:label_x_bids_responses, :count => @bid.commit)+"("+@bid.commit.to_s+")", respond_path(@bid)%> -
    -
    <%= l(:label_project_overview) %>
    -
    <% if @bid.description.size>0 %>
    @@ -145,7 +131,6 @@
    -
    @@ -154,24 +139,20 @@
    -
    +
    <%= l(:label_x_followers, :count => @bid.watcher_users.count) %> + <% if show_more_fans?(@bid) %> + <%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%> + <% end %>
    -
    - <% if @bid.watcher_users.size>0 && @bid.watcher_users.count<13%> - <% for user in @bid.watcher_users%> - <%= link_to image_tag(url_to_avatar(user), :class => "avatar", :title => user.name ), user_path(user), :class => "avatar" %> - <% end %> - <% else %> -

    <%= l(:label_project_no_follow) %>

    - <% end%> + <%= show_bid_fans_picture(@bid)%>
    @@ -179,33 +160,24 @@
    -
    - <%= l(:label_bidding_project) %> - <%= link_to "更多>>", :controller => 'bids', :action => 'show_project'%> -
    -
    +
    + <%= l(:label_bidding_project) %> + <% if show_more_bid_project?(@bid) %> + <%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%> + <% end %> +
    + <%= show_bid_project(@bid) %> +
    - <% if @bid.projects.size<0%> -

    <%= l(:label_no_bid_project) %>

    - - <%else%> - <% for project in objCut12(@bid.projects.where('is_public=1')) %> - <%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar" %> - <% end%> - <% end %> -
    - -
    -
    @@ -215,9 +187,9 @@
    <%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %> <% if show_more_participate?(@bid) %> -
    + <%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%> -
    + <% end %>
    @@ -228,8 +200,8 @@
    - -
+
+
<% if display_main_menu?(@bid) %>
diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index b3f5c22ea..2915c032f 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -1,36 +1,6 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %> - - -
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> <% if params[:project_type] == "1" %> @@ -85,10 +55,13 @@ <% end %>
- +<% if @projects.size == 0 %> +<%= render :partial => 'layouts/no_content'%> +<% else %>
<%= render_project_hierarchy(@projects)%>
+<% end %>