MOBILE-3002 block: Add Recent blog entries block feature
parent
8ede493cef
commit
cac7f0bc12
|
@ -29,6 +29,7 @@
|
||||||
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
||||||
"addon.block_badges.pluginname": "block_badges",
|
"addon.block_badges.pluginname": "block_badges",
|
||||||
"addon.block_blogmenu.pluginname": "block_blog_menu",
|
"addon.block_blogmenu.pluginname": "block_blog_menu",
|
||||||
|
"addon.block_blogrecent.nocourses": "block_blog_recent",
|
||||||
"addon.block_blogtags.pluginname": "block_blog_tags",
|
"addon.block_blogtags.pluginname": "block_blog_tags",
|
||||||
"addon.block_calendarmonth.pluginname": "block_calendar_month",
|
"addon.block_calendarmonth.pluginname": "block_calendar_month",
|
||||||
"addon.block_calendarupcoming.pluginname": "block_calendar_upcoming",
|
"addon.block_calendarupcoming.pluginname": "block_calendar_upcoming",
|
||||||
|
|
|
@ -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 { AddonBlockBlogRecentHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockBlogRecentHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockBlogRecentModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBlogRecentHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
.addon-block-blog-recent core-block-pre-rendered {
|
||||||
|
.core-block-content {
|
||||||
|
ul.list {
|
||||||
|
list-style: none;
|
||||||
|
@include margin-horizontal(0);
|
||||||
|
-webkit-padding-start: 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Recent blog entries"
|
||||||
|
}
|
|
@ -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 AddonBlockBlogRecentHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockBlogRecent';
|
||||||
|
blockName = 'blog_recent';
|
||||||
|
|
||||||
|
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_blogrecent.pluginname'),
|
||||||
|
class: 'addon-block-blog-recent',
|
||||||
|
component: CoreBlockPreRenderedComponent
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ import { AddonBlockActivityModulesModule } from '@addon/block/activitymodules/ac
|
||||||
import { AddonBlockBadgesModule } from '@addon/block/badges/badges.module';
|
import { AddonBlockBadgesModule } from '@addon/block/badges/badges.module';
|
||||||
import { AddonBlockBlogMenuModule } from '@addon/block/blogmenu/blogmenu.module';
|
import { AddonBlockBlogMenuModule } from '@addon/block/blogmenu/blogmenu.module';
|
||||||
import { AddonBlockBlogTagsModule } from '@addon/block/blogtags/blogtags.module';
|
import { AddonBlockBlogTagsModule } from '@addon/block/blogtags/blogtags.module';
|
||||||
|
import { AddonBlockBlogRecentModule } from '@addon/block/blogrecent/blogrecent.module';
|
||||||
import { AddonBlockCalendarMonthModule } from '@addon/block/calendarmonth/calendarmonth.module';
|
import { AddonBlockCalendarMonthModule } from '@addon/block/calendarmonth/calendarmonth.module';
|
||||||
import { AddonBlockCalendarUpcomingModule } from '@addon/block/calendarupcoming/calendarupcoming.module';
|
import { AddonBlockCalendarUpcomingModule } from '@addon/block/calendarupcoming/calendarupcoming.module';
|
||||||
import { AddonBlockCommentsModule } from '@addon/block/comments/comments.module';
|
import { AddonBlockCommentsModule } from '@addon/block/comments/comments.module';
|
||||||
|
@ -231,6 +232,7 @@ export const CORE_PROVIDERS: any[] = [
|
||||||
AddonBlockActivityModulesModule,
|
AddonBlockActivityModulesModule,
|
||||||
AddonBlockBadgesModule,
|
AddonBlockBadgesModule,
|
||||||
AddonBlockBlogMenuModule,
|
AddonBlockBlogMenuModule,
|
||||||
|
AddonBlockBlogRecentModule,
|
||||||
AddonBlockBlogTagsModule,
|
AddonBlockBlogTagsModule,
|
||||||
AddonBlockCalendarMonthModule,
|
AddonBlockCalendarMonthModule,
|
||||||
AddonBlockCalendarUpcomingModule,
|
AddonBlockCalendarUpcomingModule,
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
"addon.block_activitymodules.pluginname": "Activities",
|
"addon.block_activitymodules.pluginname": "Activities",
|
||||||
"addon.block_badges.pluginname": "Latest badges",
|
"addon.block_badges.pluginname": "Latest badges",
|
||||||
"addon.block_blogmenu.pluginname": "Blog menu",
|
"addon.block_blogmenu.pluginname": "Blog menu",
|
||||||
|
"addon.block_blogrecent.pluginname": "Recent blog entries",
|
||||||
"addon.block_blogtags.pluginname": "Blog tags",
|
"addon.block_blogtags.pluginname": "Blog tags",
|
||||||
"addon.block_calendarmonth.pluginname": "Calendar",
|
"addon.block_calendarmonth.pluginname": "Calendar",
|
||||||
"addon.block_calendarupcoming.pluginname": " Upcoming events",
|
"addon.block_calendarupcoming.pluginname": " Upcoming events",
|
||||||
|
|
Loading…
Reference in New Issue