Merge branch 'master' of https://github.com/senaduka/ribica
This commit is contained in:
4
back-office/app/controllers/item_groups_controller.rb
Normal file
4
back-office/app/controllers/item_groups_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class ItemGroupsController < ApplicationController
|
||||||
|
active_scaffold :"item_group" do |conf|
|
||||||
|
end
|
||||||
|
end
|
||||||
4
back-office/app/controllers/link_banners_controller.rb
Normal file
4
back-office/app/controllers/link_banners_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class LinkBannersController < ApplicationController
|
||||||
|
active_scaffold :"link_banner" do |conf|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
class SpecialOffersController < ApplicationController
|
|
||||||
active_scaffold :"special_offer" do |conf|
|
|
||||||
end
|
|
||||||
end
|
|
||||||
2
back-office/app/helpers/item_groups_helper.rb
Normal file
2
back-office/app/helpers/item_groups_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module ItemGroupsHelper
|
||||||
|
end
|
||||||
2
back-office/app/helpers/link_banners_helper.rb
Normal file
2
back-office/app/helpers/link_banners_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module LinkBannersHelper
|
||||||
|
end
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module SpecialOffersHelper
|
|
||||||
end
|
|
||||||
@@ -3,7 +3,7 @@ class Item < ActiveRecord::Base
|
|||||||
has_many :multi_media_descriptions
|
has_many :multi_media_descriptions
|
||||||
belongs_to :sub_category
|
belongs_to :sub_category
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
belongs_to :special_offer
|
has_and_belongs_to_many :item_groups, :join_table => 'item_item_groups'
|
||||||
|
|
||||||
validates_presence_of :name, :description, :list_price, :current_input_price, :tags, :unit_id, :code, :sub_category_id, :weight, :supplier_id
|
validates_presence_of :name, :description, :list_price, :current_input_price, :tags, :unit_id, :code, :sub_category_id, :weight, :supplier_id
|
||||||
|
|
||||||
|
|||||||
4
back-office/app/models/item_group.rb
Normal file
4
back-office/app/models/item_group.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class ItemGroup < ActiveRecord::Base
|
||||||
|
has_and_belongs_to_many :items, :join_table => 'item_item_groups'
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class SpecialOffer < ActiveRecord::Base
|
class LinkBanner < ActiveRecord::Base
|
||||||
belongs_to :item
|
|
||||||
belongs_to :category
|
belongs_to :category
|
||||||
belongs_to :section
|
belongs_to :section
|
||||||
belongs_to :sub_category
|
belongs_to :sub_category
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
resources :item_groups do as_routes end
|
||||||
|
resources :link_banners do as_routes end
|
||||||
resources :delivery_time_estimations do as_routes end
|
resources :delivery_time_estimations do as_routes end
|
||||||
resources :special_offers do as_routes end
|
|
||||||
resources :suppliers do as_routes end
|
resources :suppliers do as_routes end
|
||||||
resources :places do as_routes end
|
resources :places do as_routes end
|
||||||
resources :delivery_destinations do as_routes end
|
resources :delivery_destinations do as_routes end
|
||||||
|
|||||||
49
back-office/test/controllers/item_groups_controller_test.rb
Normal file
49
back-office/test/controllers/item_groups_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ItemGroupsControllerTest < ActionController::TestCase
|
||||||
|
setup do
|
||||||
|
@item_group = item_groups(:one)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get index" do
|
||||||
|
get :index
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil assigns(:item_groups)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get new" do
|
||||||
|
get :new
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create item_group" do
|
||||||
|
assert_difference('ItemGroup.count') do
|
||||||
|
post :create, item_group: { description: @item_group.description, name: @item_group.name, visible: @item_group.visible }
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to item_group_path(assigns(:item_group))
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should show item_group" do
|
||||||
|
get :show, id: @item_group
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get edit" do
|
||||||
|
get :edit, id: @item_group
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update item_group" do
|
||||||
|
patch :update, id: @item_group, item_group: { description: @item_group.description, name: @item_group.name, visible: @item_group.visible }
|
||||||
|
assert_redirected_to item_group_path(assigns(:item_group))
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy item_group" do
|
||||||
|
assert_difference('ItemGroup.count', -1) do
|
||||||
|
delete :destroy, id: @item_group
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to item_groups_path
|
||||||
|
end
|
||||||
|
end
|
||||||
49
back-office/test/controllers/link_banners_controller_test.rb
Normal file
49
back-office/test/controllers/link_banners_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class LinkBannersControllerTest < ActionController::TestCase
|
||||||
|
setup do
|
||||||
|
@link_banner = link_banners(:one)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get index" do
|
||||||
|
get :index
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil assigns(:link_banners)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get new" do
|
||||||
|
get :new
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create link_banner" do
|
||||||
|
assert_difference('LinkBanner.count') do
|
||||||
|
post :create, link_banner: { beginning: @link_banner.beginning, category_id: @link_banner.category_id, checkout_page: @link_banner.checkout_page, ending: @link_banner.ending, footer: @link_banner.footer, header: @link_banner.header, image_url: @link_banner.image_url, item_id: @link_banner.item_id, link_url: @link_banner.link_url, search_result_page: @link_banner.search_result_page, section_id: @link_banner.section_id, start_page: @link_banner.start_page, sub_category_id: @link_banner.sub_category_id, thank_you_page: @link_banner.thank_you_page }
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to link_banner_path(assigns(:link_banner))
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should show link_banner" do
|
||||||
|
get :show, id: @link_banner
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get edit" do
|
||||||
|
get :edit, id: @link_banner
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update link_banner" do
|
||||||
|
patch :update, id: @link_banner, link_banner: { beginning: @link_banner.beginning, category_id: @link_banner.category_id, checkout_page: @link_banner.checkout_page, ending: @link_banner.ending, footer: @link_banner.footer, header: @link_banner.header, image_url: @link_banner.image_url, item_id: @link_banner.item_id, link_url: @link_banner.link_url, search_result_page: @link_banner.search_result_page, section_id: @link_banner.section_id, start_page: @link_banner.start_page, sub_category_id: @link_banner.sub_category_id, thank_you_page: @link_banner.thank_you_page }
|
||||||
|
assert_redirected_to link_banner_path(assigns(:link_banner))
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy link_banner" do
|
||||||
|
assert_difference('LinkBanner.count', -1) do
|
||||||
|
delete :destroy, id: @link_banner
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to link_banners_path
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
require 'test_helper'
|
|
||||||
|
|
||||||
class SpecialOffersControllerTest < ActionController::TestCase
|
|
||||||
setup do
|
|
||||||
@special_offer = special_offers(:one)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should get index" do
|
|
||||||
get :index
|
|
||||||
assert_response :success
|
|
||||||
assert_not_nil assigns(:special_offers)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should get new" do
|
|
||||||
get :new
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should create special_offer" do
|
|
||||||
assert_difference('SpecialOffer.count') do
|
|
||||||
post :create, special_offer: { beginning: @special_offer.beginning, category_id: @special_offer.category_id, checkout_page: @special_offer.checkout_page, ending: @special_offer.ending, image_url: @special_offer.image_url, item_id: @special_offer.item_id, search_result_page: @special_offer.search_result_page, section_id: @special_offer.section_id, start_page: @special_offer.start_page, sub_category_id: @special_offer.sub_category_id, thank_you_page: @special_offer.thank_you_page }
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_redirected_to special_offer_path(assigns(:special_offer))
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should show special_offer" do
|
|
||||||
get :show, id: @special_offer
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should get edit" do
|
|
||||||
get :edit, id: @special_offer
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should update special_offer" do
|
|
||||||
patch :update, id: @special_offer, special_offer: { beginning: @special_offer.beginning, category_id: @special_offer.category_id, checkout_page: @special_offer.checkout_page, ending: @special_offer.ending, image_url: @special_offer.image_url, item_id: @special_offer.item_id, search_result_page: @special_offer.search_result_page, section_id: @special_offer.section_id, start_page: @special_offer.start_page, sub_category_id: @special_offer.sub_category_id, thank_you_page: @special_offer.thank_you_page }
|
|
||||||
assert_redirected_to special_offer_path(assigns(:special_offer))
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should destroy special_offer" do
|
|
||||||
assert_difference('SpecialOffer.count', -1) do
|
|
||||||
delete :destroy, id: @special_offer
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_redirected_to special_offers_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
11
back-office/test/fixtures/item_groups.yml
vendored
Normal file
11
back-office/test/fixtures/item_groups.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
|
visible: false
|
||||||
@@ -10,8 +10,11 @@ one:
|
|||||||
thank_you_page: false
|
thank_you_page: false
|
||||||
search_result_page: false
|
search_result_page: false
|
||||||
checkout_page: false
|
checkout_page: false
|
||||||
beginning: 2015-03-18
|
beginning: 2015-03-22
|
||||||
ending: 2015-03-18
|
ending: 2015-03-22
|
||||||
|
footer: false
|
||||||
|
header: false
|
||||||
|
link_url: MyString
|
||||||
|
|
||||||
two:
|
two:
|
||||||
image_url: MyString
|
image_url: MyString
|
||||||
@@ -23,5 +26,8 @@ two:
|
|||||||
thank_you_page: false
|
thank_you_page: false
|
||||||
search_result_page: false
|
search_result_page: false
|
||||||
checkout_page: false
|
checkout_page: false
|
||||||
beginning: 2015-03-18
|
beginning: 2015-03-22
|
||||||
ending: 2015-03-18
|
ending: 2015-03-22
|
||||||
|
footer: false
|
||||||
|
header: false
|
||||||
|
link_url: MyString
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SpecialOfferTest < ActiveSupport::TestCase
|
class ItemGroupTest < ActiveSupport::TestCase
|
||||||
# test "the truth" do
|
# test "the truth" do
|
||||||
# assert true
|
# assert true
|
||||||
# end
|
# end
|
||||||
7
back-office/test/models/link_banner_test.rb
Normal file
7
back-office/test/models/link_banner_test.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class LinkBannerTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
25
front-api/db/migrate/20150322043737_create_link_banners.rb
Normal file
25
front-api/db/migrate/20150322043737_create_link_banners.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
class CreateLinkBanners < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :link_banners do |t|
|
||||||
|
t.string :image_url
|
||||||
|
t.boolean :start_page
|
||||||
|
t.integer :section_id
|
||||||
|
t.integer :category_id
|
||||||
|
t.integer :sub_category_id
|
||||||
|
t.integer :item_id
|
||||||
|
t.boolean :thank_you_page
|
||||||
|
t.boolean :search_result_page
|
||||||
|
t.boolean :checkout_page
|
||||||
|
t.date :beginning
|
||||||
|
t.date :ending
|
||||||
|
t.boolean :footer
|
||||||
|
t.boolean :header
|
||||||
|
t.string :link_url
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
drop_table :special_offers
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
13
front-api/db/migrate/20150322044941_create_item_groups.rb
Normal file
13
front-api/db/migrate/20150322044941_create_item_groups.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class CreateItemGroups < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :item_groups do |t|
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
t.boolean :visible
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
create_join_table :item, :item_groups
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150321052740) do
|
ActiveRecord::Schema.define(version: 20150322044941) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -85,6 +85,14 @@ ActiveRecord::Schema.define(version: 20150321052740) do
|
|||||||
t.integer "filter_criteria_id"
|
t.integer "filter_criteria_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "item_groups", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.boolean "visible"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "item_in_carts", force: :cascade do |t|
|
create_table "item_in_carts", force: :cascade do |t|
|
||||||
t.integer "cart_id"
|
t.integer "cart_id"
|
||||||
t.integer "item_id"
|
t.integer "item_id"
|
||||||
@@ -94,6 +102,11 @@ ActiveRecord::Schema.define(version: 20150321052740) do
|
|||||||
t.decimal "price"
|
t.decimal "price"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "item_item_groups", id: false, force: :cascade do |t|
|
||||||
|
t.integer "item_id", null: false
|
||||||
|
t.integer "item_group_id", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "items", force: :cascade do |t|
|
create_table "items", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "code", limit: 10
|
t.string "code", limit: 10
|
||||||
@@ -114,6 +127,25 @@ ActiveRecord::Schema.define(version: 20150321052740) do
|
|||||||
t.integer "delivery_time_estimation_id"
|
t.integer "delivery_time_estimation_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "link_banners", force: :cascade do |t|
|
||||||
|
t.string "image_url"
|
||||||
|
t.boolean "start_page"
|
||||||
|
t.integer "section_id"
|
||||||
|
t.integer "category_id"
|
||||||
|
t.integer "sub_category_id"
|
||||||
|
t.integer "item_id"
|
||||||
|
t.boolean "thank_you_page"
|
||||||
|
t.boolean "search_result_page"
|
||||||
|
t.boolean "checkout_page"
|
||||||
|
t.date "beginning"
|
||||||
|
t.date "ending"
|
||||||
|
t.boolean "footer"
|
||||||
|
t.boolean "header"
|
||||||
|
t.string "link_url"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "media_types", force: :cascade do |t|
|
create_table "media_types", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
end
|
end
|
||||||
@@ -139,22 +171,6 @@ ActiveRecord::Schema.define(version: 20150321052740) do
|
|||||||
t.integer "order"
|
t.integer "order"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "special_offers", force: :cascade do |t|
|
|
||||||
t.string "image_url"
|
|
||||||
t.boolean "start_page"
|
|
||||||
t.integer "section_id"
|
|
||||||
t.integer "category_id"
|
|
||||||
t.integer "sub_category_id"
|
|
||||||
t.integer "item_id"
|
|
||||||
t.boolean "thank_you_page"
|
|
||||||
t.boolean "search_result_page"
|
|
||||||
t.boolean "checkout_page"
|
|
||||||
t.date "beginning"
|
|
||||||
t.date "ending"
|
|
||||||
t.datetime "created_at", null: false
|
|
||||||
t.datetime "updated_at", null: false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "sub_categories", force: :cascade do |t|
|
create_table "sub_categories", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "category_id"
|
t.integer "category_id"
|
||||||
|
|||||||
Reference in New Issue
Block a user