diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index e785ff381..749d40a7d 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -3,6 +3,7 @@ class BidsController < ApplicationController before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add] helper :watchers + def index if params[:bid_title] Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) @@ -32,6 +33,13 @@ class BidsController < ApplicationController end def show_project + @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) + @option = [] + @membership.each do |membership| + @option << membership.project + end + # a = [1] + # @project = Project.where("id in []", a) @user = @bid.author @bidding_project = @bid.biding_projects respond_to do |format| @@ -43,9 +51,9 @@ class BidsController < ApplicationController end def add - project_id = params[:bid_for_save][:project_id] + project = Project.where('name = ?', params[:bid]).first bid_message = params[:bid_for_save][:bid_message] - BidingProject.cerate_bidding(@bid.id, project_id, bid_message) + BidingProject.cerate_bidding(@bid.id, project.id, bid_message) @bidding_project = @bid.biding_projects respond_to do |format| # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} @@ -56,7 +64,7 @@ class BidsController < ApplicationController def create if params[:user_message].size>0 - message = params[:user_message] + message = params[:user_message][:message] @bid.add_jour(User.current, message) # if a_message.size > 5 # @message = a_message[-5, 5] diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 4135208ac..ca0d8764a 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -1,6 +1,8 @@ - -<% if journals.size > 5 %> + + + +
<%=l(:label_user_response)%>(<%= journals.count%>)<% if journals.size > 5 %> <% unless state%>
<%= link_to l(:button_more), @@ -16,22 +18,35 @@ :method => 'get' %>
<% end %> -<% end %> - -

<%=l(:label_user_response)%>(<%= journals.count%>)

+<% end %>
+
<% unless state%> <% if journals.size > 5 %> <% journals = journals[0, 5] %> <% end %> <% end %> -<% for journal in journals %> -
-
-

<%= link_to "##{journal.indice}", {}, :class => "journal-link" %> - <%= avatar(journal.user, :size => "24") %> - <%= l(:label_updated_time_by, :author => journal.user, :age => time_tag(journal.created_at)).html_safe%>

- <%= render_notes(bid, journal, :reply_links => true) unless journal.notes.blank? %> -
-
- <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> + +<% if journals.size >0 %> +<% remove_allowed = (User.current.id == journals.first.jour_id) %> +<% for journal in journals%> + + + + + +
<%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> + + + + + + + + + + +
<%=link_to journal.user, user_path(journal.user)%> 对需求进行了反馈<%= link_to "##{journal.indice}", {}, :class => "journal-link" %>

<%= textilizable journal.notes%>

<%= journal.created_at %><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, + :method => 'post', :title => l(:button_quote))%><%= link_to(image_tag('delete.png'), {:controller => 'bids', :action => 'destroy', :object_id => journal, :bid_id => bid}, + :remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.user_id == User.current.id %>
+<% end %> <% end %> diff --git a/app/views/bids/_new.html.erb b/app/views/bids/_new.html.erb index 1e3958148..c6ab08a4a 100644 --- a/app/views/bids/_new.html.erb +++ b/app/views/bids/_new.html.erb @@ -1,13 +1,14 @@ -<%= form_tag({:controller => 'bids', + +<%= form_for('user_message', :remote => true, :method => :post, + :url => {:controller => 'bids', :action => 'create', :bid_id => bid, - :sta => sta}, - :remote => true, - :method => :post) do %> - -

<%= label_tag 'user_message', l(:label_leave_message) %><%= text_area_tag 'user_message', nil %>

-

- <%= 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|%> + + + + + +
<%= f.text_area 'message', :rows => 4, :cols => 65, :value => "我要反馈", :required => true, :style => "resize: none;" %>
<%= submit_tag l(:button_leave_meassge), :name => nil %> + <%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('user_message_message');", :type => 'button' %>
<% end %> diff --git a/app/views/bids/_project_list.html.erb b/app/views/bids/_project_list.html.erb index 53eda2b0e..5f569c725 100644 --- a/app/views/bids/_project_list.html.erb +++ b/app/views/bids/_project_list.html.erb @@ -1,21 +1,28 @@ <% @bidding_project.each do |b_project|%> -
  • - - - + +
    - - - - -
    - - - - - - - -
    <%= link_to(b_project.project.name, project_path(b_project.project)) %>
    <%= b_project.project.description %>
    + + + - - - - -
    + + + + + - -
    +
    + <%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %> +
    + + + + + + + + + + + +
    <%= link_to(b_project.project.name, project_path(b_project.project)) %>参与了应标
    <%= b_project.project.description %>
    <%= b_project.created_at%>
    +
    @@ -23,13 +30,10 @@ -
    应标人:<%= link_to(b_project.user.name, user_path(b_project.user)) %>
    应标宣言:<%= b_project.description %>
     
    - +
    +
    + + <% end %> diff --git a/app/views/bids/add.js.erb b/app/views/bids/add.js.erb index 9a6d1515a..aaed6524d 100644 --- a/app/views/bids/add.js.erb +++ b/app/views/bids/add.js.erb @@ -1,4 +1,4 @@ $('#bidding_project_list').html('<%= escape_javascript(render(:partial => 'project_list', :locals => {:bidding_project => @bidding_project})) %>'); $("#project_id").val("请选择项目"); -$("#project_id").val("请输入应标理由"); +$("#bid_message").val("请输入应标理由"); $("#put-bid-form").hide(); \ No newline at end of file diff --git a/app/views/bids/create.js.erb b/app/views/bids/create.js.erb index a524d9dd8..15cf3f20d 100644 --- a/app/views/bids/create.js.erb +++ b/app/views/bids/create.js.erb @@ -1,2 +1,2 @@ -$('#history').html('<%= escape_javascript(render(:partial => 'history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>'); -$('#user_message').val(""); +$('#history').html('<%= escape_javascript(render(:partial => 'bids/history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>'); +$('#user_message_message').val(""); diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 74c0531f3..0cb206d03 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -1,37 +1,44 @@
    - <%= link_to("新建需求", {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %> + <%= link_to("新建需求", {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add', :style => "margin-right: 100px;") %>
    -

    需求列表

    + + +
    需求列表
    - \ No newline at end of file +<% end %> diff --git a/app/views/bids/new.js.erb b/app/views/bids/new.js.erb index d2cdeaae9..2a4df8a67 100644 --- a/app/views/bids/new.js.erb +++ b/app/views/bids/new.js.erb @@ -1,2 +1,2 @@ -$('#user_message').val("<%= raw escape_javascript(@content) %>"); +$('#user_message_message').val("<%= raw escape_javascript(@content) %>"); showAndScrollTo("user_message", "user_message"); diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index a82711081..a5f259e7b 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -1,11 +1,25 @@ -

    <%= link_to(@bid.author.name, user_path(@bid.author))%>:<%= @bid.name %>

    - - - - - +

    需求描述

    <%= @bid.description %>
    + + + +
    <%= link_to image_tag(url_to_avatar(@bid.author), :class => "avatar"), user_path(@bid.author), :class => "avatar" %> + + + + + + +

    <%= link_to(@bid.author.name, user_path(@bid.author))%>:<%= @bid.name %>

    悬赏:<%= @bid.budget %>
    +
    + + + + + +
    <%= @bid.description %>
    +
    <%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %> diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index c1af73b3b..8a5d13f99 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -1,32 +1,29 @@ -
    -
    -
    -<%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %> +
    +
    + <%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %> +
    -

    应标项目列表

    -
      -
      - <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %> -
      -
    - + + +
    应标项目(<%= @bidding_project.count%>)
    +
    + <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %> +
    diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index f61d1d1c7..e5aa2a086 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -56,19 +56,18 @@
    - 关注 (<%= link_to @bid.watcher_users.count, home_path %>)  应标项目 (<%= link_to @bid.biding_projects.count, home_path %>)反馈(<%= @bid.commit%>) + 关注 (<%= link_to @bid.watcher_users.count, home_path %>)  应标项目 (<%= link_to @bid.biding_projects.count, project_for_bid_path(@bid) %>) 反馈(<%= link_to @bid.commit, respond_path(@bid)%>)
    -
    - +
    +
    + 标签 +
    +
    - - - - +
    标签云:
    -
    +
    <%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%> -
    @@ -86,10 +85,7 @@ <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %> <% end%> - - - <%= link_to "显示所有关注",home_path %>(<%= link_to @bid.watcher_users.count, home_path %>) - +
    @@ -102,11 +98,11 @@
    - - - - - + +
    <%= link_to "显示所有应标项目",home_path %>(<%= link_to @bid.biding_projects.count, home_path %>)
    + <% for project in @bid.projects%> + <%= link_to image_tag(url_to_avatar(project), :class => "avatar"), project_path(project), :class => "avatar" %> + <% end%>
    diff --git a/config/routes.rb b/config/routes.rb index 51daeb281..b3a8c225e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -408,13 +408,13 @@ RedmineApp::Application.routes.draw do delete 'bids/destroy', :to => 'bids#destroy' get 'bids/more', :to => 'bids#more' get 'bids/back', :to=> 'bids#back' - match 'bids/:bid_id/show_project', :controller => 'bids', :action => 'show_project' + match 'bids/:bid_id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' match 'bids/:bid_id/add', :controller => 'bids', :action => 'add' match 'bids/new_bid', :controller => 'bids', :action => 'new_bid' # added by young match 'bids', :controller => 'bids', :action => 'index' - match 'bids/:bid_id/show', :controller => 'bids', :action => 'show' + match 'bids/:bid_id/show', :controller => 'bids', :action => 'show', :as => 'respond' match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post] diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 7b40d828b..ec60c8ef5 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1502,4 +1502,18 @@ div.member_content { margin-top: 20px; width: 600px; margin-left: 40px; +} +/*by fanqiang*/ +img.avatar3 { + width: 50px; + height: 50px; +} + +a.bid_path { + font-size: 14px; +} +a.bid_user { + font-family:微软雅黑; + color:#acaeb1; + font-size:12px; } \ No newline at end of file