Created
May 26, 2017 19:19
-
-
Save seankross/ada83a63fb4885183b9565110189c346 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' @importFrom shiny | |
| #' @import miniUI | |
| codefinch_app <- function(){ | |
| ui <- miniPage( | |
| gadgetTitleBar("Codefinch: Tweet Your Code", | |
| right = miniTitleBarButton("tweet_it", "Send Tweet", primary = TRUE)), | |
| miniContentPanel(scrollable=FALSE, | |
| fillRow(flex = c(2, 3), | |
| fillCol( | |
| uiOutput("status_box"), | |
| textOutput("chars"), | |
| checkboxInput("gist_url", "Include Gist URL?"), | |
| selectInput("highlight", "Select Highlight", choices = c( | |
| "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn","haddock" | |
| )) | |
| ), | |
| fillCol(imageOutput("code_png")) | |
| ) | |
| # fillCol(flex = c(5, 2), | |
| # imageOutput("code_png", height = "100%"), | |
| # fillRow(flex = c(2, 1), | |
| # fillCol(textAreaInput("status", label = NULL, width = "100%", height = "100%", | |
| # resize = "both"), | |
| # fillRow(textOutput("chars"), | |
| # checkboxInput("gist_url", "Include Gist URL?")) | |
| # ), | |
| # selectInput("highlight", "Select Highlight", choices = c( | |
| # "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn","haddock" | |
| # )) | |
| # ) | |
| # ) | |
| ) | |
| ) | |
| server <- function(input, output){ | |
| img <- create_image(highlight = input$highlight) | |
| output$status_box <- renderUI({ | |
| textAreaInput("status", label = NULL, width = "100%", height = "100%", | |
| resize = "both", value = img$gist_url) | |
| }) | |
| output$code_png <- renderImage({ | |
| list(src = img$path, width = "100%") | |
| }) | |
| output$chars <- renderText({ | |
| 140 - nchar(input$status) | |
| }) | |
| } | |
| runGadget(ui, server, viewer = paneViewer()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment