Can't get ContentPagesResolver to work

Bug and problem reporting on Cyclos 4 version

Moderators: hugo, alexandre, rmvanarkel

Post Reply
atitokor
Posts: 44
Joined: Tue Jan 01, 2019 8:33 pm

Can't get ContentPagesResolver to work

Post by atitokor » Tue May 28, 2019 9:19 am

I created 4 content pages in Cyclos Content > Menu and Pages > as shown in the screenshot below but my content pages will not show even though the page titles show...
1.png
1.png (12.06 KiB) Viewed 177 times
Below is my setup.ts

Code: Select all

import { Configuration } from 'app/configuration';
import { ExampleContentPagesResolver } from 'app/content/example-content-pages-resolver';
/**
 * Set all desired Cyclos configuration options
 */
export function setup() {
  Configuration.apiRoot = 'https://subdomain.example.com/api';
  Configuration.appTitle = 'Example';
  Configuration.appTitleSmall = 'Example';
  Configuration.appTitleMenu = 'Example menu';
  // true means a separated menu bar, false means joining the menu on the top bar
  Configuration.menuBar = false;
  // The key is the ad category internal name, the value defines the icon and color
  Configuration.adCategories = {
    'community': { icon: 'people', color: '#2196f3' },
    'food': { icon: 'restaurant', color: '#f04d4e' },
    'goods': { icon: 'pages', color: '#ff9700' },
    'housing': { icon: 'location_city', color: '#029487' },
    'jobs': { icon: 'work', color: '#8062b3' },
    'labor': { icon: 'business', color: '#de3eaa' },
    'leisure': { icon: 'mood', color: '#687ebd' },
    'services': { icon: 'room_service', color: '#8ec63f' }
  };
  // The key is the custom operation internal name, the value defines the icon
  Configuration.operations = {
    addUnitsWithPayPal: { icon: 'format_paint' },
    //operation2: { icon: 'get_app' }
  };
  Configuration.contentPages = new ExampleContentPagesResolver();
}

and bellow is my ExampleContentPagesResolver

Code: Select all

import { ContentPage } from 'app/content/content-page';
import { ContentPagesResolver } from 'app/content/content-pages-resolver';
import { RootMenu } from 'app/shared/menu';

/**
 * Example for a content pages resolver
 */
export class ExampleContentPagesResolver implements ContentPagesResolver {

  /**
   * Returns the application content pages
   */
  contentPages(): ContentPage[] {
    return [
      {
        rootMenu: RootMenu.CONTENT,
        slug: 'About',
		loggedUsers: false,
        title: 'About',
        content: ''
	  },
      {
        rootMenu: RootMenu.CONTENT,
        slug: 'Solutions',
		loggedUsers: false,
        title: 'Solutions',
        content: ''
	  },
      {
        rootMenu: RootMenu.CONTENT,
        slug: 'Integrations',
		loggedUsers: false,
        title: 'Integrations',
        content: ''
	  },
      {
        rootMenu: RootMenu.CONTENT,
        slug: 'Resources',
		loggedUsers: false,
        title: 'Resources',
        content: ''
      }
    ];
  }

}
The screenshot bellow shows my front page as it currently looks: I have tried and tried but can't get the actual content in Content pages from Cyclos to appear in the front page
2.png
2.png (35.54 KiB) Viewed 177 times

Thanks Lius and all Admin Team members for your continuing help.
Art

luis
Posts: 179
Joined: Fri Feb 17, 2006 11:01 am

Re: Can't get ContentPagesResolver to work

Post by luis » Wed May 29, 2019 3:03 pm

That's because on the content fields you just set an empty string (content: '').
There's no relation between the content pages in Cyclos and the pages shown in the frontend.
You can, however, fetch the content of Cyclos content pages by URL. They need to be floating pages in Cyclos. In the floating page details page the URL is shown. You'll use it below.
So, as example:

Code: Select all

import { ContentPagesResolver } from 'app/content/content-pages-resolver';
import { ContentGetter } from 'app/content/content-getter';
import { ContentPage } from 'app/content/content-page';

export class ExampleContentPagesResolver implements ContentPagesResolver {

  contentPages(): ContentPage[] {
    return [
      {
        slug: 'about',
        layout: 'card',
        title: 'About Cyclos',
        loggedUsers: false,
        content: ContentGetter.cyclosPage(`http://localhost:8888/#page-content!id=808362123121454779`) // URL in Cyclos
      }
    ];
  }
}
Just a note, the slug is the path part which will show up in the URL - generally a kebab-case string (all lowercase, separated by dashes -).
Also, please, report future issues regarding the new frontend in its issue tracker: https://github.com/cyclosproject/cyclos4-ui/issues
Luis Fernando Planella Gonzalez
Cyclos development team

atitokor
Posts: 44
Joined: Tue Jan 01, 2019 8:33 pm

Re: Can't get ContentPagesResolver to work

Post by atitokor » Thu May 30, 2019 11:24 am

Thank you so much, Luis!
Art

Post Reply