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

Add support for passing gist id as parameter #3

Open
ramnathv opened this issue May 8, 2013 · 1 comment
Open

Add support for passing gist id as parameter #3

ramnathv opened this issue May 8, 2013 · 1 comment

Comments

@ramnathv
Copy link
Owner

ramnathv commented May 8, 2013

For example, http://ramnathv.github.io/rNotebook/?c06d4f0488af3dbdedc4 should automatically load the contents of the gist.

I can extend this to load urls as well. The code is already there in ace-shiny.js, but needs to be cleaned up a bit.

@ramnathv
Copy link
Owner Author

This should be done for both the Shiny and OpenCPU versions of the notebook.

For the Shiny version, I can use parseQueryString which makes it easy to return key value pairs of the query string. I can combine this with the clientData parameter introduced in Shiny, which makes it easy to retrieve information about the URL.

shinyServer(function(input, output, clientData) {

  # Return the components of the URL in a string:
  output$urlText <- renderText({
    paste(sep = "",
      "protocol: ", clientData$url_protocol, "\n",
      "hostname: ", clientData$url_hostname, "\n",
      "pathname: ", clientData$url_pathname, "\n",
      "port: ",     clientData$url_port,     "\n",
      "search: ",   clientData$url_search,   "\n"
    )
  })

  # Parse the GET query string
  output$queryText <- renderText({
    query <- parseQueryString(clientData$url_search)

    # Return a string with key-value pairs
    paste(names(query), query, sep = "=", collapse=", ")
  })
})

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

No branches or pull requests

1 participant