Skip to content
Open
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
6 changes: 6 additions & 0 deletions assets/icons/json.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/src/js/v3/shared/icons/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const icons = [
'iso',
'javascript',
'jpg',
'json',
'jsonFile',
'key',
'landscape',
Expand Down
2 changes: 2 additions & 0 deletions assets/src/js/v3/shared/utils/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const endpoints = {
GET_GOOGLE_MEET_DETAILS: 'tutor_google_meet_meeting_details',
SAVE_GOOGLE_MEET: 'tutor_google_meet_new_meeting',
DELETE_GOOGLE_MEET: 'tutor_google_meet_delete',
UPLOAD_GOOGLE_MEET_CREDENTIALS: 'tutor_pro_google_meet_credential_upload',
RESET_GOOGLE_MEET_CREDENTIALS: 'tutor_google_meet_reset_cred',

// TOPIC
GET_COURSE_CONTENTS: 'tutor_course_contents',
Expand Down
1 change: 1 addition & 0 deletions classes/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ final class Icon {
const ISO = 'iso';
const JAVASCRIPT = 'javascript';
const JPG = 'jpg';
const JSON = 'json';
const JSON_FILE = 'json-file';
const KEY = 'key';
const LANDSCAPE = 'landscape';
Expand Down
51 changes: 49 additions & 2 deletions components/FileUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ class FileUploader extends BaseComponent {
*/
protected $value = '';

/**
* Upload icon size.
*
* @since 4.0.0
*
* @var integer
*/
protected $upload_icon_size = 24;

/**
* Whether to show subtitle.
*
* @since 4.0.0
*
* @var boolean
*/
protected $show_subtitle = true;

/**
* Set uploader accept attribute.
*
Expand Down Expand Up @@ -277,6 +295,33 @@ public function uploader_icon( $icon ) {
return $this;
}

/**
* Set whether to show subtitle.
*
* @param boolean $show_subtitle show subtitle or not.
*
* @return self
*/
public function show_subtitle( $show_subtitle = true ) {
$this->show_subtitle = $show_subtitle;
return $this;
}

/**
* Set uploader icon size.
*
* @since 4.0.0
*
* @param int $size Icon size.
*
* @return $this
*/
public function uploader_icon_size( $size ) {
$this->upload_icon_size = $size;

return $this;
}

/**
* Set uploader title.
*
Expand Down Expand Up @@ -562,7 +607,7 @@ class="tutor-file-uploader-wrapper"
</div>
<div class="tutor-mt-1">
<button type="button" class="tutor-btn tutor-btn-primary-soft tutor-btn-sm" @click="openFileDialog()">
<?php esc_html_e( 'Upload More Files', 'tutor' ); ?>
<?php $this->multiple ? esc_html_e( 'Upload More Files', 'tutor' ) : esc_html_e( 'Upload Again', 'tutor' ); ?>
</button>
</div>
</div>
Expand Down Expand Up @@ -595,11 +640,13 @@ class="tutor-file-uploader-input"
<?php echo $this->get_attributes_string(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
>
<div class="tutor-file-uploader-icon">
<?php tutor_utils()->render_svg_icon( $icon, 24, 24 ); ?>
<?php tutor_utils()->render_svg_icon( $icon, $this->upload_icon_size, $this->upload_icon_size ); ?>
</div>
<div class="tutor-file-uploader-content">
<p class="tutor-file-uploader-title"><?php echo esc_html( $title ); ?></p>
<?php if ( $this->show_subtitle ) : ?>
<p class="tutor-file-uploader-subtitle"><?php echo esc_html( $subtitle ); ?></p>
<?php endif; ?>
</div>
<button type="button" class="tutor-btn tutor-btn-primary-soft" :disabled="isDisabled">
<?php echo esc_html( $button_text ); ?>
Expand Down
Loading