diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 149bd4f39..a2dc0dbe5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,30 +8,34 @@ on: jobs: php-lint: - name: Run PHP Linter and Code Style checker - runs-on: ubuntu-latest - steps: - - name: Checkout the project - uses: actions/checkout@v2 - - name: Get PHP version - shell: bash - run: php -v - - name: Install Composer - shell: bash - run: >- - wget https://github.com/composer/getcomposer.org/raw/master/web/installer -O - -q | - php -- --quiet - - name: Install packages - shell: bash - run: composer install - - name: Run linter - shell: bash - run: composer lint:lint - - name: Run code style checker - shell: bash - env: - PHP_CS_FIXER_IGNORE_ENV: 1 - run: composer cs:check + name: Run PHP Linter and Code Style checker + runs-on: ubuntu-latest + steps: + - name: Checkout the project + uses: actions/checkout@v2 + - name: Get PHP version + shell: bash + run: php -v + - name: Install Composer + shell: bash + run: >- + wget https://github.com/composer/getcomposer.org/raw/master/web/installer -O - -q | + php -- --quiet + - name: Install packages + shell: bash + run: composer install + - name: Run linter + shell: bash + run: composer lint:lint + - name: Run code style checker + shell: bash + env: + PHP_CS_FIXER_IGNORE_ENV: 1 + run: composer cs:check + - name: Check for formatting issues with vue files + shell: bash + run: npm run prettier + unit-tests: name: Run the unittests diff --git a/CHANGELOG.md b/CHANGELOG.md index d1543aa60..8c266fa56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ [#596](https://github.com/nextcloud/cookbook/pull/596) @seyfeb - Updated dependency of eslint-config-prettier [#603](https://github.com/nextcloud/cookbook/pull/603) @christianlupus +- Enforce basic code styling using prettier in vue files + [#607](https://github.com/nextcloud/cookbook/pull/607) @christianlupus ## Deprecated - Obsolete routes to old user interface, see `appinfo/routes.php` diff --git a/src/components/AppControls.vue b/src/components/AppControls.vue index 120489205..3cecd3c6a 100644 --- a/src/components/AppControls.vue +++ b/src/components/AppControls.vue @@ -2,237 +2,372 @@
- + - - + + - {{ t('cookbook', 'Filter') }} - {{ t('cookbook', 'Search') }} + {{ t("cookbook", "Filter") }} + {{ + t("cookbook", "Search") + }} - - + + - - + + {{ t('cookbook', 'Reload recipe') }} + >{{ t("cookbook", "Reload recipe") }} - - + + {{ t('cookbook', 'Save changes') }} + >{{ t("cookbook", "Save changes") }} - + {{ t('cookbook', 'Reload recipe') }} + >{{ t("cookbook", "Reload recipe") }} - + {{ t('cookbook', 'Edit recipe') }} + @click=" + $window.goTo( + '/recipe/' + $store.state.recipe.id + '/edit' + ) + " + >{{ t("cookbook", "Edit recipe") }} - + {{ t('cookbook', 'Print recipe') }} + >{{ t("cookbook", "Print recipe") }} - + {{ t('cookbook', 'Delete recipe') }} + >{{ t("cookbook", "Delete recipe") }} - - + + - - + + - + - +
- - diff --git a/src/components/AppIndex.vue b/src/components/AppIndex.vue index 879340023..742c06322 100644 --- a/src/components/AppIndex.vue +++ b/src/components/AppIndex.vue @@ -1,30 +1,30 @@ diff --git a/src/components/AppInvalidGuest.vue b/src/components/AppInvalidGuest.vue index 805ccd11f..a29c2e182 100644 --- a/src/components/AppInvalidGuest.vue +++ b/src/components/AppInvalidGuest.vue @@ -4,21 +4,19 @@
- {{ t('cookbook', 'Cannot access recipe folder.') }} + {{ t("cookbook", "Cannot access recipe folder.") }}
{{ - t('cookbook', 'You are logged in with a guest account. Therefore, you are not allowed to generate arbitrary files and folders on this Nextcloud instance. To be able to use the Cookbook app as a guest, you need to specify a folder where all recipes are stored. You will need write permission to this folder.') + // prettier-ignore + t("cookbook", "You are logged in with a guest account. Therefore, you are not allowed to generate arbitrary files and folders on this Nextcloud instance. To be able to use the Cookbook app as a guest, you need to specify a folder where all recipes are stored. You will need write permission to this folder." ) }}
-
-
@@ -26,30 +24,29 @@ diff --git a/src/components/AppNavi.vue b/src/components/AppNavi.vue index 003a5b25c..6c4f09f1a 100644 --- a/src/components/AppNavi.vue +++ b/src/components/AppNavi.vue @@ -1,8 +1,9 @@ \ No newline at end of file + diff --git a/src/components/AppNavigationCaption.vue b/src/components/AppNavigationCaption.vue index 26fe5429a..8e0ac8fdb 100644 --- a/src/components/AppNavigationCaption.vue +++ b/src/components/AppNavigationCaption.vue @@ -45,123 +45,135 @@ button will be automatically created. @@ -169,65 +181,64 @@ export default { @import "@nextcloud/vue/src/assets/variables.scss"; .app-navigation-caption-mod { - display: flex; - flex: 0 0 auto; - order: 1; - overflow: hidden; - opacity: 0.7; + display: flex; + flex: 0 0 auto; + order: 1; + overflow: hidden; + opacity: 0.7; } // extra top space if it's not the first item on the list .app-navigation-caption-mod:not(:first-child) { - margin-top: $clickable-area / 2; + margin-top: $clickable-area / 2; } // Main entry link .app-navigation-caption-div { - z-index: 100; /* above the bullet to allow click*/ - display: flex; - overflow: hidden; - flex: 1 1 0; - box-sizing: border-box; - min-height: $clickable-area; - padding: 0; - white-space: nowrap; - color: var(--color-text-maxcontrast); - font-weight: bold; - - background-repeat: no-repeat; - background-position: $icon-margin center; - background-size: $icon-size $icon-size; - line-height: $clickable-area; - box-shadow: none !important; - - .app-navigation-caption-icon { - display: flex; - align-items: center; - flex: 0 0 $clickable-area; - justify-content: center; - width: $clickable-area; - height: $clickable-area; - background-size: $icon-size $icon-size; - } - .app-navigation-caption__title { - overflow: hidden; - max-width: 100%; - white-space: nowrap; - text-overflow: ellipsis; - // padding-left: 6px; - } + z-index: 100; /* above the bullet to allow click*/ + display: flex; + overflow: hidden; + flex: 1 1 0; + box-sizing: border-box; + min-height: $clickable-area; + padding: 0; + white-space: nowrap; + color: var(--color-text-maxcontrast); + font-weight: bold; + + background-repeat: no-repeat; + background-position: $icon-margin center; + background-size: $icon-size $icon-size; + line-height: $clickable-area; + box-shadow: none !important; + + .app-navigation-caption-icon { + display: flex; + align-items: center; + flex: 0 0 $clickable-area; + justify-content: center; + width: $clickable-area; + height: $clickable-area; + background-size: $icon-size $icon-size; + } + .app-navigation-caption__title { + overflow: hidden; + max-width: 100%; + white-space: nowrap; + text-overflow: ellipsis; + // padding-left: 6px; + } } /* counter and actions */ .app-navigation-entry__utils { - display: flex; - align-items: center; - flex: 0 1 auto; - // visually balance the menu so it's not - // stuck to the scrollbar - .action-item { - margin-right: 2px; - } + display: flex; + align-items: center; + flex: 0 1 auto; + // visually balance the menu so it's not + // stuck to the scrollbar + .action-item { + margin-right: 2px; + } } - diff --git a/src/components/AppSettings.vue b/src/components/AppSettings.vue index a7ba81b87..33adfe4f0 100644 --- a/src/components/AppSettings.vue +++ b/src/components/AppSettings.vue @@ -6,25 +6,46 @@
  • - - + +
  • - +
  • - +
  • @@ -34,16 +55,16 @@ diff --git a/src/components/EditImageField.vue b/src/components/EditImageField.vue index 161dec66d..bd0a518b0 100644 --- a/src/components/EditImageField.vue +++ b/src/components/EditImageField.vue @@ -3,36 +3,45 @@ - - + + diff --git a/src/components/EditInputField.vue b/src/components/EditInputField.vue index 45f5491ac..5b154ebfd 100644 --- a/src/components/EditInputField.vue +++ b/src/components/EditInputField.vue @@ -3,49 +3,66 @@ - - - +
  • +
    + {{ parseInt(idx) + 1 }} +
    + +
    - - - - + + + +
  • - + diff --git a/src/components/EditMultiselect.vue b/src/components/EditMultiselect.vue index 9933cab29..74c9cac88 100644 --- a/src/components/EditMultiselect.vue +++ b/src/components/EditMultiselect.vue @@ -5,29 +5,27 @@ class="edit-multiselect" v-bind="$attrs" v-on="$listeners" - /> + /> diff --git a/src/components/EditMultiselectInputGroup.vue b/src/components/EditMultiselectInputGroup.vue index 6bcb545ca..5986cbba0 100644 --- a/src/components/EditMultiselectInputGroup.vue +++ b/src/components/EditMultiselectInputGroup.vue @@ -2,7 +2,7 @@
    diff --git a/src/components/EditMultiselectPopup.vue b/src/components/EditMultiselectPopup.vue index 52554990b..1cc2048f3 100644 --- a/src/components/EditMultiselectPopup.vue +++ b/src/components/EditMultiselectPopup.vue @@ -10,52 +10,57 @@ @select="optionSelected" @close="closePopup" @keyup="keyUp" - /> + />
    - +
    diff --git a/src/components/EditTimeField.vue b/src/components/EditTimeField.vue index 135632f4c..d891b025f 100644 --- a/src/components/EditTimeField.vue +++ b/src/components/EditTimeField.vue @@ -1,9 +1,22 @@ @@ -16,44 +29,42 @@ export default { required: true, default: { time: [null, null], - paddedTime: null - } + paddedTime: null, + }, }, fieldLabel: String, }, - data () { + data() { return { minutes: null, hours: null, } }, watch: { - value: function() { + value: function () { this.hours = this.value.time[0] this.minutes = this.value.time[1] - } + }, }, methods: { - - handleInput () { + handleInput() { this.minutes = this.minutes ? this.minutes : 0 this.hours = this.hours ? this.hours : 0 // create padded time string - let hours_p = this.hours.toString().padStart(2, '0') - let mins_p = this.minutes.toString().padStart(2, '0') - - this.$emit('input', { + let hours_p = this.hours.toString().padStart(2, "0") + let mins_p = this.minutes.toString().padStart(2, "0") + + this.$emit("input", { time: [this.hours, this.minutes], - paddedTime: 'PT' + hours_p + 'H' + mins_p + 'M' - }) + paddedTime: "PT" + hours_p + "H" + mins_p + "M", + }) }, }, } diff --git a/src/components/LazyPicture.vue b/src/components/LazyPicture.vue index 5ed7905cd..43d73e751 100644 --- a/src/components/LazyPicture.vue +++ b/src/components/LazyPicture.vue @@ -1,17 +1,21 @@ - diff --git a/src/components/NotFound.vue b/src/components/NotFound.vue index f259afd04..255246779 100644 --- a/src/components/NotFound.vue +++ b/src/components/NotFound.vue @@ -1,20 +1,18 @@ diff --git a/src/components/RecipeEdit.vue b/src/components/RecipeEdit.vue index d9dcd04c0..ed8bec7a0 100644 --- a/src/components/RecipeEdit.vue +++ b/src/components/RecipeEdit.vue @@ -1,37 +1,121 @@ diff --git a/src/components/RecipeImages.vue b/src/components/RecipeImages.vue index c7f25b417..eb969b38a 100644 --- a/src/components/RecipeImages.vue +++ b/src/components/RecipeImages.vue @@ -1,56 +1,59 @@ diff --git a/src/components/RecipeIngredient.vue b/src/components/RecipeIngredient.vue index b600bd451..62aae5482 100644 --- a/src/components/RecipeIngredient.vue +++ b/src/components/RecipeIngredient.vue @@ -1,22 +1,28 @@ diff --git a/src/components/RecipeInstruction.vue b/src/components/RecipeInstruction.vue index cf4ebcd0a..ed3e12ba6 100644 --- a/src/components/RecipeInstruction.vue +++ b/src/components/RecipeInstruction.vue @@ -1,27 +1,25 @@ diff --git a/src/components/RecipeKeyword.vue b/src/components/RecipeKeyword.vue index 0f61c0eb1..12f26f066 100644 --- a/src/components/RecipeKeyword.vue +++ b/src/components/RecipeKeyword.vue @@ -2,61 +2,57 @@
  • {{ name }} - ({{count}}) + ({{ count }})
  • diff --git a/src/components/RecipeList.vue b/src/components/RecipeList.vue index 7ce90fa13..1200306a4 100644 --- a/src/components/RecipeList.vue +++ b/src/components/RecipeList.vue @@ -1,31 +1,42 @@ diff --git a/src/components/RecipeNutritionInfoItem.vue b/src/components/RecipeNutritionInfoItem.vue index 8a8f9a239..4f356e2fc 100644 --- a/src/components/RecipeNutritionInfoItem.vue +++ b/src/components/RecipeNutritionInfoItem.vue @@ -11,26 +11,24 @@ diff --git a/src/components/RecipeTimer.vue b/src/components/RecipeTimer.vue index b09049ad0..af5bfa3e0 100644 --- a/src/components/RecipeTimer.vue +++ b/src/components/RecipeTimer.vue @@ -1,18 +1,21 @@ diff --git a/src/components/RecipeTool.vue b/src/components/RecipeTool.vue index 1a4bfa8b5..1d83c3044 100644 --- a/src/components/RecipeTool.vue +++ b/src/components/RecipeTool.vue @@ -4,15 +4,13 @@ diff --git a/src/components/RecipeView.vue b/src/components/RecipeView.vue index 49d6ac6b4..544cf517f 100644 --- a/src/components/RecipeView.vue +++ b/src/components/RecipeView.vue @@ -1,83 +1,268 @@