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

Issue 10 snippet helper #28

Merged
merged 10 commits into from
Mar 3, 2020
Merged

Issue 10 snippet helper #28

merged 10 commits into from
Mar 3, 2020

Conversation

m-l-1
Copy link
Collaborator

@m-l-1 m-l-1 commented Feb 20, 2020

#10

@m-l-1 m-l-1 requested review from DivadNojnarg and xni7 February 20, 2020 20:24
@DivadNojnarg
Copy link
Collaborator

DivadNojnarg commented Feb 21, 2020

Started to test:

  • add_moduleworks well

Maybe add a slot for nested modules as well as:

# module R6Class ---------------------------------

#' R6 Class representing the module
#'
#' @description
#' UI and server code necessary for the module
#' @details
#' More details
#'
#' @export
module <- R6::R6Class(
  "module",
  inherit = tidymodules::TidyModule,
  public = list(
    #' @field nested_mod nested modules. This is updated by the initialize function.
    nested_mod = list(),
    
    #' @description
    #' Module initialization
    #' @param ... NULL by default.
    #' @return A new `module` object.
    initialize = function(...) {
      super$initialize(...)
      
      # initialize nested modules
      # self$nested_mod[[1]] <- Nested$new(inherit = TRUE)
      
      # define ports
      self$definePort({
    
      })
      
    },
    
    #' @description
    #' Create the module UI
    #' @return ...
    ui = function() {
      tagList(
        # UI elements go here
      )
    },
    
    #' @description
    #' Server function description
    #' @param input Shiny input object.
    #' @param output Shiny output object.
    #' @param session Shiny session object.
    #' @return The server function.
    server = function(input, output, session) {
      
      super$server(input, output, session)
      
      # call all nasted modules below
      # self$nested_mod[[1]]$callModule()
      
      # update output ports
      self$assignPort({
        # self$updateOutputPort(...)
      })
      
    }
  )
)

@DivadNojnarg
Copy link
Collaborator

Second test fails:

tidymodules::add_tm_snippets():

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file '/home/rstudio-user/.R/snippets/r.snippets': No such file or directory

R/snippets.R Show resolved Hide resolved
DESCRIPTION Outdated Show resolved Hide resolved
inst/rstudio/r.snippets Show resolved Hide resolved
R/add_module.R Outdated Show resolved Hide resolved
@m-l-1 m-l-1 requested a review from xni7 February 21, 2020 16:54
Copy link
Collaborator Author

@m-l-1 m-l-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a few changes addressing most of your feedbacks, could you please re-check?

@m-l-1 m-l-1 requested a review from bzkrouse February 26, 2020 16:19
Copy link
Collaborator

@xni7 xni7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! certainly will help newcomers

Copy link
Collaborator

@bzkrouse bzkrouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-l-1 Really nice additions to the package! These helpers are user-friendly and should definitely help reduce overhead when creating new classes. Looking forward to using them.

@m-l-1 m-l-1 merged commit 9ba6639 into master Mar 3, 2020
@m-l-1 m-l-1 deleted the issue-10-snippet-helper branch March 11, 2020 23:05
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.

4 participants