Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit and delete jobs asynchronously #6

Merged
merged 12 commits into from
Nov 1, 2014
Merged

Conversation

tannerwelsh
Copy link
Contributor

This branch solves the requirements for release 1.2.0:

  • User can edit jobs on the résumé show page
  • User can delete jobs on the résumé show page
  • Editing jobs occurs asynchronously
  • Deleting jobs occurs asynchronously
  • Edited jobs are updated on the page without refresh
  • Deleted jobs are removed from the page without refresh

In addition, it adds console logging to the jobs.js functions. If you want to see what JavaScript is doing, simply open your browser console. As you click around to create, edit, and delete jobs, logging information will render to the JavaScript console.

- Add form to job partial for sending delete request
- New utility CSS class for floating right
- Clicking delete will send AJAX DELETE request to /jobs
- Show completed requirements on README
That main.js file was getting much too large. Time to split it into
smaller scripts that manage jobs and skills, respectively.
When a user clicks the "edit" button next to a job, an edit form will
show up to allow them to edit the job information.

This is accomplished by rendering the edit forms in the page but
ensuring that they are hidden by default. This way, the JS linked to the
edit button just hides the job information and shows the form.

Currently not asynchronous.
- Editing jobs now sends an AJAX request and will update the DOM with
  the updated job data
- Modified the event listener on the "edit" button to use [event
  delegation](http://learn.jquery.com/events/event-delegation/) so that
  it will still function on elements added after the initial page load
- Server route /jobs/edit responds to async requests with the job
  partial HTML
Makes more sense for the job info and the edit form to both be inside
the same <li> tag, since they will never be displayed at the same time
and thus act like a single list item.

This also makes it easier to associate the form with its corresponding
job info element from the JavaScript.
Because the page is updating so frequently, it is better to use
delegation to ensure that events on newly created elements will trigger
the appropriate functions.
Wasn't returning the edit job form along with the job itself, so newly
created jobs weren't able to be edited.
- Make naming more conventional
- Remove smaller functions
- Standardize format of functions
If you want to see what JavaScript is doing, simply open your browser
console. As you click around to create, edit, and delete jobs, logging
information will render to the JavaScript console.
tannerwelsh added a commit that referenced this pull request Nov 1, 2014
Edit and delete jobs asynchronously
@tannerwelsh tannerwelsh merged commit 598af1d into master Nov 1, 2014
@jcdavison
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants