New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Pending draft" link in page list for custom entities it's not working #214

Closed
groccodm opened this Issue Jun 4, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@groccodm
Copy link

groccodm commented Jun 4, 2018

Hi, i created some custom entities on Coufoundry, and they configured with AutoPublish=false. In the list page the Pending Draft link of an unpublished entry it's not working, it seems that the link it's not configured correctly, this is what i see in code generated on the page

<td class="ng-scope" ng-if="::!vm.options.autoPublish"> <!-- ngIf: entity.isPublished --><span class="ng-scope" ng-if="entity.isPublished">Published</span><!-- end ngIf: entity.isPublished --> <!-- ngIf: !entity.isPublished && entity.publishStatus == 'Published' --> <!-- ngIf: entity.publishStatus == 'Unpublished' --> <br> <!-- ngIf: entity.hasDraft --><a class="ng-scope" href="" ng-if="entity.hasDraft">(Pending Draft)</a><!-- end ngIf: entity.hasDraft --> </td>

Thanks for your support.

@HeyJoel

This comment has been minimized.

Copy link
Member

HeyJoel commented Jun 4, 2018

Hi there, I'm trying this out with our SimpleSite sample and cannot replicate an issue. In the sample I'm looking at the Blog Post custom entity listing "/admin/blog-posts#/" and if I have a blog post in draft state the Pending Draft link works.

In what way are you seeing an issue? Is the url wrong? Does the Pending Draft link display or is it hidden?

@groccodm

This comment has been minimized.

Copy link

groccodm commented Jun 5, 2018

The link is displayed, but when i click on it, the page reloads and nothing happens. I'm guessing it could be the configuration of my custom entity, this is how i configured it:

` public class NewsDataModel : ICustomEntityDataModel
{
[Display(Description = "Titolo della news")]
public string Title { get; set; }
[Display(Description = "Contenuto della news")]
[Html]
public string Content { get; set; }

    [Display(Description = "Data di pubblicazione")]
    [Date]
    public DateTime Published { get; set; }
    
    [Display(Description = "Data di scadenza")]
    [Date]
    public DateTime? DueDate { get; set; }

    [Display(Description = "Tipologia di news")]
    [CustomEntity("CANWST")]
    public int Type { get; set; }

    [Display(Description = "Allegato (opzionale)")]
    [Document]
    public int? Attachment { get; set; }
}
public class NewsTypeDataModel : ICustomEntityDataModel
{
    
}
public class NewsCustomEntityDefinition : ICustomEntityDefinition<NewsDataModel>
{
    /// <summary>
    /// This constant is a convention that allows us to reference this definition code 
    /// in other parts of the application (e.g. querying)
    /// </summary>
    public const string DefinitionCode = "CANEWS";

    /// <summary>
    /// Unique 6 letter code representing the module (the convention is to use uppercase)
    /// </summary>
    public string CustomEntityDefinitionCode => DefinitionCode;

    /// <summary>
    /// Singlar name of the entity
    /// </summary>
    public string Name => "News";

    /// <summary>
    /// Plural name of the entity
    /// </summary>
    public string NamePlural => "News";

    /// <summary>
    /// A short description that shows up as a tooltip for the admin 
    /// panel.
    /// </summary>
    public string Description => "News pubblicate nel portale";

    /// <summary>
    /// Indicates whether the UrlSlug property should be treated
    /// as a unique property and be validated as such.
    /// </summary>
    public bool ForceUrlSlugUniqueness => false;

    /// <summary>
    /// Indicates whether the url slug should be autogenerated. If this
    /// is selected then the user will not be shown the UrlSlug property
    /// and it will be auto-generated based on the title.
    /// </summary>
    public bool AutoGenerateUrlSlug => true;

    /// <summary>
    /// Indicates whether this custom entity should always be published when 
    /// saved, provided the user has permissions to do so. Useful if this isn't
    /// the sort of entity that needs a draft state workflow
    /// </summary>
    public bool AutoPublish => false;

    /// <summary>
    /// Indicates whether the entities are partitioned by locale
    /// </summary>
    public bool HasLocale => false;
}

public class NewsTypeCustomEntityDefinition : ICustomEntityDefinition<NewsTypeDataModel>
{
    /// <summary>
    /// This constant is a convention that allows us to reference this definition code 
    /// in other parts of the application (e.g. querying)
    /// </summary>
    public const string DefinitionCode = "CANWST";

    /// <summary>
    /// Unique 6 letter code representing the module (the convention is to use uppercase)
    /// </summary>
    public string CustomEntityDefinitionCode => DefinitionCode;

    /// <summary>
    /// Singlar name of the entity
    /// </summary>
    public string Name => "NewsType";

    /// <summary>
    /// Plural name of the entity
    /// </summary>
    public string NamePlural => "NewsTypes";

    /// <summary>
    /// A short description that shows up as a tooltip for the admin 
    /// panel.
    /// </summary>
    public string Description => "Tipologia di News";

    /// <summary>
    /// Indicates whether the UrlSlug property should be treated
    /// as a unique property and be validated as such.
    /// </summary>
    public bool ForceUrlSlugUniqueness => false;

    /// <summary>
    /// Indicates whether the url slug should be autogenerated. If this
    /// is selected then the user will not be shown the UrlSlug property
    /// and it will be auto-generated based on the title.
    /// </summary>
    public bool AutoGenerateUrlSlug => true;

    /// <summary>
    /// Indicates whether this custom entity should always be published when 
    /// saved, provided the user has permissions to do so. Useful if this isn't
    /// the sort of entity that needs a draft state workflow
    /// </summary>
    public bool AutoPublish => true;

    /// <summary>
    /// Indicates whether the entities are partitioned by locale
    /// </summary>
    public bool HasLocale => false;
}`

The "NewsDataModel" is the data model of the custom entity.

Thanks

@HeyJoel HeyJoel added the bug label Jun 5, 2018

@HeyJoel HeyJoel added this to the 0.3.2 milestone Jun 5, 2018

HeyJoel added a commit that referenced this issue Jun 5, 2018

@HeyJoel

This comment has been minimized.

Copy link
Member

HeyJoel commented Jun 5, 2018

Ok I've found the issue, Am I right in thinking that you do not have a custom entity page associated with the custom entity?

I've found an issue where the Preview Draft link displays even when there is no page associated with the custom entity. The draft link is supposed to redirect you to that page, but was still displaying if there was no link. I've fixed that now and it will be released in v0.3.2

@groccodm

This comment has been minimized.

Copy link

groccodm commented Jun 5, 2018

Yes, you are right i do not have a custom entity page for the class. Thanks for your support.

@HeyJoel HeyJoel closed this Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment