Permalink
Browse files

Rearranging project to use Gem Plugins

  • Loading branch information...
1 parent 2d7552f commit 9f3b8a711ea5f355356faad0d4f18e580bfd9585 @jcnetdev jcnetdev committed Jul 12, 2008
Showing 1,564 changed files with 346 additions and 190,804 deletions.
View
2 README
@@ -32,7 +32,7 @@ http://jobberrails.crowdsound.com/widgets/content?aid=234
1) Set up Database (database.yml)
-2) Run rake db:create db:migrate db:seed
+2) Run rake gems:install db:create db:schema:load db:migrate
3) Start server
@@ -29,7 +29,7 @@ def apply
@job_applicant = @job.job_applicants.build(params[:job_applicant])
if @job_applicant.save
session[:applied_id] = @job.id
- Notifier::deliver_somebodyapplied(@job.poster_email,@job_applicant.name, @job_applicant.message, @job_applicant.filename, @job_applicant.id)
+ Notifier.deliver_somebody_applied(@job.poster_email,@job_applicant.name, @job_applicant.message, @job_applicant.filename, @job_applicant.id)
redirect_to job_url(@job)
else
render :action => "show"
@@ -100,7 +100,7 @@ def create
flash[:notice] = 'Job was successfully created.'
format.html { redirect_to verify_job_url(@job) }
format.xml { render :xml => @job, :status => :created, :location => @job }
- Notifier::deliver_jobposted(@job.poster_email,@job.company)
+ Notifier.deliver_job_posted(@job.poster_email,@job.company)
else
format.html { render :action => "new" }
@@ -26,4 +26,29 @@ def error_message_for(record, attribute, error_msg = nil)
def display_notice
page.insert_html :after, 'footer', :partial => 'layouts/admin_flash_boxes'
end
+
+ # Additional View Helpers
+
+ def bull
+ "<li>&bull;</li>"
+ end
+
+ def nbsp
+ "&nbsp;"
+ end
+
+ def add_class_if(condition, css_class)
+ if condition
+ {:class => css_class}
+ else
+ {}
+ end
+ end
+
+
+ def link_to_image(image_path, label, url, options={})
+ link_to(image_tag(image_path, :class => "vert-middle"), url, options) +
+ nbsp +
+ link_to(label, url, options)
+ end
end
View
@@ -1,90 +0,0 @@
-module TagHelper
- def br
- "<br />"
- end
-
- def hr
- "<hr />"
- end
-
- def nbsp
- "&nbsp;"
- end
-
- def space
- "<hr class='space' />"
- end
-
- def anchor(anchor_name)
- "<a name='#{anchor_name}'></a>"
- end
-
- def clear(direction = nil)
- clear_tag(:div, direction)
- end
-
- def clear_tag(tag, direction = nil)
- "<#{tag} class=\"clear#{direction}\"></#{tag}>"
- end
-
- def bull
- "<li>&bull;</li>"
- end
-
- def lorem
- "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
- end
-
- def hidden
- {:style => "display:none"}
- end
-
- def hidden_if(condition)
- if condition
- {:style => "display:none"}
- else
- {}
- end
- end
-
- def hidden_unless(condition)
- unless condition
- {:style => "display:none"}
- else
- {}
- end
- end
-
- def add_class_if(condition, css_class)
- if condition
- {:class => css_class}
- else
- {}
- end
- end
-
- def clearbit_icon(icon, color, options = {})
- image_tag "clearbits/#{icon}.gif", {:class => "clearbits #{color}", :alt => icon}.merge(options)
- end
-
- def delete_link(*args)
- options = {:method => :delete, :confirm => "Are you sure you want to delete this?"}.merge(args.extract_options!)
- args << options
- link_to *args
- end
-
- def link_to_block(*args, &block)
- content = capture_haml(&block)
- return link_to(content, *args)
- end
-
- def link_to_image(image_path, label, url, options={})
- link_to(image_tag(image_path, :class => "vert-middle"), url, options)+
- "&nbsp;"+
- link_to(label, url, options)
- end
-
- def current_year
- Time.now.strftime("%Y")
- end
-end
View
@@ -22,7 +22,7 @@ class Job < ActiveRecord::Base
validates_presence_of :company
validates_presence_of :poster_email
- validates_email_format_of :poster_email
+ validates_as_email_address :poster_email
before_save :format_fields
@@ -4,13 +4,10 @@ class JobApplicant < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :email
- validates_email_format_of :email
+ validates_as_email_address :email, :allow_blank => true
+
+ has_attached_file :resume
- # allow attachments
- has_attachment :storage => :file_system,
- # :storage => :s3,
- :path_prefix => "public/attachments"
-
def self.new_default(init_values = {})
self.new(init_values)
end
View
@@ -3,5 +3,5 @@ class JobHunter < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :email
- validates_email_format_of :email
+ validates_as_email_address :email, :allow_blank => true
end
View
@@ -1,27 +1,27 @@
class Notifier < ActionMailer::Base
- def jobposted(recipient, company, sent_at = Time.now)
- subject 'thanks for posting'
+ def job_posted(recipient, company, sent_at = Time.now)
+ subject "#{AppConfig.site_name} - Thanks for Posting"
recipients recipient
- from 'jobs@'
+ from AppConfig.from_email
sent_on sent_at
content_type "multipart/alternative"
part :content_type => "text/plain",
- :body => render_message("jobposted", :company => company)
+ :body => render_message("job_posted", :company => company)
end
- def somebodyapplied(recipient, name, message, filename, id, sent_at = Time.now)
- subject 'somebody applied'
+ def somebody_applied(recipient, name, message, filename, id, sent_at = Time.now)
+ subject "#{AppConfig.site_name} - New Job Applicant"
recipients recipient
- from 'jobs@'
+ from AppConfig.from_email
sent_on sent_at
content_type "multipart/alternative"
part :content_type => "text/plain",
- :body => render_message("somebodyapplied", :name => name, :message => message, :filename => filename, :id => id)
+ :body => render_message("somebody_applied", :name => name, :message => message, :filename => filename, :id => id)
end
@@ -51,7 +51,7 @@
-# show job apply form
- if !confirm and job.apply_online?
#apply_online_now= link_to "&raquo; Apply now", "#"
- #apply_online{hidden_unless(@job_applicant)}
+ #apply_online{hide_unless(@job_applicant)}
= partial "jobs/parts/apply_form", :job => job, :job_applicant => @job_applicant
#job_bottom
@@ -26,7 +26,7 @@
%td
= f.select :location_id, Location.to_select, :disabled => !@job.outside_location.blank?, :include_blank => "-- Anywhere --"
= link_to @job.location_switch_label, "#", :id => "other_location_label", :onclick => "Jobber.HandleLocationOutside(); return false;"
- #outside_location{hidden_if(@job.outside_location.blank?)}
+ #outside_location{hide_if(@job.outside_location.blank?)}
where ?
= f.text_field :outside_location, :size => 50, :maxlength => 140
.suggestion
View
@@ -0,0 +1,6 @@
+site_name: jobberRails
+site_url: http://www.jobberrails.com
+from_email: jobberRails<jobberrails@gmail.com>
+require_email_activation: false
+
+search_suggestions: '(e.g. "ajax", "designer, london", "php, chicago")'
View
@@ -10,7 +10,7 @@
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
-require 'plugins/app_config/lib/configuration'
+require 'github_gem'
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
@@ -30,7 +30,7 @@
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
- config.plugins = [ :exception_notification, :all ]
+ # config.plugins = [ :exception_notification, :all ]
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
@@ -68,14 +68,78 @@
# Gem Requirements
config.gem "haml", :version => ">= 2.0.0"
- config.gem "will_paginate", :version => ">= 2.2.2"
- # Configuration Settings
- config.app_config.site_name = "jobberRails"
- config.app_config.site_url = "http://www.jobberrails.com"
- config.app_config.from_email = "jobberRails<jobberrails@gmail.com>"
- config.app_config.require_email_activation = false
-
- config.app_config.search_suggestions = '(e.g. "ajax", "designer, london", "php, chicago")'
+ # exception_notification
+ # ------
+ # Allows unhandled exceptions to be emailed on production
+ # ------
+ config.github_gem 'jcnetdev-exception_notification', :version => '>= 1.1'
+
+ # acts_as_list
+ # ------
+ # Allows ActiveRecord Models to be easily ordered via position attributes
+ # ------
+ config.github_gem 'jcnetdev-acts_as_list', :version => '>= 1.0'
+
+ # app_config
+ # ------
+ # Allow application wide configuration settings via YML files
+ # ------
+ config.github_gem 'jcnetdev-app_config', :version => '>= 1.0'
+
+ # auto_migrations
+ # ------
+ # Allows migrations to be run automatically based on updating the schema.rb
+ # ------
+ config.github_gem 'jcnetdev-auto_migrations', :version => '>= 1.2'
+
+ # better_partials
+ # ------
+ # Adds a helper (partial) that wraps around render :partial. Pass local variables and blocks to your partials easily
+ # ------
+ config.github_gem 'jcnetdev-better_partials', :version => '>= 1.0'
+
+ # form_fu
+ # ------
+ # Allows easier rails form creation and processing
+ # ------
+ config.github_gem 'neorails-form_fu', :version => '>= 0.51'
+
+ # paperclip
+ # ------
+ # Allows easy uploading of files
+ # ------
+ config.github_gem 'jcnetdev-paperclip', :version => '>= 1.0'
+
+ # seed-fu
+ # ------
+ # Allows easier database seeding of tables
+ # ------
+ config.github_gem 'jcnetdev-seed-fu', :version => '>= 1.0'
+
+ # subdomain-fu
+ # ------
+ # Allows easier subdomain selection
+ # ------
+ # config.github_gem 'jcnetdev-subdomain-fu', :version => '>= 0.0.2'
+
+ # validates_as_email_address
+ # ------
+ # Allows for easy format validation of email addresses
+ # ------
+ config.github_gem 'jcnetdev-validates_as_email_address', :version => '>= 1.0'
+
+ # will_paginate
+ # ------
+ # Allows nice and easy pagination
+ # ------
+ config.github_gem 'jcnetdev-will_paginate', :version => '>= 2.3.2'
+
+ # view_fu
+ # ------
+ # Adds view helpers for titles, stylesheets, javascripts, and common tags
+ # ------
+ config.github_gem 'neorails-view_fu', :version => '>= 0.3'
+
end
@@ -0,0 +1 @@
+site_url: http://127.0.0.1:3000
@@ -0,0 +1 @@
+Haml.init_rails(binding)
@@ -1,13 +0,0 @@
-class CreateJobTypes < ActiveRecord::Migration
- def self.up
- create_table :job_types, :force => true do |t|
- t.string :name
- t.string :value
- t.timestamps
- end
- end
-
- def self.down
- drop_table :job_types
- end
-end
@@ -1,14 +0,0 @@
-class CreateCategories < ActiveRecord::Migration
- def self.up
- create_table :categories, :force => true do |t|
- t.string :name
- t.string :value
- t.integer :position, :default => 0
- t.timestamps
- end
- end
-
- def self.down
- drop_table :categories
- end
-end
Oops, something went wrong.

0 comments on commit 9f3b8a7

Please sign in to comment.