MOBILE-3002 block: Add Tags block feature
parent
ebe4b0cf99
commit
48303896b9
|
@ -56,6 +56,7 @@
|
|||
"addon.block_sitemainmenu.pluginname": "block_site_main_menu",
|
||||
"addon.block_starredcourses.nocourses": "block_starredcourses",
|
||||
"addon.block_starredcourses.pluginname": "block_starredcourses",
|
||||
"addon.block_tags.pluginname": "block_tags",
|
||||
"addon.block_timeline.duedate": "block_timeline",
|
||||
"addon.block_timeline.next30days": "block_timeline",
|
||||
"addon.block_timeline.next3months": "block_timeline",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"pluginname": "Tags"
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// (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 { Injectable, Injector } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
|
||||
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||
|
||||
/**
|
||||
* Block handler.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AddonBlockTagsHandler extends CoreBlockBaseHandler {
|
||||
name = 'AddonBlockTags';
|
||||
blockName = 'tags';
|
||||
|
||||
constructor(private translate: TranslateService) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data needed to render the block.
|
||||
*
|
||||
* @param {Injector} injector Injector.
|
||||
* @param {any} block The block to render.
|
||||
* @param {string} contextLevel The context where the block will be used.
|
||||
* @param {number} instanceId The instance ID associated with the context level.
|
||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||
*/
|
||||
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||
|
||||
return {
|
||||
title: this.translate.instant('addon.block_tags.pluginname'),
|
||||
class: 'addon-block-tags',
|
||||
component: CoreBlockPreRenderedComponent
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
// (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 { NgModule } from '@angular/core';
|
||||
import { IonicModule } from 'ionic-angular';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||
import { AddonBlockTagsHandler } from './providers/block-handler';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
],
|
||||
imports: [
|
||||
IonicModule,
|
||||
TranslateModule.forChild()
|
||||
],
|
||||
exports: [
|
||||
],
|
||||
providers: [
|
||||
AddonBlockTagsHandler
|
||||
]
|
||||
})
|
||||
export class AddonBlockTagsModule {
|
||||
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockTagsHandler) {
|
||||
blockDelegate.registerHandler(blockHandler);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
.addon-block-tags core-block-pre-rendered {
|
||||
.core-block-content {
|
||||
.tag_cloud {
|
||||
text-align: center;
|
||||
ul.inline-list {
|
||||
list-style: none;
|
||||
@include margin-horizontal(0);
|
||||
-webkit-padding-start: 0;
|
||||
|
||||
li {
|
||||
padding: 0 .2em;
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
.tag_cloud .s20 {
|
||||
font-size: 2.7em;
|
||||
}
|
||||
|
||||
.tag_cloud .s19 {
|
||||
font-size: 2.6em;
|
||||
}
|
||||
|
||||
.tag_cloud .s18 {
|
||||
font-size: 2.5em;
|
||||
}
|
||||
|
||||
.tag_cloud .s17 {
|
||||
font-size: 2.4em;
|
||||
}
|
||||
|
||||
.tag_cloud .s16 {
|
||||
font-size: 2.3em;
|
||||
}
|
||||
|
||||
.tag_cloud .s15 {
|
||||
font-size: 2.2em;
|
||||
}
|
||||
|
||||
.tag_cloud .s14 {
|
||||
font-size: 2.1em;
|
||||
}
|
||||
|
||||
.tag_cloud .s13 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.tag_cloud .s12 {
|
||||
font-size: 1.9em;
|
||||
}
|
||||
|
||||
.tag_cloud .s11 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
.tag_cloud .s10 {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
|
||||
.tag_cloud .s9 {
|
||||
font-size: 1.6em;
|
||||
}
|
||||
|
||||
.tag_cloud .s8 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.tag_cloud .s7 {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
|
||||
.tag_cloud .s6 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.tag_cloud .s5 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.tag_cloud .s4 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.tag_cloud .s3 {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.tag_cloud .s2 {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.tag_cloud .s1 {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.tag_cloud .s0 {
|
||||
font-size: 0.7em;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -109,6 +109,7 @@ import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyac
|
|||
import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module';
|
||||
import { AddonBlockStarredCoursesModule } from '@addon/block/starredcourses/starredcourses.module';
|
||||
import { AddonBlockSelfCompletionModule } from '@addon/block/selfcompletion/selfcompletion.module';
|
||||
import { AddonBlockTagsModule } from '@addon/block/tags/tags.module';
|
||||
import { AddonModAssignModule } from '@addon/mod/assign/assign.module';
|
||||
import { AddonModBookModule } from '@addon/mod/book/book.module';
|
||||
import { AddonModChatModule } from '@addon/mod/chat/chat.module';
|
||||
|
@ -243,6 +244,7 @@ export const CORE_PROVIDERS: any[] = [
|
|||
AddonBlockRecentlyAccessedItemsModule,
|
||||
AddonBlockStarredCoursesModule,
|
||||
AddonBlockSelfCompletionModule,
|
||||
AddonBlockTagsModule,
|
||||
AddonModAssignModule,
|
||||
AddonModBookModule,
|
||||
AddonModChatModule,
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
"addon.block_sitemainmenu.pluginname": "Main menu",
|
||||
"addon.block_starredcourses.nocourses": "No starred courses",
|
||||
"addon.block_starredcourses.pluginname": "Starred courses",
|
||||
"addon.block_tags.pluginname": "Tags",
|
||||
"addon.block_timeline.duedate": "Due date",
|
||||
"addon.block_timeline.next30days": "Next 30 days",
|
||||
"addon.block_timeline.next3months": "Next 3 months",
|
||||
|
|
Loading…
Reference in New Issue