diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000..99e859c
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,23 @@
+on: [push]
+jobs:
+ test:
+ runs-on: docker
+ image: ruby:3.3.4
+ name: Text
+ steps:
+ - name: Cache repository
+ uses: actions/cache@v4
+ id: cache-repository
+ with:
+ path: repository
+ key: ${{ runner.os }}-repository-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-repository-
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ path: repository
+ submodules: recursive
+ - run: cd repository
+ - run: bundle install
+ - run: bundle exec rails test
diff --git a/app/controllers/checklists_controller.rb b/app/controllers/checklists_controller.rb
index 7d09926..02a20b8 100644
--- a/app/controllers/checklists_controller.rb
+++ b/app/controllers/checklists_controller.rb
@@ -24,7 +24,7 @@ class ChecklistsController < ApplicationController
@checklist = Checklist.new(checklist_params)
if @checklist.save
- redirect_to [:edit, @checklist], notice: 'Checklist was successfully created.'
+ redirect_to @checklist, notice: 'Checklist was successfully created.'
else
render :new, status: :unprocessable_entity
end
diff --git a/app/controllers/success_criteria_controller.rb b/app/controllers/success_criteria_controller.rb
index 73802b9..2b22791 100644
--- a/app/controllers/success_criteria_controller.rb
+++ b/app/controllers/success_criteria_controller.rb
@@ -42,7 +42,12 @@ class SuccessCriteriaController < ApplicationController
# DELETE /success_criteria/1
def destroy
@success_criterion.destroy!
- redirect_to success_criteria_url, notice: 'Success criterion was successfully destroyed.', status: :see_other
+ respond_to do |format|
+ format.html do
+ redirect_to success_criteria_url, notice: 'Success criterion was successfully destroyed.', status: :see_other
+ end
+ format.turbo_stream
+ end
end
private
diff --git a/app/helpers/success_criteria_helper.rb b/app/helpers/success_criteria_helper.rb
index 2754b45..1fdada1 100644
--- a/app/helpers/success_criteria_helper.rb
+++ b/app/helpers/success_criteria_helper.rb
@@ -10,4 +10,20 @@ module SuccessCriteriaHelper
'bi bi-question text-warning'
end
end
+
+ def success_criterion_edit_button(success_criterion, edit_mode)
+ path = if success_criterion.persisted?
+ if edit_mode
+ success_criterion
+ else
+ [:edit,
+ success_criterion]
+ end
+ else
+ success_criterion.element
+ end
+ link_to tag.i(class: 'bi bi-pencil'),
+ path,
+ class: "btn btn-#{edit_mode ? 'link text-warning' : 'link text-secondary'}"
+ end
end
diff --git a/app/views/elements/index.html.erb b/app/views/elements/index.html.erb
index 2b6b800..c8f8061 100644
--- a/app/views/elements/index.html.erb
+++ b/app/views/elements/index.html.erb
@@ -25,7 +25,7 @@
<%= link_to(element.title, url_for(element)) %> |
- <%= link_to(truncate(strip_tags(element.description_html)), url_for(element)) %> |
+ <%= link_to(truncate(element.description_html&.to_plain_text), url_for(element)) %> |
<% end %>
diff --git a/app/views/success_criteria/_header.html.erb b/app/views/success_criteria/_header.html.erb
index 8fa1cae..298b251 100644
--- a/app/views/success_criteria/_header.html.erb
+++ b/app/views/success_criteria/_header.html.erb
@@ -21,7 +21,7 @@
<% end %>
- <%= link_to tag.i(class: "bi bi-#{edit_mode ? "pencil" : "pencil"}"), edit_mode ? success_criterion : [:edit, success_criterion], class: "btn btn-#{edit_mode ? "link text-warning" : "link text-secondary"}" %>
+ <%= success_criterion_edit_button(success_criterion, edit_mode) %>