diff --git a/src/addon/files/pages/list/list.html b/src/addon/files/pages/list/list.html
index 360a36e70..06fdce330 100644
--- a/src/addon/files/pages/list/list.html
+++ b/src/addon/files/pages/list/list.html
@@ -3,7 +3,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/src/addon/mod/data/components/index/addon-mod-data-index.html b/src/addon/mod/data/components/index/addon-mod-data-index.html
index 18ddc9354..166f9bfd1 100644
--- a/src/addon/mod/data/components/index/addon-mod-data-index.html
+++ b/src/addon/mod/data/components/index/addon-mod-data-index.html
@@ -92,7 +92,7 @@
-
+
diff --git a/src/addon/mod/forum/components/index/addon-mod-forum-index.html b/src/addon/mod/forum/components/index/addon-mod-forum-index.html
index 981e01d02..bcbce5865 100644
--- a/src/addon/mod/forum/components/index/addon-mod-forum-index.html
+++ b/src/addon/mod/forum/components/index/addon-mod-forum-index.html
@@ -12,7 +12,7 @@
-
+
@@ -87,7 +87,7 @@
-
+
diff --git a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html
index d3fcd19f0..f57a4fd31 100644
--- a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html
+++ b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html
@@ -16,7 +16,7 @@
-
+
@@ -59,7 +59,7 @@
-
+
diff --git a/src/addon/mod/wiki/components/index/addon-mod-wiki-index.html b/src/addon/mod/wiki/components/index/addon-mod-wiki-index.html
index bc2e6294a..976ae64c9 100644
--- a/src/addon/mod/wiki/components/index/addon-mod-wiki-index.html
+++ b/src/addon/mod/wiki/components/index/addon-mod-wiki-index.html
@@ -73,7 +73,7 @@
-
+
diff --git a/src/app/app.scss b/src/app/app.scss
index 7d49632fc..839ceb389 100644
--- a/src/app/app.scss
+++ b/src/app/app.scss
@@ -678,12 +678,6 @@ ion-app.app-root {
padding-bottom: 56px;
}
- .scroll-content ion-fab {
- position: fixed;
- margin-bottom: 56px;
- }
-
-
// For some reason, in iOS the pages don't inherit the background-color from ion-app, set it explicitly.
.ion-page {
background-color: $background-color;
diff --git a/src/core/comments/components/comments/comments.ts b/src/core/comments/components/comments/comments.ts
index 657848984..079716675 100644
--- a/src/core/comments/components/comments/comments.ts
+++ b/src/core/comments/components/comments/comments.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
import { NavParams, NavController } from 'ionic-angular';
import { CoreCommentsProvider } from '../../providers/comments';
@@ -23,7 +23,7 @@ import { CoreCommentsProvider } from '../../providers/comments';
selector: 'core-comments',
templateUrl: 'core-comments.html',
})
-export class CoreCommentsCommentsComponent {
+export class CoreCommentsCommentsComponent implements OnChanges {
@Input() contextLevel: string;
@Input() instanceId: number;
@Input() component: string;
@@ -41,6 +41,22 @@ export class CoreCommentsCommentsComponent {
* View loaded.
*/
ngOnInit(): void {
+ this.fetchData();
+ }
+
+ /**
+ * Listen to changes.
+ */
+ ngOnChanges(changes: { [name: string]: SimpleChange }): void {
+ // If something change, update the fields.
+ if (changes) {
+ this.fetchData();
+ }
+ }
+
+ protected fetchData(): void {
+ this.commentsLoaded = false;
+
this.commentsProvider.getComments(this.contextLevel, this.instanceId, this.component, this.itemId, this.area, this.page)
.then((comments) => {
this.commentsCount = comments && comments.length ? comments.length : 0;
diff --git a/src/core/login/pages/sites/sites.html b/src/core/login/pages/sites/sites.html
index 1de888148..d6e6ad2e4 100644
--- a/src/core/login/pages/sites/sites.html
+++ b/src/core/login/pages/sites/sites.html
@@ -12,7 +12,7 @@
-
+
@@ -27,7 +27,7 @@
-
+
diff --git a/src/directives/directives.module.ts b/src/directives/directives.module.ts
index e3ad9693b..6b58c1054 100644
--- a/src/directives/directives.module.ts
+++ b/src/directives/directives.module.ts
@@ -16,6 +16,7 @@ import { NgModule } from '@angular/core';
import { CoreAutoFocusDirective } from './auto-focus';
import { CoreDownloadFileDirective } from './download-file';
import { CoreExternalContentDirective } from './external-content';
+import { CoreFabDirective } from './fab';
import { CoreFormatTextDirective } from './format-text';
import { CoreLinkDirective } from './link';
import { CoreKeepKeyboardDirective } from './keep-keyboard';
@@ -30,6 +31,7 @@ import { CoreSupressEventsDirective } from './supress-events';
CoreAutoFocusDirective,
CoreDownloadFileDirective,
CoreExternalContentDirective,
+ CoreFabDirective,
CoreFormatTextDirective,
CoreKeepKeyboardDirective,
CoreLinkDirective,
@@ -44,6 +46,7 @@ import { CoreSupressEventsDirective } from './supress-events';
CoreAutoFocusDirective,
CoreDownloadFileDirective,
CoreExternalContentDirective,
+ CoreFabDirective,
CoreFormatTextDirective,
CoreKeepKeyboardDirective,
CoreLinkDirective,
diff --git a/src/directives/fab.ts b/src/directives/fab.ts
new file mode 100644
index 000000000..828c1cec5
--- /dev/null
+++ b/src/directives/fab.ts
@@ -0,0 +1,53 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { Directive, ElementRef, OnInit, OnDestroy } from '@angular/core';
+import { Content } from 'ionic-angular';
+
+/**
+ * Directive to move ion-fab components as direct children of the nearest ion-content.
+ *
+ * Example usage:
+ *
+ *
+ */
+@Directive({
+ selector: 'ion-fab[core-fab]'
+})
+export class CoreFabDirective implements OnInit, OnDestroy {
+ protected element: HTMLElement;
+
+ constructor(el: ElementRef, protected content: Content) {
+ this.element = el.nativeElement;
+ }
+
+ /**
+ * Initialize Component.
+ */
+ ngOnInit(): void {
+ if (this.content) {
+ this.content.getNativeElement().classList.add('has-fab');
+ this.content.getFixedElement().appendChild(this.element);
+ }
+ }
+
+ /**
+ * Destroy component.
+ */
+ ngOnDestroy(): void {
+ if (this.content) {
+ this.content.getNativeElement().classList.remove('has-fab');
+ }
+ }
+}