rubyforgood / inkind-admin

A project serving Community Education Partnerships - https://www.cep.ngo/ . This Rails application presents an admin interface for CEP to manage their volunteers and students. And provides a GraphQL backend for https://github.com/rubyforgood/inkind-volunteer .
MIT License
9 stars 27 forks source link

Default upload text should change to file name #121

Open ghost opened 2 years ago

ghost commented 2 years ago

Summary

PR #120 solves the styling of the modal, but the "No file selected message" does not change to the name of the file uploaded.

Things to Consider

This page would be a nice material to refer to.

Criteria for Completion

What it looks like right now: Screenshot 2021-10-22 at 20-33-14 Volunteers INKIND

What it should look like: Screenshot 2021-10-22 at 20-35-21 Volunteers INKIND

chandan270 commented 2 years ago

Can I work on this issue?

ghost commented 2 years ago

@chandan270 that would be great. Just wait for @garettarrowood's ping, and you can work on the issue.

garettarrowood commented 2 years ago

Thanks @chandan270 !

garettarrowood commented 2 years ago

@chandan270 - Are you still interested in completing this work? Just checking in.

ghost commented 2 years ago

@garettarrowood I'll fix this issue this after the 8th of this month.

garettarrowood commented 2 years ago

That'd we great! Thanks @Ashvith !

ghost commented 2 years ago

@garettarrowood need some help with adding Javascript. I am actually clueless about where we can add JS files here. Is it supposed to be inside javascript/controllers?

This is what I wanted to add:

const actualBtn = document.getElementById('select-file');

const fileChosen = document.getElementById('file-chosen');

actualBtn.addEventListener('change', function(){
  fileChosen.textContent = this.files[0].name
})
garettarrowood commented 2 years ago

@Ashvith - I'm not experienced with StimulusReflex JS conventions at all.

I would say try it in a couple places that seem to make sense, and use your best judgement. As long as we get it working, and its named well (as in, the file is named well), we should be able to either run with your convention, or refactor it to another place as we grow smarter/more experienced :) .

ghost commented 2 years ago

@garettarrowood Looks like this is out of my experience too. If you want to, I could have a look at some of the tutorials, and examples and maybe fix this sometimes later?

garettarrowood commented 2 years ago

If you can even get this to work in a <script> tag at the bottom of the HTML file, I'm fine with it.

ghost commented 2 years ago

I've tried the script method, and it isn't working as well. Stimulus-Reflex is the only way. I've tried some examples, but then I was not able to succeed because when the label-for click element is triggered, the application is supposed to wait till the user chooses a file, but in my case, it starts looking for the file directly even before the user can click, which is non-existent at the time of the event, and so it throws a controller error.

JelenaD1 commented 2 years ago

Can I take over and work on this issue? @garettarrowood