diff --git a/scripts/langindex.json b/scripts/langindex.json
index 74e8da77f..a0a90351c 100644
--- a/scripts/langindex.json
+++ b/scripts/langindex.json
@@ -479,6 +479,7 @@
"addon.mod_forum.addanewdiscussion": "forum",
"addon.mod_forum.addanewquestion": "forum",
"addon.mod_forum.addanewtopic": "forum",
+ "addon.mod_forum.advanced": "forum",
"addon.mod_forum.cannotadddiscussion": "forum",
"addon.mod_forum.cannotadddiscussionall": "forum",
"addon.mod_forum.cannotcreatediscussion": "forum",
@@ -508,6 +509,7 @@
"addon.mod_forum.refreshdiscussions": "local_moodlemobileapp",
"addon.mod_forum.refreshposts": "local_moodlemobileapp",
"addon.mod_forum.reply": "forum",
+ "addon.mod_forum.replyplaceholder": "forum",
"addon.mod_forum.subject": "forum",
"addon.mod_forum.unread": "forum",
"addon.mod_forum.unreadpostsnumber": "forum",
diff --git a/src/addon/mod/forum/components/post/addon-mod-forum-post.html b/src/addon/mod/forum/components/post/addon-mod-forum-post.html
index 3c827084a..a1d0e09d9 100644
--- a/src/addon/mod/forum/components/post/addon-mod-forum-post.html
+++ b/src/addon/mod/forum/components/post/addon-mod-forum-post.html
@@ -45,13 +45,20 @@
{{ 'addon.mod_forum.message' | translate }}
-
-
- 0" [files]="replyData.files" [maxSize]="forum.maxbytes" [maxSubmissions]="forum.maxattachments" [component]="component" [componentId]="forum.cmid" [allowOffline]="true">
-
- {{ 'addon.mod_forum.privatereply' | translate }}
-
+
+
+
+
+ {{ 'addon.mod_forum.advanced' | translate }}
+
+
+ 0" [files]="replyData.files" [maxSize]="forum.maxbytes" [maxSubmissions]="forum.maxattachments" [component]="component" [componentId]="forum.cmid" [allowOffline]="true">
+
+ {{ 'addon.mod_forum.privatereply' | translate }}
+
+
+
diff --git a/src/addon/mod/forum/components/post/post.ts b/src/addon/mod/forum/components/post/post.ts
index 454d80ab5..92251ae5c 100644
--- a/src/addon/mod/forum/components/post/post.ts
+++ b/src/addon/mod/forum/components/post/post.ts
@@ -52,6 +52,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy {
messageControl = new FormControl();
uniqueId: string;
+ advanced = false; // Display all form fields.
protected syncId: string;
@@ -119,6 +120,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy {
this.originalData.message = this.replyData.message;
this.originalData.files = this.replyData.files.slice();
this.originalData.isprivatereply = this.replyData.isprivatereply;
+
+ // Show advanced fields if any of them has not the default value.
+ this.advanced = this.replyData.files.length > 0 || this.originalData.isprivatereply;
}
/**
@@ -325,6 +329,13 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy {
this.forumProvider.invalidateDiscussionPosts(this.discussionId);
}
+ /**
+ * Show or hide advanced form fields.
+ */
+ toggleAdvanced(): void {
+ this.advanced = !this.advanced;
+ }
+
/**
* Component being destroyed.
*/
diff --git a/src/addon/mod/forum/lang/en.json b/src/addon/mod/forum/lang/en.json
index c0ae05283..42fb302a5 100644
--- a/src/addon/mod/forum/lang/en.json
+++ b/src/addon/mod/forum/lang/en.json
@@ -2,6 +2,7 @@
"addanewdiscussion": "Add a new discussion topic",
"addanewquestion": "Add a new question",
"addanewtopic": "Add a new topic",
+ "advanced": "Advanced",
"cannotadddiscussion": "Adding discussions to this forum requires group membership.",
"cannotadddiscussionall": "You do not have permission to add a new discussion topic for all participants.",
"cannotcreatediscussion": "Could not create new discussion",
@@ -31,6 +32,7 @@
"refreshdiscussions": "Refresh discussions",
"refreshposts": "Refresh posts",
"reply": "Reply",
+ "replyplaceholder": "Write your reply...",
"subject": "Subject",
"unread": "Unread",
"unreadpostsnumber": "{{$a}} unread posts"
diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.html b/src/addon/mod/forum/pages/new-discussion/new-discussion.html
index 1003dd05a..236b8bcef 100644
--- a/src/addon/mod/forum/pages/new-discussion/new-discussion.html
+++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.html
@@ -21,21 +21,28 @@
{{ 'addon.mod_forum.message' | translate }}
-
- {{ 'addon.mod_forum.group' | translate }}
-
- {{ group.name }}
-
-
-
- {{ 'addon.mod_forum.discussionsubscription' | translate }}
-
-
-
- {{ 'addon.mod_forum.discussionpinned' | translate }}
-
-
- 0" [files]="newDiscussion.files" [maxSize]="forum.maxbytes" [maxSubmissions]="forum.maxattachments" [component]="component" [componentId]="forum.cmid" [allowOffline]="true">
+
+
+
+ {{ 'addon.mod_forum.advanced' | translate }}
+
+
+
+ {{ 'addon.mod_forum.group' | translate }}
+
+ {{ group.name }}
+
+
+
+ {{ 'addon.mod_forum.discussionsubscription' | translate }}
+
+
+
+ {{ 'addon.mod_forum.discussionpinned' | translate }}
+
+
+ 0" [files]="newDiscussion.files" [maxSize]="forum.maxbytes" [maxSubmissions]="forum.maxattachments" [component]="component" [componentId]="forum.cmid" [allowOffline]="true">
+
diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
index bb5c7f95a..aaad29946 100644
--- a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
+++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
@@ -61,6 +61,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
pin: false,
files: []
};
+ advanced = false; // Display all form fields.
protected courseId: number;
protected cmId: number;
@@ -193,11 +194,19 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
this.messageControl.setValue(discussion.message);
// Treat offline attachments if any.
+ let promise;
if (discussion.options.attachmentsid && discussion.options.attachmentsid.offline) {
- return this.forumHelper.getNewDiscussionStoredFiles(this.forumId, this.timeCreated).then((files) => {
+ promise = this.forumHelper.getNewDiscussionStoredFiles(this.forumId, this.timeCreated).then((files) => {
this.newDiscussion.files = files;
});
}
+
+ return Promise.resolve(promise).then(() => {
+ // Show advanced fields by default if any of them has not the default value.
+ if (!this.newDiscussion.subscribe || this.newDiscussion.pin || this.newDiscussion.files.length) {
+ this.advanced = true;
+ }
+ });
});
}));
}
@@ -497,6 +506,13 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
});
}
+ /**
+ * Show or hide advanced form fields.
+ */
+ toggleAdvanced(): void {
+ this.advanced = !this.advanced;
+ }
+
/**
* Check if we can leave the page or not.
*
diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json
index 7ed4e00c2..f5aa4c783 100644
--- a/src/assets/lang/en.json
+++ b/src/assets/lang/en.json
@@ -479,6 +479,7 @@
"addon.mod_forum.addanewdiscussion": "Add a new discussion topic",
"addon.mod_forum.addanewquestion": "Add a new question",
"addon.mod_forum.addanewtopic": "Add a new topic",
+ "addon.mod_forum.advanced": "Advanced",
"addon.mod_forum.cannotadddiscussion": "Adding discussions to this forum requires group membership.",
"addon.mod_forum.cannotadddiscussionall": "You do not have permission to add a new discussion topic for all participants.",
"addon.mod_forum.cannotcreatediscussion": "Could not create new discussion",
@@ -508,6 +509,7 @@
"addon.mod_forum.refreshdiscussions": "Refresh discussions",
"addon.mod_forum.refreshposts": "Refresh posts",
"addon.mod_forum.reply": "Reply",
+ "addon.mod_forum.replyplaceholder": "Write your reply...",
"addon.mod_forum.subject": "Subject",
"addon.mod_forum.unread": "Unread",
"addon.mod_forum.unreadpostsnumber": "{{$a}} unread posts",