修改了部分功能

This commit is contained in:
huangjingquan 2013-09-14 17:25:57 +08:00
parent e4cbc7533e
commit 11370329dd
7 changed files with 25 additions and 11 deletions

View File

@ -341,6 +341,7 @@ class ProjectsController < ApplicationController
@course = Course.new
@course.extra=params[:project][:identifier]
@course.safe_attributes = params[:project][:course]
@course.tea_id = User.current.id
@course.save
# project = ProjectInfo.create(:user_id => User.current.id, :project_id => @project.id)
# project_status = ProjectStatus.create(:project_id => @project.id)

View File

@ -3,8 +3,9 @@ class Course < ActiveRecord::Base
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state
belongs_to :project, :class_name => 'Project', :foreign_key => :extra
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
has_many :bid
validates_presence_of :time
validates_presence_of :state
safe_attributes 'extra',
'time',
'name',

View File

@ -69,11 +69,14 @@
<div class="inf_user_context">
<table style="font-family:微软雅黑" width="220">
<tr>
<td valign="top" style="padding-left: 8px;">课程学时</td><td class="font_lighter_sidebar"><%= @course.state%></td>
<td valign="top" style="padding-left: 8px;">课程口令</td><td class="font_lighter_sidebar"><%= @course.state%></td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">课程学时:</td><td class="font_lighter_sidebar"><%= @course.time%></td>
</tr>
<td valign="top" style="padding-left: 8px;">主讲老师:</td><td class="font_lighter_sidebar"><%= @course.teacher.name %></td>
</tr>
</table>
</div>
@ -85,12 +88,18 @@
</div>
<div style="padding-bottom: 8px">
<% if @project.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @project.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= @project.created_on %>
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
</div>
</div>
<div class="user_underline"></div>

View File

@ -110,8 +110,8 @@
<ul>
<li><%= link_to l(:label_question_student), { :controller => 'bids', :action => 'show' },:class => link_class(:respond)%></li>
<li><%= link_to l(:label_homework_commit), { :controller => 'bids', :action => 'show_project' },:class => link_class(:project)%></li>
<li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
<ul>
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
--><ul>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>

View File

@ -13,8 +13,9 @@
<% 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>
<!-- added by huang -->
<p style="margin-left:-10px;"><%= m.text_field :state, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<% end %>
<% end %>
<!-- <p style="margin-left:-10px;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></p> -->

View File

@ -35,7 +35,7 @@
</div>
<% end %>
<% else %>
<div><%= l(:label_tags_no) %></div>
<div style="color:#919294;"><%= l(:label_tags_no) %></div>
<% end %>
<% end %>

View File

@ -221,7 +221,7 @@ zh:
field_location: 工作单位
field_couurse_time: 学时
field_course_code: 学分
field_state: 设置口令
field_state: 加入课程口令
#end
field_description: 描述
field_summary: 摘要
@ -951,6 +951,7 @@ zh:
text_caracters_maximum: "最多 %{count} 个字符。"
text_caracters_minimum: "至少需要 %{count} 个字符。"
text_length_between: "长度必须在 %{min} 到 %{max} 个字符之间。"
text_command: 口令仅数字可以使用,学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
text_tracker_no_workflow: 此跟踪标签未定义工作流程
text_unallowed_characters: 非法字符
text_comma_separated: 可以使用多个值(用逗号,分开)。
@ -1402,6 +1403,7 @@ zh:
label_issue_cancel_query: 取消查询
field_reward_type: 奖励类型
label_tags_no: 暂无标签!
label_course_description_no: 你还未对该课程添加描述!
label_bid_publish: 发布了
label_bid_project: 项目
label_project_no_follow: 该项目暂未被关注!