created delivery destination model

This commit is contained in:
Senad Uka
2015-02-20 07:33:26 +01:00
parent 47017b6830
commit 53fc9f0b99
10 changed files with 123 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
class DeliveryDestinationsController < ApplicationController
active_scaffold :"delivery_destination" do |conf|
end
end

View File

@@ -0,0 +1,2 @@
module DeliveryDestinationsHelper
end

View File

@@ -0,0 +1,2 @@
class DeliveryDestination < ActiveRecord::Base
end

View File

@@ -1,5 +1,6 @@
Rails.application.routes.draw do
resources :delivery_destinations do as_routes end
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
resources :filter_criteria_values do as_routes end
resources :filter_criteria do as_routes end

View File

@@ -0,0 +1,49 @@
require 'test_helper'
class DeliveryDestinationsControllerTest < ActionController::TestCase
setup do
@delivery_destination = delivery_destinations(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:delivery_destinations)
end
test "should get new" do
get :new
assert_response :success
end
test "should create delivery_destination" do
assert_difference('DeliveryDestination.count') do
post :create, delivery_destination: { address: @delivery_destination.address, email: @delivery_destination.email, name: @delivery_destination.name, note: @delivery_destination.note, phone: @delivery_destination.phone, place: @delivery_destination.place, postal_code: @delivery_destination.postal_code }
end
assert_redirected_to delivery_destination_path(assigns(:delivery_destination))
end
test "should show delivery_destination" do
get :show, id: @delivery_destination
assert_response :success
end
test "should get edit" do
get :edit, id: @delivery_destination
assert_response :success
end
test "should update delivery_destination" do
patch :update, id: @delivery_destination, delivery_destination: { address: @delivery_destination.address, email: @delivery_destination.email, name: @delivery_destination.name, note: @delivery_destination.note, phone: @delivery_destination.phone, place: @delivery_destination.place, postal_code: @delivery_destination.postal_code }
assert_redirected_to delivery_destination_path(assigns(:delivery_destination))
end
test "should destroy delivery_destination" do
assert_difference('DeliveryDestination.count', -1) do
delete :destroy, id: @delivery_destination
end
assert_redirected_to delivery_destinations_path
end
end

View File

@@ -0,0 +1,19 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
address: MyString
place: MyString
postal_code: MyString
phone: MyString
email: MyString
note: MyText
two:
name: MyString
address: MyString
place: MyString
postal_code: MyString
phone: MyString
email: MyString
note: MyText

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class DeliveryDestinationTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@@ -0,0 +1,19 @@
class CreateDeliveryDestinations < ActiveRecord::Migration
def change
create_table :delivery_destinations do |t|
t.string :name
t.string :address
t.string :place
t.string :postal_code
t.string :phone
t.string :email
t.text :note
t.boolean :email_verified
t.boolean :phone_verified
t.string :phone_verification_code
t.string :email_verification_code
t.timestamps null: false
end
end
end

View File

@@ -11,7 +11,8 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150218053655) do
ActiveRecord::Schema.define(version: 20150220062314) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -30,6 +31,22 @@ ActiveRecord::Schema.define(version: 20150218053655) do
t.string "image_url"
end
create_table "delivery_destinations", force: :cascade do |t|
t.string "name"
t.string "address"
t.string "place"
t.string "postal_code"
t.string "phone"
t.string "email"
t.text "note"
t.boolean "email_verified"
t.boolean "phone_verified"
t.string "phone_verification_code"
t.string "email_verification_code"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "filter_criteria", force: :cascade do |t|
t.string "title"
t.string "field_name"

View File

@@ -66,7 +66,7 @@ var CheckoutPage = React.createClass({
<input id="phone" name="phone" className="form-control" placeholder="1 222 333" type="text" required="" />
</div>
<p className="help-block">broj mobitela - mora biti sa jedne od mreža u BiH</p>
</div>
</div>
</div>
@@ -83,7 +83,7 @@ var CheckoutPage = React.createClass({
<label className="col-md-4 control-label" htmlFor="note">Napomena</label>
<div className="col-md-4">
<textarea className="form-control" id="note" name="note"></textarea>
</div>
</div>
</div>
<div className="form-group">