This commit is contained in:
huangjingquan 2013-09-13 10:11:36 +08:00
parent 7aa5eef2e4
commit ffa412d290
8 changed files with 197 additions and 10 deletions

View File

@ -92,11 +92,17 @@ class BidsController < ApplicationController
# @journals = @bid.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
# @journals.each_with_index {|j,i| j.indice = i+1}
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
@ -112,9 +118,15 @@ class BidsController < ApplicationController
@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

View File

@ -1,4 +1,5 @@
class CoursesController < ApplicationController
before_filter :require_login, :only => [:join, :unjoin]

View File

@ -46,12 +46,18 @@ class NewsController < ApplicationController
@newss = scope.all(:include => [:author, :project],
:order => "#{News.table_name}.created_on DESC",
:offset => @offset,
:limit => @limit)
:limit => @limit)
respond_to do |format|
format.html {
@news = News.new # for adding news inline
# huang
@course_tag = @project.project_type
if @course_tag
render :layout => 'base_courses'
else
render :layout => false if request.xhr?
end
}
format.api
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
@ -61,10 +67,18 @@ class NewsController < ApplicationController
def show
@comments = @news.comments
@comments.reverse! if User.current.wants_comments_in_reverse_order?
@course_tag = @project.project_type
if @course_tag
render :layout => 'base_courses'
end
end
def new
@news = News.new(:project => @project, :author => User.current)
@course_tag = @project.project_type
if @course_tag
render :layout => 'base_courses'
end
end
def create

View File

@ -23,15 +23,17 @@ class ProjectsController < ApplicationController
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index
#by huang
# menu_item :files, :only => :files
# menu_tiem :news, :only => :news
# layout 'base_course'
# menu_item l(:label_homework), :only => homework
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join]
before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
#by young
before_filter :member, :file, :statistics, :watcherlist
before_filter :file, :statistics, :watcherlist
#
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
@ -249,6 +251,7 @@ class ProjectsController < ApplicationController
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
render :layout => 'base_courses'
end
def new_homework
@ -497,7 +500,16 @@ class ProjectsController < ApplicationController
#by young
def member
if @project.project_type == 1
render :layout => 'base_courses'
end
end
# def news
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# end
def file
# @course_tag = params[:course]

View File

@ -133,10 +133,10 @@
<ul>
<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_file_path(@project))%></li>
<li><%= link_to(l(:label_course_file), project_files_path(@project))%></li>
<li><%= link_to "课程通知", {:controller => 'news', :action => 'index'} %></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>
<li><%= link_to(l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project}) %></li></ul>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>

View File

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="">
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" valign="middle">
<%= link_to image_tag(url_to_avatar(@bid.courses.first), :class => "avatar2"), project_path(@bid.courses.first), :class => "avatar" %>
</td>
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr>
<tr>
<td align="center"> <%= watcher_link(@bid, User.current) %> </td>
</tr>
</table></td>
</tr>
</table>
<table>
<tr>
<td><%= l(:label_teacher) %> : <%= link_to(@user, user_path(@user))%></td>
</tr>
<tr>
<td><%= l(:label_course_homework) %> : <%= link_to(@bid.courses.first.name, project_path(@bid.courses.first))%></td>
</tr>
<tr>
<td><%= l(:label_limit_time) %> <%= @bid.deadline%></td>
</tr>
</table>
<!-- <div>
<%= link_to "问答"+"("+@bid.watcher_users.count.to_s+")", respond_path(@bid) %> &nbsp;
<%= link_to l(:label_commit_homework)+ ":" +"("+@bid.biding_projects.count.to_s+")", project_for_bid_path(@bid) %>&nbsp;
<%= link_to l(:label_responses)+"("+@bid.commit.to_s+")", respond_path(@bid)%>
</div> -->
</div>
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_tag) %></strong>
</div><div class="user_underline"></div>
<table style="font-family:微软雅黑">
<tr>
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td>
</tr>
</table>
</div>
<!--homework-->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_commit_homework) %></strong>
</div>
<div class="user_underline"></div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<% if @bid.projects.size>0 %>
<% for project in @bid.projects%>
<%= 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>
<% end %>
</td>
</tr>
</table>
</div>
</div>
<div class="user_underline"></div>
</div>
</div>
<!-- end -->
</div>
<div id="content">
<% if display_main_menu?(@bid) %>
<div class="tabs_new">
<%= render_menu :bid_menu %>
</div>
<% end %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
</div>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -519,6 +519,16 @@ zh:
label_activities_settings: 显示设置
label_user_login_new: 登录
label_user_login_tips: 您还没有登录,请登录后留言
#end
#by huang
label_followers: 关注
label_teacher: 教师
label_limit_time: 截止日期
label_commit_homework: 提交作业
label_course_homework: 对应课程
label_homework_response: 作业咨询
label_bidding_homework: 提交作业
#end
label_my_page: 我的工作台
label_my_account: 我的帐号
@ -574,7 +584,7 @@ zh:
label_news_added: 新闻已添加
label_settings: 配置
label_overview: 课程动态
label_course_file: 课件下载
label_course_file: 资料下载
label_course_news: 课程通知
label_version: 版本
label_version_new: 新建版本
@ -1443,7 +1453,7 @@ zh:
label_public_info: 若不公开,仅项目成员可见该项目
label_course_student: 学生
label_homework: 课程作业
label_course_file: 课件下载
label_course_file: 资料下载
label_course_new_homework: 新建作业
label_course_homework_list: 作业列表
label_course_homework_new: 发布作业

View File

@ -223,6 +223,12 @@ Redmine::MenuManager.map :application_menu do |menu|
# Empty
end
######
Redmine::MenuManager.map :homework_menu do |menu|
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_homework_response
menu.push :project, { :controller => 'bids', :action => 'show_project' }, :caption => :label_bidding_homework
end
########end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :users, {:controller => 'users'}, :caption => :label_user_plural