Closed ajones05 closed 7 years ago
@abdulhafeez I can truncate the text from the server side. How we should make "Read more" link?
@yuriyua I think truncating on server side is not a good idea as we need full post text to show on comments view. I think I can do it on client side only by traversing the list of posts when I receive them and checking length of each post news. If it exceeds 350 chars, I can truncate and save original text in a new variable on the same post object. Then when the 'see more ...' is clicked, I can show full text in comments from the saved text. I think this kind of idea can work.
T do it on server side and to make things easier on client side, we can include a new param on post object: truncatedNews which holds the truncated text while the original text remains in news param. I can then check truncatedNews on client side. If it is not null, I can show 'see more ...' link and on comments view, I can show original text from news property.
I have realised that the second idea described above is a good one. Lets try that. @yuriyua all you need to do is, truncate the text in 'news' property if it exceeds 350 characters and put the result in truncatedNews property. Leave the original non-truncated text in news as it is. I'll make the required changes on front end.
@abdulhafeez Should I apply this update to all post gateways: https://github.com/ajones05/seearound.me/wiki/Mobile-Api-Reference#-mobilepost https://github.com/ajones05/seearound.me/wiki/Mobile-Api-Reference#-mobilemyposts https://github.com/ajones05/seearound.me/wiki/Mobile-Api-Reference#-mobilerequest-nearest ?
Yes, it makes sense. At any place where we show a post, we will need to do this. So, please make the change for all gateways where it applies.
done
@abdulhafeez Can you test this post, please? https://www.seearound.me/admin/mobile-api/post/token/6V5KQK8ZZDXZML5VQPDM67HR3VTH28D85ISV52V4FR45E816YDT5LCXN9Q8A1LI5/post_id/5678/submit
How you will render post link?
Yeah, its working. I can see the truncatedNews property in the response. That is fine. Rendering link is no problem. Its simple and I have done it. However, there are couple of things to correct:
done
post body that contains just long link https://www.seearound.me/admin/mobile-api/post/token/TT8NME24C46AG698R6K6K1ZM71GM42EZXNMI4PNFTTRB22IT861S6ZGD1Z242G3Y/post_id/5685/submit
remove truncated link https://www.seearound.me/admin/mobile-api/post/token/TT8NME24C46AG698R6K6K1ZM71GM42EZXNMI4PNFTTRB22IT861S6ZGD1Z242G3Y/post_id/5678/submit
....
Thanks! Looks good now.
Can we do the same thing as we've done for the desktop version in List View? If a post is more than 350 characters (including spaces) truncate the the text and add "... See more." This can link to the "comment" page, which should include the full post text.![image](https://cloud.githubusercontent.com/assets/10637288/25514735/c9ddd30a-2b93-11e7-932d-054a4058de31.png)