-
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 #13 from chonla/main
feat: Auto-save, Add default title
- Loading branch information
Showing
18 changed files
with
175 additions
and
100 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.
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,29 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import { useDebounce } from 'stimulus-use' | ||
|
||
// Connects to data-controller="auto-submit" | ||
export default class extends Controller { | ||
static targets = [ 'savingIcon', 'savedIcon' ]; | ||
static debounces = [ 'submit' ]; | ||
|
||
connect() { | ||
useDebounce(this, { wait: 2500 }); | ||
this.savedIconTarget.classList.add('hidden'); | ||
this.savingIconTarget.classList.add('hidden'); | ||
} | ||
|
||
dirty(event) { | ||
event.preventDefault() | ||
this.savingIconTarget.classList.add('hidden'); | ||
this.savedIconTarget.classList.add('hidden'); | ||
} | ||
|
||
submit(event) { | ||
event.preventDefault() | ||
this.savingIconTarget.classList.remove('hidden'); | ||
this.savedIconTarget.classList.add('hidden'); | ||
this.element.requestSubmit(); | ||
this.savingIconTarget.classList.add('hidden'); | ||
this.savedIconTarget.classList.remove('hidden'); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
cdmm/app/javascript/controllers/page_capture_controller.js
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,35 @@ | ||
<%= form_with url: evaluation_save_path, method: :post, data: { controller: "auto-submit", action: "capability:toggled@window->auto-submit#dirty capability:toggled@window->auto-submit#submit", turbo_stream: true } do |form| %> | ||
<% if table[:form_key] %> | ||
<input type="hidden" name="form_key" value="<%= table[:form_key] %>"> | ||
<% end %> | ||
<div class="flex flex-row justify-between items-center mb-2"> | ||
<div class="flex flex-col"> | ||
<div class="flex flex-row justify-start items-center gap-x-2"> | ||
<h1 class="noto-serif-thai-bold text-xl md:text-2xl lg:text-3xl leading-normal lg:leading-relaxed"><%= table[:title] %></h1> | ||
<div data-auto-submit-target="savingIcon" class="h-5 md:h-6 lg:h-8 flex flex-row gap-x-1 items-baseline"> | ||
<svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" class="text-slate-500" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"> | ||
<g transform="translate(0, -2) matrix(1.01508,0,0,1,0.0940615,0.0723927)"> | ||
<path d="M4.38,19.443C2.455,19.443 0.892,17.88 0.892,15.955C0.892,14.03 2.455,12.467 4.38,12.467C4.448,12.467 4.516,12.469 4.583,12.473C4.583,12.471 4.583,12.469 4.583,12.467C4.583,10.265 6.372,8.476 8.574,8.476C8.857,8.476 9.133,8.506 9.399,8.562C9.817,6.205 11.877,4.412 14.353,4.412C17.129,4.412 19.383,6.666 19.383,9.443C19.383,9.556 19.38,9.668 19.372,9.78C21.24,10.505 22.566,12.32 22.566,14.443C22.566,17.202 20.325,19.443 17.566,19.443C17.561,19.443 17.557,19.443 17.553,19.443L4.38,19.443Z" style="fill:none;stroke:currentColor;stroke-width:1.98px;"/> | ||
</g> | ||
</svg> | ||
<span class="text-sm md:text-lg lg:text-lg">Saving...</span> | ||
</div> | ||
<div data-auto-submit-target="savedIcon" class="h-5 md:h-6 lg:h-8 flex flex-row gap-x-1"> | ||
<svg viewBox="0 0 24 24" version="1.1" class="text-blue-600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"> | ||
<g transform="translate(0, -2)"> | ||
<g transform="matrix(1.01508,0,0,1,0.0940615,0.0723927)"> | ||
<path d="M4.38,19.443C2.455,19.443 0.892,17.88 0.892,15.955C0.892,14.03 2.455,12.467 4.38,12.467C4.448,12.467 4.516,12.469 4.583,12.473C4.583,12.471 4.583,12.469 4.583,12.467C4.583,10.265 6.372,8.476 8.574,8.476C8.857,8.476 9.133,8.506 9.399,8.562C9.817,6.205 11.877,4.412 14.353,4.412C17.129,4.412 19.383,6.666 19.383,9.443C19.383,9.556 19.38,9.668 19.372,9.78C21.24,10.505 22.566,12.32 22.566,14.443C22.566,17.202 20.325,19.443 17.566,19.443C17.561,19.443 17.557,19.443 17.553,19.443L4.38,19.443Z" style="fill:none;stroke:currentColor;stroke-width:1.98px;"/> | ||
</g> | ||
<g transform="matrix(0.897531,0,0,0.856767,1.71728,1.40309)"> | ||
<path d="M7,14L9.777,16.777L16.759,9.796" style="fill:none;stroke:currentColor;stroke-width:2.28px;"/> | ||
</g> | ||
</g> | ||
</svg> | ||
<span class="text-sm md:text-lg lg:text-lg">Saved</span> | ||
</div> | ||
</div> | ||
<h4 class="noto-serif-thai-regular text-slate-400 text-sm md:text-lg lg:text-lg leading-loose">Continuous Delivery Maturity Model</h4> | ||
</div> | ||
</div> | ||
<%= render "form_table", table: table %> | ||
<% 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,26 +1,28 @@ | ||
<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> | ||
<%= turbo_frame_tag "evaluation_form", data: { turbo_cache_control: "no-cache" } do %> | ||
<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 %> | ||
</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> | ||
</tbody> | ||
</table> | ||
<% end %> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
<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 %> | ||
<%= render "cdmm_form", table: @table %> | ||
</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
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,6 @@ | ||
class AddFormStatus < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :evaluations, :form_status, :string | ||
add_index :evaluations, :form_status, unique: false | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.