Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !1691

Revert ujs removal

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Pablo Brasero requested to merge github/fork/pablobm/revert-ujs-removal into master Jun 28, 2020
  • Overview 3
  • Commits 2
  • Pipelines 0
  • Changes 5

Fixes https://github.com/thoughtbot/administrate/issues/1643

When https://github.com/thoughtbot/administrate/pull/1618 was merged, some JS broke. One important piece of functionality that stopped working was "destroy" links.

We were using the JS-driven destroy links that are common in Rails. These work on links with the attribute data-method="delete", and show a confirm() box with text extracted from the attribute data-confirm.

You might be wondering why the specs didn't break... Well, it turns out that Capybara tries to be clever about these special attributes, even when using Rack::Test. As a result, tests passed even though the JS to drive the functionality wasn't working. To avoid this happening again, I have told Capybara to respect_data_method: false.

We'll still have to look into the issue that #1618 was intended to help with: how to integrate with both Webpacker and the asset pipeline. For now, this is a pressing problem, and this solution will make do.

The specs demonstrating the issue are taken from https://github.com/thoughtbot/administrate/pull/1688. Note one difference though: I'm passing the :js option as now Rack::Test won't try pretend that JS is available.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/pablobm/revert-ujs-removal