Skip to content

Commit c1b0695

Browse files
authored
Fix form builder when is used in system (#104)
* Fix nil errors in form builder when is system * Refactor with alias method * Rubocopify and update upload artifact * Upload actions * Install Imagemagick in github actions * Refactor returns * Rubocopify
1 parent 782784c commit c1b0695

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/test_integration.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
- run: tar -zcf /tmp/testapp-env.tar.gz ./spec/decidim_dummy_app
6767

68-
- uses: actions/upload-artifact@v3
68+
- uses: actions/upload-artifact@v4
6969
with:
7070
name: workspace
7171
path: /tmp/testapp-env.tar.gz
@@ -120,8 +120,11 @@ jobs:
120120
with:
121121
ruby-version: ${{ env.RUBY_VERSION }}
122122
bundler-cache: true
123+
124+
- name: Install imagemagick
125+
run: sudo apt install -y imagemagick
123126

124-
- uses: actions/download-artifact@v3
127+
- uses: actions/download-artifact@v4
125128
with:
126129
name: workspace
127130
path: /tmp
@@ -140,7 +143,7 @@ jobs:
140143
with:
141144
token: ${{ secrets.CODECOV_TOKEN }}
142145

143-
- uses: actions/upload-artifact@v3
146+
- uses: actions/upload-artifact@v4
144147
if: always()
145148
with:
146149
name: screenshots-${{ matrix.name }}

app/forms/concerns/decidim/reporting_proposals/form_builder_override.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ module FormBuilderOverride
1010
delegate :asset_pack_path, to: :@template
1111

1212
included do
13+
alias_method :original_file_field, :file_field
14+
1315
def file_field(object_name, options = {})
14-
return super(object_name, options) unless Decidim::ReportingProposals.use_camera_button
16+
return original_file_field(object_name, options) unless Decidim::ReportingProposals.use_camera_button
17+
return original_file_field(object_name, options) unless @template.respond_to?(:snippets)
1518

1619
unless @template.snippets.any?(:reporting_proposals_camera_scripts) || @template.snippets.any?(:reporting_proposals_camera_styles)
1720
@template.snippets.add(:reporting_proposals_camera_scripts, @template.prepend_javascript_pack_tag("decidim_reporting_proposals_camera"))

0 commit comments

Comments
 (0)