Skip to content
Browse files

Added Flag Job Post and View Count

  • Loading branch information...
1 parent 0d6e18b commit 4a7c4cff0c146c481f4d3dbc3970bfa330f4dfb0 @jcnetdev jcnetdev committed Jun 28, 2008
View
16 app/controllers/jobs_controller.rb
@@ -15,6 +15,7 @@ def index
# GET /jobs/1.xml
def show
@job = Job.find(params[:id])
+ @job.increment!(:view_count)
respond_to do |format|
format.html # show.html.erb
@@ -27,14 +28,25 @@ def apply
@job_applicant = @job.job_applicants.build(params[:job_applicant])
if @job_applicant.save
- # flash[:success] = " Congratulations, your application has been sent! Best of luck to you!"
session[:applied_id] = @job.id
redirect_to job_url(@job)
else
render :action => "show"
end
end
-
+
+ def report_spam
+ @job = Job.find(params[:id])
+
+ if @job.id == session[:reported_id]
+ render :text => "<em>Your vote has already been registered. Thanks for voting.</em>"
+ else
+ @job.increment!(:report_count)
+ session[:reported_id] = @job.id
+ render :text => "Thank you, your vote was registered and is highly appreciated!"
+ end
+ end
+
# GET /jobs/new
# GET /jobs/new.xml
def new
View
18 app/views/jobs/parts/_details.html.haml
@@ -53,3 +53,21 @@
#apply_online_now= link_to "&raquo; Apply now", "#"
#apply_online{hidden_unless(@job_applicant)}
= partial "jobs/parts/apply_form", :job => job, :job_applicant => @job_applicant
+
+ #job_bottom
+ #job_post_utils
+ = link_to "&laquo; go back to the homepage", root_url
+ = br
+ Is this job ad fake?
+ = link_to "Report it!", "#", :onclick => "Jobber.ReportSpam('/jobs/#{job.id}/report_spam/', #{job.id}); return false;"
+ = nbsp*2
+ %span#report_spam_response
+ = br
+ #number_views
+ Published at:
+ %strong= job.created_at.to_s(:post_listing_date)
+ = br
+ Viewed:
+ %strong= pluralize(job.view_count, "time")
+ = clear
+
View
6 app/views/layouts/_footer.html.haml
@@ -6,13 +6,16 @@
= link_to "Post a new job", new_job_url
= br
-
+
= link_to "Site widget", "#widget"
= br
= link_to "RSS Feeds", "#feeds"
= br
+ = link_to "The Ideal Job", new_job_request_url
+ = br
+
.footer-mid
Find out more:
@@ -23,6 +26,7 @@
= link_to "Contact", "#contact"
= br
+
.footer-right
Misc:
View
3 config/routes.rb
@@ -3,7 +3,8 @@
map.resources :jobs, :member => {
:verify => :any,
:apply => :post,
- :confirm => :any
+ :confirm => :any,
+ :report_spam => :post
}
map.resources :job_requests, :collection => {:success => :get}
View
11 db/migrate/20080628140740_add_view_count_to_jobs.rb
@@ -0,0 +1,11 @@
+class AddViewCountToJobs < ActiveRecord::Migration
+ def self.up
+ add_column :jobs, :view_count, :integer, :default => 0
+ add_column :jobs, :report_count, :integer, :default => 0
+ end
+
+ def self.down
+ remove_column :jobs, :view_count
+ remove_column :jobs, :report_count
+ end
+end
View
4 db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20080628140339) do
+ActiveRecord::Schema.define(:version => 20080628140740) do
create_table "categories", :force => true do |t|
t.string "name"
@@ -92,6 +92,8 @@
t.text "description_html"
t.string "formatting_type"
t.integer "job_applicants_count", :limit => 11, :default => 0
+ t.integer "view_count", :limit => 11, :default => 0
+ t.integer "report_count", :limit => 11, :default => 0
end
create_table "locations", :force => true do |t|
View
14 public/javascripts/common/jobber.js
@@ -88,18 +88,8 @@
url: url,
data: "job_id=" + job_id,
success: function(msg) {
- if (msg == "0")
- {
- var status = "Thank you for your intention, but your vote could not be registered.";
- $("#report-spam-response").css({ color: "red" });
- }
- else
- {
- var status = "Thank you, your vote was registered and is highly appreciated!";
- $("#frm-send-to-friend").clearForm();
- $("#report-spam-response").css({ color: "green" });
- }
- $("#report-spam-response").html(status);
+ $("#report_spam_response").html(msg);
+ $("#report_spam_response").css({ color: "green" });
}
});
},
View
13 public/stylesheets/styles.css
@@ -377,27 +377,32 @@ table/job-posts td.time-posted img, table/job-posts td.applicants img {
list-style-type: disc;
}
-#job-bottom {
+#job_bottom {
background-color: #f0f0f0;
- padding: 2px;
+ padding:15px 8px 0px;
font-size: 14px;
height: 50px;
}
-#number-views {
+#number_views {
float: right;
display: inline;
font-size: 11px;
color: #777;
}
-#job-post-utils {
+#job_post_utils {
float: left;
display: inline;
font-size: 11px;
color: #888;
}
+#job_post_utils #report_spam_response em{
+ font-style: normal;
+ color: orange;
+}
+
#apply_online_now {
font-size: 14px;
margin-bottom: 7px;

0 comments on commit 4a7c4cf

Please sign in to comment.
Something went wrong with that request. Please try again.