From b78504a5f1ae9623de283eec12dc7ca1e6c7fb94 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Wed, 7 Aug 2013 16:45:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=9A=84bug=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98=E4=BB=A5=E5=8F=8A=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 5 +- app/controllers/users_controller.rb | 20 ++++++-- app/views/bids/_bid_show.html.erb | 4 +- app/views/bids/_history.html.erb | 2 + app/views/bids/_new.html.erb | 19 ++++++- app/views/bids/_new_bid.html.erb | 26 +++++++--- app/views/bids/index.html.erb | 4 +- app/views/bids/show_project.html.erb | 77 ++++++++++++++++++++++++---- app/views/words/_message.html.erb | 8 ++- app/views/words/_new.html.erb | 74 ++++++++++++++++++++++---- 10 files changed, 201 insertions(+), 38 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index b13a097f9..aceda304d 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -145,7 +145,10 @@ class BidsController < ApplicationController def new_bid if params[:bid_title] - Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) + bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) + end + unless bid.watched_by?(User.current) + bid.add_watcher(User.current) end @limit = 5 @bid_count = Bid.count diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e54c1c61b..2937f4fce 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -148,7 +148,13 @@ class UsersController < ApplicationController ### modified by fq def show - + has = { + "show_issues" => true, + "show_changesets" => true, + "show_news" => true, + "show_messages" => true, + "show_bids" => true, + } #####fq @message = MessagesForUser.find_message(@user.id) JournalsForMessage.reference_message(@user.id) @@ -156,13 +162,19 @@ class UsersController < ApplicationController @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) if @user == User.current events = [] - events += Redmine::Activity::Fetcher.new(User.current, :author => User.current).events(nil, nil, :limit => 10) + activity = Redmine::Activity::Fetcher.new(User.current, :author => User.current) + activity.scope_select {|t| !has["show_#{t}"].nil?} + events += activity.events(nil, nil, :limit => 10) @watcher = User.watched_by(@user) for user in @watcher - events += Redmine::Activity::Fetcher.new(User.current, :author => user).events(nil, nil, :limit => 10) + activity = Redmine::Activity::Fetcher.new(User.current, :author => user) + activity.scope_select {|t| !has["show_#{t}"].nil?} + events += activity.events(nil, nil, :limit => 10) end else - events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10) + activity = Redmine::Activity::Fetcher.new(User.current, :author => @user) + activity.scope_select {|t| !has["show_#{t}"].nil?} + events = activity.events(nil, nil, :limit => 10) end @events_by_day = events.group_by(&:event_date) diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb index cf44111dc..e1fb7d581 100644 --- a/app/views/bids/_bid_show.html.erb +++ b/app/views/bids/_bid_show.html.erb @@ -1,10 +1,10 @@ - + <% end %>
需求列表 + <% if User.current.logged? %>
<%= toggle_link l(:button_new_bid), 'put-bid-form', {:focus => 'project_id'} %> -
<% bids.each do |bid|%> diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 6bc784d3c..e68dff1cb 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -21,9 +21,11 @@ <% end %> +<% if User.current.logged? %>
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
+<% end %> <% unless state%> <% if journals.size > 5 %> diff --git a/app/views/bids/_new.html.erb b/app/views/bids/_new.html.erb index d203603d7..a953a8183 100644 --- a/app/views/bids/_new.html.erb +++ b/app/views/bids/_new.html.erb @@ -35,6 +35,23 @@ border: #d5dee9 1px solid; } + + + <%= form_for('bid_message', :remote => true, :method => :post, :url => {:controller => 'bids', :action => 'create', @@ -42,7 +59,7 @@ :sta => sta}) do |f|%> - +
<%= f.text_area 'message', :rows => 3, :cols => 65, :value => "我要反馈", :style => "resize: none;", :class => 'noline'%><%= f.text_area 'message', :rows => 3, :cols => 65, :value => "我要反馈", :onfocus => "clearInfo('bid_message_message')", :onblur => "showInfo('bid_message_message')", :style => "resize: none;", :class => 'noline'%>
<%= f.text_field :reference_user_id, :style=>"display:none"%> diff --git a/app/views/bids/_new_bid.html.erb b/app/views/bids/_new_bid.html.erb index 2b899154d..8b98764e6 100644 --- a/app/views/bids/_new_bid.html.erb +++ b/app/views/bids/_new_bid.html.erb @@ -1,8 +1,18 @@ <%= form_tag({:controller => 'bids', :action => 'new_bid', @@ -13,26 +23,26 @@
- + - + - + - +
<%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title')"%><%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title', '为你的需求起个名字~~')", :onblur => "showInfo('bid_title', '为你的需求起个名字~~')"%>
<%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 8, - :onfocus => "clearInfo('bid_description')" %><%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 8, + :onfocus => "clearInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')", :onblur => "showInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')" %>
<%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_budget')"%><%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true %>
<%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_deadline')"%><%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_deadline')"%><%= calendar_for('bid_deadline')%>
diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 9e83e6413..04e9bf4b2 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -1,7 +1,9 @@ +<% if User.current.logged? %> +<% end %> <%= form_tag(bids_path, :method => :get) do %>
<%=l(:label_bid_plural)%> @@ -10,7 +12,7 @@ <%= submit_tag l(:label_search), :class => "small", :name => nil %>
-<% end %> +<%end%>
<%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index cabf9a294..50ca2bf91 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -1,7 +1,64 @@ + + + +<% if User.current.logged? %>
- <%= toggle_link l(:button_bidding), 'put-bid-form', {:focus => 'project_id'} %> + <%= toggle_link l(:button_bidding), 'put-bid-form' %>
-
<%= select_tag 'bid', options_for_select(@option), :name => 'bid', :class => 'grayline' %>
- - - -
<%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :value => "请输入应标理由", :style => "resize: none;", :class => 'noline'%>
- - - + + + +
<%= f.submit l(:button_add)%><%= link_to_function l(:button_cancel), '$("#put-bid-form").hide();'%><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, + :onfocus => "clearInfo('bid_message')", :onblur => "showInfo('bid_message')", + :value => "请输入应标理由", :style => "resize: none;", :class => 'noline'%>
<%= submit_tag l(:button_add), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'"%> + <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", + :onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
<% end %> +<% end %>
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %> diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index 8da757d8d..06305a723 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -8,7 +8,13 @@ - + diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index 8c007a321..47c77ebd1 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -1,15 +1,69 @@ -

<%= l(:label_leave_message_to, :name => "user") %>

+ -<%= form_for("new_form", :remote => true, :url => {:controller => 'words', + + +<%= form_for('new_form', :remote => true, :method => :post, + :url => {:controller => 'words', :action => 'create', :user_id => user.id, - :sta => sta}) do |f| %> - -

<%= label_tag 'user_message', l(:label_leave_message) %><%= f.text_area 'user_message', :rows => 3 %>

- <%= f.text_field :reference_user_id, :style=>"display:none"%> -

- <%= submit_tag l(:button_leave_meassge), :name => nil %> - <%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('user_message');", :type => 'button' %> -

+ :sta => sta}) do |f|%> +
<%=link_to journal.user, user_path(journal.user)%> 给我留言了 <%=link_to journal.user, user_path(journal.user)%> + <% if @user == User.current%> + 给我留言了 + <% else %> + 给他留言了 + <% end %> +

<%= textilizable journal.notes%>

+ + +
<%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "给他留言", :onfocus => "clearInfo('new_form_user_message')", :onblur => "showInfo('new_form_user_message')", :style => "resize: none;", :class => 'noline'%>
+ <%= f.text_field :reference_user_id, :style=>"display:none"%> + + +
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'"%> + <%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
<% end %>