Free Clone Craigslist Program Apartments
Posted : admin On 25.08.2019
- Craigslist Search Program
- Free Clone Craigslist Program Apartments Los Angeles
- Free Craigslist Software
Best craigslist clone script for high traffic? Bad experiences so far. But if there is a craigslist clone script available with advanced features so my members. Trey songz free music downloads.
Features
- Image upload: paperclip (gem)
- Image upload requires ImageMagick
- Google Maps API: with the geocoder (gem)
- Figaro: for hiding API key (and other sensitive data)
Models
- User
- password
- Post
- title
- cost
- body
- image
- address
- latitude
- longitude
- user_id
Day 1 Image Upload
rails new craigslist-clonecd craigslist-clonegit init(add and commit)- Setup User authentication with Devise
- Add paperclip to Gemfile and
bundle install - Generate Post model
rails g model Post title cost:decimal body:textrails g paperclip post imagerake db:migrate
- Add paperclip code for image to Post model
- Generate posts_controller
rails g controller Posts index new show edit
- Add post routes to
config/routes.rbusing the resources heler and remove default generated routesresources :posts
- Add simple_form to Gemfile
rails g simple_form:install --bootstrap
- Add new form for Post
Add
post_paramsandcreateaction to posts_controllerInstall ImageMagick
- mac -
brew install imagemagick - c9
sudo apt-get updatesudo apt-get install imagemagick -y
- mac -
Fire up your app and navigate to
localhost:3000/posts/new, create a new postEdit your
posts_controllershowaction andposts/show.html.erbview to display the Post info- use
number_to_currencyandimage_tagto render the cost and the image
- use
To do items:
- Complete full CRUD for Posts
- Associate User and Post (one:many)
- Add post validations and error rendering
- Add authorization to stop malicious editing or deleting of posts
See c9 workspace for source code (navigate to: tts-dal/rails/day_17_craigslist_clone_part_1/craigslist-clone)
Day 2 Google Maps
- Add figaro gem to Gemfile
gem 'figaro'- Run
bundle - Run
bundle exec figaro install
- Create a new project in Google Maps API and get a key
- Open
config/application.ymland add your key as an environment (ENV) variablemaps_api_key: <your_key_here>- open
application.html.erband add the following script to the bottom of the head element:
- Add a div to render the map onto your
posts/show.html.erbview:
- Open
assets/stylesheets/posts.scss, rename the file to beposts.cssand add the following CSS:
- Open
assets/javascripts/posts.coffee, rename the file to beposts.jsand add the following code:
- Now we need to give our Post model an address property and connect it to the map
- Generate a new migration for the posts table:
rails g migration AddCoordinatesToPosts latitude:float longitude:float address:stringthen runrake db:migrate - Now add the address property to our
posts/new.html.erbform:
- Whitelist the new properties in your posts controller:
Craigslist Search Program
- Now add the geocoder gem:
- Add
gem geocodertoGemfileand runbundle
- Add
- Add the following code to your Post model (
models/post.rb), right after the paperclip code that we added earlier:
- To render the address and marker onto the map we'll need to set the JavaScript variables using Rail's javascript_tag, add the following code to the bottom of
posts/show.erb
Free Clone Craigslist Program Apartments Los Angeles
- I went ahead and included the title, cost, and address so we could render them onto the marker as an info window
- Update your
assets/javascripts/posts.jsfile with the following:
- Update your
- Open up
rails consoleand delete all pre-exisiting posts withPost.destroy_allnow close rails console, run yourrails serverand create a new post.
DISABLE TURBOLINKS
Do you have to refresh the page several times for the map to load? This is because of turbolinks. Turbolinks is rails gem that conflicts with our javascript.Funny, because its intended purpose is to load pages faster. Let's kill it.
- Remove the gem 'turbolinks' line from your Gemfile.
- Remove the //= require turbolinks from your app/assets/javascripts/application.js.
- Remove the two 'data-turbolinks-track' => true hash key/value pairs from yourapp/views/layouts/application.html.erb.
Day 3 Post Search
- Open up your
application.html.erbfile and modify the navbar. In the following code we are removing the html form and adding in a rails form with ERB syntax:
- Open up the
posts_controller.rbfile and replace the index action with the following code:
Free Craigslist Software
- .search is not a regular class method for the Post model, so we'll have to create it ourselves, open up your post model
models/post.rband add the following code to the bottom of your model before the closingendkeyword:
Fire up your server and check it out, you should now have the ability to search for any existing posts using keywords from their titles
Discuss SQL Injection Security Exploit

Day 4 Styling
- Install the twitter-bootstrap-rails gem
- download a free theme from startbootstrap.com (we used clean blog)
- unzip the theme
- copy and paste images dir into public
- copy and paste the minified css theme into vendor/assets/stylesheets - require in application.css (e.g. require clean-blog.min)
- copy and paste the minified js file into vendor/assets/javascripts - require in application.js
- open index.html, find any google fonts, copy and paste their - import codes from fonts.google.com into application.css using @import url()
- open index.html and copy over the navbar and header areas, be sure to replace the appropriate elements with your pre-existing rails content