Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
add additional icons
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Aug 8, 2023
1 parent 7d67a63 commit 82856b9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config/install/views.view.tide_media_browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ display:
exclude: false
alter:
alter_text: true
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% elseif content_variable == 'eps' %}\r\n <span class=\"file--tide-media-eps\"></span>\r\n{% elseif content_variable == 'xls' %}\r\n <span class=\"file--tide-media-xls\"></span>\r\n{% elseif content_variable == 'dotx' %}\r\n <span class=\"file--tide-media-dotx\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
make_link: false
path: ''
absolute: false
Expand Down Expand Up @@ -2578,7 +2578,7 @@ display:
exclude: false
alter:
alter_text: true
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% elseif content_variable == 'eps' %}\r\n <span class=\"file--tide-media-eps\"></span>\r\n{% elseif content_variable == 'xls' %}\r\n <span class=\"file--tide-media-xls\"></span>\r\n{% elseif content_variable == 'dotx' %}\r\n <span class=\"file--tide-media-dotx\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
make_link: false
path: ''
absolute: false
Expand Down
2 changes: 1 addition & 1 deletion config/optional/views.view.media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ display:
exclude: false
alter:
alter_text: true
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
text: "{% set content_variable = filemime|render|striptags %}\r\n{% if content_variable == 'msword' %}\r\n <span class=\"file--tide-media-office-document\"></span>\r\n{% elseif content_variable == 'pdf' %}\r\n <span class=\"file--tide-media-application-pdf\"></span>\r\n{% elseif content_variable == 'spreadsheet' %}\r\n <span class=\"file--tide-media-application-spreadsheet\"></span>\r\n{% elseif content_variable == 'presentation' %}\r\n <span class=\"file--tide-media-application-presentation\"></span>\r\n{% elseif content_variable == 'plaintext' %}\r\n <span class=\"file--tide-media-application-plaintext\"></span>\r\n{% elseif content_variable == 'xlsm' %}\r\n <span class=\"file--tide-media-xlsm\"></span>\r\n{% elseif content_variable == 'csv' %}\r\n <span class=\"file--tide-media-csv\"></span>\r\n{% elseif content_variable == 'ppt' %}\r\n <span class=\"file--tide-media-ppt\"></span>\r\n{% elseif content_variable == 'mswordx' %}\r\n <span class=\"file--tide-media-mswordx\"></span>\r\n{% elseif content_variable == 'tiff' %}\r\n <span class=\"file--tide-media-tiff\"></span>\r\n{% elseif content_variable == 'zip' %}\r\n <span class=\"file--tide-media-zip\"></span>\r\n{% elseif content_variable == 'eps' %}\r\n <span class=\"file--tide-media-eps\"></span>\r\n{% elseif content_variable == 'xls' %}\r\n <span class=\"file--tide-media-xls\"></span>\r\n{% elseif content_variable == 'dotx' %}\r\n <span class=\"file--tide-media-dotx\"></span>\r\n{% else %}\r\n {{ thumbnail__target_id }}\r\n{% endif %}"
make_link: false
path: ''
absolute: false
Expand Down
14 changes: 13 additions & 1 deletion css/media_browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,21 @@
background-image: url(../images/icons/tide_zip.svg);
}

.file--tide-media-eps {
background-image: url(../images/icons/tide_eps.svg);
}

.file--tide-media-xls {
background-image: url(../images/icons/tide_xls.svg);
}

.file--tide-media-dotx {
background-image: url(../images/icons/tide_dotx.svg);
}

.file--tide-media-office-document, .file--tide-media-application-pdf,
.file--tide-media-application-spreadsheet, .file--tide-media-application-presentation,
.file--tide-media-application-plaintext, .file--tide-media-xlsm, .file--tide-media-csv, .file--tide-media-ppt, .file--tide-media-mswordx, .file--tide-media-tiff, .file--tide-media-zip {
.file--tide-media-application-plaintext, .file--tide-media-xlsm, .file--tide-media-csv, .file--tide-media-ppt, .file--tide-media-mswordx, .file--tide-media-tiff, .file--tide-media-zip, .file--tide-media-eps, .file--tide-media-xls, .file--tide-media-dotx {
background-size: 100%;
background-repeat: no-repeat;
background-position: center;
Expand Down
5 changes: 5 additions & 0 deletions images/icons/tide_eps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions tide_media.install
Original file line number Diff line number Diff line change
Expand Up @@ -878,14 +878,10 @@ function tide_media_update_8046() {
function tide_media_update_8047() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_media') . '/config/install'];
$storage = \Drupal::entityTypeManager()->getStorage('view');
$config_entity = $storage->load('tide_media_browser');
if ($config_entity !== NULL) {
$storage->delete([$config_entity]);
}
$config_read = _tide_read_config('views.view.tide_media_browser', $config_location, FALSE);
$new_config_entity = $storage->createFromStorageRecord($config_read);
$new_config_entity->save();
$view_tide_media_browser = \Drupal::configFactory()->getEditable('views.view.tide_media_browser');
$view_tide_media_browser->set('display.media_browser.display_options.fields.thumbnail__target_id.alter', $config_read['display']['media_browser']['display_options']['fields']['thumbnail__target_id']['alter'])->save();
$view_tide_media_browser->set('display.document_browser.display_options.fields.thumbnail__target_id.alter', $config_read['display']['document_browser']['display_options']['fields']['thumbnail__target_id']['alter'])->save();
}

/**
Expand Down
11 changes: 10 additions & 1 deletion tide_media.module
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function tide_media_views_pre_render(ViewExecutable $view) {
$file_type = $value->_relationship_entities['field_media_file_target_id'];
$file_mime = $file_type->get('filemime')->value;
if ($file_mime) {
if (strpos($file_mime, 'msword') || strpos($file_mime, 'wordprocessingml.document')) {
if (strpos($file_mime, 'msword') || $file_mime == 'application/rtf') {
$value->_relationship_entities['field_media_file_target_id']->set('filemime', 'msword');
}
if (strpos($file_mime, 'wordprocessingml.document')) {
Expand Down Expand Up @@ -342,6 +342,15 @@ function tide_media_views_pre_render(ViewExecutable $view) {
if ($file_mime == 'application/zip') {
$value->_relationship_entities['field_media_file_target_id']->set('filemime', 'zip');
}
if ($file_mime == 'application/postscript') {
$value->_relationship_entities['field_media_file_target_id']->set('filemime', 'eps');
}
if ($file_mime == 'application/vnd.ms-excel') {
$value->_relationship_entities['field_media_file_target_id']->set('filemime', 'xls');
}
if ($file_mime == 'application/vnd.openxmlformats-officedocument.wordprocessingml.template') {
$value->_relationship_entities['field_media_file_target_id']->set('filemime', 'dotx');
}
}
}
}
Expand Down

0 comments on commit 82856b9

Please sign in to comment.