You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Andi Huber (JIRA)" <ji...@apache.org> on 2017/09/09 06:39:02 UTC

[jira] [Comment Edited] (ISIS-1616) Support URLs as a link / "As-is" HTML rendering

    [ https://issues.apache.org/jira/browse/ISIS-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16159785#comment-16159785 ] 

Andi Huber edited comment on ISIS-1616 at 9/9/17 6:38 AM:
----------------------------------------------------------

Real world example of THUMBNAIL rendering.

* We have the property _logo_ to store an Image. ISIS provides upload and download via the UI.
* With the new _Markup_ value type, we may provide a (readonly) thumbnail preview (_logoPreview_), that we can use even in collection views (tables).

(Don't mind the HtmlBuilder class, it simply does the HTML formatting.)

{code:java}

// - LOGO
	
@PropertyLayout(labelPosition=LabelPosition.TOP, hidden=Where.ALL_TABLES)
@Column(allowsNull="true") @Persistent(defaultFetchGroup="false") 
@Getter @Setter private Blob logo;

// - LOGO PREVIEW

@NotPersistent	
public Markup getLogoPreview(){
	return new Markup(
		Optional.ofNullable(getLogo())
		.map(blob->new HtmlBuilder()
				.img()._class("img-thumb-h24")._srcEmbed(getLogo().getMimeType().toString(), blob.getBytes()).endln()
				.build().toString())
		.orElse("-")
		);
}

{code}




was (Author: hobrom):
Real world example of THUMBNAIL rendering.

* We have the property _logo_ to store an Image. ISIS provides upload and download via the UI.
* With the new _Markup_ value type, we may provide a (readonly) thumbnail preview (_logoPreview_), that we can use even in collection views (tables).

(Don't mind the HtmlBuilder class, it simply does the HTML formatting.)

{code:java}

// - LOGO
	
@MemberOrder(sequence = "1")
@PropertyLayout(labelPosition=LabelPosition.TOP, hidden=Where.ALL_TABLES)
@Column(allowsNull="true") @Persistent(defaultFetchGroup="false") 
@Getter @Setter private Blob logo;

// - LOGO PREVIEW
	
public Markup getLogoPreview(){
	return new Markup(
		Optional.ofNullable(getLogo())
		.map(blob->new HtmlBuilder()
				.img()._class("img-thumb-h24")._srcEmbed(getLogo().getMimeType().toString(), blob.getBytes()).endln()
				.build().toString())
		.orElse("-")
		);
}

{code}



> Support URLs as a link  /  "As-is" HTML rendering
> -------------------------------------------------
>
>                 Key: ISIS-1616
>                 URL: https://issues.apache.org/jira/browse/ISIS-1616
>             Project: Isis
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.14.0
>            Reporter: Dan Haywood
>            Priority: Minor
>             Fix For: 2.1.0
>
>         Attachments: Clipboard01.png, Clipboard02.png
>
>
> Reuse Kevin's work, https://github.com/kev-m/isis-wicket-url/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)