Skip to content
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

Helper method to create an sms link #36511

Merged
merged 2 commits into from Jul 19, 2019

Conversation

@aantix
Copy link
Contributor

commented Jun 17, 2019

When the user clicks the sms link, the user's messaging software is opened with the passed in phone number and optional body value prepopulated.

Test page :
https://sms-to-rails-test.herokuapp.com/

<%= sms_to "15155555785", "Text me", body: "I have a question.." %>

Summary

OSX Chrome/Safari
image

Android
image

iOS Safari
image

@rails-bot rails-bot bot added the actionview label Jun 17, 2019

@guilleiguaran

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

I think this should be sms_to to be consistent with email_to

@aantix

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2019

I think this should be sms_to to be consistent with email_to

Fair point. Changed the method name to sms_to.

@rafaelfranca rafaelfranca requested a review from guilleiguaran Jun 18, 2019

Helper method to create an sms link - when clicked it opens the phone…
…/desktop's messaging client with the phone number and optional body value prepopulated.

@aantix aantix force-pushed the aantix:sms_link_helper branch from 388c598 to 3115b73 Jun 18, 2019

@sharang-d
Copy link
Contributor

left a comment

Simple doc changes :)

Show resolved Hide resolved actionview/lib/action_view/helpers/url_helper.rb Outdated
Show resolved Hide resolved actionview/lib/action_view/helpers/url_helper.rb Outdated
Show resolved Hide resolved actionview/lib/action_view/helpers/url_helper.rb Outdated
Show resolved Hide resolved actionview/lib/action_view/helpers/url_helper.rb Outdated
@aantix

This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2019

Are there any additional messaging clients that we can test this with?
https://sms-to-rails-test.herokuapp.com/

@guilleiguaran guilleiguaran merged commit ea91f9b into rails:master Jul 19, 2019

2 checks passed

buildkite/rails Build #61811 passed (9 minutes, 10 seconds)
Details
codeclimate All good!
Details
@pdobb

This comment has been minimized.

Copy link

commented Jul 21, 2019

🤜🏻🤛🏻

@bogdan

This comment has been minimized.

Copy link
Contributor

commented Jul 22, 2019

body escaping had some problems in historical versions of iOS and Android.
We still have this workaround in our code:

    unless ios_greater_or_equal?("10", user_agent) ||   android_greater_or_equal?('6.0.1', user_agent) # problem was fixed in ios 10 and android 6.0.1+
      body.gsub!('%', '%25')
    end

Maybe this is still actual and should be supported.

https://stackoverflow.com/q/18120062/91610

# HTML attributes for the link can be passed in +html_options+.
#
# When clicked, an SMS message is prepopulated with the passed phone number
# and optional +body+ value.

This comment has been minimized.

Copy link
@K1N5L4Y3R

K1N5L4Y3R Jul 23, 2019

image

Watch out for indentation here (being parsed as a code block)

This comment has been minimized.

Copy link
@kamipo

kamipo Jul 24, 2019

Member

Good catch. Fixed by 0e149ab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.