Skip to content

Commit

Permalink
Merge pull request #5540 from nextcloud/fix/files_menu_icons
Browse files Browse the repository at this point in the history
fix(files): Change icons+wording for adding text doc and folder description
  • Loading branch information
Pytal authored Mar 21, 2024
2 parents 903a5c2 + 3c61575 commit 3143128
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ Cypress.Commands.add('createDescription', () => {

cy.get('[data-cy-files-list] tr[data-cy-files-list-row-name="Readme.md"]').should('not.exist')
cy.get('[data-cy-upload-picker] button.action-item__menutoggle').click()
cy.get('li.upload-picker__menu-entry button').contains('Add description').click()
cy.get('li.upload-picker__menu-entry button').contains('Add folder description').click()

cy.wait('@addDescription')
})
Expand Down
5 changes: 5 additions & 0 deletions img/article.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCA\Text\Service\ConfigService;
use OCA\TpAssistant\Event\BeforeAssistantNotificationEvent;
use OCA\Viewer\Event\LoadViewer;
use OCP\App\IAppManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand Down Expand Up @@ -84,12 +85,12 @@ public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService) {
$templateManager->registerTemplateFileCreator(function () use ($l, $configService) {
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService, IAppManager $appManager) {
$templateManager->registerTemplateFileCreator(function () use ($l, $configService, $appManager) {
$markdownFile = new TemplateFileCreator(Application::APP_NAME, $l->t('New text file'), '.' . $configService->getDefaultFileExtension());
$markdownFile->addMimetype('text/markdown');
$markdownFile->addMimetype('text/plain');
$markdownFile->setIconClass('icon-filetype-text');
$markdownFile->setIconSvgInline(file_get_contents($appManager->getAppPath('text') . '/img/article.svg'));
$markdownFile->setRatio(1);
$markdownFile->setOrder(10);
$markdownFile->setActionLabel($l->t('Create new text file'));
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { showSuccess, showError } from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import { dirname } from 'path'

import FilePlusSvg from '@mdi/svg/svg/file-plus.svg'
import TextSvg from '@mdi/svg/svg/text.svg'

const FILE_ACTION_IDENTIFIER = 'Edit with text app'

Expand Down Expand Up @@ -134,14 +134,14 @@ export const addMenuRichWorkspace = () => {
const descriptionFile = t('text', 'Readme') + '.' + loadState('text', 'default_file_extension')
addNewFileMenuEntry({
id: 'rich-workspace-init',
displayName: t('text', 'Add description'),
displayName: t('text', 'Add folder description'),
enabled(context) {
if (Number(context.attributes['rich-workspace-file'])) {
return false
}
return (context.permissions & Permission.CREATE) !== 0
},
iconSvgInline: FilePlusSvg,
iconSvgInline: TextSvg,
async handler(context, content) {
const contentNames = content.map((node) => node.basename)

Expand Down
4 changes: 2 additions & 2 deletions src/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const newRichWorkspaceFileMenuPlugin = {
// register the new menu entry
menu.addMenuEntry({
id: 'rich-workspace-init',
displayName: t('text', 'Add description'),
displayName: t('text', 'Add folder description'),
templateName: descriptionFile,
iconClass: 'icon-rename',
iconClass: 'icon-add-folder-description',
fileType: 'file',
useInput: false,
actionHandler() {
Expand Down

0 comments on commit 3143128

Please sign in to comment.