修改了关于需求的bug,包括权限问题以及使用细节

This commit is contained in:
fanqiang 2013-08-07 16:45:04 +08:00
parent 2694611eed
commit b78504a5f1
10 changed files with 201 additions and 38 deletions

View File

@ -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

View File

@ -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)

View File

@ -1,10 +1,10 @@
<!-- fq -->
<table width="500px" border="0" style="padding-left: 10px; margin-bottom: 15px; padding-top: 10px;">
<td width="100px" class="font_lighter" style="font-size: 16px;">需求列表</td>
<td>
<td> <% if User.current.logged? %>
<div class='icon icon-add' >
<%= toggle_link l(:button_new_bid), 'put-bid-form', {:focus => 'project_id'} %>
</div></td>
</div> <% end %></td>
</table>
<% bids.each do |bid|%>

View File

@ -21,9 +21,11 @@
<% end %><td>
</tr></table>
<% if User.current.logged? %>
<div id='leave-message'>
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
</div>
<% end %>
<% unless state%>
<% if journals.size > 5 %>

View File

@ -35,6 +35,23 @@
border: #d5dee9 1px solid;
}
</style>
<script type="text/javascript" language="javascript">
function clearInfo(id) {
var text = $('#'+id);
if (text.val() == "我要反馈") {
$('#'+id).val('');
}
}
function showInfo(id) {
var text = $('#'+id);
if (text.val() == '') {
$('#'+id).val('我要反馈');
}
}
</script>
<%= form_for('bid_message', :remote => true, :method => :post,
:url => {:controller => 'bids',
:action => 'create',
@ -42,7 +59,7 @@
:sta => sta}) do |f|%>
<table border="0" width="525px" align="center" >
<tr>
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :value => "我要反馈", :style => "resize: none;", :class => 'noline'%></td>
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :value => "我要反馈", :onfocus => "clearInfo('bid_message_message')", :onblur => "showInfo('bid_message_message')", :style => "resize: none;", :class => 'noline'%></td>
</tr></table>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<table border="0" width="525px" align="center">

View File

@ -1,8 +1,18 @@
<!-- fq -->
<script type="text/javascript" language="javascript">
function clearInfo(id) {
$('#'+id).val('');
}
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
</script>
<%= form_tag({:controller => 'bids',
:action => 'new_bid',
@ -13,26 +23,26 @@
<table border="0" width="600px" style="border-left: 1px solid #acaeb1; border-right: 1px solid #acaeb1;
border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 60px; margin-left: 30px;">
<tr>
<td><%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title')"%></td>
<td><%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title', '为你的需求起个名字~~')", :onblur => "showInfo('bid_title', '为你的需求起个名字~~')"%></td>
</tr>
<tr>
<td><div class="tableline"></div></td>
</tr>
<tr>
<td><%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 8,
:onfocus => "clearInfo('bid_description')" %></td>
<td><%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 8,
:onfocus => "clearInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')", :onblur => "showInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')" %></td>
</tr>
<tr>
<td><div class="tableline"></div></td>
</tr>
<tr>
<td><%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_budget')"%></td>
<td><%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true %></td>
</tr>
<tr>
<td><div class="tableline"></div></td>
</tr>
<tr>
<td><%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_deadline')"%></td>
<td><%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_deadline')"%><%= calendar_for('bid_deadline')%></td>
</tr>
</table>
<table id="bidding_table" border="0" width="600" style="margin-top: 20px; margin-left: 30px;">

View File

@ -1,7 +1,9 @@
<!-- fq -->
<% if User.current.logged? %>
<div id="put-bid-form" style="display: none">
<%= render :partial => 'new_bid' %>
</div>
<% end %>
<%= form_tag(bids_path, :method => :get) do %>
<div class="project-search-block">
<span><%=l(:label_bid_plural)%></span>
@ -10,7 +12,7 @@
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
</div>
</div>
<% end %>
<%end%>
<div id="bid-show">
<%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
</div>

View File

@ -1,7 +1,64 @@
<!-- fq -->
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(255, 255, 255);
background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(255, 255, 255);
background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<script type="text/javascript" language="javascript">
function clearInfo(id) {
var text = $('#' + id);
if (text.val() == "请输入应标理由") {
$('#' + id).val('');
}
}
function showInfo(id) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val('请输入应标理由');
}
}
function cancel() {
$("#put-bid-form").hide();
}
</script>
<% if User.current.logged? %>
<div class="contextual">
<div class='icon icon-add' style="margin-right: 30px;">
<%= toggle_link l(:button_bidding), 'put-bid-form', {:focus => 'project_id'} %>
<%= toggle_link l(:button_bidding), 'put-bid-form' %>
</div>
</div>
<div id="put-bid-form" style="display: none">
@ -12,20 +69,20 @@
<tr>
<td><%= select_tag 'bid', options_for_select(@option), :name => 'bid', :class => 'grayline' %></td>
</tr>
</table>
<table id="bidding_table" border="0" width="400" style="border-left: 1px solid #acaeb1; border-right: 1px solid #acaeb1;
border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-left: 45px;">
<tr>
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :value => "请输入应标理由", :style => "resize: none;", :class => 'noline'%></td>
</tr>
</table>
<table id="bidding_table" border="0" width="400" style="margin-left: 45px;">
<tr>
<td><%= f.submit l(:button_add)%><%= link_to_function l(:button_cancel), '$("#put-bid-form").hide();'%></td>
<td><%= 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'%></td>
</tr>
<tr>
<td align="right"><%= 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'" %> </td>
</tr>
</table>
<% end %>
</div>
<% end %>
<div id='bidding_project_list'>
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %>

View File

@ -8,7 +8,13 @@
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong> <a class="font_lighter">给我留言了</a> </td>
<td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong>
<% if @user == User.current%>
<a class="font_lighter">给我留言了</a>
<% else %>
<a class="font_lighter">给他留言了</a>
<% end %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>

View File

@ -1,15 +1,69 @@
<!-- fq -->
<h3 class="title"><%= l(:label_leave_message_to, :name => "user") %></h3>
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(255, 255, 255);
background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(255, 255, 255);
background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<%= form_for("new_form", :remote => true, :url => {:controller => 'words',
<script type="text/javascript" language="javascript">
function clearInfo(id) {
var text = $('#'+id);
if (text.val() == "给他留言") {
$('#'+id).val('');
}
}
function showInfo(id) {
var text = $('#'+id);
if (text.val() == '') {
$('#'+id).val('给他留言');
}
}
</script>
<%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'words',
:action => 'create',
:user_id => user.id,
:sta => sta}) do |f| %>
<p><%= label_tag 'user_message', l(:label_leave_message) %><%= f.text_area 'user_message', :rows => 3 %></p>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<p class="buttons">
<%= submit_tag l(:button_leave_meassge), :name => nil %>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('user_message');", :type => 'button' %>
</p>
:sta => sta}) do |f|%>
<table border="0" width="525px" align="center" >
<tr>
<td><%= 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'%></td>
</tr></table>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<table border="0" width="525px" align="center">
<tr><td align="right"><%= 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'" %> </td></tr>
</table>
<% end %>