diff --git a/Gemfile b/Gemfile index 41541aa..6d1c709 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,11 @@ source 'https://rubygems.org' + +ruby '>= 2.2.2' + # # RAILS # -gem 'rails', '4.2.0' +gem 'rails', '4.2.7' # additional gems for rails 4 gem 'railties' diff --git a/Gemfile.lock b/Gemfile.lock index b4c911a..b0f7bd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/activeadmin/activeadmin.git - revision: 3941e1550c4d5d8a6df51057d0517f1a51b609e4 + revision: cc178ad0ebe1b74729eeaa59d5c7ad9b82ed7837 specs: activeadmin (1.0.0.pre4) arbre (~> 1.0, >= 1.0.2) @@ -12,7 +12,7 @@ jquery-rails jquery-ui-rails kaminari (~> 0.15) - rails (>= 3.2, < 5.1) + railties (>= 3.2, < 5.1) ransack (~> 1.3) sass-rails sprockets (< 4.1) @@ -20,40 +20,40 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) + actionmailer (4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.0) - actionview (= 4.2.0) - activesupport (= 4.2.0) - rack (~> 1.6.0) + actionpack (4.2.7) + actionview (= 4.2.7) + activesupport (= 4.2.7) + rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) actionpack-action_caching (1.1.1) actionpack (>= 4.0.0, < 5.0) actionpack-page_caching (1.0.2) actionpack (>= 4.0.0, < 5) - actionview (4.2.0) - activesupport (= 4.2.0) + actionview (4.2.7) + activesupport (= 4.2.7) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.0) - activesupport (= 4.2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.7) + activesupport (= 4.2.7) globalid (>= 0.3.0) - activemodel (4.2.0) - activesupport (= 4.2.0) + activemodel (4.2.7) + activesupport (= 4.2.7) builder (~> 3.1) - activerecord (4.2.0) - activemodel (= 4.2.0) - activesupport (= 4.2.0) + activerecord (4.2.7) + activemodel (= 4.2.7) + activesupport (= 4.2.7) arel (~> 6.0) - activesupport (4.2.0) + activesupport (4.2.7) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -227,16 +227,16 @@ rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.0) - actionmailer (= 4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) - activemodel (= 4.2.0) - activerecord (= 4.2.0) - activesupport (= 4.2.0) + rails (4.2.7) + actionmailer (= 4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) + activemodel (= 4.2.7) + activerecord (= 4.2.7) + activesupport (= 4.2.7) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0) + railties (= 4.2.7) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -248,9 +248,9 @@ loofah (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) - railties (4.2.0) - actionpack (= 4.2.0) - activesupport (= 4.2.0) + railties (4.2.7) + actionpack (= 4.2.7) + activesupport (= 4.2.7) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (11.2.2) @@ -284,9 +284,9 @@ actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - swagger-docs (0.2.8) - activesupport (>= 3, < 5) - rails (>= 3, < 5) + swagger-docs (0.2.9) + activesupport (>= 3) + rails (>= 3) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref @@ -361,7 +361,7 @@ omniauth-shibboleth protected_attributes rack-test - rails (= 4.2.0) + rails (= 4.2.7) rails-observers railties recaptcha @@ -381,5 +381,8 @@ wicked_pdf yard +RUBY VERSION + ruby 2.2.2p95 + BUNDLED WITH 1.12.5 diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb index 261f930..850d282 100644 --- a/config/initializers/locale.rb +++ b/config/initializers/locale.rb @@ -10,8 +10,16 @@ # set default locale to something other than :en # initializers are run before migrations, languages table might not be present - if ActiveRecord::Base.connection.tables.include?('languages') - config.i18n.default_locale = Language.where(default_language: true).first.abbreviation + if ActiveRecord::Base.connection.tables.include?('languages') && + ActiveRecord::Base.connection.column_exists?(:languages, :default_language) + + # If a default language is not defined in the DB use en-UK + if Language.where(default_language: true).empty? + config.i18n.default_locale = 'en-UK' + else + config.i18n.default_locale = Language.where(default_language: true).first.abbreviation + end + else config.i18n.default_locale = 'en-UK' # if this is not set then admin area is not working, which is required to change the default_language end diff --git a/db/schema.rb b/db/schema.rb index 3b66e7c..2939cab 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,13 +12,14 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160805105941) do + create_table "answers", force: :cascade do |t| t.text "text", limit: 65535 t.integer "plan_id", limit: 4 t.integer "user_id", limit: 4 t.integer "question_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "answers_options", id: false, force: :cascade do |t| @@ -32,9 +33,9 @@ t.integer "user_id", limit: 4 t.integer "question_id", limit: 4 t.text "text", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "archived", limit: 1 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "archived" t.integer "plan_id", limit: 4 t.integer "archived_by", limit: 4 end @@ -42,13 +43,13 @@ create_table "dmptemplates", force: :cascade do |t| t.string "title", limit: 255 t.text "description", limit: 65535 - t.boolean "published", limit: 1 + t.boolean "published" t.integer "user_id", limit: 4 t.integer "organisation_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "locale", limit: 255 - t.boolean "is_default", limit: 1 + t.boolean "is_default" end create_table "dmptemplates_guidance_groups", id: false, force: :cascade do |t| @@ -60,8 +61,8 @@ t.integer "plan_id", limit: 4 t.integer "user_id", limit: 4 t.string "format", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "file_types", force: :cascade do |t| @@ -69,8 +70,8 @@ t.string "icon_name", limit: 255 t.integer "icon_size", limit: 4 t.string "icon_location", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "file_uploads", force: :cascade do |t| @@ -78,15 +79,15 @@ t.string "title", limit: 255 t.text "description", limit: 65535 t.integer "size", limit: 4 - t.boolean "published", limit: 1 + t.boolean "published" t.string "location", limit: 255 t.integer "file_type_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", limit: 255, null: false + t.string "slug", limit: 191, null: false t.integer "sluggable_id", limit: 4, null: false t.string "sluggable_type", limit: 40 t.datetime "created_at" @@ -99,10 +100,10 @@ create_table "guidance_groups", force: :cascade do |t| t.string "name", limit: 255 t.integer "organisation_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "optional_subset", limit: 1 - t.boolean "published", limit: 1 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "optional_subset" + t.boolean "published" end create_table "guidance_in_group", id: false, force: :cascade do |t| @@ -115,17 +116,17 @@ create_table "guidances", force: :cascade do |t| t.text "text", limit: 65535 t.integer "guidance_group_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "question_id", limit: 4 - t.boolean "published", limit: 1 + t.boolean "published" end create_table "languages", force: :cascade do |t| t.string "abbreviation", limit: 255 t.string "description", limit: 255 t.string "name", limit: 255 - t.boolean "default_language", limit: 1 + t.boolean "default_language" end create_table "option_warnings", force: :cascade do |t| @@ -140,9 +141,9 @@ t.integer "question_id", limit: 4 t.string "text", limit: 255 t.integer "number", limit: 4 - t.boolean "is_default", limit: 1 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "is_default" + t.datetime "created_at" + t.datetime "updated_at" end create_table "org_token_permissions", force: :cascade do |t| @@ -155,8 +156,8 @@ create_table "organisation_types", force: :cascade do |t| t.string "name", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "organisations", force: :cascade do |t| @@ -168,10 +169,10 @@ t.string "domain", limit: 255 t.string "wayfless_entity", limit: 255 t.integer "stylesheet_file_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "parent_id", limit: 4 - t.boolean "is_other", limit: 1 + t.boolean "is_other" t.string "sort_name", limit: 255 t.text "banner_text", limit: 65535 t.string "logo_file_name", limit: 255 @@ -184,14 +185,9 @@ t.text "description", limit: 65535 t.integer "number", limit: 4 t.integer "dmptemplate_id", limit: 4 -<<<<<<< HEAD - t.datetime "created_at", null: false - t.datetime "updated_at", null: false -======= t.datetime "created_at" t.datetime "updated_at" ->>>>>>> 8fe77923f8665849a4381acb35648bce07c723fe - t.string "slug", limit: 255 + t.string "slug", limit: 191 end add_index "phases", ["dmptemplate_id"], name: "index_phases_on_dmptemplate_id", using: :btree @@ -201,27 +197,27 @@ t.integer "user_id", limit: 4 t.integer "section_id", limit: 4 t.integer "plan_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.datetime "release_time" end create_table "plans", force: :cascade do |t| - t.boolean "locked", limit: 1 + t.boolean "locked" t.integer "project_id", limit: 4 t.integer "version_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "project_groups", force: :cascade do |t| - t.boolean "project_creator", limit: 1 - t.boolean "project_editor", limit: 1 + t.boolean "project_creator" + t.boolean "project_editor" t.integer "user_id", limit: 4 t.integer "project_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "project_administrator", limit: 1 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "project_administrator" end create_table "project_guidance", id: false, force: :cascade do |t| @@ -234,14 +230,9 @@ create_table "projects", force: :cascade do |t| t.string "title", limit: 255 t.integer "dmptemplate_id", limit: 4 -<<<<<<< HEAD - t.datetime "created_at", null: false - t.datetime "updated_at", null: false -======= t.datetime "created_at" t.datetime "updated_at" ->>>>>>> 8fe77923f8665849a4381acb35648bce07c723fe - t.string "slug", limit: 255 + t.string "slug", limit: 191 t.integer "organisation_id", limit: 4 t.string "grant_number", limit: 255 t.string "identifier", limit: 255 @@ -257,8 +248,8 @@ create_table "question_formats", force: :cascade do |t| t.string "title", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "questions", force: :cascade do |t| @@ -270,10 +261,10 @@ t.integer "dependency_id", limit: 4 t.text "dependency_text", limit: 65535 t.integer "section_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "question_format_id", limit: 4 - t.boolean "option_comment_display", limit: 1, default: true + t.boolean "option_comment_display", default: true end create_table "questions_themes", id: false, force: :cascade do |t| @@ -283,12 +274,6 @@ add_index "questions_themes", ["question_id", "theme_id"], name: "index_questions_themes_on_question_id_and_theme_id", using: :btree -<<<<<<< HEAD - create_table "roles", force: :cascade do |t| - t.string "name", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false -======= create_table "region_groups", force: :cascade do |t| t.integer "super_region_id", limit: 4 t.integer "region_id", limit: 4 @@ -301,11 +286,10 @@ end create_table "roles", force: :cascade do |t| - t.string "name", limit: 255 + t.string "name", limit: 191 t.datetime "created_at" t.datetime "updated_at" ->>>>>>> 8fe77923f8665849a4381acb35648bce07c723fe - t.boolean "role_in_plans", limit: 1 + t.boolean "role_in_plans" t.integer "resource_id", limit: 4 t.string "resource_type", limit: 255 end @@ -319,16 +303,16 @@ t.integer "number", limit: 4 t.integer "version_id", limit: 4 t.integer "organisation_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "published", limit: 1 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "published" end create_table "settings", force: :cascade do |t| - t.string "var", limit: 255, null: false + t.string "var", limit: 191, null: false t.text "value", limit: 65535 t.integer "target_id", limit: 4, null: false - t.string "target_type", limit: 255, null: false + t.string "target_type", limit: 191, null: false t.datetime "created_at" t.datetime "updated_at" end @@ -337,24 +321,24 @@ create_table "splash_logs", force: :cascade do |t| t.string "destination", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "suggested_answers", force: :cascade do |t| t.integer "question_id", limit: 4 t.integer "organisation_id", limit: 4 t.text "text", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "is_example", limit: 1 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "is_example" end create_table "themes", force: :cascade do |t| t.string "title", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "locale", limit: 255 end @@ -381,28 +365,28 @@ create_table "user_role_types", force: :cascade do |t| t.string "name", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "user_statuses", force: :cascade do |t| t.string "name", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "user_types", force: :cascade do |t| t.string "name", limit: 255 t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "users", force: :cascade do |t| t.string "firstname", limit: 255 t.string "surname", limit: 255 - t.string "email", limit: 255, default: "", null: false + t.string "email", limit: 191, default: "", null: false t.string "orcid_id", limit: 255 t.string "shibboleth_id", limit: 255 t.integer "user_type_id", limit: 4 @@ -410,7 +394,7 @@ t.datetime "created_at" t.datetime "updated_at" t.string "encrypted_password", limit: 255, default: "" - t.string "reset_password_token", limit: 255 + t.string "reset_password_token", limit: 191 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.integer "sign_in_count", limit: 4, default: 0 @@ -418,15 +402,16 @@ t.datetime "last_sign_in_at" t.string "current_sign_in_ip", limit: 255 t.string "last_sign_in_ip", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "confirmation_token", limit: 191 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "invitation_token", limit: 255 + t.string "invitation_token", limit: 191 t.datetime "invitation_created_at" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" t.string "other_organisation", limit: 255 - t.boolean "accept_terms", limit: 1 + t.boolean "dmponline3" + t.boolean "accept_terms" t.integer "organisation_id", limit: 4 t.string "api_token", limit: 255 t.integer "invited_by_id", limit: 4 @@ -449,11 +434,11 @@ create_table "versions", force: :cascade do |t| t.string "title", limit: 255 t.text "description", limit: 65535 - t.boolean "published", limit: 1 + t.boolean "published" t.integer "number", limit: 4 t.integer "phase_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end add_index "versions", ["phase_id"], name: "index_versions_on_phase_id", using: :btree diff --git a/db/seeds.rb b/db/seeds.rb index 8cde5a0..48e2994 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -614,7 +614,7 @@ section: "Data Collection", number: 1, guidance: "
Questions to consider:
Guidance:
Give a brief description of the data, including any existing data or third-party sources that will be used, in each case noting its content, type and coverage. Outline and justify your choice of format and consider the implications of data format and data volumes in terms of storage, backup and access.
", - themes: ["Theme 1", "Theme 2"] + themes: ["Theme 2"] }, "How will the data be collected or created?" => { text: "How will the data be collected or created?", @@ -628,7 +628,7 @@ section: "Documentation and Metadata", number: 1, guidance: "Questions to consider:
Guidance:
Describe the types of documentation that will accompany the data to help secondary users to understand and reuse it. This should at least include basic details that will help people to find the data, including who created or contributed to the data, its title, date of creation and under what conditions it can be accessed.
Documentation may also include details on the methodology used, analytical and procedural information, definitions of variables, vocabularies, units of measurement, any assumptions made, and the format and file type of the data. Consider how you will capture this information and where it will be recorded. Wherever possible you should identify and use existing community standards.
", - themes: ["Theme 1", "Theme 4"] + themes: ["Theme 1"] }, "Data Overview" => { text: "Overview of the Data",