@@ -216,18 +216,22 @@ def to_text_for_social_media
216
216
end
217
217
218
218
def to_text_for_twitter
219
- text = "text=#{ self . company_name . titleize } is looking to hire a #{ self . title } "
220
- text += " in #{ self . location_name } " unless self . location_name . blank?
221
- text += ". More information here&url=https://#{ AppSettings . application_host } /jobs/#{ self . to_param } &hashtags=#{ self . location_name } "
222
- if !self . twitter_handle . blank?
223
- if self . twitter_handle . start_with? ( '@' )
224
- text += ( " " + self . twitter_handle )
225
- else
226
- text += ( " @" + self . twitter_handle )
227
- end
219
+ job_location , job_hashtags = "" , ""
220
+ job_company_name = self . company_name . titleize
221
+ job_title = self . title
222
+
223
+ unless self . location_name . blank?
224
+ job_location = "in #{ self . location_name } "
225
+ job_hashtags = "&hashtags=#{ self . location_name } "
226
+ end
227
+
228
+ job_link = "&url=https://#{ AppSettings . application_host } /jobs/#{ self . to_param } "
229
+
230
+ unless self . twitter_handle . blank?
231
+ job_twitter_account = clean_twitter_handle
228
232
end
229
233
230
- return text
234
+ return " text= #{ job_company_name } is looking to hire a #{ job_title } #{ job_location } . More information here #{ job_link } #{ job_twitter_account } "
231
235
end
232
236
233
237
private
@@ -246,4 +250,12 @@ def strip_whitespace
246
250
self . company_name = self . company_name . strip unless self . company_name . nil?
247
251
self . apply_email = self . apply_email . strip unless self . apply_email . nil?
248
252
end
253
+
254
+ def clean_twitter_handle
255
+ if self . twitter_handle . start_with? ( '@' )
256
+ return ( " " + self . twitter_handle )
257
+ else
258
+ return ( " @" + self . twitter_handle )
259
+ end
260
+ end
249
261
end
0 commit comments