diff --git a/src/addons/addons.module.ts b/src/addons/addons.module.ts index 98845ab4a..9379c35c7 100644 --- a/src/addons/addons.module.ts +++ b/src/addons/addons.module.ts @@ -14,6 +14,17 @@ import { NgModule } from '@angular/core'; +import { AddonBlockActivityResultsModule } from './block/activityresults/activityresults.module'; +import { AddonBlockBadgesModule } from './block/badges/badges.module'; +import { AddonBlockBlogMenuModule } from './block/blogmenu/blogmenu.module'; +import { AddonBlockBlogRecentModule } from './block/blogrecent/blogrecent.module'; +import { AddonBlockBlogTagsModule } from './block/blogtags/blogtags.module'; +import { AddonBlockGlossaryRandomModule } from './block/glossaryrandom/glossaryrandom.module'; +import { AddonBlockHtmlModule } from './block/html/html.module'; +import { AddonBlockNewsItemsModule } from './block/newsitems/newsitems.module'; +import { AddonBlockOnlineUsersModule } from './block/onlineusers/onlineusers.module'; +import { AddonBlockRssClientModule } from './block/rssclient/rssclient.module'; +import { AddonBlockTagsModule } from './block/tags/tags.module'; import { AddonPrivateFilesModule } from './privatefiles/privatefiles.module'; import { AddonFilterModule } from './filter/filter.module'; import { AddonUserProfileFieldModule } from './userprofilefield/userprofilefield.module'; @@ -22,6 +33,17 @@ import { AddonUserProfileFieldModule } from './userprofilefield/userprofilefield imports: [ AddonPrivateFilesModule, AddonFilterModule, + AddonBlockActivityResultsModule, + AddonBlockBadgesModule, + AddonBlockBlogMenuModule, + AddonBlockBlogRecentModule, + AddonBlockBlogTagsModule, + AddonBlockGlossaryRandomModule, + AddonBlockHtmlModule, + AddonBlockNewsItemsModule, + AddonBlockOnlineUsersModule, + AddonBlockRssClientModule, + AddonBlockTagsModule, AddonUserProfileFieldModule, ], }) diff --git a/src/addons/block/activityresults/activityresults.module.ts b/src/addons/block/activityresults/activityresults.module.ts new file mode 100644 index 000000000..0d3341953 --- /dev/null +++ b/src/addons/block/activityresults/activityresults.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockActivityResultsHandler } from './services/block-handler'; +import { AddonBlockActivityResultsComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockActivityResultsComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockActivityResultsHandler.instance); + }, + }, + ], +}) +export class AddonBlockActivityResultsModule {} diff --git a/src/addons/block/activityresults/components/activityresults/activityresults.scss b/src/addons/block/activityresults/components/activityresults/activityresults.scss new file mode 100644 index 000000000..40e29efef --- /dev/null +++ b/src/addons/block/activityresults/components/activityresults/activityresults.scss @@ -0,0 +1,29 @@ +:host .core-block-content ::ng-deep { + table.grades { + text-align: start; + width: 100%; + + .number { + text-align: start; + width: 10%; + } + + .name { + text-align: start; + width: 77%; + } + + .grade { + text-align: end; + } + + caption { + text-align: start; + padding-top: .75rem; + padding-bottom: .75rem; + color: var(--gray-darker); + font-weight: bold; + font-size: 18px; + } + } +} diff --git a/src/addons/block/activityresults/components/activityresults/activityresults.ts b/src/addons/block/activityresults/components/activityresults/activityresults.ts new file mode 100644 index 000000000..aaa609e3f --- /dev/null +++ b/src/addons/block/activityresults/components/activityresults/activityresults.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a activity results block. + */ +@Component({ + selector: 'addon-block-activity-results', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['activityresults.scss'], +}) +export class AddonBlockActivityResultsComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/activityresults/components/components.module.ts b/src/addons/block/activityresults/components/components.module.ts new file mode 100644 index 000000000..c7910cee2 --- /dev/null +++ b/src/addons/block/activityresults/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockActivityResultsComponent } from './activityresults/activityresults'; + +@NgModule({ + declarations: [ + AddonBlockActivityResultsComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockActivityResultsComponent, + ], + entryComponents: [ + AddonBlockActivityResultsComponent, + ], +}) +export class AddonBlockActivityResultsComponentsModule {} diff --git a/src/addons/block/activityresults/lang.json b/src/addons/block/activityresults/lang.json new file mode 100644 index 000000000..4dd6abbb7 --- /dev/null +++ b/src/addons/block/activityresults/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Activity results" +} \ No newline at end of file diff --git a/src/addons/block/activityresults/services/block-handler.ts b/src/addons/block/activityresults/services/block-handler.ts new file mode 100644 index 000000000..cdcb3cb1e --- /dev/null +++ b/src/addons/block/activityresults/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockActivityResultsComponent } from '../components/activityresults/activityresults'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockActivityResultsHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockActivityResults'; + blockName = 'activity_results'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_activityresults.pluginname', + class: 'addon-block-activity-results', + component: AddonBlockActivityResultsComponent, + }; + } + +} + +export class AddonBlockActivityResultsHandler extends makeSingleton(AddonBlockActivityResultsHandlerService) {} diff --git a/src/addons/block/badges/badges.module.ts b/src/addons/block/badges/badges.module.ts new file mode 100644 index 000000000..0fcd2dbe7 --- /dev/null +++ b/src/addons/block/badges/badges.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockBadgesHandler } from './services/block-handler'; +import { AddonBlockBadgesComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockBadgesComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockBadgesHandler.instance); + }, + }, + ], +}) +export class AddonBlockBadgesModule {} diff --git a/src/addons/block/badges/components/badges/badges.scss b/src/addons/block/badges/components/badges/badges.scss new file mode 100644 index 000000000..5ca9725d5 --- /dev/null +++ b/src/addons/block/badges/components/badges/badges.scss @@ -0,0 +1,22 @@ +:host .core-block-content ::ng-deep { + ul.badges { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + position: relative; + display: inline-block; + padding-top: 1em; + text-align: center; + vertical-align: top; + width: 150px; + + .badge-name { + display: block; + padding: 5px; + } + } + } +} diff --git a/src/addons/block/badges/components/badges/badges.ts b/src/addons/block/badges/components/badges/badges.ts new file mode 100644 index 000000000..5f7f64a30 --- /dev/null +++ b/src/addons/block/badges/components/badges/badges.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a badges block. + */ +@Component({ + selector: 'addon-block-badges', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['badges.scss'], +}) +export class AddonBlockBadgesComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/badges/components/components.module.ts b/src/addons/block/badges/components/components.module.ts new file mode 100644 index 000000000..b4e67d7c8 --- /dev/null +++ b/src/addons/block/badges/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockBadgesComponent } from './badges/badges'; + +@NgModule({ + declarations: [ + AddonBlockBadgesComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockBadgesComponent, + ], + entryComponents: [ + AddonBlockBadgesComponent, + ], +}) +export class AddonBlockBadgesComponentsModule {} diff --git a/src/addons/block/badges/lang.json b/src/addons/block/badges/lang.json new file mode 100644 index 000000000..dd957321f --- /dev/null +++ b/src/addons/block/badges/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Latest badges" +} \ No newline at end of file diff --git a/src/addons/block/badges/services/block-handler.ts b/src/addons/block/badges/services/block-handler.ts new file mode 100644 index 000000000..85f7bc760 --- /dev/null +++ b/src/addons/block/badges/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockBadgesComponent } from '../components/badges/badges'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockBadgesHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockBadges'; + blockName = 'badges'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_badges.pluginname', + class: 'addon-block-badges', + component: AddonBlockBadgesComponent, + }; + } + +} + +export class AddonBlockBadgesHandler extends makeSingleton(AddonBlockBadgesHandlerService) {} diff --git a/src/addons/block/blogmenu/blogmenu.module.ts b/src/addons/block/blogmenu/blogmenu.module.ts new file mode 100644 index 000000000..3d5a1af95 --- /dev/null +++ b/src/addons/block/blogmenu/blogmenu.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockBlogMenuHandler } from './services/block-handler'; +import { AddonBlockBlogMenuComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockBlogMenuComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockBlogMenuHandler.instance); + }, + }, + ], +}) +export class AddonBlockBlogMenuModule {} diff --git a/src/addons/block/blogmenu/components/blogmenu/blogmenu.scss b/src/addons/block/blogmenu/components/blogmenu/blogmenu.scss new file mode 100644 index 000000000..9cad821b4 --- /dev/null +++ b/src/addons/block/blogmenu/components/blogmenu/blogmenu.scss @@ -0,0 +1,17 @@ +:host { + .core-block-content ::ng-deep { + ul.list { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + padding-bottom: 8px; + } + } + } + .core-block-footer ::ng-deep { + display: none; + } +} diff --git a/src/addons/block/blogmenu/components/blogmenu/blogmenu.ts b/src/addons/block/blogmenu/components/blogmenu/blogmenu.ts new file mode 100644 index 000000000..415c09e87 --- /dev/null +++ b/src/addons/block/blogmenu/components/blogmenu/blogmenu.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a blog menu block. + */ +@Component({ + selector: 'addon-block-blog-menu', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['blogmenu.scss'], +}) +export class AddonBlockBlogMenuComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/blogmenu/components/components.module.ts b/src/addons/block/blogmenu/components/components.module.ts new file mode 100644 index 000000000..ac8ea52ad --- /dev/null +++ b/src/addons/block/blogmenu/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockBlogMenuComponent } from './blogmenu/blogmenu'; + +@NgModule({ + declarations: [ + AddonBlockBlogMenuComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockBlogMenuComponent, + ], + entryComponents: [ + AddonBlockBlogMenuComponent, + ], +}) +export class AddonBlockBlogMenuComponentsModule {} diff --git a/src/addons/block/blogmenu/lang.json b/src/addons/block/blogmenu/lang.json new file mode 100644 index 000000000..23541f7a0 --- /dev/null +++ b/src/addons/block/blogmenu/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Blog menu" +} \ No newline at end of file diff --git a/src/addons/block/blogmenu/services/block-handler.ts b/src/addons/block/blogmenu/services/block-handler.ts new file mode 100644 index 000000000..718a29245 --- /dev/null +++ b/src/addons/block/blogmenu/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockBlogMenuComponent } from '../components/blogmenu/blogmenu'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockBlogMenuHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockBlogMenu'; + blockName = 'blog_menu'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_blogmenu.pluginname', + class: 'addon-block-blog-menu', + component: AddonBlockBlogMenuComponent, + }; + } + +} + +export class AddonBlockBlogMenuHandler extends makeSingleton(AddonBlockBlogMenuHandlerService) {} diff --git a/src/addons/block/blogrecent/blogrecent.module.ts b/src/addons/block/blogrecent/blogrecent.module.ts new file mode 100644 index 000000000..5048ade0f --- /dev/null +++ b/src/addons/block/blogrecent/blogrecent.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockBlogRecentHandler } from './services/block-handler'; +import { AddonBlockBlogRecentComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockBlogRecentComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockBlogRecentHandler.instance); + }, + }, + ], +}) +export class AddonBlockBlogRecentModule {} diff --git a/src/addons/block/blogrecent/components/blogrecent/blogrecent.scss b/src/addons/block/blogrecent/components/blogrecent/blogrecent.scss new file mode 100644 index 000000000..cd28d8abd --- /dev/null +++ b/src/addons/block/blogrecent/components/blogrecent/blogrecent.scss @@ -0,0 +1,12 @@ +:host .core-block-content ::ng-deep { + ul.list { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + padding-bottom: 8px; + } + } +} diff --git a/src/addons/block/blogrecent/components/blogrecent/blogrecent.ts b/src/addons/block/blogrecent/components/blogrecent/blogrecent.ts new file mode 100644 index 000000000..94715c86a --- /dev/null +++ b/src/addons/block/blogrecent/components/blogrecent/blogrecent.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a blog recent block. + */ +@Component({ + selector: 'addon-block-blog-recent', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['blogrecent.scss'], +}) +export class AddonBlockBlogRecentComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/blogrecent/components/components.module.ts b/src/addons/block/blogrecent/components/components.module.ts new file mode 100644 index 000000000..552884705 --- /dev/null +++ b/src/addons/block/blogrecent/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockBlogRecentComponent } from './blogrecent/blogrecent'; + +@NgModule({ + declarations: [ + AddonBlockBlogRecentComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockBlogRecentComponent, + ], + entryComponents: [ + AddonBlockBlogRecentComponent, + ], +}) +export class AddonBlockBlogRecentComponentsModule {} diff --git a/src/addons/block/blogrecent/lang.json b/src/addons/block/blogrecent/lang.json new file mode 100644 index 000000000..a92c0cce5 --- /dev/null +++ b/src/addons/block/blogrecent/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Recent blog entries" +} \ No newline at end of file diff --git a/src/addons/block/blogrecent/services/block-handler.ts b/src/addons/block/blogrecent/services/block-handler.ts new file mode 100644 index 000000000..816ec71bf --- /dev/null +++ b/src/addons/block/blogrecent/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockBlogRecentComponent } from '../components/blogrecent/blogrecent'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockBlogRecentHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockBlogRecent'; + blockName = 'blog_recent'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_blogrecent.pluginname', + class: 'addon-block-blog-recent', + component: AddonBlockBlogRecentComponent, + }; + } + +} + +export class AddonBlockBlogRecentHandler extends makeSingleton(AddonBlockBlogRecentHandlerService) {} diff --git a/src/addons/block/blogtags/blogtags.module.ts b/src/addons/block/blogtags/blogtags.module.ts new file mode 100644 index 000000000..08103a679 --- /dev/null +++ b/src/addons/block/blogtags/blogtags.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockBlogTagsHandler } from './services/block-handler'; +import { AddonBlockBlogTagsComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockBlogTagsComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockBlogTagsHandler.instance); + }, + }, + ], +}) +export class AddonBlockBlogTagsModule {} diff --git a/src/addons/block/blogtags/components/blogtags/blogtags.scss b/src/addons/block/blogtags/components/blogtags/blogtags.scss new file mode 100644 index 000000000..75f3917dd --- /dev/null +++ b/src/addons/block/blogtags/components/blogtags/blogtags.scss @@ -0,0 +1,99 @@ +:host .core-block-content ::ng-deep { + ul.inline-list { + font-size: 80%; + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + padding: .2em; + display: inline-block; + + a { + background: var(--ion-color-primary); + color: var(--ion-color-primary-contrast); + padding: 3px 8px; + -webkit-font-smoothing: antialiased; + display: inline-block; + min-width: 10px; + font-weight: bold; + line-height: 1; + text-align: center; + white-space: nowrap; + contain: content; + vertical-align: baseline; + text-decoration: none; + border-radius: 4px; + } + .s20 { + font-size: 1.5em; + font-weight: bold; + } + + .s19 { + font-size: 1.5em; + } + + .s18 { + font-size: 1.4em; + font-weight: bold; + } + + .s17 { + font-size: 1.4em; + } + + .s16 { + font-size: 1.3em; + font-weight: bold; + } + + .s15 { + font-size: 1.3em; + } + + .s14 { + font-size: 1.2em; + font-weight: bold; + } + + .s13 { + font-size: 1.2em; + } + + .s12, + .s11 { + font-size: 1.1em; + font-weight: bold; + } + + .s10, + .s9 { + font-size: 1.1em; + } + + .s8, + .s7 { + font-size: 1em; + font-weight: bold; + } + + .s6, + .s5 { + font-size: 1em; + } + + .s4, + .s3 { + font-size: 0.9em; + font-weight: bold; + } + + .s2, + .s1 { + font-size: 0.9em; + } + } + } +} diff --git a/src/addons/block/blogtags/components/blogtags/blogtags.ts b/src/addons/block/blogtags/components/blogtags/blogtags.ts new file mode 100644 index 000000000..df38a4007 --- /dev/null +++ b/src/addons/block/blogtags/components/blogtags/blogtags.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a blo gtags block. + */ +@Component({ + selector: 'addon-block-blog-tags', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['blogtags.scss'], +}) +export class AddonBlockBlogTagsComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/blogtags/components/components.module.ts b/src/addons/block/blogtags/components/components.module.ts new file mode 100644 index 000000000..8e07f0c0c --- /dev/null +++ b/src/addons/block/blogtags/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockBlogTagsComponent } from './blogtags/blogtags'; + +@NgModule({ + declarations: [ + AddonBlockBlogTagsComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockBlogTagsComponent, + ], + entryComponents: [ + AddonBlockBlogTagsComponent, + ], +}) +export class AddonBlockBlogTagsComponentsModule {} diff --git a/src/addons/block/blogtags/lang.json b/src/addons/block/blogtags/lang.json new file mode 100644 index 000000000..683c3aa90 --- /dev/null +++ b/src/addons/block/blogtags/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Blog tags" +} \ No newline at end of file diff --git a/src/addons/block/blogtags/services/block-handler.ts b/src/addons/block/blogtags/services/block-handler.ts new file mode 100644 index 000000000..41bb68f27 --- /dev/null +++ b/src/addons/block/blogtags/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockBlogTagsComponent } from '../components/blogtags/blogtags'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockBlogTagsHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockBlogTags'; + blockName = 'blog_tags'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_blogtags.pluginname', + class: 'addon-block-blog-tags', + component: AddonBlockBlogTagsComponent, + }; + } + +} + +export class AddonBlockBlogTagsHandler extends makeSingleton(AddonBlockBlogTagsHandlerService) {} diff --git a/src/addons/block/glossaryrandom/glossaryrandom.module.ts b/src/addons/block/glossaryrandom/glossaryrandom.module.ts new file mode 100644 index 000000000..75723df8a --- /dev/null +++ b/src/addons/block/glossaryrandom/glossaryrandom.module.ts @@ -0,0 +1,36 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockGlossaryRandomHandler } from './services/block-handler'; + +@NgModule({ + imports: [ + IonicModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockGlossaryRandomHandler.instance); + }, + }, + ], +}) +export class AddonBlockGlossaryRandomModule {} diff --git a/src/addons/block/glossaryrandom/lang.json b/src/addons/block/glossaryrandom/lang.json new file mode 100644 index 000000000..1ae4de38c --- /dev/null +++ b/src/addons/block/glossaryrandom/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Random glossary entry" +} \ No newline at end of file diff --git a/src/addons/block/glossaryrandom/services/block-handler.ts b/src/addons/block/glossaryrandom/services/block-handler.ts new file mode 100644 index 000000000..94096e488 --- /dev/null +++ b/src/addons/block/glossaryrandom/services/block-handler.ts @@ -0,0 +1,48 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { CoreCourseBlock } from '@features/course/services/course'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockGlossaryRandomHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockGlossaryRandom'; + blockName = 'glossary_random'; + + /** + * Returns the data needed to render the block. + * + * @param block The block to render. + * @return Data or promise resolved with the data. + */ + getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { + return { + title: block.contents?.title || 'addon.block_glossaryrandom.pluginname', + class: 'addon-block-glossary-random', + component: CoreBlockPreRenderedComponent, + }; + } + +} + +export class AddonBlockGlossaryRandomHandler extends makeSingleton(AddonBlockGlossaryRandomHandlerService) {} diff --git a/src/addons/block/html/html.module.ts b/src/addons/block/html/html.module.ts new file mode 100644 index 000000000..418b406df --- /dev/null +++ b/src/addons/block/html/html.module.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockHtmlHandler } from './services/block-handler'; + +@NgModule({ + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockHtmlHandler.instance); + }, + }, + ], +}) +export class AddonBlockHtmlModule {} diff --git a/src/addons/block/html/services/block-handler.ts b/src/addons/block/html/services/block-handler.ts new file mode 100644 index 000000000..d77fd2deb --- /dev/null +++ b/src/addons/block/html/services/block-handler.ts @@ -0,0 +1,49 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { CoreCourseBlock } from '@features/course/services/course'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockHtmlHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockHtml'; + blockName = 'html'; + + /** + * Returns the data needed to render the block. + * + * @param block The block to render. + * @return Data or promise resolved with the data. + */ + getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { + + return { + title: block.contents?.title || '', + class: 'addon-block-html', + component: CoreBlockPreRenderedComponent, + }; + } + +} + +export class AddonBlockHtmlHandler extends makeSingleton(AddonBlockHtmlHandlerService) {} diff --git a/src/addons/block/newsitems/components/components.module.ts b/src/addons/block/newsitems/components/components.module.ts new file mode 100644 index 000000000..55c178d71 --- /dev/null +++ b/src/addons/block/newsitems/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockNewsItemsComponent } from './newsitems/newsitems'; + +@NgModule({ + declarations: [ + AddonBlockNewsItemsComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockNewsItemsComponent, + ], + entryComponents: [ + AddonBlockNewsItemsComponent, + ], +}) +export class AddonBlockNewsItemsComponentsModule {} diff --git a/src/addons/block/newsitems/components/newsitems/newsitems.scss b/src/addons/block/newsitems/components/newsitems/newsitems.scss new file mode 100644 index 000000000..9ca636473 --- /dev/null +++ b/src/addons/block/newsitems/components/newsitems/newsitems.scss @@ -0,0 +1,27 @@ +:host { + .core-block-content ::ng-deep { + .unlist { + list-style-type: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li.post { + padding-bottom: 16px; + } + li.post:last-child { + padding-bottom: 0; + } + } + } + + // Hide RSS link. + .core-block-footer ::ng-deep { + a { + display: none; + } + a:first-child { + display: inline; + } + } +} diff --git a/src/addons/block/newsitems/components/newsitems/newsitems.ts b/src/addons/block/newsitems/components/newsitems/newsitems.ts new file mode 100644 index 000000000..749868338 --- /dev/null +++ b/src/addons/block/newsitems/components/newsitems/newsitems.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a news items block. + */ +@Component({ + selector: 'addon-block-news-items', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['newsitems.scss'], +}) +export class AddonBlockNewsItemsComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/newsitems/lang.json b/src/addons/block/newsitems/lang.json new file mode 100644 index 000000000..83b981297 --- /dev/null +++ b/src/addons/block/newsitems/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Latest announcements" +} \ No newline at end of file diff --git a/src/addons/block/newsitems/newsitems.module.ts b/src/addons/block/newsitems/newsitems.module.ts new file mode 100644 index 000000000..b328ad276 --- /dev/null +++ b/src/addons/block/newsitems/newsitems.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockNewsItemsHandler } from './services/block-handler'; +import { AddonBlockNewsItemsComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockNewsItemsComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockNewsItemsHandler.instance); + }, + }, + ], +}) +export class AddonBlockNewsItemsModule {} diff --git a/src/addons/block/newsitems/services/block-handler.ts b/src/addons/block/newsitems/services/block-handler.ts new file mode 100644 index 000000000..04f1ceac5 --- /dev/null +++ b/src/addons/block/newsitems/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockNewsItemsComponent } from '../components/newsitems/newsitems'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockNewsItemsHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockNewsItems'; + blockName = 'news_items'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_newsitems.pluginname', + class: 'addon-block-news-items', + component: AddonBlockNewsItemsComponent, + }; + } + +} + +export class AddonBlockNewsItemsHandler extends makeSingleton(AddonBlockNewsItemsHandlerService) {} diff --git a/src/addons/block/onlineusers/components/components.module.ts b/src/addons/block/onlineusers/components/components.module.ts new file mode 100644 index 000000000..384ffd1d2 --- /dev/null +++ b/src/addons/block/onlineusers/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockOnlineUsersComponent } from './onlineusers/onlineusers'; + +@NgModule({ + declarations: [ + AddonBlockOnlineUsersComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockOnlineUsersComponent, + ], + entryComponents: [ + AddonBlockOnlineUsersComponent, + ], +}) +export class AddonBlockOnlineUsersComponentsModule {} diff --git a/src/addons/block/onlineusers/components/onlineusers/onlineusers.scss b/src/addons/block/onlineusers/components/onlineusers/onlineusers.scss new file mode 100644 index 000000000..c3d4b4c40 --- /dev/null +++ b/src/addons/block/onlineusers/components/onlineusers/onlineusers.scss @@ -0,0 +1,67 @@ +:host .core-block-content ::ng-deep { + max-height: 200px; + overflow-y: auto; + .item-inner, + .input-wrapper { + overflow-y: visible; + align-self: start; + } + + .list { + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li.listentry { + clear: both; + list-style-type: none; + + .user { + float: left; + position: relative; + padding-bottom: 16px; + + .core-adapted-img-container { + display: inline; + margin-left: 0; + margin-right: 8px; + } + + .userpicture { + vertical-align: text-bottom; + } + } + + .message { + float: right; + margin-top: 3px; + } + + .uservisibility { // No support on the app. + display: none; + } + } + } + + .info { + text-align: center; + } + +} + +:host-context([dir=rtl]) .core-block-content ::ng-deep { + .list li.listentry { + .user { + float: right; + + .core-adapted-img-container { + margin-left: 8px; + margin-right: 0; + } + } + + .message { + float: left; + } + } +} diff --git a/src/addons/block/onlineusers/components/onlineusers/onlineusers.ts b/src/addons/block/onlineusers/components/onlineusers/onlineusers.ts new file mode 100644 index 000000000..38880fbfd --- /dev/null +++ b/src/addons/block/onlineusers/components/onlineusers/onlineusers.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a online users block. + */ +@Component({ + selector: 'addon-block-online-users', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['onlineusers.scss'], +}) +export class AddonBlockOnlineUsersComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/onlineusers/lang.json b/src/addons/block/onlineusers/lang.json new file mode 100644 index 000000000..4bc6cd412 --- /dev/null +++ b/src/addons/block/onlineusers/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Online users" +} \ No newline at end of file diff --git a/src/addons/block/onlineusers/onlineusers.module.ts b/src/addons/block/onlineusers/onlineusers.module.ts new file mode 100644 index 000000000..6eef61477 --- /dev/null +++ b/src/addons/block/onlineusers/onlineusers.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockOnlineUsersHandler } from './services/block-handler'; +import { AddonBlockOnlineUsersComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockOnlineUsersComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockOnlineUsersHandler.instance); + }, + }, + ], +}) +export class AddonBlockOnlineUsersModule {} diff --git a/src/addons/block/onlineusers/services/block-handler.ts b/src/addons/block/onlineusers/services/block-handler.ts new file mode 100644 index 000000000..813dfaae0 --- /dev/null +++ b/src/addons/block/onlineusers/services/block-handler.ts @@ -0,0 +1,46 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockOnlineUsersComponent } from '../components/onlineusers/onlineusers'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockOnlineUsersHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockOnlineUsers'; + blockName = 'online_users'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_onlineusers.pluginname', + class: 'addon-block-online-users', + component: AddonBlockOnlineUsersComponent, + }; + } + +} + +export class AddonBlockOnlineUsersHandler extends makeSingleton(AddonBlockOnlineUsersHandlerService) {} diff --git a/src/addons/block/recentactivity/components/components.module.ts b/src/addons/block/recentactivity/components/components.module.ts new file mode 100644 index 000000000..ce4fe2ba0 --- /dev/null +++ b/src/addons/block/recentactivity/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockRecentActivityComponent } from './recentactivity/recentactivity'; + +@NgModule({ + declarations: [ + AddonBlockRecentActivityComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockRecentActivityComponent, + ], + entryComponents: [ + AddonBlockRecentActivityComponent, + ], +}) +export class AddonBlockRecentActivityComponentsModule {} diff --git a/src/addons/block/recentactivity/components/recentactivity/recentactivity.scss b/src/addons/block/recentactivity/components/recentactivity/recentactivity.scss new file mode 100644 index 000000000..a2e9d77a2 --- /dev/null +++ b/src/addons/block/recentactivity/components/recentactivity/recentactivity.scss @@ -0,0 +1,25 @@ +:host .core-block-content ::ng-deep { + .activitydate, .activityhead { + text-align: center; + } + + .unlist { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + li { + margin-bottom: 1em; + + .head .date { + float: right; + } + } + } +} + +:host-context([dir=rtl]) .core-block-content ::ng-deep { + .unlist li .head .date { + float: left; + } +} diff --git a/src/addons/block/recentactivity/components/recentactivity/recentactivity.ts b/src/addons/block/recentactivity/components/recentactivity/recentactivity.ts new file mode 100644 index 000000000..e13e693dc --- /dev/null +++ b/src/addons/block/recentactivity/components/recentactivity/recentactivity.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a recent activity block. + */ +@Component({ + selector: 'addon-block-recent-activity', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['recentactivity.scss'], +}) +export class AddonBlockRecentActivityComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/recentactivity/lang.json b/src/addons/block/recentactivity/lang.json new file mode 100644 index 000000000..29f7996e2 --- /dev/null +++ b/src/addons/block/recentactivity/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Recent activity" +} \ No newline at end of file diff --git a/src/addons/block/recentactivity/recentactivity.module.ts b/src/addons/block/recentactivity/recentactivity.module.ts new file mode 100644 index 000000000..97ae712df --- /dev/null +++ b/src/addons/block/recentactivity/recentactivity.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockRecentActivityHandler } from './services/block-handler'; +import { AddonBlockRecentActivityComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockRecentActivityComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockRecentActivityHandler.instance); + }, + }, + ], +}) +export class AddonBlockRecentActivityModule {} diff --git a/src/addons/block/recentactivity/services/block-handler.ts b/src/addons/block/recentactivity/services/block-handler.ts new file mode 100644 index 000000000..a2e35f24b --- /dev/null +++ b/src/addons/block/recentactivity/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockRecentActivityComponent } from '../components/recentactivity/recentactivity'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockRecentActivityHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockRecentActivity'; + blockName = 'recent_activity'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_recentactivity.pluginname', + class: 'addon-block-recent-activity', + component: AddonBlockRecentActivityComponent, + }; + } + +} + +export class AddonBlockRecentActivityHandler extends makeSingleton(AddonBlockRecentActivityHandlerService) {} diff --git a/src/addons/block/rssclient/components/components.module.ts b/src/addons/block/rssclient/components/components.module.ts new file mode 100644 index 000000000..b94be30d3 --- /dev/null +++ b/src/addons/block/rssclient/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockRssClientComponent } from './rssclient/rssclient'; + +@NgModule({ + declarations: [ + AddonBlockRssClientComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockRssClientComponent, + ], + entryComponents: [ + AddonBlockRssClientComponent, + ], +}) +export class AddonBlockRssClientComponentsModule {} diff --git a/src/addons/block/rssclient/components/rssclient/rssclient.scss b/src/addons/block/rssclient/components/rssclient/rssclient.scss new file mode 100644 index 000000000..bd23c6bc0 --- /dev/null +++ b/src/addons/block/rssclient/components/rssclient/rssclient.scss @@ -0,0 +1,18 @@ +:host .core-block-content ::ng-deep { + .list { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + border-top: 1px solid var(--gray); + padding: 5px; + padding-bottom: 8px; + } + + li:first-child { + border-top-width: 0; + } + } +} diff --git a/src/addons/block/rssclient/components/rssclient/rssclient.ts b/src/addons/block/rssclient/components/rssclient/rssclient.ts new file mode 100644 index 000000000..c80610358 --- /dev/null +++ b/src/addons/block/rssclient/components/rssclient/rssclient.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a rss client block. + */ +@Component({ + selector: 'addon-block-rss-client', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['rssclient.scss'], +}) +export class AddonBlockRssClientComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/rssclient/lang.json b/src/addons/block/rssclient/lang.json new file mode 100644 index 000000000..18282971b --- /dev/null +++ b/src/addons/block/rssclient/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Remote RSS feeds" +} \ No newline at end of file diff --git a/src/addons/block/rssclient/rssclient.module.ts b/src/addons/block/rssclient/rssclient.module.ts new file mode 100644 index 000000000..c572d8925 --- /dev/null +++ b/src/addons/block/rssclient/rssclient.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockRssClientHandler } from './services/block-handler'; +import { AddonBlockRssClientComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockRssClientComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockRssClientHandler.instance); + }, + }, + ], +}) +export class AddonBlockRssClientModule {} diff --git a/src/addons/block/rssclient/services/block-handler.ts b/src/addons/block/rssclient/services/block-handler.ts new file mode 100644 index 000000000..15368c908 --- /dev/null +++ b/src/addons/block/rssclient/services/block-handler.ts @@ -0,0 +1,49 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { CoreCourseBlock } from '@features/course/services/course'; +import { AddonBlockRssClientComponent } from '../components/rssclient/rssclient'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockRssClientHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockRssClient'; + blockName = 'rss_client'; + + /** + * Returns the data needed to render the block. + * + * @param block The block to render. + * @return Data or promise resolved with the data. + */ + getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { + + return { + title: block.contents?.title || 'addon.block_rssclient.pluginname', + class: 'addon-block-rss-client', + component: AddonBlockRssClientComponent, + }; + } + +} + +export class AddonBlockRssClientHandler extends makeSingleton(AddonBlockRssClientHandlerService) {} diff --git a/src/addons/block/tags/components/components.module.ts b/src/addons/block/tags/components/components.module.ts new file mode 100644 index 000000000..e26cc198b --- /dev/null +++ b/src/addons/block/tags/components/components.module.ts @@ -0,0 +1,45 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from '@ionic/angular'; +import { FormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; + +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { AddonBlockTagsComponent } from './tags/tags'; + +@NgModule({ + declarations: [ + AddonBlockTagsComponent, + ], + imports: [ + CommonModule, + IonicModule, + FormsModule, + TranslateModule.forChild(), + CoreComponentsModule, + CoreDirectivesModule, + ], + exports: [ + AddonBlockTagsComponent, + ], + entryComponents: [ + AddonBlockTagsComponent, + ], +}) +export class AddonBlockTagsComponentsModule {} diff --git a/src/addons/block/tags/components/tags/tags.scss b/src/addons/block/tags/components/tags/tags.scss new file mode 100644 index 000000000..b1144d4e0 --- /dev/null +++ b/src/addons/block/tags/components/tags/tags.scss @@ -0,0 +1,117 @@ +:host .core-block-content ::ng-deep { + .tag_cloud { + font-size: 80%; + text-align: center; + ul.inline-list { + list-style: none; + margin-left: 0; + margin-right: 0; + -webkit-padding-start: 0; + + li { + padding: .2em; + display: inline-block; + + a { + background: var(--ion-color-primary); + color: var(--ion-color-primary-contrast); + padding: 3px 8px; + -webkit-font-smoothing: antialiased; + display: inline-block; + min-width: 10px; + font-weight: bold; + line-height: 1; + text-align: center; + white-space: nowrap; + contain: content; + vertical-align: baseline; + text-decoration: none; + border-radius: 4px; + } + .s20 { + font-size: 2.7em; + } + + .s19 { + font-size: 2.6em; + } + + .s18 { + font-size: 2.5em; + } + + .s17 { + font-size: 2.4em; + } + + .s16 { + font-size: 2.3em; + } + + .s15 { + font-size: 2.2em; + } + + .s14 { + font-size: 2.1em; + } + + .s13 { + font-size: 2em; + } + + .s12 { + font-size: 1.9em; + } + + .s11 { + font-size: 1.8em; + } + + .s10 { + font-size: 1.7em; + } + + .s9 { + font-size: 1.6em; + } + + .s8 { + font-size: 1.5em; + } + + .s7 { + font-size: 1.4em; + } + + .s6 { + font-size: 1.3em; + } + + .s5 { + font-size: 1.2em; + } + + .s4 { + font-size: 1.1em; + } + + .s3 { + font-size: 1em; + } + + .s2 { + font-size: 0.9em; + } + + .s1 { + font-size: 0.8em; + } + + .s0 { + font-size: 0.7em; + } + } + } + } +} diff --git a/src/addons/block/tags/components/tags/tags.ts b/src/addons/block/tags/components/tags/tags.ts new file mode 100644 index 000000000..9ae0e6c2c --- /dev/null +++ b/src/addons/block/tags/components/tags/tags.ts @@ -0,0 +1,26 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Component } from '@angular/core'; +import { CoreBlockPreRenderedComponent } from '@features/block/components/pre-rendered-block/pre-rendered-block'; + +/** + * Component to render a tags block. + */ +@Component({ + selector: 'addon-block-tags', + templateUrl: '../../../../../core/features/block/components/pre-rendered-block/core-block-pre-rendered.html', + styleUrls: ['tags.scss'], +}) +export class AddonBlockTagsComponent extends CoreBlockPreRenderedComponent {} diff --git a/src/addons/block/tags/lang.json b/src/addons/block/tags/lang.json new file mode 100644 index 000000000..a4080dd78 --- /dev/null +++ b/src/addons/block/tags/lang.json @@ -0,0 +1,3 @@ +{ + "pluginname": "Tags" +} \ No newline at end of file diff --git a/src/addons/block/tags/services/block-handler.ts b/src/addons/block/tags/services/block-handler.ts new file mode 100644 index 000000000..381151d24 --- /dev/null +++ b/src/addons/block/tags/services/block-handler.ts @@ -0,0 +1,47 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { Injectable } from '@angular/core'; + +import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; +import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; +import { AddonBlockTagsComponent } from '../components/tags/tags'; +import { makeSingleton } from '@singletons'; + +/** + * Block handler. + */ +@Injectable({ providedIn: 'root' }) +export class AddonBlockTagsHandlerService extends CoreBlockBaseHandler { + + name = 'AddonBlockTags'; + blockName = 'tags'; + + /** + * Returns the data needed to render the block. + * + * @return Data or promise resolved with the data. + */ + getDisplayData(): CoreBlockHandlerData { + + return { + title: 'addon.block_tags.pluginname', + class: 'addon-block-tags', + component: AddonBlockTagsComponent, + }; + } + +} + +export class AddonBlockTagsHandler extends makeSingleton(AddonBlockTagsHandlerService) {} diff --git a/src/addons/block/tags/tags.module.ts b/src/addons/block/tags/tags.module.ts new file mode 100644 index 000000000..e20b990b6 --- /dev/null +++ b/src/addons/block/tags/tags.module.ts @@ -0,0 +1,38 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// 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 { APP_INITIALIZER, NgModule } from '@angular/core'; +import { IonicModule } from '@ionic/angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreBlockDelegate } from '@features/block/services/block-delegate'; +import { AddonBlockTagsHandler } from './services/block-handler'; +import { AddonBlockTagsComponentsModule } from './components/components.module'; + +@NgModule({ + imports: [ + IonicModule, + AddonBlockTagsComponentsModule, + TranslateModule.forChild(), + ], + providers: [ + { + provide: APP_INITIALIZER, + multi: true, + useValue: () => { + CoreBlockDelegate.instance.registerHandler(AddonBlockTagsHandler.instance); + }, + }, + ], +}) +export class AddonBlockTagsModule {}