Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //define(['angular', 'jquery', 'services/Article', 'model/Panel'], function (angular, $, articleService, Panel) {
- define(['angular', 'services/Article'/*, 'angular-resource', 'angular-route'*/], function (angular, articleService) {
- // Content type configuration
- var contentTypes = [{
- id: 'BingNewsFeed',
- column: 1
- }, {
- id: 'CommunityNewsFeed',
- column: 1
- }, {
- id: 'Community',
- column: 2
- }, {
- id: 'Review',
- column: 2
- }, {
- id: 'Modifications',
- column: 3
- }, {
- id: 'HowToGuide',
- column: 3
- }, {
- id: 'Archive',
- column: 4
- }];
- var mx5PortalApp = angular.module('mx5PortalApp', []);
- mx5PortalApp.controller('PanelController', function () {
- var self = this;
- self.columns = [];
- for (var index in contentTypes) {
- var contentType = contentTypes[index],
- columnIndex = contentType.column - 1;
- if (!self.columns[columnIndex]) {
- self.columns[columnIndex] = [];
- }
- (function () {
- articleService.getByContentType(contentType.id, contentType.limit || 5, function (data) {
- data = [{
- title: 'a-title' + contentType.id,
- content: 'content',
- type: 'Article'
- }, {
- title: 'b-title' + contentType.id,
- content: 'content',
- type: 'Article'
- }];
- contentType.items = data;
- self.columns[columnIndex].push(contentType);
- });
- })();
- }
- });
- angular.element(document).ready(function () {
- angular.bootstrap(document, ['mx5PortalApp']);
- });
- /*
- var panel = new Panel();
- for (var contentTypeIndex in contentTypes) {
- var contentType = contentTypes[contentTypeIndex];
- (function (contentType) {
- articleService.getByContentType(contentType.id, contentType.limit || 5, function (data) {
- data = [{
- title: 'a-title' + contentType.id,
- content: 'content',
- type: 'Article'
- }, {
- title: 'b-title' + contentType.id,
- content: 'content',
- type: 'Article'
- }];
- for (var i = 0; i < data.length; i++) {
- panel.addItem(data[i], data[i].type, contentType.name || contentType.id, contentType.column);
- }
- // Render
- $('.content').html(panel.html());
- });
- })(contentType);
- }
- */
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement