修改需求页面的一些细节,修改了更新问题的权限,现在更新问题的角色包括超级管理员,管理员,问题创建者,问题指派人员

This commit is contained in:
baiyu 2013-08-22 20:26:56 +08:00
parent 83ff8a31c1
commit 074e8adfdd
10 changed files with 43 additions and 22 deletions

View File

@ -228,6 +228,11 @@ class BidsController < ApplicationController
@bid.author_id = User.current.id
@bid.commit = 0
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)
else
@bid.safe_attributes = params[:bid]

View File

@ -114,7 +114,14 @@ class IssuesController < ApplicationController
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
@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
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)

View File

@ -1,8 +1,17 @@
class ProjectInfo < ActiveRecord::Base
attr_accessible :project_id, :user_id
belongs_to :project
belongs_to :user
validates_presence_of :project_id, :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

View File

@ -15,11 +15,11 @@
<table border="0">
<tr><td>
<% 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) %>&nbsp;<%= 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) %>&nbsp;<%= l(:label_RMB_sign) %><%= bid.budget%></span></strong>
<% elsif bid.reward_type == 2%>
<strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong>
<% else %>
<strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %>&nbsp;<%= 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) %>&nbsp;<%= bid.budget%><%= l(:label_bids_grade_number) %></span></strong>
<% 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.commit, respond_path(bid)%>)<%= l(:label_responses) %></span>

View File

@ -24,7 +24,7 @@
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>
</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,
: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),

View File

@ -1,5 +1,5 @@
<!-- fq -->
<%= form_tag(bids_path, :method => :get) do %>
<%= form_tag(calls_path, :method => :get) do %>
<div class="project-search-block">
<table width="100%" valign="center">
<tr>

View File

@ -8,11 +8,11 @@
</tr>
<tr>
<% 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) %>&nbsp;<%= @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) %>&nbsp;<%= l(:label_RMB_sign) %><%= @bid.budget%></span></strong></td>
<% 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>
<% else %>
<td><strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_grade) %>&nbsp;<%= @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) %>&nbsp;<%= @bid.budget%><%= l(:label_bids_grade_number) %></span></strong></td>
<% end %>
</tr>
</table></td>

View File

@ -2,7 +2,7 @@
<%= error_messages_for 'issue', 'time_entry' %>
<%= render :partial => 'conflict' if @conflict %>
<div class="box">
<% if @edit_allowed || !@allowed_statuses.empty? %>
<% if @edit_allowed && !@allowed_statuses.empty? %>
<fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
<div id="all_attributes">
<%= render :partial => 'form', :locals => {:f => f} %>

View File

@ -49,7 +49,7 @@
</tr>
<tr>
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
<td><%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %>&nbsp;<%= @bid.budget%><%= l(:label_RMB_sign) %></td>
<td><%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= @bid.budget%></td>
<% elsif @bid.reward_type == 2%>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
<% else %>

View File

@ -82,7 +82,7 @@ RedmineApp::Application.routes.draw do
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_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 '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
@ -429,23 +429,23 @@ RedmineApp::Application.routes.draw do
get 'words/more', :to => 'words#more'
get 'words/back', :to=> 'words#back'
############## 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 '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'
# 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
match 'tags/show_projects_tags',:to => 'tags#show_projects_tags'