Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit ddbd6cc

Browse files
Display job related text preformatted for sharing on social media
1 parent 907d58f commit ddbd6cc

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

app/models/job.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,21 @@ def self.remove_expired_jobs
201201
end
202202
end
203203

204+
def to_text_for_social_media
205+
text = "#{self.company_name.titleize} is looking to hire a #{self.title}"
206+
text += " in ##{self.location_name}" unless self.location_name.blank?
207+
text += ". More information here https://#{AppSettings.application_host}/jobs/#{self.to_param}"
208+
if !self.twitter_handle.blank?
209+
if self.twitter_handle.start_with?('@')
210+
text += (" " + self.twitter_handle)
211+
else
212+
text += (" @" + self.twitter_handle)
213+
end
214+
end
215+
216+
return text
217+
end
218+
204219
private
205220

206221
def set_dates

app/views/jobs/show.html.erb

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,34 @@
11
<section id="page-title">
2-
32
<div class="container clearfix">
43
<div class="row clearfix">
54
<div class="col-md-8 col-xs-12">
65
<h1><%= @job.title %></h1>
76
<h2><%= @job.company_name %> <%= location_str(@job) %></h2>
87
</div>
9-
108
<div class="col-md-4 nopadding fright hidden-xs">
119
<% if authorised_job_owner?(@job) %>
12-
<%= render('owner_job_actions', job: @job) %>
10+
<%= render('owner_job_actions', job: @job) %>
1311
<% else %>
1412
<%= link_to("Visit page to apply", @job.external_link, class: "button button-3d notopmargin fright hidden-xs", target: "_blank") %>
1513
<% end %>
1614
</div>
17-
1815
<!-- Mobile friendly interface -->
1916
<div class="col-md-12 nopadding visible-xs">
2017
<%= link_to("Visit page to apply", @job.external_link, class: "button button-3d", target: "_blank") %>
2118
</div>
2219
</div>
23-
2420
</div>
2521
</section>
26-
27-
<%= render("shared/flash") %>
28-
2922
<section id="content">
30-
3123
<div class="content-wrap">
32-
3324
<div class="container clearfix">
3425
<!-- Post Content
3526
============================================= -->
3627
<div class="postcontent nobottommargin">
37-
3828
<div class="single-post nobottommargin">
39-
4029
<!-- Single Post
4130
============================================= -->
4231
<div class="entry clearfix">
43-
4432
<!-- Entry Meta
4533
============================================= -->
4634
<ul class="entry-meta clearfix">
@@ -56,45 +44,37 @@
5644
</li>
5745
</ul>
5846
<!-- .entry-meta end -->
59-
6047
<!-- Entry Content
6148
============================================= -->
6249
<div class="entry-content notopmargin">
63-
6450
<ul class="content-margin-left" style="line-height: 1.8 !important;">
6551
<li>
6652
<i class="icon-briefcase"></i>
6753
Employment type: <%= @job.employment_type.try(:humanize) %>
6854
</li>
69-
7055
<li>
7156
<i class="icon-users"></i>
7257
Experience: <%= @job.experience.try(:humanize) %>
7358
</li>
74-
7559
<li>
7660
<i class="icon-money"></i>
7761
Salary: <%= @job.salary_to_s %>
7862
</li>
79-
8063
<li>
8164
<i class="icon-chart"></i>
8265
Job has equity or stock options: <%= @job.equity? ? 'Yes' : 'No' %>
8366
</li>
84-
8567
<li>
8668
<i class="icon-plane"></i>
8769
Job is remote or has remote working as an option: <%= @job.remote? ? 'Yes' : 'No' %>
8870
</li>
89-
9071
<% unless @job.apply_email.blank? %>
9172
<li>
9273
<i class="icon-email"></i>
9374
Apply to email: <%= mail_to(@job.apply_email) %>
9475
</li>
9576
<% end %>
9677
</ul>
97-
9878
<hr/>
9979
<div>
10080
<% if @job.description.blank? %>
@@ -108,7 +88,6 @@
10888
</div>
10989
</div>
11090
</div>
111-
11291
<!-- Sidebar
11392
============================================= -->
11493
<% if @job.online? %>
@@ -121,15 +100,13 @@
121100
</div>
122101
</div>
123102
<% end %>
124-
125103
<% if authorised_admin? %>
126104
<div class="sidebar nobottommargin col_last clearfix visible-lg visible-md">
127105
<div class="sidebar-widgets-wrap">
128106
<div class="panel panel-info">
129107
<div class="panel-heading">
130108
<h3 class="panel-title">Dashboard actions</h3>
131109
</div>
132-
133110
<div class="panel-body">
134111
<div class="row">
135112
<!-- Display admin actions -->
@@ -142,7 +119,6 @@
142119
</div>
143120
</div>
144121
<% end %>
145-
146122
<% if (authorised_job_owner?(@job) || authorised_admin?) %>
147123
<div class="sidebar nobottommargin col_last clearfix visible-lg visible-md">
148124
<div class="sidebar-widgets-wrap">
@@ -151,14 +127,12 @@
151127
<h3 class="panel-title">Status</h3>
152128
<small>(Only visible to job owner)</small>
153129
</div>
154-
155130
<div class="panel-body">
156131
<%= job_status(@job) %>
157132
</div>
158133
</div>
159134
</div>
160135
</div>
161-
162136
<div class="sidebar nobottommargin col_last clearfix visible-lg visible-md">
163137
<div class="sidebar-widgets-wrap">
164138
<div class="panel panel-info">
@@ -168,21 +142,36 @@
168142
<br/>
169143
<small>(Only visible to job owner)</small>
170144
</div>
171-
172145
<div class="panel-body">
173-
<% if @job_statistics.size > 0 %>
146+
<% if @job_statistics.size > 0 %>
174147
<ul class="content-margin-left">
175148
<% @job_statistics.each do |job_statistic| %>
176149
<li><%= link_to(visitor_name(job_statistic.user), directory_user_path(job_statistic.user)) %> x <%= job_statistic.counter %> <%= fa_icon("eye") %></li>
177150
<% end %>
178151
</ul>
179152
<% else %>
180-
No views yet
153+
No views yet
181154
<% end %>
182155
</div>
183156
</div>
184157
</div>
185158
</div>
159+
160+
<!-- Section displays job details to share on social media channels -->
161+
<% if (authorised_job_owner?(@job) || authorised_admin?) %>
162+
<div class="sidebar nobottommargin col_last clearfix visible-lg visible-md">
163+
<div class="sidebar-widgets-wrap">
164+
<div class="panel panel-info">
165+
<div class="panel-heading">
166+
<h3 class="panel-title">Share to Social Media text</h3>
167+
</div>
168+
<div class="panel-body">
169+
<%= @job.to_text_for_social_media %>
170+
</div>
171+
</div>
172+
</div>
173+
</div>
174+
<% end %>
186175
<% end %>
187176
<!-- .sidebar end -->
188177
</div>

0 commit comments

Comments
 (0)