This commit is contained in:
huangjingquan 2013-09-13 16:36:36 +08:00
parent ffa412d290
commit 767231c202
11 changed files with 61 additions and 40 deletions

View File

@ -131,6 +131,33 @@ class BidsController < ApplicationController
end
end
##### by huang
def show_project_homework
# flash[:notice] = ""
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
@option = []
@membership.each do |membership|
@option << membership.project
end
# a = [1]
# @project = Project.where("id in []", a)
@user = @bid.author
@bidding_project = @bid.biding_projects
respond_to do |format|
if @bid.reward_type == 3
format.html {
render :layout => 'base_homework'
}
else
format.html {
render :layout => 'base_bids'
}
end
format.api
end
end
###添加应标项目
def add
project = Project.where('name = ?', params[:bid]).first

View File

@ -19,8 +19,9 @@ class BoardsController < ApplicationController
layout 'base_projects'#by young
default_search_scope :messages
before_filter :find_project_by_project_id, :find_board_if_available
before_filter :authorize, :except => [:new, :show, :create]
before_filter :authorize, :except => [:new, :show, :create, :index]
accept_rss_auth :index, :show
helper :sort
include SortHelper

View File

@ -22,7 +22,7 @@ class DocumentsController < ApplicationController
before_filter :find_project_by_project_id, :only => [:index, :new, :create]
before_filter :find_model_object, :except => [:index, :new, :create]
before_filter :find_project_from_association, :except => [:index, :new, :create]
before_filter :authorize #, :except => [:index]#Added by young
before_filter :authorize , :except => [:index]#Added by young
helper :attachments

View File

@ -22,8 +22,14 @@ class ProjectsController < ApplicationController
menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index
#by huang
# layout 'base_course'
# layout 'base_courses'# by young
# menu_item :overview
# menu_item l(:label_homework), :only => :homework
# menu_item :files, :only => :files
#
# layout 'base_courses'
# menu_item l(:label_homework), :only => homework
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
@ -351,7 +357,7 @@ class ProjectsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
if params[:continue]
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_path(attrs, :course => '1')
redirect_to new_project_path(attrs, :course => '0')
#Added by young
elsif params[:course_continue]
@ -532,7 +538,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project)
redirect_to settings_project_path(@project,:course => @project.project_type)
}
format.api { render_api_ok }
end

View File

@ -1,21 +0,0 @@
# encoding: utf-8
#
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module IssueCategoriesHelper
end

View File

@ -54,11 +54,11 @@
<% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'%></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<td class="font_index"><%=link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram">
<td align="center" width="80px"> <%= " 成员" %></td>
<td align="center" width="80px"> <%= "缺陷" %></td>
<td align="center" width="80px"><%= l(:label_course_data) %></td>
</tr>
</table>
@ -134,7 +134,7 @@
<li><%= link_to(l(:label_overview), project_path(@project))%></li>
<li><%= link_to(l(:label_homework), {:controller => 'projects', :action => 'homework'})%></li>
<li><%= link_to(l(:label_course_file), project_files_path(@project))%></li>
<li><%= link_to "课程通知", {:controller => 'news', :action => 'index'} %></li>
<li><%= link_to "课程通知", {:controller => 'news', :action => 'index', :project_id => @project}%></li>
<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> -->
<li><%= link_to(l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project}) %></li></ul>
</div>

View File

@ -90,7 +90,7 @@
<%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar" %>
<% end%>
<% else %>
<p class="font_lighter"><%= l(:label_no_bid_project) %></p>
<p class="font_lighter"><%= l(:label_no_course_project) %></p>
<% end %>
</td>
</tr>
@ -106,12 +106,13 @@
<!-- end -->
</div>
<div id="content">
<% if display_main_menu?(@bid) %>
<div class="tabs_new">
<%= render_menu :bid_menu %>
</div>
<% end %>
<div class="tabs_new">
<ul>
<li><%= link_to(l(:label_question_student), { :controller => 'bids', :action => 'show' })%></li>
<li><%= link_to(l(:label_homework_commit), { :controller => 'bids', :action => 'show_project' })%></li>
<ul>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>

View File

@ -10,12 +10,13 @@
<% unless @project.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
<% end %></p>
<% if @project.new_record? %>
<%= f.fields_for @course do |m| %>
<p style="margin-left:-10px;"><%= m.text_field :time, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<p style="margin-left:-10px;"><%= m.text_field :state, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<% end %>
<% end %>
<!-- <p style="margin-left:-10px;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></p> -->
<p style="display:none;"><%= f.text_field :project_type, :value => 1 %></p>

View File

@ -1,8 +1,10 @@
<div class="box tabular" style="margin-right:10px;" >
<%= labelled_form_for @project do |f| %>
<% if @project.project_type == 1%>
<%= render :partial => 'course_form', :locals => { :f => f } %>
<% else %>
<%= render :partial => 'form', :locals => { :f => f } %>
<% end %>
<%= submit_tag l(:button_save) %>
<% end %>
</div>

View File

@ -584,6 +584,8 @@ zh:
label_news_added: 新闻已添加
label_settings: 配置
label_overview: 课程动态
label_question_student: 学生咨询 #huang
label_homework_commit: 提交作业 #huang
label_course_file: 资料下载
label_course_news: 课程通知
label_version: 版本
@ -1399,6 +1401,7 @@ zh:
label_bid_project: 项目
label_project_no_follow: 该项目暂未被关注!
label_no_bid_project: 暂无参与项目
label_no_course_project: 暂无已提交的作业!
label_bids_reward_method: 奖励方式
label_bids_reward_what: 输入奖励内容
label_call_bonus: 奖金

View File

@ -435,6 +435,7 @@ RedmineApp::Application.routes.draw do
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/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid' # by huang
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'