Conflicts:
	app/views/contests/show_attendingcontest.html.erb
	db/schema.rb
This commit is contained in:
z9hang 2014-07-19 16:48:14 +08:00
commit 376ba1d793
15 changed files with 199 additions and 20 deletions

View File

@ -335,7 +335,7 @@ module ApplicationHelper
# set the project environment to please macros. # set the project environment to please macros.
@course = course @course = course
if (ancestors.empty? )#|| course.is_descendant_of?(ancestors.last)) if (ancestors.empty? )#|| course.is_descendant_of?(ancestors.last))
s << "<ul class=courses'>\n" s << "<ul class=courses>\n"
else else
ancestors.pop ancestors.pop
s << "</li>" s << "</li>"

View File

@ -174,5 +174,17 @@ module ContestsHelper
tmp tmp
end end
#作品分类下拉框
def work_type_opttion
type = []
#work_types = WorksCategory.all
WorksCategory.all.each do |work_type|
option = []
option << work_type.category
option << work_type.category
type << option
end
type
end
end end

View File

@ -371,7 +371,7 @@ module CoursesHelper
#获取作业的教师评分 #获取作业的教师评分
def teacher_score_for_homework homework def teacher_score_for_homework homework
member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
if member.nil? if member.nil?
return "0.00" return "0.00"
end end

View File

@ -34,7 +34,7 @@ class Course < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files, acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files :delete_permission => :manage_files
validates_presence_of :password, :term,:name validates_presence_of :password, :term,:name ,:class_period
validates_format_of :class_period, :with =>/^\d*$/ validates_format_of :class_period, :with =>/^\d*$/
#validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ #validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/

View File

@ -0,0 +1,3 @@
class WorksCategory < ActiveRecord::Base
attr_accessible :category
end

View File

@ -33,7 +33,7 @@
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> <p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
</p> </p>
<!-- <!--
<p><%= f.select :homework_type, homework_type_option %> <p><%#= f.select :homework_type, homework_type_option %>
</p> </p>
--> -->
<p><%= f.select :is_evaluation, is_evaluation_option %> <p><%= f.select :is_evaluation, is_evaluation_option %>

View File

@ -91,7 +91,7 @@
<tr style="width:700px; margin-left: -10px;"> <tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span> <span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td> <td><%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span> <span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
@ -101,17 +101,32 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_running_platform) %></span> <span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td> <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %></td>
</tr> </tr>
<br/> <br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span>
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;"} %>
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td>
</tr>
<br/>
<br/>
<br/> <br/>
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_work_description) %></span> <span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td> <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span> <span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
@ -121,7 +136,7 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span> <span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td> <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %></td>
</tr> </tr>
<br/> <br/>
@ -130,8 +145,9 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span> <span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %></span> <span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %></span>
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) --> <span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
<span><%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target => '_blank' %></span>
</tr> </tr>
<br/> <br/>
<br/> <br/>
@ -240,7 +256,10 @@
<div style="padding-left: 68px"> <div style="padding-left: 68px">
<tr> <tr>
<td><%= l(:label_profile) %>:</td> <td><%= l(:label_profile) %>:</td>
<td> <%= c_project.project.description.truncate(90, omission: '...') %> </td> <td>
<%#= c_project.project.description.truncate(90, omission: '...') %>
<%= c_project.project.description %>
</td>
</tr> </tr>
</br> </br>
</div> </div>
@ -276,7 +295,10 @@
<div style="padding-left: 68px; padding-top: 5px"> <div style="padding-left: 68px; padding-top: 5px">
<tr> <tr>
<td><strong><%= l(:label_profile) %>:</strong></td> <td><strong><%= l(:label_profile) %>:</strong></td>
<td> <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> </td> <td>
<%#= c_softapplication.softapplication.description.truncate(90, omission: '...') %>
<%= c_softapplication.softapplication.description %>
</td>
</tr> </tr>
</br> </br>
</div> </div>

View File

@ -28,7 +28,7 @@
</p> </p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;"> <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),:name => "project_id", :required => true, :style => "width:490px;"%> <%= 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' %> <%= 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>

View File

@ -41,6 +41,7 @@
<%=link_to_user(User.current)%> <%=link_to_user(User.current)%>
<ul class="sub_menu"> <ul class="sub_menu">
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%> <% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=true%>
<li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %> <li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
<ul class="course_sub_menu"> <ul class="course_sub_menu">
<% User.current.courses.each do |course| %> <% User.current.courses.each do |course| %>
@ -52,8 +53,13 @@
</li> </li>
<% end -%> <% end -%>
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu">
<% User.current.projects.each do |project| %> <% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
<% else %>
<ul class="project_sub_menu">
<% end %>
<% User.current.projects.each do |project| %>
<li><%= link_to project.name.truncate(10, omission: '...'), {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li> <li><%= link_to project.name.truncate(10, omission: '...'), {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>
<% end %> <% end %>
</ul> </ul>

View File

@ -143,7 +143,7 @@
<div class="right" style="float: right; width: 48%; "> <div class="right" style="float: right; width: 48%; ">
<ul class="welcome-message-list"> <ul class="welcome-message-list">
<!--<% cache 'forum_links' do %> --> <!--<%# cache 'forum_links' do %> -->
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;"> <div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
<h3 style="color: rgb(21, 188, 207);"> <h3 style="color: rgb(21, 188, 207);">
<strong>贴吧动态</strong> <strong>贴吧动态</strong>
@ -151,11 +151,11 @@
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%></h3> <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
</div> </div>
<!--<%end %> --> <!--<%#end %> -->
<div class="welcome-box-list-new memo_activity"> <div class="welcome-box-list-new memo_activity">
<% topics = find_new_forum_topics(7) %> <% topics = find_new_forum_topics(7) %>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%> <% topics.includes(:forum, :last_reply, :author).each do |topic|%>
<!--<% cache cache_key_for_topic(topic) do %> --> <!--<%# cache cache_key_for_topic(topic) do %> -->
<li class="message-brief-intro"> <li class="message-brief-intro">
<div class='memo_title text_nowrap'> <div class='memo_title text_nowrap'>
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %>
@ -175,7 +175,7 @@
</span> </span>
</div> </div>
</li> </li>
<!--<%end %> --> <!-- cache --> <!--<%#end %> --> <!-- cache -->
<% end %> <% end %>
</div> </div>
</ul> </ul>

View File

@ -0,0 +1,9 @@
class CreateWorksCategories < ActiveRecord::Migration
def change
create_table :works_categories do |t|
t.string :category
t.timestamps
end
end
end

View File

@ -0,0 +1,98 @@
# -*coding:utf-8 -*-
class SetWorksCategories < ActiveRecord::Migration
def up
workscategory1 = WorksCategory.new
workscategory1.category = "影音播放"
workscategory1.save
workscategory2 = WorksCategory.new
workscategory2.category = "交通导航"
workscategory2.save
workscategory3 = WorksCategory.new
workscategory3.category = "生活娱乐"
workscategory3.save
workscategory4 = WorksCategory.new
workscategory4.category = "网络购物"
workscategory4.save
workscategory5 = WorksCategory.new
workscategory5.category = "输入法"
workscategory5.save
workscategory6 = WorksCategory.new
workscategory6.category = "聊天社区"
workscategory6.save
workscategory7 = WorksCategory.new
workscategory7.category = "浏览器"
workscategory7.save
workscategory8 = WorksCategory.new
workscategory8.category = "窗口小部件"
workscategory8.save
workscategory9 = WorksCategory.new
workscategory9.category = "安全防护"
workscategory9.save
workscategory10 = WorksCategory.new
workscategory10.category = "拍照摄影"
workscategory10.save
workscategory11 = WorksCategory.new
workscategory11.category = "实用工具"
workscategory11.save
workscategory12 = WorksCategory.new
workscategory12.category = "词典翻译"
workscategory12.save
workscategory13 = WorksCategory.new
workscategory13.category = "教育阅读"
workscategory13.save
workscategory14 = WorksCategory.new
workscategory14.category = "主题桌面"
workscategory14.save
workscategory15 = WorksCategory.new
workscategory15.category = "事务管理"
workscategory15.save
workscategory16 = WorksCategory.new
workscategory16.category = "系统工具"
workscategory16.save
workscategory17 = WorksCategory.new
workscategory17.category = "资讯新闻"
workscategory17.save
workscategory18 = WorksCategory.new
workscategory18.category = "金融理财"
workscategory18.save
workscategory19 = WorksCategory.new
workscategory19.category = "通话通信"
workscategory19.save
workscategory20 = WorksCategory.new
workscategory20.category = "电子办公"
workscategory20.save
workscategory21 = WorksCategory.new
workscategory21.category = "体育竞技"
workscategory21.save
workscategory22 = WorksCategory.new
workscategory22.category = "健康医疗"
workscategory22.save
end
def down
WorksCategory.all do |wc|
wc.destroy
end
end
end

View File

@ -696,7 +696,6 @@ ul.user_course_sort li{list-style-type:none;
height:auto;} height:auto;}
.info-break{ .info-break{
word-wrap: break-word; word-wrap: break-word;
word-break: break-all; word-break: break-all;
@ -1765,6 +1764,22 @@ input#content_comments {width: 99%}
p.pagination {margin-top:8px; font-size: 90%} p.pagination {margin-top:8px; font-size: 90%}
ul.courses {margin:0px; padding-left:0em;}
ul.courses ul {padding-left:1.6em;}
ul.courses.root {margin:0; padding:0;}
ul.courses li {list-style-type:none;}
ul.courses li {list-style-type:none;}
#courses-index ul.courses ul.courses { border-left: 3px solid #e0e0e0; padding-left:1em;}
#courses-index ul.courses li.root {margin-bottom: 1em;}
#courses-index ul.courses li.child {margin-top: 1em;}
#courses-index ul.courses div.root a.course {font-family:'微软雅黑', "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 14px; margin: 0 0 10px 0; }
.my-course { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; }
/***** Tabular forms ******/ /***** Tabular forms ******/
.tabular p{ .tabular p{
margin: 0; margin: 0;

7
test/fixtures/works_categories.yml vendored Normal file
View File

@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
category: MyString
two:
category: MyString

View File

@ -0,0 +1,7 @@
require 'test_helper'
class WorksCategoryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end