Free Clone Craigslist Program Apartments

27.07.2019by admin
  1. Free Craigslist Software
  2. Craigslist Search Program
  3. Free Clone Craigslist Program Apartments In Los Angeles

Craigslist Clone and Backpage Clone Solutions and Cross-Integrations with CMS and e-Shops Custom classifieds: adult, general and specific topics. The Real Life Projects, Samples of Custom Work. Most successful customers' projects. Seattle apts/housing for rent - craigslist. Favorite this post Aug 30 ☆ Apartments In the heart of Tacoma, Dishwasher. Favorite this post Aug 30 $300 OFF☺ Apartments in Tacoma, Free Coffee Bar, On-Site Management $1205 1br - 585ft 2. Provides local classifieds and forums for asbestos, personal injury, DUI attorneys, housing, personals, services, local community, and events Craigslist Clone 100% flexible product!

Features

Free Craigslist Software

  • 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
    • email
    • password
  • Post
    • title
    • cost
    • body
    • image
    • address
    • latitude
    • longitude
    • user_id

Day 1 Image Upload

  • rails new craigslist-clone
  • cd craigslist-clone
  • git 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:text
    • rails g paperclip post image
    • rake 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.rb using the resources heler and remove default generated routes
    • resources :posts
  • Add simple_form to Gemfile
    • rails g simple_form:install --bootstrap
  • Add new form for Post
  • Add post_params and create action to posts_controller

  • Install ImageMagick

    • mac - brew install imagemagick
    • c9
      • sudo apt-get update
      • sudo apt-get install imagemagick -y
  • Fire up your app and navigate to localhost:3000/posts/new, create a new post

  • Edit your posts_controllershow action and posts/show.html.erb view to display the Post info

    • use number_to_currency and image_tag to render the cost and the image

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) 29r7077 drivers download.

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.yml and add your key as an environment (ENV) variable
    • maps_api_key: <your_key_here>
    • open application.html.erb and add the following script to the bottom of the head element:
  • Add a div to render the map onto your posts/show.html.erb view:
  • Open assets/stylesheets/posts.scss, rename the file to be posts.css and add the following CSS:
  • Open assets/javascripts/posts.coffee, rename the file to be posts.js and 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:string then run rake db:migrate
  • Now add the address property to our posts/new.html.erb form:
  • Whitelist the new properties in your posts controller:
  • Now add the geocoder gem:
    • Add gem geocoder to Gemfile and run bundle
  • Add the following code to your Post model (models/post.rb), right after the paperclip code that we added earlier:
Free Clone Craigslist Program Apartments

Craigslist Search Program

  • 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 In 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.js file with the following:
  • Open up rails console and delete all pre-exisiting posts with Post.destroy_all now close rails console, run your rails server and 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.erb file 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.rb file and replace the index action with the following code:
  • .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.rb and add the following code to the bottom of your model before the closing end keyword:
  • 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