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
8 changes: 8 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@
},
"edit": "Edit",
"@edit": {},
"preview": "Preview",
"loadingText": "Loading...",
"@loadingText": {
"description": "Text to show when entries are being loaded in the background: Loading..."
Expand Down Expand Up @@ -913,6 +914,13 @@
"@baseData": {
"description": "The base data for an exercise such as category, trained muscles, etc."
},
"useBasicMarkdown": "You can use basic Markdown to format the text",
"editorBold": "Bold",
"@editorBold": {
"description": "Label for bold formatting"
},
"editorItalic": "Italic",
"editorList": "List",
"enterTextInLanguage": "Please enter the text in the correct language!",
"settingsTitle": "Settings",
"settingsCacheTitle": "Cache",
Expand Down
16 changes: 14 additions & 2 deletions lib/models/exercises/exercise_submission.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (C) 2020, 2021 wger Team
* Copyright (c) 2020 - 2026 wger Team
*
* wger Workout Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -51,10 +51,15 @@ sealed class ExerciseCommentSubmissionApi with _$ExerciseCommentSubmissionApi {
sealed class ExerciseTranslationSubmissionApi with _$ExerciseTranslationSubmissionApi {
const factory ExerciseTranslationSubmissionApi({
required String name,
required String description,

@JsonKey(name: 'description_source') required String description,

required int language,

@JsonKey(name: 'license_author') required String author,

@Default([]) List<ExerciseAliasSubmissionApi> aliases,

@Default([]) List<ExerciseCommentSubmissionApi> comments,
}) = _ExerciseTranslationSubmissionApi;

Expand All @@ -67,12 +72,19 @@ sealed class ExerciseTranslationSubmissionApi with _$ExerciseTranslationSubmissi
sealed class ExerciseSubmissionApi with _$ExerciseSubmissionApi {
const factory ExerciseSubmissionApi({
required int category,

required List<int> muscles,

@JsonKey(name: 'muscles_secondary') required List<int> musclesSecondary,

required List<int> equipment,

@JsonKey(name: 'license_author') required String author,

@JsonKey(includeToJson: true) int? variation,

@JsonKey(includeToJson: true, name: 'variations_connect_to') int? variationConnectTo,

required List<ExerciseTranslationSubmissionApi> translations,
}) = _ExerciseSubmissionApi;

Expand Down
16 changes: 8 additions & 8 deletions lib/models/exercises/exercise_submission.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/models/exercises/exercise_submission.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions lib/providers/add_exercise.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (c) 2026 wger Team
*
* wger Workout Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
Expand Down Expand Up @@ -100,7 +118,7 @@ class AddExerciseProvider with ChangeNotifier {

ExerciseSubmissionApi get exerciseApiObject {
return ExerciseSubmissionApi(
author: '',
author: author,
variation: _variationId,
variationConnectTo: _variationConnectToExercise,
category: category!.id,
Expand All @@ -110,7 +128,7 @@ class AddExerciseProvider with ChangeNotifier {
translations: [
// Base language (English)
ExerciseTranslationSubmissionApi(
author: '',
author: author,
language: languageEn!.id,
name: exerciseNameEn!,
description: descriptionEn!,
Expand All @@ -123,7 +141,7 @@ class AddExerciseProvider with ChangeNotifier {
// Optional translation
if (languageTranslation != null)
ExerciseTranslationSubmissionApi(
author: '',
author: author,
language: languageTranslation!.id,
name: exerciseNameTrans!,
description: descriptionTrans!,
Expand Down Expand Up @@ -190,8 +208,9 @@ class AddExerciseProvider with ChangeNotifier {

request.files.add(await http.MultipartFile.fromPath('image', image.imageFile.path));
request.fields['exercise'] = exerciseId.toString();
request.fields['license'] = CC_BY_SA_4_ID.toString();
request.fields['is_main'] = 'false';
request.fields['license'] = CC_BY_SA_4_ID.toString();
request.fields['license_author'] = author;

final details = image.toJson();
if (details.isNotEmpty) {
Expand Down
Loading