{"id":18133317,"url":"https://github.com/andreapavoni/simple_form_fancy_uploads","last_synced_at":"2025-08-28T23:34:46.698Z","repository":{"id":2460816,"uuid":"3432823","full_name":"andreapavoni/simple_form_fancy_uploads","owner":"andreapavoni","description":"simple_form custom inputs to get image/link previews with file uploads.","archived":false,"fork":false,"pushed_at":"2023-03-08T19:46:38.000Z","size":84,"stargazers_count":162,"open_issues_count":13,"forks_count":44,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-01T11:49:43.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreapavoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-02-13T18:38:01.000Z","updated_at":"2025-05-13T04:12:50.000Z","dependencies_parsed_at":"2023-07-06T07:27:48.017Z","dependency_job_id":null,"html_url":"https://github.com/andreapavoni/simple_form_fancy_uploads","commit_stats":{"total_commits":47,"total_committers":13,"mean_commits":"3.6153846153846154","dds":"0.46808510638297873","last_synced_commit":"528e1c930075c02264ab7f774ad3cd6244a0a663"},"previous_names":["apeacox/simple_form_fancy_uploads"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/andreapavoni/simple_form_fancy_uploads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreapavoni%2Fsimple_form_fancy_uploads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreapavoni%2Fsimple_form_fancy_uploads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreapavoni%2Fsimple_form_fancy_uploads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreapavoni%2Fsimple_form_fancy_uploads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreapavoni","download_url":"https://codeload.github.com/andreapavoni/simple_form_fancy_uploads/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreapavoni%2Fsimple_form_fancy_uploads/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272002289,"owners_count":24856530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-01T13:07:25.538Z","updated_at":"2025-08-28T23:34:46.646Z","avatar_url":"https://github.com/andreapavoni.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleForm fancy uploads\n\nA set of [simple_form](https://github.com/plataformatec/simple_form) (~\u003e 4.1) custom inputs to get image previews or a link to\nuploaded file.\n\nThis gem uses the simple_form ability to write your own form tags (check the [simple_form-bootstrap](https://github.com/rafaelfranca/simple_form-bootstrap) example). In 90% of cases, you need some kind of preview when it comes to uploaded files (avatar, images, docs, etc..), why should I write the same markup each time?\n\n## What you get\n\nThere're only two new file inputs:\n\n* `ImagePreview`: guess what? when you edit an entry that contains an uploaded image, it will be shown (how many times did you this in a CMS?)\n* `AttachmentPreview`: this is a generic upload field, it will show a direct link to the file, so you can check *what* was uploaded.\n\n## How it works\n\n### Install\n\nSimply add `gem 'simple_form_fancy_uploads'` to your `Gemfile` and run `bundle install`\n\n### Usage\n\nHere's a basic example, as you can see, it's just a matter of specify the input as `:image_preview` or `:attachment_preview`. If using `:image_preview`, you can also specify a `:preview_version =\u003e :some_version_name` inside the `:input_html` Hash. This will let you to show a custom version generated with Carrierwave. Nice, isn't it?\n\nIf you need to fallback on Carrierwave's `#default_url` method to show a default image defined in your upload class, set `:use_default_url =\u003e true` in the options hash.\n\n```erb\n\u003c%= simple_form_for @some_model do |f| %\u003e\n  \u003c!-- we specify that this is an image form upload input, and we want to show the 'thumb' version\n  of the carrierwave upload to not break our layout with a non-resized image --\u003e\n  \u003c%= f.input :some_image_field, as: :image_preview, input_html: {preview_version: :thumb} %\u003e\n\n  \u003c!-- here's a *normal* attachment. with this input, a link to the filename will be shown\n  if there's an uploaded file --\u003e\n  \u003c%= f.input :some_attachment_field, as: :attachment_preview %\u003e\n\u003c% end %\u003e\n```\n\nIf you want, you can pass the `preview_url` to the image on the input_html options. This might be useful when you don't have a model binded to the form.\n\n```erb\n\u003c%= simple_form_for :user do |f| %\u003e\n  \u003c%= f.input :image, as: :image_preview, input_html: { preview_url: image_url } %\u003e\n\u003c% end %\u003e\n```\n\n### Dependencies\n\nTo get it work, you need:\n\n* [simple_form](https://github.com/plataformatec/simple_form) ~\u003e 4.1 (*repetita iuvant*)\n* [carrierwave](https://github.com/jnicklas/carrierwave) actually it's the most opinionated gem for uploads (thank you paperclip for the good times, but you know... life goes on)\n* ruby 2.2.2+\n\n### Testing\n\n* clone this repo\n* run `bundle install`\n* run `rspec spec`\n\n## Contributions \u0026 Bugs\n\n* *the easy way:* go to [issues](issues/) page and blame me.\n* *the hard way:* repeat the above points, then show your power and send a pull request.\n\n## License\nCopyright (c) 2014 Andrea Pavoni http://andreapavoni.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreapavoni%2Fsimple_form_fancy_uploads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreapavoni%2Fsimple_form_fancy_uploads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreapavoni%2Fsimple_form_fancy_uploads/lists"}