Skip to content

Commit

Permalink
remove extra functionality that should have been a separate PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Janell-Huyck committed Feb 1, 2024
1 parent 14849a5 commit ff1b26f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 17 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/add_remove_authors.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function getRoleFromButton() {
}

function removeAuthor(authorIndex) {
console.log("Remove author at : " + authorIndex);
const authorGroupElement = document.getElementById('author_group');
if (authorGroupElement && authorGroupElement.children[authorIndex]) {
authorGroupElement.children[authorIndex].remove();
Expand Down
12 changes: 3 additions & 9 deletions app/controllers/publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def create
respond_to do |format|
if instance_variable.save
PublicationMailer.publication_submit(helpers.find_submitter(session[:submitter_id]), instance_variable).deliver_now
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:success] = "#{formatted_name} was successfully created."
flash.keep[:success] = "#{controller_name.classify} was successfully created."

format.html { redirect_to publications_path }
format.json { render :show, status: :created, location: instance_variable }
Expand All @@ -141,9 +139,7 @@ def update
instance_variable = instance_variable_get("@#{controller_name.singularize}")
respond_to do |format|
if instance_variable.update(allowed_params)
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:success] = "#{formatted_name} was successfully updated."
flash.keep[:success] = "#{controller_name.classify} was successfully updated."
format.html { redirect_to instance_variable }
format.json { render :show, status: :created, location: instance_variable }
else
Expand All @@ -157,9 +153,7 @@ def destroy
instance_variable = instance_variable_get("@#{controller_name.singularize}")
instance_variable.destroy
respond_to do |format|
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:warning] = "#{formatted_name} was successfully destroyed."
flash.keep[:warning] = "#{controller_name.classify} was successfully destroyed."
format.html { redirect_to publications_path }
format.json { head :no_content }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/author_management/adding_authors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# and that a success message is displayed
click_on 'Submit'
expect(page).to have_current_path(Rails.application.routes.url_helpers.publications_path)
expect(page).to have_text 'Other Publication was successfully created.'
expect(page).to have_text 'OtherPublication was successfully created.'

# Click on the hyperlink on the id of the newly created publication
# and verify that the author names are correct
Expand Down Expand Up @@ -121,7 +121,7 @@
# and that the author names are correct
click_on 'Submit'
expect(page).to have_current_path(Rails.application.routes.url_helpers.other_publication_path(OtherPublication.last.id))
expect(page).to have_text 'Other Publication was successfully updated.'
expect(page).to have_text 'OtherPublication was successfully updated.'
expect(page).to have_selector('td', text: 'First0 Last0, First1 Last1, First2 Last2') # Information is in table format on the show page
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
expect(page).not_to have_content('Artist')
end


it 'has the title of Artist for new artworks' do
visit new_artwork_path
expect(page).to have_content('Add Artist')
Expand All @@ -47,4 +46,4 @@
expect(page).to have_selector('button', text: 'Remove Artist', count: 1)
expect(page).not_to have_content('Author')
end
end
end
3 changes: 0 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@

# Include helpers for feature tests
config.include FeatureSpecHelpers::AuthorManagement, type: :feature

# Set default wait time for Capybara
Capybara.default_max_wait_time = 5 # seconds
end

def create_submitter(submitter)
Expand Down

0 comments on commit ff1b26f

Please sign in to comment.