Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
This commit is contained in:
commit
d095aed7a3
|
@ -0,0 +1,2 @@
|
|||
class PollAnswerController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class PollController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class PollQuestionController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class PollUserController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class PollVoteController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class Poll < ActiveRecord::Base
|
||||
#attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :user
|
||||
has_many :poll_questions, :dependent => :destroy
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class PollAnswer < ActiveRecord::Base
|
||||
# attr_accessible :answer_position, :answer_text, :poll_questions_id
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :poll_question
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class PollQuestion < ActiveRecord::Base
|
||||
# attr_accessible :is_necessary, :polls_id, :question_title, :question_type
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :poll
|
||||
has_many :poll_answers, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class PollUser < ActiveRecord::Base
|
||||
# attr_accessible :poll_id, :user_id
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :poll
|
||||
belongs_to :user
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class PollVote < ActiveRecord::Base
|
||||
# attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :poll_answer
|
||||
belongs_to :poll_question
|
||||
belongs_to :user
|
||||
end
|
|
@ -77,6 +77,13 @@ class User < Principal
|
|||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
|
||||
#问卷相关关关系
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
has_many :poll, :dependent => :destroy #用户创建的问卷
|
||||
has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷
|
||||
# end
|
||||
|
||||
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
|
||||
|
|
|
@ -77,10 +77,10 @@
|
|||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<!--<%#= f.submit l(:button_project_tags_add),:class => "ButtonColor m3p10" %>-->
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" >
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" style="padding: 3px 6px">
|
||||
<%= l(:button_project_tags_add)%>
|
||||
</a>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10'%>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10' ,:style=>"padding:3px 6px"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class CreatePolls < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :polls do |t|
|
||||
t.string :polls_name
|
||||
t.string :polls_type
|
||||
t.integer :polls_group_id
|
||||
t.integer :polls_status
|
||||
t.integer :user_id
|
||||
t.datetime :published_at
|
||||
t.datetime :closed_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :polls
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class CreatePollQuestions < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :poll_questions do |t|
|
||||
t.string :question_title
|
||||
t.integer :question_type
|
||||
t.integer :is_necessary
|
||||
t.integer :poll_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :poll_questions
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class CreatePollAnswers < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :poll_answers do |t|
|
||||
t.integer :poll_question_id
|
||||
t.text :answer_text
|
||||
t.integer :answer_position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :poll_answers
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class CreatePollVotes < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :poll_votes do |t|
|
||||
t.integer :user_id
|
||||
t.integer :poll_question_id
|
||||
t.integer :poll_answer_id
|
||||
t.text :vote_text
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :poll_votes
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class CreatePollUsers < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :poll_users do |t|
|
||||
t.integer :user_id
|
||||
t.integer :poll_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :poll_users
|
||||
end
|
||||
end
|
47
db/schema.rb
47
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20141231085350) do
|
||||
ActiveRecord::Schema.define(:version => 20150108035338) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -790,6 +790,51 @@ ActiveRecord::Schema.define(:version => 20141231085350) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "poll_answers", :force => true do |t|
|
||||
t.integer "poll_question_id"
|
||||
t.text "answer_text"
|
||||
t.integer "answer_position"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "poll_questions", :force => true do |t|
|
||||
t.string "question_title"
|
||||
t.integer "question_type"
|
||||
t.integer "is_necessary"
|
||||
t.integer "poll_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "poll_users", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "poll_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "poll_votes", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "poll_question_id"
|
||||
t.integer "poll_answer_id"
|
||||
t.text "vote_text"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "polls", :force => true do |t|
|
||||
t.string "polls_name"
|
||||
t.string "polls_type"
|
||||
t.integer "polls_group_id"
|
||||
t.integer "polls_status"
|
||||
t.integer "user_id"
|
||||
t.datetime "published_at"
|
||||
t.datetime "closed_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "praise_tread_caches", :force => true do |t|
|
||||
t.integer "object_id", :null => false
|
||||
t.string "object_type"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PollAnswersTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PollQuestionsTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PollUserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PollVotesTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PollsTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue