Merge branch 'wordh' of 10.0.47.245:/home/trustie2 into wordh
This commit is contained in:
commit
1581a3a153
|
@ -18,6 +18,7 @@ class BidsController < ApplicationController
|
|||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :projects
|
||||
helper :words
|
||||
def index
|
||||
@project_type = params[:project_type]
|
||||
# Modified by nie
|
||||
|
@ -186,7 +187,7 @@ class BidsController < ApplicationController
|
|||
|
||||
def show
|
||||
@user = @bid.author
|
||||
@jours = @bid.journals_for_messages.reverse
|
||||
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
|
@ -195,21 +196,19 @@ class BidsController < ApplicationController
|
|||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
layout_file = ''
|
||||
case @bid.reward_type
|
||||
when 3
|
||||
layout_file = 'base_homework'
|
||||
when 1
|
||||
layout_file = 'base_bids'
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
layout_file = 'base_contest'
|
||||
end
|
||||
format.html {
|
||||
render :layout => layout_file
|
||||
}
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -502,7 +501,7 @@ class BidsController < ApplicationController
|
|||
@bid.add_jour(User.current, message, refer_user_id)
|
||||
end
|
||||
@user = @bid.author
|
||||
@jours = @bid.journals_for_messages.reverse
|
||||
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
|
|
|
@ -280,7 +280,7 @@ class ProjectsController < ApplicationController
|
|||
#Ended by young
|
||||
|
||||
def feedback
|
||||
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').reverse
|
||||
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
|
|
|
@ -175,11 +175,13 @@ class WordsController < ApplicationController
|
|||
|
||||
def obj_distinguish_url_origin
|
||||
referer = request.headers["Referer"]
|
||||
obj_id = referer.match((%r|/([0-9]{1,})/|))[1]
|
||||
obj_id = referer.match(%r(/([0-9]{1,})(/|$)))[1]
|
||||
if referer.match(/project/)
|
||||
obj = Project.find_by_id(obj_id)
|
||||
elsif referer.match(/user/)
|
||||
obj = User.find_by_id(obj_id)
|
||||
elsif ( referer.match(/bids/) || referer.match(/calls/) )
|
||||
obj = Bid.find_by_id(obj_id)
|
||||
else
|
||||
raise 'create reply obj unknow type.'
|
||||
end
|
||||
|
@ -192,6 +194,8 @@ class WordsController < ApplicationController
|
|||
obj.add_jour(nil, nil, nil, options)
|
||||
elsif obj.kind_of? Project
|
||||
Project.add_new_jour(nil, nil, obj.id, options)
|
||||
elsif obj.kind_of? Bid
|
||||
obj.add_jour(nil, nil, nil, options)
|
||||
else
|
||||
raise 'create reply obj unknow type.'
|
||||
end
|
||||
|
|
|
@ -110,16 +110,17 @@ module WelcomeHelper
|
|||
# activity.scope=['memos']
|
||||
# activity.events_welcome(nil, nil, {:limit => limit})
|
||||
|
||||
# resultSet = Memo.where('memos.parent_id IS NULL').includes(:last_reply).order('COALESCE (last_replies_memos.created_at, memos.created_at) DESC').limit(limit)
|
||||
resultSet = Memo.where('memos.parent_id IS NULL').includes(:last_reply).order('COALESCE (last_replies_memos.created_at, memos.created_at) DESC').limit(limit)
|
||||
# resultSet += Message.where('messages.parent_id IS NULL').includes(:last_reply).order('COALESCE (last_replies_messages.created_on, messages.created_on) DESC').limit(limit)
|
||||
resultSet = Memo.includes(:children).where('parent_id IS NULL').order('updated_at DESC').limit(limit)
|
||||
resultSet += Message.includes(:children).where('parent_id IS NULL').order('updated_on DESC').limit(limit)
|
||||
resultSet.sort! {|x,y| y.event_datetime <=> x.event_datetime}
|
||||
resultSet = resultSet.to_a
|
||||
for i in 0..(resultSet.size-1)
|
||||
resultSet[i] = resultSet[i].children.last if resultSet[i].children.count > 0
|
||||
end
|
||||
resultSet.take(limit)
|
||||
|
||||
# resultSet = Memo.includes(:children).where('parent_id IS NULL').order('updated_at DESC').limit(limit)
|
||||
# resultSet += Message.includes(:children).where('parent_id IS NULL').order('updated_on DESC').limit(limit)
|
||||
# resultSet.sort! {|x,y| y.event_datetime <=> x.event_datetime}
|
||||
# resultSet = resultSet.to_a
|
||||
# for i in 0..(resultSet.size-1)
|
||||
# resultSet[i] = resultSet[i].children.last if resultSet[i].children.count > 0
|
||||
# end
|
||||
# resultSet.take(limit)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -77,8 +77,14 @@ class Bid < ActiveRecord::Base
|
|||
# safe_attributes 'name',
|
||||
# 'description',
|
||||
# 'deadline'
|
||||
def add_jour(user, notes, reference_user_id = 0)
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
else
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
end
|
||||
|
||||
def self.creat_bids(budget, deadline, name, description=nil, reward_type)
|
||||
|
|
|
@ -1,26 +1,10 @@
|
|||
|
||||
<table width="660px" border="0" align="center" style="padding-left: 26px">
|
||||
<tr><td>
|
||||
<% if @bid.reward_type ==3 %>
|
||||
<td class="font_lighter" style="font-size: 15px;"><%=l(:label_student_response)%></td>
|
||||
<% else %>
|
||||
<td class="font_lighter" style="font-size: 15px;"><%=l(:label_user_response)%></td>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<% tip1 = (@bid.reward_type == 3) ? l(:label_student_response) : l(:label_user_response) %>
|
||||
<p class="font_lighter" style="font-size: 15px; padding-left: 85px; "><%=tip1%></p>
|
||||
|
||||
<div id='leave-message'>
|
||||
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
|
||||
</div>
|
||||
|
||||
|
||||
<% if journals.size >0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in journals%>
|
||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<% label = '';
|
||||
<% label = '';
|
||||
case @bid.reward_type
|
||||
when 1
|
||||
label = l(:label_respond_requirement)
|
||||
|
@ -30,24 +14,42 @@
|
|||
label = l(:label_question_requirement)
|
||||
else
|
||||
end
|
||||
%>
|
||||
%>
|
||||
|
||||
|
||||
<% if journals.size >0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in journals%>
|
||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<span class="body">
|
||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||
<span class="font_lighter"><%= label %></span>
|
||||
<%= textilizable journal.notes%>
|
||||
<div> <%= textilizable journal.notes%> </div>
|
||||
<span class="font_lighter"><%= l(:label_bids_published) %> <%= time_tag(journal.created_on).html_safe %> <%= l(:label_bids_published_ago) %></span>
|
||||
<span><% if @user==User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true,
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<span>
|
||||
<%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true,
|
||||
:method => 'post', :title => l(:button_quote))%>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm),
|
||||
<%= link_to l(:label_bid_respond_quote),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"}
|
||||
%>
|
||||
<% if @user==User.current|| User.current.admin? %>
|
||||
<%#= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm),
|
||||
:remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_bid_respond_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true,
|
||||
:method => 'post', :title => l(:button_quote))%>
|
||||
<% end %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<div style="clear: both;"></div>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<div id='<%= ids %>' class="respond-form">
|
||||
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div>
|
||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf""><%= l(:label_contest_innovate) %></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_contest_innovate) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
|
@ -54,4 +54,4 @@
|
|||
<%= render :partial => "layouts/no_content"%>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% html_title l(:label_contest_list)%>
|
||||
|
|
|
@ -36,3 +36,5 @@
|
|||
<%= render :partial => "layouts/no_content"%>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% html_title l(:label_requirement_enterprise_list)%>
|
|
@ -29,3 +29,5 @@
|
|||
<% else %>
|
||||
<%= render :partial => "layouts/no_content" %>
|
||||
<% end %>
|
||||
|
||||
<%html_title l(:label_forum)%>
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
<div class="tools ">
|
||||
<ul><h3>项目交流</h3>
|
||||
<li><%= link_to l(:project_module_documents), project_documents_path(@project) %></li>
|
||||
<li><%= link_to l(:project_module_wiki), project_wiki_path(@project) %></li>
|
||||
<li><%= link_to l(:label_project_tool_response) ,project_feedback_path(@project) %></li>
|
||||
<li><%= link_to l(:project_module_files) ,project_files_path(@project) %></li>
|
||||
<li><%= link_to l(:project_module_wiki), project_wiki_path(@project) %></li>
|
||||
</ul>
|
||||
<ul><h3>进度跟踪</h3>
|
||||
<li><%= link_to l(:project_module_calendar),project_calendar_path(@project) %></li>
|
||||
|
@ -15,7 +15,7 @@
|
|||
</ul>
|
||||
<ul><h3>其他工具</h3>
|
||||
<li><%= link_to l(:label_module_share) ,share_show_path(@project) %></li>
|
||||
<li><%= link_to l(:label_project_tool_response) ,project_feedback_path(@project) %></li>
|
||||
<li><%= link_to l(:project_module_documents), project_documents_path(@project) %></li>
|
||||
<li></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf""><%= l(:label_course_practice) %></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_course_practice) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged?%>
|
||||
|
@ -65,4 +65,4 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
<% html_title(l(:label_new_course)) -%>
|
||||
|
|
|
@ -43,11 +43,6 @@ function checkMaxLength() {
|
|||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<span class="body">
|
||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||
<% if @user == User.current %>
|
||||
<span class="font_lighter"><%= l(:label_leave_me_message) %> :</span>
|
||||
<% else %>
|
||||
<span class="font_lighter"><%= l(:label_leave_others_message) %> :</span>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= textilizable journal.notes%>
|
||||
</p>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% if @journal_destroyed.nil? %>
|
||||
alert('<%=l(:notice_failed_delete)%>');
|
||||
<% elsif (['Principal','Project'].include? @journal_destroyed.jour_type)%>
|
||||
<% elsif (['Principal','Project', 'Bid'].include? @journal_destroyed.jour_type)%>
|
||||
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
|
||||
destroyedItem.fadeOut(600,function(){
|
||||
destroyedItem.remove();
|
||||
|
|
|
@ -1562,6 +1562,7 @@ en:
|
|||
label_noawards: No awards
|
||||
label_user_location: Location
|
||||
label_requirement_enterprise: Requirements
|
||||
label_requirement_enterprise_list: Requirements List
|
||||
label_contest_innovate: Competitions
|
||||
label_software_user: Users
|
||||
label_course_practice: Courses
|
||||
|
|
|
@ -445,7 +445,7 @@ zh:
|
|||
project_module_time_tracking: 时间跟踪
|
||||
project_module_news: 新闻
|
||||
project_module_documents: 文档
|
||||
project_module_files: 文件共享
|
||||
project_module_files: 版本下载
|
||||
project_module_wiki: Wiki
|
||||
project_module_repository: 版本库
|
||||
project_module_boards: 讨论区
|
||||
|
@ -515,6 +515,7 @@ zh:
|
|||
label_software_user: 软件创客
|
||||
label_contest_innovate: 创新竞赛
|
||||
label_requirement_enterprise: 软件众包
|
||||
label_requirement_enterprise_list: 众包列表
|
||||
label_new_homework: 作业
|
||||
label_new_contest: 竞赛
|
||||
label_requirement_focus: 关注需求
|
||||
|
|
Loading…
Reference in New Issue