forest-rails icon indicating copy to clipboard operation
forest-rails copied to clipboard

Smart fields, concatenate urls

Open daniel-gato opened this issue 7 years ago • 9 comments

Hello,

I would like to concatenate multiple links into a smart field:

class Forest::Venue
  include ForestLiana::Collection

  collection :venues

  field :urls, type: 'String' do
    "<a href=\"#{object.facebook_url}\">FB</a><a href=\"#{object.twitter_url}\">TW</a>"
  end
end
  • Any documentation available regarding the supported types for a smart field?
  • Any chance it could support HTML markup, maybe a field type HTML?

daniel-gato avatar Aug 01 '17 23:08 daniel-gato

Hi @daniel-costa, yes you can do that with your Smart Field.

The only thing you have to do now, is to configure a "rich text editor" widget on your urls Smart Field in the Venues collection settings. Once in "Edit Layout" mode in the UI go to Venues Settings > Fields > urls and define the "rich text editor" widget. You'll see your links properly displayed.

🌲🌲🌲

arnaudbesnier avatar Aug 03 '17 09:08 arnaudbesnier

Hi @arnaudbesnier

I'm not getting that done right where I need it.

Code

class Forest::Venue
  include ForestLiana::Collection
  collection :venues
  field :urls, type: 'String' do
    # "<a href=\"www.test.com\">#{object.facebook_url}</a><a href=\"www.test.com\">#{object.twitter_url}</a>"
    "<strong>just a test</strong>"
  end
end

Field config

screen shot 2017-08-03 at 2 49 00 pm

Collection

screen shot 2017-08-03 at 2 49 18 pm

Details

screen shot 2017-08-03 at 2 49 35 pm

daniel-gato avatar Aug 03 '17 13:08 daniel-gato

@daniel-costa, so it works well in the details. About the collection list, yes it is not well formatted, we could improve that.

For your business operations, Do you want to click on the links from the collection list?

arnaudbesnier avatar Aug 03 '17 15:08 arnaudbesnier

Yes

In fact, I think this might be a recurring problem. A user profile with multiple links (social links perhaps) and we want to display all of them in a "HTML icony" way.

For me, that field is relevant only on the collections view as a space saver. It allows me to see really fast if a link is missing if the icon doesn't appear.

On 3 Aug 2017, at 4.04 PM, Arnaud Besnier [email protected] wrote:

@daniel-costa, so it works well in the details. About the collection list, yes it is not well formatted, we could improve that.

For your business operations, Do you want to click on the links from the collection list?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

daniel-gato avatar Aug 04 '17 12:08 daniel-gato

@daniel-costa we'll try to fix this in the current sprint then! I'll let you know once it is fixed in production.

arnaudbesnier avatar Aug 07 '17 16:08 arnaudbesnier

Any news about this issue?

daniel-gato avatar Nov 09 '17 14:11 daniel-gato

Any news about this issue?

daniel-gato avatar Dec 11 '17 11:12 daniel-gato

Hi @daniel-costa, we have a lot of things to do right now so I can't give you any ETA for such a fix.

But I am sure you can find some workaround to see quickly in the list which social links are present or not (several Smart Fields for each social link, String Smart Field to concatenate the present social network names that are present, ...).

arnaudbesnier avatar Dec 17 '17 16:12 arnaudbesnier

Yes sure I could find workarounds, but it wasn’t the purpose when I posted the problem...

On 17 Dec 2017, at 6.03 PM, Arnaud Besnier [email protected] wrote:

Hi @daniel-costa, we have a lot of things to do right now so I can't give you any ETA for such a fix.

But I am sure you can find some workaround to see quickly in the list which social links are present or not (several Smart Fields for each social link, String Smart Field to concatenate the present social network names that are present, ...).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

daniel-gato avatar Dec 17 '17 17:12 daniel-gato