DraftVersion base model and very basic admin pages
This commit is contained in:
@@ -355,3 +355,33 @@ Proposal.last(3).each do |proposal|
|
||||
created_at: rand((Time.current - 1.week) .. Time.current))
|
||||
puts " #{banner.title}"
|
||||
end
|
||||
|
||||
puts "Creating legislation processes"
|
||||
|
||||
(1..5).each do |i|
|
||||
process = ::Legislation::Process.create!(title: Faker::Lorem.sentence(3).truncate(60),
|
||||
description: Faker::Lorem.paragraphs.join("\n\n"),
|
||||
target: Faker::Lorem.paragraphs.join("\n\n"),
|
||||
how_to_participate: Faker::Lorem.paragraphs.join("\n\n"),
|
||||
additional_info: Faker::Lorem.paragraphs.join("\n\n"),
|
||||
start_date: Date.current - 3.days,
|
||||
end_date: Date.current + 3.days,
|
||||
debate_start_date: Date.current - 3.days,
|
||||
debate_end_date: Date.current - 1.day,
|
||||
draft_publication_date: Date.current + 1.day,
|
||||
allegations_start_date: Date.current + 2.days,
|
||||
allegations_end_date: Date.current + 3.days,
|
||||
final_publication_date: Date.current + 4.days
|
||||
)
|
||||
puts " #{process.title}"
|
||||
end
|
||||
|
||||
::Legislation::Process.all.each do |process|
|
||||
(1..3).each do |i|
|
||||
version = process.draft_versions.create!(title: "Version #{i}",
|
||||
body: Faker::Lorem.paragraphs.join("\n\n")
|
||||
)
|
||||
puts " #{version.title}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class CreateLegislationDraftVersions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :legislation_draft_versions do |t|
|
||||
t.references :legislation_process, index: true, foreign_key: true
|
||||
t.string :title
|
||||
t.text :changelog
|
||||
t.string :status, index: true, default: :draft
|
||||
t.boolean :final_version, default: false
|
||||
t.text :body
|
||||
|
||||
t.datetime :hidden_at, index: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
19
db/schema.rb
19
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161117135624) do
|
||||
ActiveRecord::Schema.define(version: 20161205110441) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -228,6 +228,22 @@ ActiveRecord::Schema.define(version: 20161117135624) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "legislation_draft_versions", force: :cascade do |t|
|
||||
t.integer "legislation_process_id"
|
||||
t.string "title"
|
||||
t.text "changelog"
|
||||
t.string "status", default: "draft"
|
||||
t.boolean "final_version", default: false
|
||||
t.text "body"
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "legislation_draft_versions", ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at", using: :btree
|
||||
add_index "legislation_draft_versions", ["legislation_process_id"], name: "index_legislation_draft_versions_on_legislation_process_id", using: :btree
|
||||
add_index "legislation_draft_versions", ["status"], name: "index_legislation_draft_versions_on_status", using: :btree
|
||||
|
||||
create_table "legislation_processes", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
@@ -584,6 +600,7 @@ ActiveRecord::Schema.define(version: 20161117135624) do
|
||||
add_foreign_key "failed_census_calls", "users"
|
||||
add_foreign_key "flags", "users"
|
||||
add_foreign_key "identities", "users"
|
||||
add_foreign_key "legislation_draft_versions", "legislation_processes"
|
||||
add_foreign_key "locks", "users"
|
||||
add_foreign_key "managers", "users"
|
||||
add_foreign_key "moderators", "users"
|
||||
|
||||
Reference in New Issue
Block a user