-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from chonla/main
Persist form data
- Loading branch information
Showing
23 changed files
with
991 additions
and
418 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module CdmmHelper | ||
def get_data_at(table, row_index, col_index) | ||
if table[:rows].count < row_index + 1 | ||
[] | ||
elsif table[:rows][row_index].count < col_index + 1 | ||
[] | ||
else | ||
table[:rows][row_index][col_index] | ||
end | ||
end | ||
|
||
def label_to_key(label) | ||
label.gsub(/::/, '__') | ||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') | ||
.gsub(/([a-z\d])([A-Z])/, '\1_\2') | ||
.downcase | ||
.gsub(/[^a-z]/, '_') | ||
.gsub(/__+/, '_') | ||
.gsub(/^_+/,'') | ||
.gsub(/_+$/, '') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,2 @@ | ||
module HomeHelper | ||
def get_data_at(table, row_index, col_index) | ||
if table[:rows].count < row_index + 1 | ||
[] | ||
elsif table[:rows][row_index].count < col_index + 1 | ||
[] | ||
else | ||
table[:rows][row_index][col_index] | ||
end | ||
end | ||
|
||
def label_to_key(label) | ||
label.gsub(/::/, '__') | ||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') | ||
.gsub(/([a-z\d])([A-Z])/, '\1_\2') | ||
.downcase | ||
.gsub(/[^a-z]/, '_') | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
cdmm/app/javascript/controllers/page_capture_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import html2canvas from "html2canvas"; | ||
|
||
// Connects to data-controller="page-capture" | ||
export default class extends Controller { | ||
static targets = [ 'table' ]; | ||
|
||
connect() { | ||
} | ||
|
||
capture() { | ||
window.scrollTo(0, 0); | ||
html2canvas(this.tableTarget).then(function (canvas) { | ||
const screenshot = canvas.toDataURL("image/png"); | ||
const downloadLink = document.createElement('a'); | ||
downloadLink.download = 'canvas_image.png'; | ||
downloadLink.href = screenshot; | ||
downloadLink.click(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Evaluation < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="flex flex-row" data-controller="event-sensor" data-event-sensor-identifier-value="<%= key %>"> | ||
<div class="mr-2"> | ||
<%= render "shared/tristate_checkbox", state: value, identifier: key, event_sensor: "#{key}:triggered" %> | ||
</div> | ||
<div> | ||
<label data-action="click->event-sensor#invoke" for="<%= key %>" class="leading-4 font-semibold text-slate-600 inline-flex text-xs md:text-sm select-none cursor-pointer hover:underline"><%= label %></label> | ||
<p class="text-xs text-slate-400 inline-flex select-none"><%= description %></p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<table class="border-separate table-fixed border-spacing-0"> | ||
<thead class="sticky top-0 z-10"> | ||
<tr> | ||
<th class="border-gray-300 bg-slate-100 border p-2 text-xs md:text-sm sticky left-0 z-20"></th> | ||
<% table[:col_headers].each_with_index do |col_header, col_index| %> | ||
<th class="border-gray-300 bg-slate-100 border border-l-0 p-2 text-center text-xs md:text-sm font-bold z-10 relative"><%= col_header %></th> | ||
<% end %> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% table[:row_headers].each_with_index do |row_header, row_index| %> | ||
<tr> | ||
<td class="sticky left-0 border-gray-300 bg-slate-100 border border-t-0 p-2 text-center text-xs md:text-sm font-bold z-10"><%= row_header %></td> | ||
<% table[:col_headers].each_with_index do |col_header, col_index| %> | ||
<td class="relative border-gray-300 border border-l-0 border-t-0 p-2 text-xs md:text-sm align-top"> | ||
<div class="flex flex-col gap-y-4 items-start"> | ||
<% get_data_at(table, row_index, col_index).each_with_index do |data, data_index| %> | ||
<%= render :partial => "capability_item", :locals => { key: data[:key], label: data[:label], description: data[:description], value: data[:value] } %> | ||
<% end %> | ||
</div> | ||
</td> | ||
<% end %> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="w-full"> | ||
<%= form_with url: evaluation_save_path, method: :post, data: { turbo: false } do |form| %> | ||
<div class="flex flex-row justify-between items-center"> | ||
<h1 class="noto-serif-thai-bold text-xl md:text-2xl lg:text-3xl leading-loose">Continuous Delivery Maturity Model</h1> | ||
<button class="p-2 border rounded w-8 h-8 bg-slate-700" data-action="click->page-capture#capture"> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="w-full h-full text-slate-100"> | ||
<path d="M1 12l0 9l22 0l0 -9" fill="none" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" /> | ||
<path d="M12 2l0 14M5 10l7 6l7 -6" fill="none" stroke-width="4" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" /> | ||
</svg> | ||
</button> | ||
</div> | ||
<%= render "form_table", table: @table %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="w-full"> | ||
<%= form_with url: evaluation_save_path, method: :post, data: { turbo: false } do |form| %> | ||
<input type="hidden" name="form_key" value="<%= params[:form_key] %>"> | ||
<div class="flex flex-row justify-between items-center"> | ||
<h1 class="noto-serif-thai-bold text-xl md:text-2xl lg:text-3xl leading-loose">Continuous Delivery Maturity Model</h1> | ||
<button class="p-2 border rounded w-8 h-8 bg-slate-700" data-action="click->page-capture#capture"> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="w-full h-full text-slate-100"> | ||
<path d="M1 12l0 9l22 0l0 -9" fill="none" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" /> | ||
<path d="M12 2l0 14M5 10l7 6l7 -6" fill="none" stroke-width="4" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" /> | ||
</svg> | ||
</button> | ||
</div> | ||
<%= render "form_table", table: @table %> | ||
<% end %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
class CreateEvaluations < ActiveRecord::Migration[7.2] | ||
def change | ||
create_table :evaluations do |t| | ||
t.timestamps | ||
t.string "form_key", null: false | ||
t.string "teams_organized_based_on_platform_technology", null: false, default: "unchecked" | ||
t.string "defined_and_documented_process", null: false, default: "unchecked" | ||
t.string "one_backlog_per_team", null: false, default: "unchecked" | ||
t.string "adopt_agile_methodologies", null: false, default: "unchecked" | ||
t.string "remove_team_boundaries", null: false, default: "unchecked" | ||
t.string "extended_team_collaboration", null: false, default: "unchecked" | ||
t.string "remove_boundary_dev_ops", null: false, default: "unchecked" | ||
t.string "common_process_for_all_changes", null: false, default: "unchecked" | ||
t.string "cross_team_continuous_improvement", null: false, default: "unchecked" | ||
t.string "teams_responsible_all_the_way_to_production", null: false, default: "unchecked" | ||
t.string "cross_functional_teams", null: false, default: "unchecked" | ||
t.string "centralized_version_control", null: false, default: "unchecked" | ||
t.string "automated_build_scripts", null: false, default: "unchecked" | ||
t.string "no_management_of_artifacts", null: false, default: "unchecked" | ||
t.string "manual_deployment", null: false, default: "unchecked" | ||
t.string "environments_are_manually_provisioned", null: false, default: "unchecked" | ||
t.string "polling_ci_builds", null: false, default: "unchecked" | ||
t.string "any_build_can_be_re_created_from_source_control", null: false, default: "unchecked" | ||
t.string "management_of_build_artifacts", null: false, default: "unchecked" | ||
t.string "automated_deployment_scripts", null: false, default: "unchecked" | ||
t.string "automated_provisioning_of_environments", null: false, default: "unchecked" | ||
t.string "commit_hook_ci_builds", null: false, default: "unchecked" | ||
t.string "build_fails_if_quality_is_not_met_code_analysis_performance_etc", null: false, default: "unchecked" | ||
t.string "push_button_deployment_and_release_of_any_releasable_artifact_to_any_environment", null: false, default: "unchecked" | ||
t.string "standard_deployment_process_for_all_environments", null: false, default: "unchecked" | ||
t.string "team_priorities_keeping_codebase_deployable_over_doing_new_work", null: false, default: "unchecked" | ||
t.string "builds_are_not_left_broken", null: false, default: "unchecked" | ||
t.string "orchestrated_deployments", null: false, default: "unchecked" | ||
t.string "blue_green_deployments", null: false, default: "unchecked" | ||
t.string "zero_touch_continuous_deployments", null: false, default: "unchecked" | ||
t.string "infrequent_and_unreliable_releases", null: false, default: "unchecked" | ||
t.string "manual_process", null: false, default: "unchecked" | ||
t.string "painful_infrequent_but_reliable_releases", null: false, default: "unchecked" | ||
t.string "infrequent_but_fully_automated_and_reliable_releases_in_any_environment", null: false, default: "unchecked" | ||
t.string "frequent_fully_automated_releases", null: false, default: "unchecked" | ||
t.string "deployment_disconnected_from_release", null: false, default: "unchecked" | ||
t.string "canary_releases", null: false, default: "unchecked" | ||
t.string "no_rollbacks_always_roll_forward", null: false, default: "unchecked" | ||
t.string "data_migrations_are_performed_manually_no_scripts", null: false, default: "unchecked" | ||
t.string "data_migrations_using_versioned_scripts_performed_manually", null: false, default: "unchecked" | ||
t.string "automated_and_versioned_changes_to_datastores", null: false, default: "unchecked" | ||
t.string "changes_to_datastores_automatically_performed_as_part_of_the_deployment_process", null: false, default: "unchecked" | ||
t.string "automatic_datastore_changes_and_rollbacks_tested_with_every_deployment", null: false, default: "unchecked" | ||
t.string "automated_unit_tests", null: false, default: "unchecked" | ||
t.string "separate_test_environment", null: false, default: "unchecked" | ||
t.string "automatic_integration_tests", null: false, default: "unchecked" | ||
t.string "static_code_analysis", null: false, default: "unchecked" | ||
t.string "test_coverage_analysis", null: false, default: "unchecked" | ||
t.string "automatic_functional_tests", null: false, default: "unchecked" | ||
t.string "manual_performance_security_tests", null: false, default: "unchecked" | ||
t.string "fully_automatic_acceptance", null: false, default: "unchecked" | ||
t.string "automatic_performance_security_tests", null: false, default: "unchecked" | ||
t.string "manual_exploratory_testing_based_on_risk_based_testing_analysis", null: false, default: "unchecked" | ||
t.string "verify_expected_business_value", null: false, default: "unchecked" | ||
t.string "defects_found_and_fixed_immediately_roll_forward", null: false, default: "unchecked" | ||
t.string "baseline_process_metrics", null: false, default: "unchecked" | ||
t.string "manual_reporting", null: false, default: "unchecked" | ||
t.string "visible_to_report_runner", null: false, default: "unchecked" | ||
t.string "measure_the_process", null: false, default: "unchecked" | ||
t.string "automatic_reporting", null: false, default: "unchecked" | ||
t.string "visible_to_team", null: false, default: "unchecked" | ||
t.string "automatic_generation_of_release_notes", null: false, default: "unchecked" | ||
t.string "pipeline_traceability", null: false, default: "unchecked" | ||
t.string "reporting_history", null: false, default: "unchecked" | ||
t.string "visible_to_cross_silo", null: false, default: "unchecked" | ||
t.string "report_trend_analysis", null: false, default: "unchecked" | ||
t.string "real_time_graphs_on_deployment_pipeline_metrics", null: false, default: "unchecked" | ||
t.string "dynamic_self_service_of_information", null: false, default: "unchecked" | ||
t.string "customizable_dashboards", null: false, default: "unchecked" | ||
t.string "cross_reference_across_organizational_boundaries", null: false, default: "unchecked" | ||
|
||
t.index ["form_key"], name: "index_evaluation_form_key" | ||
end | ||
end | ||
end |
Oops, something went wrong.