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

Ds 2577 #3

Merged
merged 15 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: flipFormat
Type: Package
Title: Formatting of R outputs
Version: 1.3.3
Version: 1.3.4
Author: Displayr <opensource@displayr.com>
Maintainer: Displayr <opensource@displayr.com>
Description: Formatting to be used in print statements and other outputs. E.g.,
Expand Down
1 change: 1 addition & 0 deletions R/CreateChoiceModelDesignWidget.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CreateChoiceModelDesignWidget <- function(x,
## add CSS
addCss("table.css", cata)
addCss("cmd.css", cata)
addCss("details.css", cata)
if (!is.null(css))
addCss(css, cata, in.css.folder = FALSE)

Expand Down
482 changes: 449 additions & 33 deletions R/createtextanalysiswidget.R

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions inst/css/cmd.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,6 @@
right: 0;
}

summary {
/* border-bottom: 3px solid #151A1C; */
background: #F2F5FA;
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
color: #151A1C;
font-size: 15px;
margin-top: 10px;
/* margin-bottom: 10px; */
}

@supports (-ms-ime-align:auto) {
.summary, .details {
/* border-bottom: 3px solid #151A1C; */
/* background: #F2F5FA; */
/* font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif; */
/* color: #151A1C; */
/* font-size: 15px; */
/* margin-top: 10px; */
/* margin-bottom: 10px; */
display: block;
}
}

details summary::-webkit-details-marker{
color: #3E7DCC;
margin-left: 10px; /* so doesnt overlap with displayr resize tool */
}

h1 {
text-align: left;
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
Expand Down
32 changes: 32 additions & 0 deletions inst/css/details.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
summary {
/* border-bottom: 3px solid #151A1C; */
background: #F2F5FA;
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
color: #151A1C;
font-size: 16px;
margin-top: 10px;
user-select: none;
/* margin-bottom: 10px; */
}

@supports (-ms-ime-align:auto) {
.summary, .details {
/* border-bottom: 3px solid #151A1C; */
/* background: #F2F5FA; */
/* font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif; */
/* color: #151A1C; */
/* font-size: 15px; */
/* margin-top: 10px; */
/* margin-bottom: 10px; */
display: block;
}
}

details summary::-webkit-details-marker{
color: #3E7DCC;
margin-left: 10px; /* so doesnt overlap with displayr resize tool */
}

.sub-details {
font-size: 14px;
}
93 changes: 84 additions & 9 deletions inst/css/textanalysis.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,43 @@
.main-container {
width: 100%;
height: 100%;
}

.vertical-container {
height: calc(100vh - 50px);
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: stretch;
overflow: auto;
}

.top-container {
width: 100%;
height: calc(100vh - 120px);
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
align-items: stretch;
overflow-x: auto;
padding-top: 10px;
}

.bottom-container {
overflow-y: scroll;
display: flex;
}

.bottom-container-full {
overflow-y: scroll;
display: flex;
height: 100%;
}

.bottom-container-half {
overflow-y: scroll;
display: flex;
height: 50%;
}

#footer-container {
Expand All @@ -16,13 +48,10 @@
}

#text-panel {
resize: horizontal;
height: calc(100vh - 50px);
overflow-y: scroll;
overflow-x: auto;
min-width: 0;
flex: 1 1 70%

flex: 1 1 auto;
}

.raw-replacement {
Expand All @@ -35,10 +64,8 @@
resize: horizontal;
overflow-y: scroll;
overflow-x: auto;
height: calc(100vh - 50px);
min-width: 0;
max-width: 50%;
/* flex 1 1 50% will make the panels a fixed width */
max-width: calc(50vw);
flex: 1 1 auto;
}

#footer-container {
Expand Down Expand Up @@ -77,3 +104,51 @@
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 18px;
}

.diagnostics-title {
color: #3E7DCC;
font-size: 22px;
margin: 10px 15px 0 15px;
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
}

.diagnostics-container {
margin-top: 10px;
width: 100%;
}

.diagnostics-text {
display: block;
}

.diagnostics-table {
font-size: 12px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 20px;
}

.diagnostics-table td {
padding-left: 5px;
padding-right: 5px;
word-break: break-word; /* only break words in cells not table headers */
hyphens: auto;
}

.diagnostics-block {
display: flex;
border-bottom: solid 1px #BBB;
}

.diagnostics-group {
padding-top: 10px;
}

.diagnostics-message {
font-size: 12px;
margin-left: 10px;
margin-right: 10px;
margin-top: 5px;
margin-bottom: 10px;
color: #444;
}
Binary file added inst/testdata/text.analysis.diagnostics.rda
Binary file not shown.
12 changes: 6 additions & 6 deletions man/CreateTextAnalysisWidget.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/testthat/test-createtextanalysiswidget.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
findInstDirFile <- function(file)
{
file.path(system.file("testdata", package = "flipFormat", mustWork = TRUE),
file)
}

raw.and.normalized.text <- list(`Original Text` = c("Aim to higlight ai. Raindrops on roses and whiskers on kittens",
"Bright copper kettles and warm woolen mittens", "Brown paper packages tied up with strings",
"These are a few of my favorite things", "Cream colored ponies and crisp apple streudels",
Expand Down Expand Up @@ -124,3 +130,12 @@ test_that("Text analysis output",
token.substitution, footer)
expect_is(result, "htmlwidget")
})

test_that("Raw text diagnostics",
{
load(findInstDirFile("text.analysis.diagnostics.rda"))
result <- CreateTextAnalysisWidget(raw.and.normalized.text,
n.gram.frequencies,
token.substitution, footer,
text.analysis.diagnostics)
})