Merge remote-tracking branch 'remotes/origin/szzh' into develop

This commit is contained in:
nwb 2014-07-19 13:28:07 +08:00
commit 4259d9c282
10 changed files with 183 additions and 14 deletions

View File

@ -173,6 +173,18 @@ module ContestsHelper
end
tmp
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

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>
<!--
<p><%= f.select :homework_type, homework_type_option %>
<p><%#= f.select :homework_type, homework_type_option %>
</p>
-->
<p><%= f.select :is_evaluation, is_evaluation_option %>

View File

@ -91,7 +91,7 @@
<tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></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>
</tr>
<br/>
@ -101,17 +101,32 @@
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></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>
<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/>
<tr style="width:800px;">
<span><%= l(:label_work_description) %></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>
</tr>
<br/>
@ -121,7 +136,7 @@
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></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>
<br/>
@ -130,8 +145,8 @@
<tr style="width:800px;">
<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><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0} , :target => '_blank',host:Setting.project_domain %></span><!-- new_project_path(course: 0, project_type: 0) -->
<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), new_project_path(course: 0, project_type: 0), :target => '_blank' %></span>
</tr>
<br/>
<br/>
@ -240,7 +255,10 @@
<div style="padding-left: 68px">
<tr>
<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>
</br>
</div>
@ -276,7 +294,10 @@
<div style="padding-left: 68px; padding-top: 5px">
<tr>
<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>
</br>
</div>

View File

@ -41,6 +41,7 @@
<%=link_to_user(User.current)%>
<ul class="sub_menu">
<% 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} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
@ -52,8 +53,13 @@
</li>
<% 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} %>
<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>
<% end %>
</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

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140716021558) do
ActiveRecord::Schema.define(:version => 20140719030941) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -916,7 +916,7 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
create_table "softapplications", :force => true do |t|
t.string "name"
t.string "description"
t.text "description"
t.integer "app_type_id"
t.string "app_type_name"
t.string "android_min_version_available"
@ -1212,4 +1212,10 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
create_table "works_categories", :force => true do |t|
t.string "category"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end

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