//~OPTIONS
{
  extends: "fcfManagement:templates/pages/base.tmpl",  
  access:  ["root"],
}

//~ARGUMENTS
{
  title: fcf.t("Data editor: Projections"),
}


//~ARGUMENTS body
{
}

//~TEMPLATE body
%{{
  var projections = fcf.application.getProjections().getProjections();
  var projectionsData = [];
  fcf.each(projections, function(a_key, a_projection){
    if (a_projection.inner)
      return;
    projectionsData.push({
      alias:       a_projection.alias,
      title:       a_projection.title,
      description: a_projection.description,
    })
  });
}}%

@{{
  render.template({
    template: "@controls:table",
    args: {
      enableToolbar: true,
      enableSearch:  true,
      outputRowCount: 10,
      value: projectionsData,
      columns:[
        {
          alias: "alias", 
          title: "!{Alias}!", 
          type:  "string",
        },
        {
          alias: "title", 
          title: "!{Title}!", 
          type:  "string",
        },
        {
          alias: "description", 
          title: "!{Description}!", 
          type:  "string",
        },
        {
          alias: "action", 
          title: "!{Action}!", 
          type:  "string",
          template: "@controls:link",
          args: {
            url:   "/fcfpackages/fcfManagement/data/records/${record.alias}$",
            title: "!{Open editor}!",
          }
        },
      ]
    }
  })
}}@