| @@ -228,6 +228,11 @@ class BidsController < ApplicationController | |||||
| @bid.author_id = User.current.id | @bid.author_id = User.current.id | ||||
| @bid.commit = 0 | @bid.commit = 0 | ||||
| if @bid.save | if @bid.save | ||||
| unless @bid.watched_by?(User.current) | |||||
| if @bid.add_watcher(User.current) | |||||
| flash[:notice] = l(:label_bid_succeed) | |||||
| end | |||||
| end | |||||
| redirect_to respond_path(@bid) | redirect_to respond_path(@bid) | ||||
| else | else | ||||
| @bid.safe_attributes = params[:bid] | @bid.safe_attributes = params[:bid] | ||||
| @@ -114,7 +114,14 @@ class IssuesController < ApplicationController | |||||
| @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } | ||||
| @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | ||||
| @edit_allowed = User.current.allowed_to?(:edit_issues, @project) | |||||
| # @edit_allowed = User.current.allowed_to?(:edit_issues, @project) | |||||
| if User.current.admin? || User.current.id == @issue.author_id || User.current.id == @issue.assigned_to_id || ProjectInfo.manager?(User.current.id, @project) | |||||
| @edit_allowed = true | |||||
| # elsif User.current.id == @issue.author.id | |||||
| else | |||||
| @edit_allowed = false | |||||
| end | |||||
| # @edit_allowed = User.current.allowed_to?(:edit_issues, @project) | |||||
| @priorities = IssuePriority.active | @priorities = IssuePriority.active | ||||
| @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) | ||||
| @@ -1,8 +1,17 @@ | |||||
| class ProjectInfo < ActiveRecord::Base | class ProjectInfo < ActiveRecord::Base | ||||
| attr_accessible :project_id, :user_id | attr_accessible :project_id, :user_id | ||||
| belongs_to :project | belongs_to :project | ||||
| belongs_to :user | belongs_to :user | ||||
| validates_presence_of :project_id, :user_id | validates_presence_of :project_id, :user_id | ||||
| validates_uniqueness_of :project_id, :scope => :user_id | validates_uniqueness_of :project_id, :scope => :user_id | ||||
| def self.manager? (user_id, project) | |||||
| for project_info in project.project_infos | |||||
| if project_info.user_id == user_id | |||||
| return true | |||||
| end | |||||
| end | |||||
| return false | |||||
| end | |||||
| end | end | ||||
| @@ -15,11 +15,11 @@ | |||||
| <table border="0"> | <table border="0"> | ||||
| <tr><td> | <tr><td> | ||||
| <% if bid.reward_type.nil? or bid.reward_type == 1%> | <% if bid.reward_type.nil? or bid.reward_type == 1%> | ||||
| <strong><%= l(:label_bids_reward_method) %><span style="color: rgb(255, 0, 0);font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %> <%= bid.budget%><%= l(:label_RMB_sign) %></span></strong> | |||||
| <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= bid.budget%></span></strong> | |||||
| <% elsif bid.reward_type == 2%> | <% elsif bid.reward_type == 2%> | ||||
| <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong> | <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong> | ||||
| <% else %> | <% else %> | ||||
| <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %> <%= bid.budget%><%= l(:label_bids_grade_number) %></span></strong> | |||||
| <strong><%= l(:label_bids_reward_method) %><span style="color: #54ed24;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %> <%= bid.budget%><%= l(:label_bids_grade_number) %></span></strong> | |||||
| <% end %> | <% end %> | ||||
| <span class="font_lighter">(<%= link_to bid.biding_projects.count, project_for_bid_path(bid)%>)<%= l(:label_biding_project) %></span> | <span class="font_lighter">(<%= link_to bid.biding_projects.count, project_for_bid_path(bid)%>)<%= l(:label_biding_project) %></span> | ||||
| <span class="font_lighter">(<%= link_to bid.commit, respond_path(bid)%>)<%= l(:label_responses) %></span> | <span class="font_lighter">(<%= link_to bid.commit, respond_path(bid)%>)<%= l(:label_responses) %></span> | ||||
| @@ -24,7 +24,7 @@ | |||||
| <td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td> | <td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td align="left"><span class="font_lighter"> <%= journal.created_on %></span></td> | |||||
| <td align="left"><span class="font_lighter">发布于 <%= time_tag(journal.created_on).html_safe %>之前</span></td> | |||||
| <td width="200" align="right" class="a"><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, | <td width="200" align="right" class="a"><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, | ||||
| :method => 'post', :title => l(:button_quote))%> | :method => 'post', :title => l(:button_quote))%> | ||||
| <%= link_to(image_tag('delete.png'), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm), | <%= link_to(image_tag('delete.png'), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm), | ||||
| @@ -1,5 +1,5 @@ | |||||
| <!-- fq --> | <!-- fq --> | ||||
| <%= form_tag(bids_path, :method => :get) do %> | |||||
| <%= form_tag(calls_path, :method => :get) do %> | |||||
| <div class="project-search-block"> | <div class="project-search-block"> | ||||
| <table width="100%" valign="center"> | <table width="100%" valign="center"> | ||||
| <tr> | <tr> | ||||
| @@ -8,11 +8,11 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <% if @bid.reward_type.nil? or @bid.reward_type == 1%> | <% if @bid.reward_type.nil? or @bid.reward_type == 1%> | ||||
| <td><strong><%= l(:label_bids_reward_method) %><span style="color: rgb(255, 0, 0);font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %> <%= @bid.budget%><%= l(:label_RMB_sign) %></span></strong></td> | |||||
| <td><strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%></span></strong></td> | |||||
| <% elsif @bid.reward_type == 2%> | <% elsif @bid.reward_type == 2%> | ||||
| <td><strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= @bid.budget%></span></strong></td> | <td><strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= @bid.budget%></span></strong></td> | ||||
| <% else %> | <% else %> | ||||
| <td><strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %> <%= @bid.budget%><%= l(:label_bids_grade_number) %></span></strong></td> | |||||
| <td><strong><%= l(:label_bids_reward_method) %><span style="color: #54ed24;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %> <%= @bid.budget%><%= l(:label_bids_grade_number) %></span></strong></td> | |||||
| <% end %> | <% end %> | ||||
| </tr> | </tr> | ||||
| </table></td> | </table></td> | ||||
| @@ -2,7 +2,7 @@ | |||||
| <%= error_messages_for 'issue', 'time_entry' %> | <%= error_messages_for 'issue', 'time_entry' %> | ||||
| <%= render :partial => 'conflict' if @conflict %> | <%= render :partial => 'conflict' if @conflict %> | ||||
| <div class="box"> | <div class="box"> | ||||
| <% if @edit_allowed || !@allowed_statuses.empty? %> | |||||
| <% if @edit_allowed && !@allowed_statuses.empty? %> | |||||
| <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> | <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> | ||||
| <div id="all_attributes"> | <div id="all_attributes"> | ||||
| <%= render :partial => 'form', :locals => {:f => f} %> | <%= render :partial => 'form', :locals => {:f => f} %> | ||||
| @@ -49,7 +49,7 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <% if @bid.reward_type.nil? or @bid.reward_type == 1%> | <% if @bid.reward_type.nil? or @bid.reward_type == 1%> | ||||
| <td><%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= @bid.budget%><%= l(:label_RMB_sign) %></td> | |||||
| <td><%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%></td> | |||||
| <% elsif @bid.reward_type == 2%> | <% elsif @bid.reward_type == 2%> | ||||
| <td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td> | <td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td> | ||||
| <% else %> | <% else %> | ||||
| @@ -82,7 +82,7 @@ RedmineApp::Application.routes.draw do | |||||
| match 'user_projects', :to => 'users#user_projects', :via => :get, :as => "user_projects" | match 'user_projects', :to => 'users#user_projects', :via => :get, :as => "user_projects" | ||||
| match 'user_activities', :to => 'users#show', :via => :get, :as => "user_activities" | match 'user_activities', :to => 'users#show', :via => :get, :as => "user_activities" | ||||
| match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" | match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" | ||||
| match 'watch_bids', :controller => 'users', :action => 'watch_bids', :via => [:get , :post] | |||||
| match 'watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post] | |||||
| match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' | match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' | ||||
| match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang | match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang | ||||
| match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang | match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang | ||||
| @@ -429,23 +429,23 @@ RedmineApp::Application.routes.draw do | |||||
| get 'words/more', :to => 'words#more' | get 'words/more', :to => 'words#more' | ||||
| get 'words/back', :to=> 'words#back' | get 'words/back', :to=> 'words#back' | ||||
| ############## fq | ############## fq | ||||
| post 'bids/create', :to => 'bids#create' | |||||
| delete 'bids/destroy', :to => 'bids#destroy' | |||||
| match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post] | |||||
| get 'bids/more', :to => 'bids#more' | |||||
| get 'bids/back', :to=> 'bids#back' | |||||
| match 'bids/new_bid', :controller => 'bids', :action => 'new_bid' | |||||
| match 'bids/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' | |||||
| match 'bids/:id/add', :controller => 'bids', :action => 'add' | |||||
| post 'calls/create', :to => 'bids#create' | |||||
| delete 'calls/destroy', :to => 'bids#destroy' | |||||
| match 'calls/new', :controller => 'bids', :action => 'new', :via => [:get , :post] | |||||
| get 'calls/more', :to => 'bids#more' | |||||
| get 'calls/back', :to=> 'bids#back' | |||||
| match 'calls/new_bid', :controller => 'bids', :action => 'new_bid' | |||||
| match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' | |||||
| match 'calls/:id/add', :controller => 'bids', :action => 'add' | |||||
| match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond' | match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond' | ||||
| match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' | match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' | ||||
| match 'bids/create_bid', :to => 'bids#create_bid' | |||||
| match 'calls/create_bid', :to => 'bids#create_bid' | |||||
| ## 测试用 | ## 测试用 | ||||
| # match 'test/index', :controller => 'test', :action => 'index' | # match 'test/index', :controller => 'test', :action => 'index' | ||||
| # added by young | # added by young | ||||
| match 'bids', :controller => 'bids', :action => 'index' | |||||
| match 'calls', :controller => 'bids', :action => 'index' | |||||
| match 'bids/:id', :controller => 'bids', :action => 'show', :as => 'respond' | |||||
| match 'calls/:id', :controller => 'bids', :action => 'show', :as => 'respond' | |||||
| ######added by nie | ######added by nie | ||||
| match 'tags/show_projects_tags',:to => 'tags#show_projects_tags' | match 'tags/show_projects_tags',:to => 'tags#show_projects_tags' | ||||