noosfero | WIP: Custom forms graphs (!1597)

Rodrigo Souto gitlab at mg.gitlab.com
Fri Aug 17 17:50:07 BRT 2018


Rodrigo Souto started a new discussion on plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb:

>      end
>    end
>  
> +  def download_field_answers
> +    field = CustomFormsPlugin::TextField.find_by(name: params[:field_name])
> +    profile = Profile.find_by(identifier: params[:profile])
> +    @form = profile.forms.find_by(identifier: params[:id])
> +
> +    respond_to do |format|
> +      format.html
> +      format.csv do
> +        handler = CustomFormsPlugin::CsvHandler.new(@form)
> +        csv_content = handler.generate_csv([field])
> +        send_data csv_content, type: 'text/csv', filename: "#{params[:field_name]}.csv"

I'd add the form name in the filename as well here.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1597#note_95211245
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180817/d8c714f0/attachment.html>


More information about the Noosfero-dev mailing list