This commit is contained in:
nwb 2014-06-30 17:26:25 +08:00
commit 6141cc56e6
15 changed files with 115 additions and 43 deletions

View File

@ -805,7 +805,10 @@ class BidsController < ApplicationController
@homework = @bid
@course = Course.find_by_id(params[:course_id])
@course_id = @course.id
#respond_to do |format|
# format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
# format.api { render_validation_errors(@bid) }
#end
render file: 'courses/new_homework', layout: 'base_courses'
end
end

View File

@ -489,19 +489,9 @@ class CoursesController < ApplicationController
# 新建作业
def new_homework
if (User.current.logged? &&
(User.current.admin? ||
(
!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? &&
(
Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles &&
( Role.where(id: [3, 4, 7, 9]).size > 0 )
)
)
)
)
@homework = Bid.new
@homework.safe_attributes = params[:bid]
@homework = Bid.new
@homework.safe_attributes = params[:bid]
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
render_404

View File

@ -15,9 +15,9 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
belongs_to :project,
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :project
#:foreign_key => 'jour_id',
#:conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :course,
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Course' "

View File

@ -70,8 +70,8 @@
</td>
</tr>
<tr>
<td colspan="2"> <% if bid.reward_type.nil? or bid.reward_type == 1 %> <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>
<td colspan="2"> <% if bid.reward_type.nil? or bid.reward_type == 1 %> <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 %>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
@ -83,9 +83,12 @@
</span></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"><span> <%= l(:label_create_time) %> :&nbsp; <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> :&nbsp; <%=bid.deadline %></span></td>
<td></td>
</tr>
<td style="text-align: left">
<span class="font_lighter">
<%= l(:label_create_time) %> :&nbsp; <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> :&nbsp; <%=bid.deadline %>
</span></td>
<td></td>
</tr>
</table></td>
</tr>
</table>
@ -94,7 +97,7 @@
<% end %>
<div class="pagination">
<ul>
<%= pagination_links_full bid_pages %>
<ul>
<ul>
<%= pagination_links_full bid_pages %>
</ul>
</div>

View File

@ -93,7 +93,8 @@
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<option value = '2017'>2017</option>".html_safe %></td></tr></table>
</p>
<% elsif @course.time == 2009 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
@ -236,7 +237,8 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% end %>
<% end %></td>
<% end %>
</td>
<td>
<% unless @course.nil? %>
<% if @course.term == l(:label_spring) %>
@ -276,7 +278,8 @@
<% end %>
<% end %></td></tr></table></p>
<% end %></td></tr></table>
</p>
<!-- end -->
@ -291,12 +294,12 @@
<!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<!-- <p style="margin-left:-10px;"><%#= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<p style="margin-left:-10px;"><label for="course[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@course.password %>" size="60" name="course[password]"></p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<% end %>
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%#= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
<p style="margin-left:-20px;padding-right: 20px;"><label for="course_description" style="font-size: 13px;"><%=l(:label_new_course_description)%></label><span class="jstEditor"><textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40" ><%=@course.description%></textarea></span></p>

View File

@ -25,11 +25,12 @@
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<!-- <p><%= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}") %><%= calendar_for('bid_deadline')%>
</p>
<p><%= f.select :is_evaluation, is_evaluation_option %>
</p>

View File

@ -1,6 +1,6 @@
<h3><%=l(:label_course_new_homework)%></h3>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id=>@course.id} do |f| %>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %>

View File

@ -0,0 +1,8 @@
<div>技术得分:</div>
<div>&nbsp;&nbsp;&nbsp; 踩别人的帖子 -2</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员顶 +4</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员顶 +6</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员顶 +8</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员踩 -2</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员踩 -4</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员踩 -6</div>

View File

@ -0,0 +1,6 @@
<div>项目贡献得分:</div>
<div>&nbsp;&nbsp;&nbsp; 提交代码 +4</div>
<div>&nbsp;&nbsp;&nbsp; 提交文档 +4</div>
<div>&nbsp;&nbsp;&nbsp; 提交附件 +4</div>
<div>&nbsp;&nbsp;&nbsp; 更新缺陷完成度 +2</div>
<div>&nbsp;&nbsp;&nbsp; 发布缺陷 +4</div>

View File

@ -0,0 +1,2 @@
<div>影响力得分:</div>
<div>&nbsp;&nbsp;&nbsp; 被关注人数 +2/人</div>

View File

@ -48,23 +48,23 @@
<table style="border-bottom: solid 0px #80a6d2;" width="100%">
<tr>
<%= l(:label_user_score) %> :
<%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_collaboration) %> :
<%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_influence) %> :
<%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_skill) %> :
<%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_active) %>
<%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %>
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
</tr><br>
</table>

View File

@ -0,0 +1 @@
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_new_score_index', :locals => {:index =>0 }) %>');

View File

@ -0,0 +1 @@
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_new_score_index', :locals => {:index =>0 }) %>');

View File

@ -0,0 +1 @@
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_new_score_index', :locals => {:index =>0 }) %>');

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140617013146) do
ActiveRecord::Schema.define(:version => 20140626012511) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -175,6 +175,58 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id"
t.integer "change_id"
t.integer "attachment_id"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.string "action_type"
t.integer "changeset_id"
end
create_table "code_review_project_settings", :force => true do |t|
t.integer "project_id"
t.integer "tracker_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "updated_by"
t.boolean "hide_code_review_tab", :default => false
t.integer "auto_relation", :default => 1
t.integer "assignment_tracker_id"
t.text "auto_assign"
t.integer "lock_version", :default => 0, :null => false
t.boolean "tracker_in_review_dialog", :default => false
end
create_table "code_review_user_settings", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.integer "mail_notification", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "code_reviews", :force => true do |t|
t.integer "project_id"
t.integer "change_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "line"
t.integer "updated_by_id"
t.integer "lock_version", :default => 0, :null => false
t.integer "status_changed_from"
t.integer "status_changed_to"
t.integer "issue_id"
t.string "action_type"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.integer "attachment_id"
t.integer "file_count", :default => 0, :null => false
t.boolean "diff_all"
end
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@ -374,12 +426,13 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
t.integer "project_id", :default => 0
end
create_table "homework_for_courses", :force => true do |t|
@ -740,7 +793,7 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
end
create_table "relative_memos", :force => true do |t|
t.integer "osp_id", :null => false
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false