Skip to content

Commit

Permalink
change HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
shahronak47 committed Jul 2, 2023
1 parent 26b3b00 commit 31403e0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions R/shinyRatings.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ ratings_html <- function(n, disabled, inputId) {

dynamic_html <- paste0(
sprintf(
'<label aria-label="%s stars" class="rating__label rating__label--half" for="rating2-%s"><i class="rating__icon--star fa fa-star-half"></i></label>
<input class="rating__input" name="rating2-%s" id="rating2-%s" value="%s" type="radio">
<label aria-label="%s star" class="rating__label" for="rating2-%s"><i class="rating__icon--star fa fa-star"></i></label>
<input class="rating__input" name="rating2-%s" id="rating2-%s" value="%s" type="radio">',
half_num, half_num_chr, inputId, half_num_chr, half_num, full_num, full_num_chr, inputId, full_num_chr, full_num
'<label aria-label="%s stars" class="rating__label rating__label--half" for="%s-%s"><i class="rating__icon--star fa fa-star-half"></i></label>
<input class="rating__input" name="%s" id="%s-%s" value="%s" type="radio">
<label aria-label="%s star" class="rating__label" for="%s-%s"><i class="rating__icon--star fa fa-star"></i></label>
<input class="rating__input" name="%s" id="%s-%s" value="%s" type="radio">',
half_num, inputId, half_num_chr, inputId, inputId, half_num_chr, half_num, full_num, inputId, full_num_chr, inputId, inputId, full_num_chr, full_num
), collapse = '')


if(isTRUE(disabled)) {
# Add disabled attribute to input elements
dynamic_html <- gsub('<input', '<input disabled', dynamic_html, fixed = TRUE)
Expand Down

0 comments on commit 31403e0

Please sign in to comment.