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

Commit 9f3d1d2

Browse files
Improve job content and update content margin
1 parent 4f2aa6d commit 9f3d1d2

File tree

11 files changed

+140
-165
lines changed

11 files changed

+140
-165
lines changed

app/helpers/jobs_helper.rb

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ def job_creator_name(job)
88
end
99

1010
def posted_date(job, in_words = false)
11-
posted_date_str = "Not online yet"
11+
posted_date_str = ""
1212

1313
if job.approved?
1414
if in_words
1515
posted_date_str = time_ago_in_words(job.posted_on)
1616
elsif !job.posted_on.blank?
17-
posted_date_str = job.posted_on.strftime('%A %e %B %Y ')
17+
posted_date_str = job.posted_on.strftime('%b %e %Y ')
1818
end
1919
end
2020

@@ -26,9 +26,7 @@ def location_str(job)
2626
lc_str = "[remote]"
2727
end
2828

29-
if !job.country.blank? && job.remote?
30-
lc_str = " - " + job.location_name + " [remote]"
31-
elsif !job.country.blank? && !job.remote?
29+
if !job.country.blank?
3230
lc_str = " - " + job.location_name
3331
end
3432

@@ -49,13 +47,38 @@ def job_status(job)
4947
status += 'has expired'
5048
alert_class = 'alert alert-danger text-center'
5149
else
52-
status += 'is ' + job.aasm_state.to_s.humanize(capitalize: false)
50+
status += 'is ' + job.aasm.human_state
5351
alert_class = 'alert alert-warning text-center'
5452
end
5553

5654
return content_tag(:div, status, class: alert_class, role: 'alert')
5755
end
5856

57+
def show_job_status(job)
58+
job_status = ""
59+
selected = false
60+
61+
Job.aasm.states.map(&:display_name).each do |custom_state_name|
62+
css_class = ""
63+
64+
if job.aasm.human_state == custom_state_name
65+
css_class = "is-active"
66+
selected = true
67+
elsif selected == false
68+
css_class = "is-complete"
69+
end
70+
71+
job_status += content_tag(:li, class: css_class) do
72+
content_tag(:span) do
73+
custom_state_name
74+
# job.aasm.human_state
75+
end
76+
end
77+
end
78+
79+
return job_status
80+
end
81+
5982
def visitor_name(user)
6083
if user.profile.complete?
6184
user.name

app/models/job.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class Job < ApplicationRecord
4040

4141
aasm do
4242
state :draft, :initial => true
43-
state :under_review
44-
state :approved
45-
state :edited
46-
state :disabled
43+
state :under_review, display: "Pending Approval"
44+
state :approved, display: "Published"
45+
state :edited, display: "Modified"
46+
state :disabled, display: "Expired"
4747

4848
event :request_edit do
4949
transitions :from => [:under_review, :edited, :approved, :disabled], :to => :draft
@@ -201,10 +201,20 @@ def self.remove_expired_jobs
201201
end
202202
end
203203

204+
# Generic formatter to share on social media
204205
def to_text_for_social_media
205206
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 += " in #{self.location_name}" unless self.location_name.blank?
207208
text += ". More information here https://#{AppSettings.application_host}/jobs/#{self.to_param}"
209+
return text
210+
end
211+
212+
def to_text_for_twitter
213+
text = "text=#{self.company_name.titleize} is looking to hire a #{self.title}"
214+
text += " in #{self.location_name}" unless self.location_name.blank?
215+
text += ". More information here"
216+
text += "&url=https://#{AppSettings.application_host}/jobs/#{self.to_param}"
217+
text += "&hashtags=#{self.location_name}"
208218
if !self.twitter_handle.blank?
209219
if self.twitter_handle.start_with?('@')
210220
text += (" " + self.twitter_handle)

app/views/devise/registrations/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div class="content-wrap">
1717

18-
<div class="container clearfix">
18+
<div class="container clearfix add-content-margin">
1919

2020
<div class="col-md-3"></div>
2121
<div class="col-sm-12 col-md-6">

app/views/devise/sessions/new.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<section id="page-title">
44

55
<div class="container clearfix center">
6-
<h1>Use ONE of the login options below to login</h1>
6+
<h1>Use any of the login options below to login</h1>
77
</div>
88

99
</section>
@@ -13,12 +13,12 @@
1313
============================================= -->
1414
<section id="content">
1515
<div class="content-wrap">
16-
<div class="container clearfix">
16+
<div class="container clearfix add-content-margin">
1717

1818
<div class="col-sm-12 col-md-6">
1919
<div class="panel panel-default">
2020
<div class="panel-body" style="padding: 40px; background-color: #FAFFEC;">
21-
<h3>MENAdevs Slack credentials</h3>
21+
<h3>Login with MENAdevs Slack credentials</h3>
2222

2323
<div class="col_full">
2424
<div class="well well-sm">
@@ -36,7 +36,7 @@
3636
<div class="col-sm-12 col-md-6">
3737
<div class="panel panel-default">
3838
<div class="panel-body" style="padding: 40px; background-color: #E5FEDF;">
39-
<h3>Personal email and password</h3>
39+
<h3>Login with your email and password</h3>
4040

4141
<div class="col_full">
4242
<%= render "form" %>

app/views/home/contact.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div class="content-wrap">
1717

18-
<div class="container clearfix">
18+
<div class="container clearfix add-content-margin">
1919

2020
<!-- Single Post
2121
============================================= -->

app/views/invitations/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<div class="content-wrap">
2424

25-
<div class="container clearfix content-padding-bottom">
25+
<div class="container clearfix content-padding-bottom add-content-margin">
2626

2727
<div class="row clearfix">
2828
<div class="col-lg-12 col-md-12 col-sm-6">
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<% if job.under_review? %>
2-
<%= link_to("Approve", approve_job_path(job), class: "button button-3d notopmargin fright button-green", method: 'put') %>
2+
<div class="button-container">
3+
<%= link_to("Approve", approve_job_path(job), class: "button button-3d button-small button-green", method: 'put') %>
4+
</div>
5+
<div class="button-container">
6+
<%= link_to("Reject", approve_job_path(job), class: "button button-3d button-small button-red", method: 'put') %>
7+
</div>
38
<% elsif job.online? %>
4-
<%= link_to("Take down", take_down_job_path(job), class: "button button-3d notopmargin fright button-red", method: 'put') %>
9+
<div class="button-container">
10+
<%= link_to("Take down", take_down_job_path(job), class: "button button-3d button-small button-red", method: 'put') %>
11+
</div>
12+
<% else %>
13+
There are no actions at the current time
514
<% end %>

app/views/jobs/_form.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@
102102
</div>
103103

104104
<div class="row job-form-buttons">
105-
<div class="col-md-12">
105+
<div class="col-md-9">
106+
<%= link_to "Cancel", :back, class: "button button-3d button button-rounded button-default pull-right" %>
107+
</div>
108+
109+
<div class="col-md-3">
106110
<%= f.submit "Save and continue", class: "button button-3d button button-rounded button-green pull-right" %>
107111
</div> <!-- /.col-md-12 -->
108112
</div> <!-- /.job-form-buttons -->
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<% if job.offline? %>
2-
<%= link_to("Delete", job_path(job), class: "button button-3d notopmargin button-red fright", method: 'delete') %>
3-
<%= link_to("Edit", edit_job_path(job), class: "button button-3d notopmargin button-blue fright") %>
2+
<div style="width:100%;height:40px;margin:auto;">
3+
<%= link_to("Edit", edit_job_path(job), class: "button button-small button-3d button-blue") %>
4+
</div>
45

5-
<% if @job.draft? %>
6-
<br/>
7-
<%= link_to("Submit for approval", pre_approve_job_path(job), class: "button button-3d notopmargin fright button-green", method: 'put') %>
8-
<% end %>
6+
<div style="width:100%;height:40px;margin:auto;">
7+
<%= link_to("Delete", job_path(job), class: "button button-small button-3d button-red", method: 'delete', data: { confirm: "Are you sure that you want to delete this job?" }) %>
8+
</div>
99
<% elsif job.online? %>
10-
<%= link_to("Edit", edit_job_path(job), class: "button button-3d notopmargin button-blue fright") %>
10+
<div style="width:100%;height:40px;margin:auto;">
11+
<%= link_to("Edit", edit_job_path(job), class: "button button-small button-3d button-blue") %>
12+
</div>
1113
<% end %>

app/views/jobs/feedback.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<%= render("shared/flash") %>
1515

16-
<section id="content" style="margin-bottom: 0px;">
16+
<section id="content">
1717

1818
<div class="content-wrap">
1919
<% if (user_signed_in? && current_user.id == @job.user_id) %>

0 commit comments

Comments
 (0)