1.增加作业参与人员类homework_users及相关代码

2.homework_attach增加字段:name,description,state
This commit is contained in:
sw 2014-05-19 17:44:36 +08:00
parent 0de77bdc44
commit b80c51475f
11 changed files with 69 additions and 16 deletions

View File

@ -0,0 +1,3 @@
class HomeworkUsersController < ApplicationController
end

View File

@ -0,0 +1,2 @@
module HomeworkUsersHelper
end

View File

@ -1,8 +1,12 @@
class HomeworkAttach < ActiveRecord::Base class HomeworkAttach < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
#attr_accessible :name, :description, :state, :user_id, :bid_id
belongs_to :user belongs_to :user
belongs_to :bid belongs_to :bid
has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_users, :dependent => :destroy
seems_rateable :allow_update => true, :dimensions => :quality seems_rateable :allow_update => true, :dimensions => :quality
safe_attributes "bid_id", safe_attributes "bid_id",

View File

@ -0,0 +1,6 @@
class HomeworkUser < ActiveRecord::Base
attr_accessible :homework_attach_id, :user_id
belongs_to :homework_attach
has_one :user
end

View File

@ -68,6 +68,8 @@ class User < Principal
['none', :label_user_mail_option_none] ['none', :label_user_mail_option_none]
] ]
has_one :homework_user
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)} :after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify has_many :changesets, :dependent => :nullify

View File

@ -85,12 +85,12 @@
<!--点击新建参赛作品弹出框--> <!--点击新建参赛作品弹出框-->
<div id="put-project-form" style="display: none; padding-left: 83px; width: 70%"> <div id="put-project-form" style="display: none; padding-left: 83px; width: 70%">
<%= form_for Softapplication.new, :remote=>true, :url => softapplications_path, :complete => '$("#put-bid-form").hide();' do |f| %> <%= form_for Softapplication.new, :remote=>true, :url => softapplications_path, :complete => '$("#put-bid-form").hide();' do |f| %>
<fieldset class="contes-new-box", style="padding-left: 36px"> <fieldset style="padding-left: 36px" class="contes-new-box">
<tr style="width:700px; margin-left: -10px"> <tr style="width:700px; margin-left: -10px">
<span><%= l(:label_softapplication_name) %></span> <span><%= l(:label_softapplication_name) %></span>
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -98,7 +98,7 @@
<span><%= l(:label_softapplication_version_available) %></span> <span><%= l(:label_softapplication_version_available) %></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> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -107,7 +107,7 @@
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -115,7 +115,7 @@
<span><%= l(:label_softapplication_description) %></span> <span><%= l(:label_softapplication_description) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -123,11 +123,11 @@
<span><%= l(:label_softapplication_developers) %></span> <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> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
<fieldset style="width: 500px", style="padding-top: 10px"> <fieldset style="width: 500px; padding-top: 10px">
<legend> <legend>
上传应用软件包和应用截图 上传应用软件包和应用截图
</legend> </legend>
@ -146,7 +146,7 @@
</fieldset> </fieldset>
</fieldset></br> </fieldset></br>
<div class="align-center", style="padding-top: -3px; padding-bottom: 8px"> <div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<%= submit_tag l(:button_create), :onclick => "cancel();" %> <%= submit_tag l(:button_create), :onclick => "cancel();" %>
</div> </div>
<% end %> <% end %>

View File

@ -16,6 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do RedmineApp::Application.routes.draw do
resources :homework_users
resources :no_uses resources :no_uses
delete 'no_uses', :to => 'no_uses#delete' delete 'no_uses', :to => 'no_uses#delete'

View File

@ -0,0 +1,10 @@
class CreateHomeworkUsers < ActiveRecord::Migration
def change
create_table :homework_users do |t|
t.string :homework_attach_id
t.string :user_id
t.timestamps
end
end
end

View File

@ -0,0 +1,7 @@
class AddNameToHomeworkAttach < ActiveRecord::Migration
def change
add_column :homework_attaches, :name, :string
add_column :homework_attaches, :description, :string
add_column :homework_attaches, :state, :int
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140509020307) do ActiveRecord::Schema.define(:version => 20140519070751) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -52,14 +52,11 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
create_table "attachmentstypes", :id => false, :force => true do |t| create_table "attachmentstypes", :force => true do |t|
t.integer "id", :null => false t.integer "typeId", :null => false
t.integer "typeId"
t.string "typeName", :limit => 50 t.string "typeName", :limit => 50
end end
add_index "attachmentstypes", ["id"], :name => "id"
create_table "auth_sources", :force => true do |t| create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false
@ -325,9 +322,12 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
create_table "homework_attaches", :force => true do |t| create_table "homework_attaches", :force => true do |t|
t.integer "bid_id" t.integer "bid_id"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "reward" t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
end end
create_table "homework_for_courses", :force => true do |t| create_table "homework_for_courses", :force => true do |t|
@ -335,6 +335,13 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
t.integer "bid_id" t.integer "bid_id"
end end
create_table "homework_users", :force => true do |t|
t.string "homework_attach_id"
t.string "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "issue_categories", :force => true do |t| create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false

9
test/fixtures/homework_users.yml vendored Normal file
View File

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