Skip to content

Commit

Permalink
fix(tutorial): use the new column type text-rich instead of text-long (
Browse files Browse the repository at this point in the history
…#523)

* fix(tutorial): use the new column type text-rich instead of text-long

Signed-off-by: Florian Steffens <[email protected]>

* fix(templates): select correct rich editor depending on the nc version

Signed-off-by: Florian Steffens <[email protected]>

* adjust cypress test setup

Signed-off-by: Florian Steffens <[email protected]>

---------

Signed-off-by: Florian Steffens <[email protected]>
  • Loading branch information
Florian authored Sep 8, 2023
1 parent 5010d89 commit e2a7076
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ jobs:
ref: ${{ matrix.server-versions }}
path: apps/viewer

- name: Register text Git reference
run: |
text_app_ref="$(if [ "${{ matrix.server-versions }}" = "master" ]; then echo -n "main"; else echo -n "${{ matrix.server-versions }}"; fi)"
echo "text_app_ref=$text_app_ref" >> $GITHUB_ENV
- name: Checkout text app
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
repository: nextcloud/text
path: apps/text
ref: ${{ env.text_app_ref }}

- name: Checkout app
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -107,6 +119,7 @@ jobs:
./occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu"
cat config/config.php
./occ user:list
./occ app:enable --force text
./occ app:enable --force ${{ env.APP_NAME }}
./occ config:system:set query_log_file --value '/home/runner/work/${{ env.APP_NAME }}/${{ env.APP_NAME }}/query.log'
php -S 127.0.0.1:8081 > /tmp/requestlog 2>&1 &
Expand Down
36 changes: 24 additions & 12 deletions lib/Service/TableTemplateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\Exception;
use OCP\IConfig;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Expand All @@ -25,13 +26,24 @@ class TableTemplateService {

private ?string $userId;

public function __construct(LoggerInterface $logger, IL10N $l, ColumnService $columnService, ?string $userId, RowService $rowService, ViewService $viewService) {
private IConfig $config;

private string $textRichColumnTypeName = 'rich';

public function __construct(LoggerInterface $logger, IL10N $l, ColumnService $columnService, ?string $userId, RowService $rowService, ViewService $viewService, IConfig $config) {
$this->logger = $logger;
$this->l = $l;
$this->columnService = $columnService;
$this->rowService = $rowService;
$this->viewService = $viewService;
$this->userId = $userId;
$this->config = $config;

// if we are on NC25, wie have to use the old text-long column type
// this is because NC25 does not serve the text editor globally
if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '26.0.0', '<')) {
$this->textRichColumnTypeName = 'long';
}
}

/**
Expand Down Expand Up @@ -148,7 +160,7 @@ private function makeWeight(Table $table):void {
$params = [
'title' => $this->l->t('Comments'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,
];
$columns['comment'] = $this->createColumn($table->id, $params);

Expand Down Expand Up @@ -234,15 +246,15 @@ private function makeCustomers(Table $table):void {
$params = [
'title' => $this->l->t('Description'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['description'] = $this->createColumn($table->id, $params);

$params = [
'title' => $this->l->t('Contact information'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['contactInformation'] = $this->createColumn($table->id, $params);
Expand All @@ -259,7 +271,7 @@ private function makeCustomers(Table $table):void {
$params = [
'title' => $this->l->t('Comment'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['comment'] = $this->createColumn($table->id, $params);
Expand Down Expand Up @@ -408,7 +420,7 @@ private function makeVacationRequests(Table $table):void {
$params = [
'title' => $this->l->t('Comments'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['comment'] = $this->createColumn($table->id, $params);
Expand Down Expand Up @@ -537,7 +549,7 @@ private function makeMembers(Table $table):void {
$params = [
'title' => $this->l->t('Skills'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['skills'] = $this->createColumn($table->id, $params);
Expand All @@ -553,7 +565,7 @@ private function makeMembers(Table $table):void {
$params = [
'title' => $this->l->t('Comments'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['comment'] = $this->createColumn($table->id, $params);
Expand Down Expand Up @@ -595,7 +607,7 @@ private function makeTodo(Table $table): void {
$params = [
'title' => $this->l->t('Description'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,
'description' => $this->l->t('Title or short description'),
'textMultiline' => true,

Expand All @@ -605,7 +617,7 @@ private function makeTodo(Table $table): void {
$params = [
'title' => $this->l->t('Target'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,
'description' => $this->l->t('Date, time or whatever'),

];
Expand All @@ -623,7 +635,7 @@ private function makeTodo(Table $table): void {
$params = [
'title' => $this->l->t('Comments'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['comments'] = $this->createColumn($table->id, $params);
Expand Down Expand Up @@ -707,7 +719,7 @@ private function makeStartupTable(Table $table):void {
$params = [
'title' => $this->l->t('How to do'),
'type' => 'text',
'subtype' => 'long',
'subtype' => $this->textRichColumnTypeName,

];
$columns['how'] = $this->createColumn($table->id, $params);
Expand Down

0 comments on commit e2a7076

Please sign in to comment.