Template Versioning
This commit is a complete refactor of all the pages involved with Template creating/editing. The database, models, controllers, views and JS have all been changed.

------------------------------------------------------------

removed unused template methods from Plan model and removed references to 'Dmptemplate' from tests

started updating model scopes and began creating new unit tests and test_helper methods

Rebased with template customization fixes. updated tests and latest_version queries

Grouping class methods. Grouping scope methods into separate class

removed Template::valid scope method in favour of Template::unarchived

Moved class methods to scope rails flavour.

Removed Template::get_public_published_template_versions method

Model#deep_copy instead of Model::deep_copy. Model#deep_copy without side effects

added customize method to model

updated customize to use new deep_copy and added some tests

fixed test

fixed broken tests after latest PR. DMPRoadmap/roadmap#1341

generate_version with unit test associated

customize with unit test associated

upgrade_customization first attempt

added tests for upgrade_customization

upgrade_customization with several unit test associated

added generate_copy

fixed tests and added test_helper for phase/section/question/annotation/question_option equality for verifying template copy/version/customize

added comments

finished up tests

Removed template.update! in favour of a more re-usable deep_copy with atomic saving.

removed new_copy.save! from templates_controller#copy. Atomic save for upgrade_customization method

renamed to bang notation generate_copy, generate_version, customize and upgrade_customization

question mark methods for generate_version, customize and upgrade_customization

unique indices for template and template customisations. #1341

init functionality for versionable concern

updated errors, added get_new

unique indices for template and template customisations. #1341

new schema dump generated from rails

manually set up the default for org.links

Fix for rake tasks

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

wired in the new versionable concern

wired in the new versionable concern

updated query structure in template_filter

updated routes and paths

moved phases controller to org_admin namespace

changes to phase model and unit tests

started moving phase views to new org_admin namespace and tests

fixed tests

started fixing up references to moved plan/phase status

started fixing up references to moved plan/phase status

moved js file, fixed tests and manually checked pages

set schema.rb back to sprint2

added in versionable concern and fixed tests

removed unused phase_status method

removed test for phase_status method

fixed issue with template visibility for the default template

fixed issue with default templates and versioning/customization

versionable_test.rb

versionable concern updated

find_or_generate_version! into template, test associated

annotation and question model using has_one through adequately

templates_controller#update action refactored

tweaks to template_test

get_new and get_modifiable test cases for RuntimeError capture

passing parent object ids to children during deep_copy

updated question_option and annotation deep copy

removed old deep_copy method from section model and updated unit tests

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

started work on new template show/edit

finished up templates UI

fixed tests

consolidated form

consolidated form

fixed history page

removed old view

fixed test

fixed typo in en_US app.po

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

fixed tests and missing policy

fixed tests

created separate routes for each template index tab

updates to template index page structure

added callback to template model to ensure only one published version

finished up first pass of templates index page

fixed tests

removed current_tab from phase views. DMPRoadmap/roadmap#1407

section#create refactored. DMPRoadmap/roadmap#1407

sections loaded on demand for a phase. DMPRoadmap/roadmap#1407

ExpandAll triggers click instead of using collapse. DMPRoadmap/roadmap#1407

added phase/section/question overview back to template details page

send customizer to show section page

updated button text

updated history controller action

updated controller

updated views

added customization distinction to page title

updates to phase/section to introduce referrer logic and added section-show for customizable

removed old 'edit phase details button

removed edit question partial from section show

tweaks to templates index pages

fixed tests and default scope

added test for default customizations

added namespace to org section of templates index and made autocomplete combobox aware of form namespace

fixed issue with container view

removed old policies

updated statuses of templates

fixed typo in phases/overview view. DMPRoadmap/roadmap#1377

annotations moved to org_admin namespace. DMPRoadmap/roadmap#1377

annotations_controller#(create|update|destroy) with test associated. DMPRoadmap/roadmap#1377

flash notice for successful action carried out. DMPRoadmap/roadmap#1377

flash notice for success actions. create? method for annotation policy. DMPRoadmap/roadmap#1377

started refactor of sections/questions

fixed nil references. DMPRoadmap/roadmap#1462

annotations as fields_for nested attributes. DMPRoadmap/roadmap#1462

commented out version check on template update

removed invalid test

fixed reference to moved partials and family to family_id

fixed question update

updated guidances to work with modified themes form

finished up questions

fixed broken tests

updated preview and customize

fixed issue with sections index

cleaned up remaining issues with template editing and customization

added in check for nil phase to sections create

any user with readable rights should see download tab for a plan. DMPRoadmap/roadmap#1483

updated history to use new template.draft? logic to determine when to show draft icon

added latest check

added check for default option

added checks for historical and customization on preview page

added redirect to show if template is customization

added redirect to show if template is customization

updated ajax success/error for section display

fixed issues with create plan template selection and changing plan visibility

forgot to include model change

reverted schema.rb changes

adding org to chained scope in order to have searchable and sortable templates. DMPRoadmap/roadmap#1495

improved customization template search against all funder templates. DMPRoadmap/roadmap#1499

started work on adding edit/show/new/cancel buttons for questions

added toggle functionality between question show/edit

removed whitespace

made text area the default

updated template statuses

updated class to fix layout

introducing event delegation for sections/questions/annotations. DMPRoadmap/roadmap#1502

removed console.log

fixed JS for section/question

annotation loading tinymce when section show only permits customisation. DMPRoadmap/roadmap#1502

fixed issue with customizating by adding a section/question

removed reload

set focus to first invalid form input

fixed placement of focus for new validation.js

Added joins for customizations table

updated query

fixed initial numbering for new phases/sections

reverted referrer change

made section fields required

added ariatise to new section form

fixed referrer check

fixed inconsistent status message for transfer customization workflow

fixed issue with csv download

fixed csv header

fixed links for customization on history page

updated sections index so new section doesn't show unless its the current template

Added joins for customizations table

added includes to customisable query

fixed issue with paginable history

fixed merge conflicts in templates_controller and questions/_show.html.erb

resolved additional rebase conflict
dev
1 parent a638884 commit 92da1d9e45e29eb2fe6bc2548fdb935ed936baed
@briley briley authored on 5 Apr 2018
Showing 170 changed files
View
app/controllers/annotations_controller.rb 100644 → 0
Too large
View
app/controllers/answers_controller.rb
Too large
View
app/controllers/api/v0/plans_controller.rb
Too large
View
app/controllers/api/v0/statistics_controller.rb
Too large
View
app/controllers/api/v0/templates_controller.rb
Too large
View
app/controllers/concerns/paginable.rb
Too large
View
app/controllers/concerns/versionable.rb 0 → 100644
Too large
View
app/controllers/guidances_controller.rb
Too large
View
app/controllers/org_admin/phases_controller.rb 0 → 100644
Too large
View
app/controllers/org_admin/questions_controller.rb 0 → 100644
Too large
View
app/controllers/org_admin/sections_controller.rb 0 → 100644
Too large
View
app/controllers/org_admin/templates_controller.rb
Too large
View
app/controllers/paginable/templates_controller.rb
Too large
View
app/controllers/phases_controller.rb 100644 → 0
Too large
View
app/controllers/plans_controller.rb
Too large
View
app/controllers/public_pages_controller.rb
Too large
View
app/controllers/questions_controller.rb 100644 → 0
Too large
View
app/controllers/sections_controller.rb 100644 → 0
Too large
View
app/controllers/users_controller.rb
Too large
View
app/models/annotation.rb
Too large
View
app/models/concerns/exportable_plan.rb
Too large
View
app/models/guidance.rb
Too large
View
app/models/org.rb
Too large
View
app/models/phase.rb
Too large
View
app/models/plan.rb
Too large
View
app/models/question.rb
Too large
View
app/models/question_option.rb
Too large
View
app/models/scopes/template_scope.rb 0 → 100644
Too large
View
app/models/section.rb
Too large
View
app/models/template.rb
Too large
View
app/policies/annotation_policy.rb
Too large
View
app/policies/paginable/template_policy.rb 100644 → 0
Too large
View
app/policies/phase_policy.rb
Too large
View
app/policies/plan_policy.rb
Too large
View
app/policies/question_policy.rb
Too large
View
app/policies/section_policy.rb
Too large
View
app/policies/template_policy.rb
Too large
View
app/views/annotations/_new_edit.html.erb 100644 → 0
Too large
View
app/views/annotations/_show.html.erb 100644 → 0
Too large
View
app/views/answers/_new_edit.html.erb
Too large
View
app/views/api/v0/plans/show.json.jbuilder
Too large
View
app/views/api/v0/statistics/plans.json.jbuilder
Too large
View
app/views/api/v0/templates/index.json.jbuilder
Too large
View
app/views/guidances/new_edit.html.erb
Too large
View
app/views/layouts/_branding.html.erb
Too large
View
app/views/layouts/application.html.erb
Too large
View
app/views/org_admin/annotations/_form.html.erb 0 → 100644
Too large
View
app/views/org_admin/annotations/_show.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_edit.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_form.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_index.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_new.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_overview.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/_show.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/container.html.erb 0 → 100644
Too large
View
app/views/org_admin/phases/preview.html.erb 0 → 100644
Too large
View
app/views/org_admin/question_options/_option_fields.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_container.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_edit.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_form.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_index.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_new.html.erb 0 → 100644
Too large
View
app/views/org_admin/questions/_show.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_edit.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_form.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_index.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_new.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_progress.html.erb 0 → 100644
Too large
View
app/views/org_admin/sections/_show.html.erb 0 → 100644
Too large
View
app/views/org_admin/shared/_theme_selector.html.erb
Too large
View
app/views/org_admin/templates/_admin_nav_tabs.html.erb 100644 → 0
Too large
View
app/views/org_admin/templates/_edit.html.erb
Too large
View
app/views/org_admin/templates/_edit_template.html.erb 100644 → 0
Too large
View
app/views/org_admin/templates/_form.html.erb 0 → 100644
Too large
View
app/views/org_admin/templates/_navigation.html.erb 0 → 100644
Too large
View
app/views/org_admin/templates/_new.html.erb 0 → 100644
Too large
View
app/views/org_admin/templates/_show.html.erb 0 → 100644
Too large
View
app/views/org_admin/templates/_show_phases_sections.html.erb 100644 → 0
Too large
View
app/views/org_admin/templates/_show_template.html.erb 100644 → 0
Too large
View
app/views/org_admin/templates/container.html.erb
Too large
View
app/views/org_admin/templates/history.html.erb
Too large
View
app/views/org_admin/templates/index.html.erb
Too large
View
app/views/org_admin/templates/new.html.erb 100644 → 0
Too large
View
app/views/paginable/orgs/_index.html.erb
Too large
View
app/views/paginable/templates/_all.html.erb 100644 → 0
Too large
View
app/views/paginable/templates/_customisable.html.erb 0 → 100644
Too large
View
app/views/paginable/templates/_funders.html.erb 100644 → 0
Too large
View
app/views/paginable/templates/_history.html.erb
Too large
View
app/views/paginable/templates/_index.html.erb 0 → 100644
Too large
View
app/views/paginable/templates/_organisational.html.erb 0 → 100644
Too large
View
app/views/paginable/templates/_orgs.html.erb 100644 → 0
Too large
View
app/views/paginable/templates/_publicly_visible.html.erb
Too large
View
app/views/phases/_admin_add.html.erb 100644 → 0
Too large
View
app/views/phases/_admin_show.html.erb 100644 → 0
Too large
View
app/views/phases/_edit_phase.html.erb 100644 → 0
Too large
View
app/views/phases/_edit_plan_answers.html.erb
Too large
View
app/views/phases/_guidances_notes.html.erb
Too large
View
app/views/phases/_overview.html.erb
Too large
View
app/views/phases/_show_phase.html.erb 100644 → 0
Too large
View
app/views/phases/admin_preview.html.erb 100644 → 0
Too large
View
app/views/phases/edit.html.erb
Too large
View
app/views/plans/_navigation.html.erb
Too large
View
app/views/question_options/_option_fields.html.erb 100644 → 0
Too large
View
app/views/questions/_add_question.html.erb 100644 → 0
Too large
View
app/views/questions/_edit_question.html.erb 100644 → 0
Too large
View
app/views/questions/_new_edit_question_option_based.html.erb
Too large
View
app/views/questions/_show_question.html.erb 100644 → 0
Too large
View
app/views/sections/_add_section.html.erb 100644 → 0
Too large
View
app/views/sections/_edit_section.html.erb 100644 → 0
Too large
View
app/views/sections/_progress.html.erb 100644 → 0
Too large
View
app/views/sections/_show_section.html.erb 100644 → 0
Too large
View
app/views/shared/_my_org.html.erb
Too large
View
config/application.rb
Too large
View
config/locale/en_US/app.po
Too large
View
config/routes.rb
Too large
View
db/migrate/20180405151713_rename_template_fields.rb 0 → 100644
Too large
View
db/migrate/20180405151942_remove_dirty_from_templates.rb 0 → 100644
Too large
View
db/migrate/20180405152454_add_family_id_index_to_templates.rb 0 → 100644
Too large
View
db/migrate/20180417124026_add_unique_index_family_id_version_to_template.rb 0 → 100644
Too large
View
db/migrate/20180418115318_add_unique_index_customization_of_version_org_id_to_template.rb 0 → 100644
Too large
View
db/schema.rb
Too large
View
lib/assets/javascripts/application.js
Too large
View
lib/assets/javascripts/utils/ariatiseForm.js
Too large
View
lib/assets/javascripts/utils/expandCollapseAll.js
Too large
View
lib/assets/javascripts/utils/validation.js
Too large
View
lib/assets/javascripts/views/annotations/add.js 100644 → 0
Too large
View
lib/assets/javascripts/views/annotations/edit.js 100644 → 0
Too large
View
lib/assets/javascripts/views/org_admin/phases/new_edit.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/phases/preview.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/question_options/index.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/questions/sharedEventHandlers.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/sections/index.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/templates/edit.js
Too large
View
lib/assets/javascripts/views/org_admin/templates/index.js
Too large
View
lib/assets/javascripts/views/org_admin/templates/new.js 0 → 100644
Too large
View
lib/assets/javascripts/views/org_admin/templates/show.js 100644 → 0
Too large
View
lib/assets/javascripts/views/phases/edit.js 100644 → 0
Too large
View
lib/assets/javascripts/views/phases/show.js 100644 → 0
Too large
View
lib/assets/javascripts/views/question_options/index.js 100644 → 0
Too large
View
lib/assets/javascripts/views/questions/index.js 100644 → 0
Too large
View
lib/assets/javascripts/views/questions/new_edit.js 100644 → 0
Too large
View
lib/assets/javascripts/views/questions/sharedEventHandlers.js 100644 → 0
Too large
View
lib/assets/javascripts/views/questions/show.js 100644 → 0
Too large
View
lib/assets/javascripts/views/sections/edit.js 100644 → 0
Too large
View
lib/assets/javascripts/views/sections/index.js 100644 → 0
Too large
View
lib/assets/javascripts/views/sections/new.js 100644 → 0
Too large
View
lib/assets/stylesheets/overrides.scss
Too large
View
lib/tasks/upgrade.rake
Too large
View
lib/template_filter.rb 100644 → 0
Too large
View
test/functional/annotations_controller_test.rb 100644 → 0
Too large
View
test/functional/org_admin/phases_controller_test.rb 0 → 100644
Too large
View
test/functional/org_admin/questions_controller_test.rb 0 → 100644
Too large
View
test/functional/org_admin/sections_controller_test.rb 0 → 100644
Too large
View
test/functional/org_admin/templates_controller_test.rb
Too large
View
test/functional/phases_controller_test.rb 100644 → 0
Too large
View
test/functional/public_pages_controller_test.rb
Too large
View
test/functional/questions_controller_test.rb 100644 → 0
Too large
View
test/functional/sections_controller_test.rb 100644 → 0
Too large
View
test/integration/download_plan_path_test.rb 0 → 100644
Too large
View
test/integration/template_selection_test.rb
Too large
View
test/integration/template_versioning_test.rb 100644 → 0
Too large
View
test/mailers/previews/user_mailer_preview.rb
Too large
View
test/test_helper.rb
Too large
View
test/unit/concerns/versionable_test.rb 0 → 100644
Too large
View
test/unit/org_test.rb
Too large
View
test/unit/phase_test.rb
Too large
View
test/unit/plan_test.rb
Too large
View
test/unit/question_test.rb
Too large
View
test/unit/section_test.rb
Too large
View
test/unit/template_test.rb
Too large