Skip to content

Add attachments to Initiatives#5844

Merged
jesusdb merged 15 commits intodecidim:developfrom
armandfardeau:feature/add-attachment-to-initiatives
May 26, 2020
Merged

Add attachments to Initiatives#5844
jesusdb merged 15 commits intodecidim:developfrom
armandfardeau:feature/add-attachment-to-initiatives

Conversation

@armandfardeau
Copy link
Copy Markdown
Contributor

@armandfardeau armandfardeau commented Mar 10, 2020

🎩 What? Why?

Adds the possibility for the user to add a file when filing an initiative, then allows to modify the attachments from the back office.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add/modify seeds

📷 Screenshots (optional)

image
image

@armandfardeau armandfardeau changed the title Feature/add attachment to initiatives Feature/add attachments to initiatives Mar 11, 2020
@armandfardeau armandfardeau marked this pull request as ready for review March 11, 2020 14:34
@virgile-dev
Copy link
Copy Markdown
Contributor

@armandfardeau I have a minor bug to report.
As a user trying to add a joint file in the step 4 of the initiative wizard and make mistake, say do not give a title to my attachement, I cannot submit the form and no red error message appears to tell me what is wrong.

Before submission
Capture d’écran 2020-03-13 à 12 27 19

After submission
Capture d’écran 2020-03-13 à 12 27 32

@armandfardeau
Copy link
Copy Markdown
Contributor Author

@armandfardeau I have a minor bug to report.
As a user trying to add a joint file in the step 4 of the initiative wizard and make mistake, say do not give a title to my attachement, I cannot submit the form and no red error message appears to tell me what is wrong.

Before submission
Capture d’écran 2020-03-13 à 12 27 19

After submission
Capture d’écran 2020-03-13 à 12 27 32

Indeed that's quite strange! I will check asap :)

@virgile-dev
Copy link
Copy Markdown
Contributor

virgile-dev commented Mar 16, 2020

@armandfardeau If you want to fix this as well at the same time. Might be worth squashing it into this PR : #5860

@armandfardeau
Copy link
Copy Markdown
Contributor Author

@armandfardeau If you want to fix this as well at the same time. Might be worth squashing it into this PR : #5860

I suggest we fix this after this one.

Comment on lines +59 to +68
def trigger_attachment_errors
return if attachment.blank?
return if attachment.valid?

attachment.errors.each { |error| errors.add(:attachment, error) }

attachment = Attachment.new(file: attachment.try(:file))

errors.add(:attachment, :file) if !attachment.save && attachment.errors.has_key?(:file)
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This little trick solves a part of the problem. Due to wicked's wizard, the validation on the form is not done until the final step, so we ensure that validations are triggered before. Quite sure this is the ugliest way to do it so if someone has an idea, I'm in! 😀

@andreslucena andreslucena changed the title Feature/add attachments to initiatives Add attachments to Initiatives Mar 24, 2020
@paulinebessoles
Copy link
Copy Markdown
Contributor

Link to Metadecidim proposal

Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @armandfardeau , can you check the tests, merge develop and solve conflicts? 😉

@virgile-dev
Copy link
Copy Markdown
Contributor

@tramuntanal Armand just resolved the conflict. This should be ready to be merged. Thanks in advance.

@armandfardeau
Copy link
Copy Markdown
Contributor Author

@tramuntanal Hello and sorry for the delay! It should be all good now!

@virgile-dev
Copy link
Copy Markdown
Contributor

@Leusev or @ivan-mr we've applied the requested changes in the review. Could you see if we can merge this one ?

@jesusdb jesusdb self-requested a review May 22, 2020 09:44
@jesusdb
Copy link
Copy Markdown
Contributor

jesusdb commented May 22, 2020

It looks good to me! But could you check the conflicting files, please?

@armandfardeau
Copy link
Copy Markdown
Contributor Author

@jesusdb Seems all good to me ;)

@armandfardeau armandfardeau requested a review from tramuntanal May 25, 2020 11:13
@virgile-dev
Copy link
Copy Markdown
Contributor

@jesusdb could you check if we can merge this now ? Thanks in advance !

Copy link
Copy Markdown
Contributor

@jesusdb jesusdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, done! 😄

@jesusdb jesusdb merged commit 366a6d6 into decidim:develop May 26, 2020
ace pushed a commit to aspgems/decidim that referenced this pull request May 27, 2020
* develop:
  Include year in meetings card (decidim#6102)
  Add attachment enabled option to initiative types and initiatives (decidim#6036)
  Fix a flaky test in group profile conversations (decidim#6123)
  Add attachments to Initiatives (decidim#5844)
  Add initiatives export (decidim#6070)
  Improvements to conversations with more than one participant (decidim#6094)
  Elections module and election administration (decidim#6065)
  Separate forms in steps (decidim#6108)
  Add sorting by publishing date to initiatives (decidim#6016)
  Improve proposal preview: Use proposal card when previewing a proposal draft (decidim#6064)
  Newsletter templates fixes (decidim#6096)

# Conflicts:
#	decidim-initiatives/app/models/decidim/initiative.rb
#	decidim-initiatives/spec/system/admin/initiative_types_controller_spec.rb
ace pushed a commit to aspgems/decidim that referenced this pull request May 28, 2020
* feature/add_areas_to_initiatives: (30 commits)
  Adds areas to FO filters
  Fix lint issue
  Fixes rubocop issues
  Updates changelog
  Adds areas to initiatives
  Send notification when signature threshold reached (decidim#6098)
  Adds filter by initiative type to admin panel (decidim#6093)
  Require confirmation on exiting a survey mid-answering (decidim#6118)
  Information message when there isn't any Proposal (decidim#6063)
  Set email asset host dynamically (decidim#5888)
  Harmonizes the design of initiatives search in FO (decidim#6090)
  Include year in meetings card (decidim#6102)
  Add attachment enabled option to initiative types and initiatives (decidim#6036)
  Fix a flaky test in group profile conversations (decidim#6123)
  Add attachments to Initiatives (decidim#5844)
  Add initiatives export (decidim#6070)
  Improvements to conversations with more than one participant (decidim#6094)
  Elections module and election administration (decidim#6065)
  Separate forms in steps (decidim#6108)
  Add sorting by publishing date to initiatives (decidim#6016)
  ...

# Conflicts:
#	decidim-initiatives/app/cells/decidim/initiatives/initiative_m_cell.rb
#	decidim-initiatives/app/commands/decidim/initiatives/admin/update_initiative.rb
#	decidim-initiatives/app/controllers/decidim/initiatives/initiatives_controller.rb
#	decidim-initiatives/app/forms/decidim/initiatives/admin/initiative_form.rb
#	decidim-initiatives/app/helpers/decidim/initiatives/application_helper.rb
#	decidim-initiatives/app/models/decidim/initiative.rb
#	decidim-initiatives/app/services/decidim/initiatives/initiative_search.rb
#	decidim-initiatives/app/views/decidim/initiatives/create_initiative/fill_data.html.erb
#	decidim-initiatives/app/views/decidim/initiatives/initiatives/_filters.html.erb
#	decidim-initiatives/app/views/decidim/initiatives/initiatives/_tags.html.erb
#	decidim-initiatives/config/locales/en.yml
#	decidim-initiatives/db/migrate/20200514085422_add_area_to_initiatives.rb
#	decidim-initiatives/db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb
#	decidim-initiatives/spec/forms/initiative_form_spec.rb
#	decidim-initiatives/spec/services/decidim/initiatives/initiative_search_spec.rb
#	decidim-initiatives/spec/shared/update_initiative_type_example.rb
#	decidim-initiatives/spec/system/admin/admin_manages_initiatives_spec.rb
#	decidim-initiatives/spec/system/admin/initiative_types_controller_spec.rb
#	decidim-initiatives/spec/system/filter_initiatives_spec.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants