diff --git a/app/controllers/homework_users_controller.rb b/app/controllers/homework_users_controller.rb new file mode 100644 index 000000000..cb55d965d --- /dev/null +++ b/app/controllers/homework_users_controller.rb @@ -0,0 +1,3 @@ +class HomeworkUsersController < ApplicationController + +end diff --git a/app/helpers/homework_users_helper.rb b/app/helpers/homework_users_helper.rb new file mode 100644 index 000000000..48a9a8e4f --- /dev/null +++ b/app/helpers/homework_users_helper.rb @@ -0,0 +1,2 @@ +module HomeworkUsersHelper +end diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index 4bac58449..e395e65e5 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -1,8 +1,12 @@ class HomeworkAttach < ActiveRecord::Base include Redmine::SafeAttributes + + #attr_accessible :name, :description, :state, :user_id, :bid_id + belongs_to :user belongs_to :bid has_many :journals_for_messages, :as => :jour, :dependent => :destroy + has_many :homework_users, :dependent => :destroy seems_rateable :allow_update => true, :dimensions => :quality safe_attributes "bid_id", diff --git a/app/models/homework_user.rb b/app/models/homework_user.rb new file mode 100644 index 000000000..da7e65afb --- /dev/null +++ b/app/models/homework_user.rb @@ -0,0 +1,6 @@ +class HomeworkUser < ActiveRecord::Base + attr_accessible :homework_attach_id, :user_id + + belongs_to :homework_attach + has_one :user +end diff --git a/app/models/user.rb b/app/models/user.rb index d16d790d2..840275794 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -68,6 +68,8 @@ class User < Principal ['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)}, :after_remove => Proc.new {|user, group| group.user_removed(user)} has_many :changesets, :dependent => :nullify diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 8a00f12ae..d63c4f816 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -85,12 +85,12 @@ <!--点击新建参赛作品弹出框--> <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| %> - <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"> <span><%= l(:label_softapplication_name) %></span> <span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td> - </tr></ br> + </tr><br/> <br /> <br /> @@ -98,7 +98,7 @@ <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> - </tr></ br> + </tr><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> - </tr></ br> + </tr><br/> <br /> <br /> @@ -115,7 +115,7 @@ <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> - </tr></ br> + </tr><br/> <br /> <br /> @@ -123,11 +123,11 @@ <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> - </tr></ br> + </tr><br/> <br /> <br /> - <fieldset style="width: 500px", style="padding-top: 10px"> + <fieldset style="width: 500px; padding-top: 10px"> <legend> 上传应用软件包和应用截图 </legend> @@ -146,7 +146,7 @@ </fieldset> </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();" %> </div> <% end %> diff --git a/config/routes.rb b/config/routes.rb index b14d23aee..be132dd68 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,6 +16,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. RedmineApp::Application.routes.draw do + resources :homework_users + + resources :no_uses delete 'no_uses', :to => 'no_uses#delete' diff --git a/db/migrate/20140519054846_create_homework_users.rb b/db/migrate/20140519054846_create_homework_users.rb new file mode 100644 index 000000000..46f033436 --- /dev/null +++ b/db/migrate/20140519054846_create_homework_users.rb @@ -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 diff --git a/db/migrate/20140519070751_add_name_to_homework_attach.rb b/db/migrate/20140519070751_add_name_to_homework_attach.rb new file mode 100644 index 000000000..f819b51d2 --- /dev/null +++ b/db/migrate/20140519070751_add_name_to_homework_attach.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 74310a946..4c60942a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| 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", ["created_on"], :name => "index_attachments_on_created_on" - create_table "attachmentstypes", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "typeId" + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false t.string "typeName", :limit => 50 end - add_index "attachmentstypes", ["id"], :name => "id" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :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| t.integer "bid_id" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "reward" + t.string "name" + t.string "description" + t.integer "state" end create_table "homework_for_courses", :force => true do |t| @@ -335,6 +335,13 @@ ActiveRecord::Schema.define(:version => 20140509020307) do t.integer "bid_id" 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| t.integer "project_id", :default => 0, :null => false t.string "name", :limit => 30, :default => "", :null => false diff --git a/test/fixtures/homework_users.yml b/test/fixtures/homework_users.yml new file mode 100644 index 000000000..bec69e598 --- /dev/null +++ b/test/fixtures/homework_users.yml @@ -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