This commit is contained in:
alan 2014-10-29 16:14:06 +08:00
commit b7cac9427b
8 changed files with 55 additions and 25 deletions

View File

@ -236,11 +236,10 @@ class WordsController < ApplicationController
#modify by nwb
#添加对课程留言的支持
referer = request.headers["Referer"]
#referer = "http://forge.trustie.net/words/create_reply"
obj_id = referer.match(%r(/([0-9]{1,})(/|\?|$)))[1]
if referer.match(/project/)
obj = Project.find_by_id(obj_id)
elsif referer.match(/course/)
obj = Course.find_by_id(obj_id)
elsif referer.match(/user/)
obj = User.find_by_id(obj_id)
elsif ( referer.match(/bids/) || referer.match(/calls/) )
@ -251,6 +250,8 @@ class WordsController < ApplicationController
obj = Softapplication.find_by_id(obj_id)
elsif ( referer.match(/homework_attach/) || referer.match(/homework_attach/) ) #new added
obj = HomeworkAttach.find_by_id(obj_id)
elsif referer.match(/course/)
obj = Course.find_by_id(obj_id)
else
raise "create reply obj unknow type.#{referer}"
end

View File

@ -110,7 +110,7 @@ class ZipdownController < ApplicationController
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping("#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
zipping("#{homework.user.user_extensions.student_id}_#{homeattach.user.name.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
#user_attaches_paths
#end
end

View File

@ -317,27 +317,27 @@ module WelcomeHelper
str << content_tag("span", "发表了") <<
content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe <<
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url)
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description})
when 'issue', 'message' , 'bid' , 'wiki-page' , 'document'
str << content_tag("span", "发表了") <<
content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe <<
link_to(event.event_title, event.event_url)
link_to(event.event_title, event.event_url, {:title => event.event_title})
when 'reply' ,'Reply', 'Memo'
str << content_tag("span", "发表了") <<
content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe <<
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url)
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description})
when 'attachment'
str << content_tag('span', '上传了') <<
content_tag('span', find_all_event_type(event)) <<
':&nbsp;'.html_safe <<
link_to(event.event_title, event.event_url) <<
link_to(event.event_title, event.event_url, {:title => event.event_title}) <<
link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color")
else
str << content_tag("span", "更新了") <<
content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe << link_to(event.event_title, event.event_url)
':&nbsp;'.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title})
end
str
rescue Exception => e

View File

@ -36,7 +36,7 @@ class Bid < ActiveRecord::Base
acts_as_attachable
NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 250
DESCRIPTION_LENGTH_LIMIT = 3000
validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :author_id, presence: true

View File

@ -36,7 +36,8 @@
:maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
</p>
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %>
<p>
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %>
<%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>

View File

@ -2,19 +2,40 @@
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
<td style="width: auto; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td style="width: auto; color: #15bccf">
<strong>
<%= l(:label_user_location) %> :
</strong>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index'%></a></td>
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> >
<span><%= link_to(@bid.courses.first.name.to_s, homework_course_path(@bid.courses.first)) if @bid.courses.first%></span> >
<%=link_to(@bid.name, respond_path(@bid)) %> > <span><%= link_to "创建作业", new_homework_attach_path(@bid)%></span></p></td>
<td style="padding-left: 8px">
<a>
<%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index'%>
</a>
</td>
<td>
<p class="top-content-list-homework">
<%=link_to "主页", home_path %> >
<%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> >
<span>
<%= link_to(@bid.courses.first.name.to_s, homework_course_path(@bid.courses.first)) if @bid.courses.first%>
</span> >
<%=link_to(@bid.name, respond_path(@bid)) %> >
<span>
<%= link_to "创建作业", new_homework_attach_path(@bid)%>
</span>
</p>
</td>
</tr>
</table>
</div>
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=h l(:label_new_homework)%> </p>
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html">
<%=h l(:label_new_homework)%>
</p>
<div class="box">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'homework_attach',
@ -27,18 +48,20 @@
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;", :maxlength => 254 %>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong>提交项目&nbsp;&nbsp;</strong>
<strong>
提交项目&nbsp;&nbsp;
</strong>
<%= f.select :project_id,options_for_select(user_projects_option), {},{:style => "width:490px;"} %>
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
<p class="font_lighter" style="padding-left:120px;clear:left;">
提交项目可以为空
</p>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;</strong>
<strong style="vertical-align: top">
描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;
</strong>
<span style="margin-left:-10px;padding-right: 20px;">
<!--<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<%#= f.text_area :description, :rows => 15, :class => 'wiki-edit', :id => 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>-->
<%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => 65534 %>
</span>
</p>

View File

@ -0,0 +1,5 @@
class ChangeBidsDescriptionType < ActiveRecord::Migration
def change
change_column :bids, :description, :text, default: nil
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20141013023400) do
ActiveRecord::Schema.define(:version => 20141029065917) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -98,7 +98,7 @@ ActiveRecord::Schema.define(:version => 20141013023400) do
t.string "budget", :null => false
t.integer "author_id"
t.date "deadline"
t.string "description"
t.text "description"
t.datetime "created_on", :null => false
t.datetime "updated_on", :null => false
t.integer "commit"