comable-backend 0.7.0.beta1 → 0.7.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -2
- data/app/assets/javascripts/comable/admin/application.coffee +23 -0
- data/app/assets/javascripts/comable/admin/dispatcher.coffee +3 -0
- data/app/assets/javascripts/comable/admin/products.coffee +30 -0
- data/app/assets/javascripts/comable/admin/stocks.coffee +10 -0
- data/app/assets/stylesheets/comable/admin/_products.scss +7 -0
- data/app/assets/stylesheets/comable/admin/application.scss +2 -0
- data/app/controllers/comable/admin/navigations_controller.rb +2 -11
- data/app/controllers/comable/admin/orders_controller.rb +11 -3
- data/app/controllers/comable/admin/pages_controller.rb +1 -1
- data/app/controllers/comable/admin/payment_methods_controller.rb +1 -1
- data/app/controllers/comable/admin/products_controller.rb +3 -2
- data/app/controllers/comable/admin/shipment_methods_controller.rb +1 -1
- data/app/controllers/comable/admin/stock_locations_controller.rb +76 -0
- data/app/controllers/comable/admin/stocks_controller.rb +3 -2
- data/app/controllers/comable/admin/themes_controller.rb +1 -0
- data/app/controllers/comable/admin/trackers_controller.rb +1 -1
- data/app/controllers/comable/admin/users_controller.rb +1 -1
- data/app/controllers/comable/admin/variants_controller.rb +3 -3
- data/app/helpers/comable/admin/application_helper.rb +1 -5
- data/app/helpers/comable/admin/navigations_helper.rb +0 -4
- data/app/helpers/comable/admin/products_helper.rb +5 -0
- data/app/helpers/comable/admin/themes_helper.rb +1 -1
- data/app/navigations/comable/admin/application.rb +4 -0
- data/app/views/comable/admin/navigations/_navigation_item_fields.slim +2 -3
- data/app/views/comable/admin/orders/_shipment_state.slim +3 -3
- data/app/views/comable/admin/orders/edit.slim +1 -1
- data/app/views/comable/admin/orders/show.slim +2 -2
- data/app/views/comable/admin/products/_form.slim +19 -2
- data/app/views/comable/admin/products/_property_fields.slim +8 -0
- data/app/views/comable/admin/shared/_address_form.slim +27 -0
- data/app/views/comable/admin/shared/_stocks_fields.slim +15 -0
- data/app/views/comable/admin/shared/_variant_form.slim +3 -4
- data/app/views/comable/admin/stock_locations/_form.slim +37 -0
- data/app/views/comable/admin/stock_locations/edit.slim +27 -0
- data/app/views/comable/admin/stock_locations/index.slim +28 -0
- data/app/views/comable/admin/stock_locations/new.slim +16 -0
- data/app/views/comable/admin/stocks/_form.slim +5 -13
- data/app/views/comable/admin/stocks/index.slim +2 -5
- data/app/views/comable/admin/users/edit.slim +1 -27
- data/app/views/comable/admin/variants/edit.slim +1 -1
- data/config/routes.rb +1 -0
- data/lib/comable/backend/engine.rb +2 -1
- metadata +28 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a4aab8272e2f6d7559b2b904eff5dae392ac9b
|
4
|
+
data.tar.gz: 6a467557d5063f57772c037adddabc6099bfce7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74082e26be423fa71b1d3196d9daf07251b106665314a77bde732c3a77812bb63a27853149375dd8ee14f763e620107788328e657de86291782a5223603a9c61
|
7
|
+
data.tar.gz: cfa9c867269a22cb149cea5f1a5e69f67dd73fe40dc9b7e69985a0972bd5718a21ad8d17858a4e7a24dde9483096aa27e146ae4cd0e3faf6ef422c478db08cac
|
data/Rakefile
CHANGED
@@ -4,6 +4,7 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
+
require 'rspec/core/rake_task'
|
7
8
|
require 'rdoc/task'
|
8
9
|
|
9
10
|
RDoc::Task.new(:rdoc) do |rdoc|
|
@@ -69,9 +70,9 @@ if File.exist?('comable.gemspec')
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
task default: ['app:spec:all', 'rubocop', 'brakeman:all']
|
73
|
+
task default: ['app:spec:all', 'jasmine', 'rubocop', 'brakeman:all']
|
73
74
|
else
|
74
|
-
task default: ['app:spec', 'rubocop', 'brakeman']
|
75
|
+
task default: ['app:spec', 'jasmine', 'rubocop', 'brakeman']
|
75
76
|
end
|
76
77
|
|
77
78
|
Bundler::GemHelper.install_tasks
|
@@ -79,6 +80,10 @@ Bundler::GemHelper.install_tasks
|
|
79
80
|
# from https://github.com/rspec/rspec-rails/issues/936
|
80
81
|
task 'test:prepare'
|
81
82
|
|
83
|
+
task :jasmine do
|
84
|
+
sh 'bundle exec rake app:spec:javascript RAILS_ENV=test'
|
85
|
+
end
|
86
|
+
|
82
87
|
task :rubocop do
|
83
88
|
sh 'rubocop'
|
84
89
|
end
|
@@ -12,8 +12,10 @@
|
|
12
12
|
#= require ace/ace
|
13
13
|
#= require ace/worker-html
|
14
14
|
#= require ace/mode-liquid
|
15
|
+
#= require ace/theme-monokai
|
15
16
|
#= require moment
|
16
17
|
#= require bootstrap-datetimepicker
|
18
|
+
#= require select2
|
17
19
|
#= require comable/admin/dispatcher
|
18
20
|
#= require_tree .
|
19
21
|
#= require_self
|
@@ -46,6 +48,22 @@ add_beforeunload_event = ->
|
|
46
48
|
$form.submit(remove_beforeunload_function)
|
47
49
|
$(document).on('page:change', remove_beforeunload_function)
|
48
50
|
|
51
|
+
# Based on http://gistflow.com/posts/428-autocomplete-with-rails-and-select2
|
52
|
+
initialize_select2 = ->
|
53
|
+
$('.select2').each( ->
|
54
|
+
$select = $(this)
|
55
|
+
options = { theme: 'bootstrap' }
|
56
|
+
if $select.hasClass('ajax')
|
57
|
+
options.ajax = {
|
58
|
+
url: $select.data('source')
|
59
|
+
dataType: 'json'
|
60
|
+
cache: true
|
61
|
+
data: (params) -> { q: { name_cont: params.term }, page: params.page }
|
62
|
+
processResults: (data, page) -> { results: data }
|
63
|
+
}
|
64
|
+
$select.select2(options)
|
65
|
+
)
|
66
|
+
|
49
67
|
window.add_fields = (_this, association, content) ->
|
50
68
|
new_id = new Date().getTime()
|
51
69
|
regexp = new RegExp('new_' + association, 'g')
|
@@ -57,6 +75,11 @@ window.add_fields = (_this, association, content) ->
|
|
57
75
|
|
58
76
|
$(document).ready(->
|
59
77
|
add_beforeunload_event()
|
78
|
+
initialize_select2()
|
79
|
+
|
80
|
+
$(document).on('click', '.add_fields', ->
|
81
|
+
initialize_select2()
|
82
|
+
)
|
60
83
|
|
61
84
|
$('.btn-file :file').change(->
|
62
85
|
$(this).closest('form').submit()
|
@@ -22,6 +22,9 @@ class Dispatcher
|
|
22
22
|
when 'products:new', 'products:show', 'products:edit', 'products:update', 'products:create'
|
23
23
|
new Product
|
24
24
|
new Variant
|
25
|
+
new Stock
|
26
|
+
when 'variants:show', 'variants:edit', 'variants:update'
|
27
|
+
new Stock
|
25
28
|
when 'navigations:new', 'navigations:show', 'navigations:edit', 'navigations:update', 'navigations:create'
|
26
29
|
new Navigation
|
27
30
|
when 'themes:tree'
|
@@ -25,9 +25,13 @@ class @Product
|
|
25
25
|
@radio_published = $('#product_published_at_published')
|
26
26
|
@radio_unpublished = $('#product_published_at_unpublished')
|
27
27
|
@published_at = $('#product_published_at')
|
28
|
+
@property = $('#product_property')
|
29
|
+
@properties = $('#properties')
|
30
|
+
@add_property = $('.add_property')
|
28
31
|
|
29
32
|
@initialize_visibility()
|
30
33
|
@add_event_to_set_visibility()
|
34
|
+
@add_event_to_property()
|
31
35
|
|
32
36
|
# 公開/非公開の制御
|
33
37
|
initialize_visibility: ->
|
@@ -54,3 +58,29 @@ class @Product
|
|
54
58
|
@published_at.blur( =>
|
55
59
|
@radio_unpublished.click() unless @published_at.val()
|
56
60
|
)
|
61
|
+
|
62
|
+
add_event_to_property: ->
|
63
|
+
@properties.on('change', 'input', @reset_property)
|
64
|
+
@properties.on('click', '.remove_property', @remove_property)
|
65
|
+
@properties.on('click', '.remove_property', @reset_property)
|
66
|
+
@add_property.click(@adding_property_field)
|
67
|
+
|
68
|
+
reset_property: =>
|
69
|
+
property_attrbutes = $('.property').map( (_index, property) ->
|
70
|
+
property_key = $(property).find('.property_key').val()
|
71
|
+
property_value = $(property).find('.property_value').val()
|
72
|
+
return unless property_key && property_value
|
73
|
+
{
|
74
|
+
'property_key': property_key,
|
75
|
+
'property_value': property_value
|
76
|
+
}
|
77
|
+
)
|
78
|
+
@property.val(JSON.stringify(property_attrbutes.get()))
|
79
|
+
|
80
|
+
remove_property: ->
|
81
|
+
$(this).closest('tr').remove()
|
82
|
+
|
83
|
+
adding_property_field: ->
|
84
|
+
field_tags = $(this).data('fields')
|
85
|
+
$field = $(field_tags)
|
86
|
+
$('#properties').append($field) # タグを追加
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class @Stock
|
2
|
+
constructor: ->
|
3
|
+
@register_click_event_to_remove_comable_stock_button()
|
4
|
+
|
5
|
+
register_click_event_to_remove_comable_stock_button: ->
|
6
|
+
$(document).on('click', '.js-remove-comable-stock', ->
|
7
|
+
$stock = $(this).closest('.comable-stock')
|
8
|
+
$stock.addClass('hidden')
|
9
|
+
$stock.find('input[data-name="destroy"]').val(true)
|
10
|
+
)
|
@@ -7,7 +7,7 @@ module Comable
|
|
7
7
|
|
8
8
|
def index
|
9
9
|
@q = Comable::Navigation.ransack(params[:q])
|
10
|
-
@navigations = @q.result.accessible_by(current_ability)
|
10
|
+
@navigations = @q.result.accessible_by(current_ability).by_newest
|
11
11
|
end
|
12
12
|
|
13
13
|
def show
|
@@ -46,21 +46,12 @@ module Comable
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def search_linkable_ids
|
49
|
-
@linkable_id_options = linkable_id_options
|
49
|
+
@linkable_id_options = Comable::NavigationItem.linkable_id_options(params[:linkable_type])
|
50
50
|
render layout: false
|
51
51
|
end
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
-
def linkable_type
|
56
|
-
return if params[:linkable_type].blank?
|
57
|
-
params[:linkable_type] if Comable.const_defined?(params[:linkable_type].demodulize)
|
58
|
-
end
|
59
|
-
|
60
|
-
def linkable_id_options
|
61
|
-
linkable_type ? linkable_type.constantize.linkable_id_options : [[]]
|
62
|
-
end
|
63
|
-
|
64
55
|
def navigation_params
|
65
56
|
params.require(:navigation).permit(
|
66
57
|
:name,
|
@@ -59,17 +59,21 @@ module Comable
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def ship
|
62
|
-
|
62
|
+
if params[:shipment_id]
|
63
|
+
find_shipment.ship!
|
64
|
+
else
|
65
|
+
@order.ship!
|
66
|
+
end
|
63
67
|
redirect_to :back, notice: Comable.t('successful')
|
64
68
|
end
|
65
69
|
|
66
70
|
def cancel_shipment
|
67
|
-
|
71
|
+
find_shipment.cancel!
|
68
72
|
redirect_to :back, notice: Comable.t('successful')
|
69
73
|
end
|
70
74
|
|
71
75
|
def resume_shipment
|
72
|
-
|
76
|
+
find_shipment.resume!
|
73
77
|
redirect_to :back, notice: Comable.t('successful')
|
74
78
|
end
|
75
79
|
|
@@ -90,6 +94,10 @@ module Comable
|
|
90
94
|
def redirect_to_back_with_alert(exception)
|
91
95
|
redirect_to :back, alert: exception.message
|
92
96
|
end
|
97
|
+
|
98
|
+
def find_shipment
|
99
|
+
@order.shipments.find(params[:shipment_id])
|
100
|
+
end
|
93
101
|
end
|
94
102
|
end
|
95
103
|
end
|
@@ -7,7 +7,7 @@ module Comable
|
|
7
7
|
|
8
8
|
def index
|
9
9
|
@q = Comable::Product.ransack(params[:q])
|
10
|
-
@products = @q.result(distinct: true).includes(:images, variants: [:option_values, :
|
10
|
+
@products = @q.result(distinct: true).includes(:images, variants: [:option_values, :stocks]).page(params[:page]).accessible_by(current_ability).by_newest
|
11
11
|
end
|
12
12
|
|
13
13
|
def show
|
@@ -73,10 +73,11 @@ module Comable
|
|
73
73
|
params.require(:product).permit(
|
74
74
|
:name,
|
75
75
|
:caption,
|
76
|
+
:property,
|
76
77
|
:published_at,
|
77
78
|
category_path_names: [],
|
78
79
|
images_attributes: [:id, :file, :_destroy],
|
79
|
-
variants_attributes: [:id, :price, :sku, :options, :quantity, :_destroy],
|
80
|
+
variants_attributes: [:id, :price, :sku, :options, :_destroy, stocks_attributes: [:id, :quantity, :stock_location_id, :_destroy]],
|
80
81
|
option_types_attributes: [:id, :name, { values: [] }]
|
81
82
|
)
|
82
83
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require_dependency 'comable/admin/application_controller'
|
2
|
+
|
3
|
+
module Comable
|
4
|
+
module Admin
|
5
|
+
class StockLocationsController < Comable::Admin::ApplicationController
|
6
|
+
include Comable::PermittedAttributes
|
7
|
+
|
8
|
+
load_and_authorize_resource class: Comable::StockLocation.name, except: :index
|
9
|
+
|
10
|
+
before_filter :build_address, only: [:show, :new, :edit]
|
11
|
+
|
12
|
+
def index
|
13
|
+
@q = Comable::StockLocation.ransack(params[:q])
|
14
|
+
@stock_locations = @q.result.page(params[:page]).accessible_by(current_ability)
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html
|
18
|
+
format.json { render json: @stock_locations }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def show
|
23
|
+
render :edit
|
24
|
+
end
|
25
|
+
|
26
|
+
def new
|
27
|
+
@stock_location.build_address unless @stock_location.address
|
28
|
+
end
|
29
|
+
|
30
|
+
def create
|
31
|
+
if @stock_location.save
|
32
|
+
redirect_to comable.admin_stock_location_path(@stock_location), notice: Comable.t('successful')
|
33
|
+
else
|
34
|
+
flash.now[:alert] = Comable.t('failure')
|
35
|
+
render :new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def edit
|
40
|
+
end
|
41
|
+
|
42
|
+
def update
|
43
|
+
if @stock_location.update_attributes(stock_location_params)
|
44
|
+
redirect_to comable.admin_stock_location_path(@stock_location), notice: Comable.t('successful')
|
45
|
+
else
|
46
|
+
flash.now[:alert] = Comable.t('failure')
|
47
|
+
render :edit
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def destroy
|
52
|
+
@stock_location.destroy
|
53
|
+
redirect_to comable.admin_stock_locations_path, notice: Comable.t('successful')
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def stock_location_params
|
59
|
+
params.require(:stock_location).permit(
|
60
|
+
:name,
|
61
|
+
:active,
|
62
|
+
:default,
|
63
|
+
address_attributes: permitted_address_attributes
|
64
|
+
).tap do |params|
|
65
|
+
next unless params[:address_attributes]
|
66
|
+
next if params[:address_attributes].values.any?(&:present?)
|
67
|
+
params.delete(:address_attributes)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_address
|
72
|
+
@stock_location.build_address unless @stock_location.address
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -10,7 +10,7 @@ module Comable
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
@q = @stocks.ransack(params[:q])
|
13
|
-
@stocks = @q.result.includes(variant: [:product, :option_values]).page(params[:page]).accessible_by(current_ability)
|
13
|
+
@stocks = @q.result.includes(variant: [:product, :option_values]).page(params[:page]).accessible_by(current_ability).by_newest
|
14
14
|
end
|
15
15
|
|
16
16
|
def show
|
@@ -76,7 +76,8 @@ module Comable
|
|
76
76
|
:code,
|
77
77
|
:quantity,
|
78
78
|
:sku_h_choice_name,
|
79
|
-
:sku_v_choice_name
|
79
|
+
:sku_v_choice_name,
|
80
|
+
:stock_location_id
|
80
81
|
)
|
81
82
|
end
|
82
83
|
end
|
@@ -8,7 +8,7 @@ module Comable
|
|
8
8
|
|
9
9
|
def index
|
10
10
|
@q = @variants.ransack(params[:q])
|
11
|
-
@variants = @q.result.includes(:product).page(params[:page]).accessible_by(current_ability)
|
11
|
+
@variants = @q.result.includes(:product).page(params[:page]).accessible_by(current_ability).by_newest
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
@@ -41,7 +41,7 @@ module Comable
|
|
41
41
|
|
42
42
|
def destroy
|
43
43
|
@variant.destroy
|
44
|
-
redirect_to comable.
|
44
|
+
redirect_to comable.admin_product_path(@product), notice: Comable.t('successful')
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
@@ -50,7 +50,7 @@ module Comable
|
|
50
50
|
params.require(:variant).permit(
|
51
51
|
:price,
|
52
52
|
:sku,
|
53
|
-
|
53
|
+
stocks_attributes: [:id, :quantity, :stock_location_id, :_destroy],
|
54
54
|
option_values_attributes: [:id, :name]
|
55
55
|
)
|
56
56
|
end
|
@@ -31,7 +31,7 @@ module Comable
|
|
31
31
|
new_object = f.object.send("build_#{type}")
|
32
32
|
f.send("#{type}_fields", new_object, child_index: "new_#{type}", &render_block)
|
33
33
|
else
|
34
|
-
new_object =
|
34
|
+
new_object = Comable.const_get(type.to_s.classify).new
|
35
35
|
f.send('fields_for', type, new_object, child_index: "new_#{type}", &render_block)
|
36
36
|
end
|
37
37
|
end
|
@@ -46,10 +46,6 @@ module Comable
|
|
46
46
|
false
|
47
47
|
end
|
48
48
|
|
49
|
-
def page_name
|
50
|
-
[controller_name, action_name].join(':')
|
51
|
-
end
|
52
|
-
|
53
49
|
private
|
54
50
|
|
55
51
|
def singular?(string)
|
@@ -5,10 +5,6 @@ module Comable
|
|
5
5
|
Comable::NavigationItem.linkable_params_lists.map { |attr| attr.slice(:name, :type).values }
|
6
6
|
end
|
7
7
|
|
8
|
-
def linkable_id_options(navigation_item)
|
9
|
-
navigation_item.linkable_class.try(:linkable_id_options) || [[]]
|
10
|
-
end
|
11
|
-
|
12
8
|
# アイテム追加ボタン設置
|
13
9
|
def add_fields_button_tag(name, f, association)
|
14
10
|
new_object = f.object.send(association).klass.new
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Comable
|
2
2
|
module Admin
|
3
3
|
module ProductsHelper
|
4
|
+
# プロパティ追加ボタン設置
|
5
|
+
def add_property_button_tag(name)
|
6
|
+
fields = render 'comable/admin/products/property_fields', property_key: nil, property_value: nil
|
7
|
+
button_tag(name, type: :button, class: 'add_property btn btn-default pull-right', data: { fields: fields.delete("\n") })
|
8
|
+
end
|
4
9
|
end
|
5
10
|
end
|
6
11
|
end
|
@@ -20,7 +20,7 @@ module Comable
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def views_dir
|
23
|
-
spec = Gem::Specification.
|
23
|
+
spec = Gem::Specification.find_by_path('comable/frontend')
|
24
24
|
fail 'Please install "comable-frontend" gem!' unless spec
|
25
25
|
"#{spec.gem_dir}/app/views"
|
26
26
|
end
|
@@ -54,6 +54,10 @@ AwesomeAdminLayout.define(only: Comable::Admin::ApplicationController) do |contr
|
|
54
54
|
link comable.admin_stocks_path
|
55
55
|
end
|
56
56
|
|
57
|
+
item Comable.t('admin.nav.stock_location') do
|
58
|
+
link comable.admin_stock_locations_path
|
59
|
+
end
|
60
|
+
|
57
61
|
item Comable.t('admin.nav.category') do
|
58
62
|
link comable.admin_categories_path
|
59
63
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
-
|
2
|
-
- link_selectable = linkable_class.try(:linkable_exists?)
|
1
|
+
- link_selectable = f.object.linkable_exists?
|
3
2
|
|
4
3
|
fieldset.navigation-item class="#{'hidden' if f.object._destroy}"
|
5
4
|
.row
|
@@ -16,7 +15,7 @@ fieldset.navigation-item class="#{'hidden' if f.object._destroy}"
|
|
16
15
|
= f.text_field :url
|
17
16
|
|
18
17
|
.col-sm-3.linkable_id class="#{'hidden' unless link_selectable}"
|
19
|
-
= f.select :linkable_id,
|
18
|
+
= f.select :linkable_id, f.object.linkable_id_options
|
20
19
|
|
21
20
|
.col-sm-3
|
22
21
|
= f.hidden_field :_destroy, class: :destroy
|
@@ -19,7 +19,7 @@ section.row
|
|
19
19
|
|
20
20
|
li
|
21
21
|
- if shipment.state?(:ready)
|
22
|
-
= link_to comable.ship_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :completed).merge(method: :post, disabled:
|
22
|
+
= link_to comable.ship_admin_order_path(shipment.order, shipment_id: shipment.id), options_of_shipment_badge_for(shipment, state: :completed).merge(method: :post, disabled: !shipment.can_ship?) do
|
23
23
|
i.fa.fa-truck
|
24
24
|
- else
|
25
25
|
= content_tag :div, options_of_shipment_badge_for(shipment, state: :completed) do
|
@@ -32,7 +32,7 @@ section.row
|
|
32
32
|
|
33
33
|
- if shipment.state?(:completed) || shipment.state?(:resumed)
|
34
34
|
li
|
35
|
-
= link_to comable.cancel_shipment_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :canceled).merge(method: :post) do
|
35
|
+
= link_to comable.cancel_shipment_admin_order_path(shipment.order, shipment_id: shipment.id), options_of_shipment_badge_for(shipment, state: :canceled).merge(method: :post) do
|
36
36
|
i.fa.fa-close
|
37
37
|
|
38
38
|
- if shipment.state?(:canceled)
|
@@ -40,5 +40,5 @@ section.row
|
|
40
40
|
= content_tag :div, options_of_shipment_badge_for(shipment, state: :canceled) do
|
41
41
|
i.fa.fa-close
|
42
42
|
li
|
43
|
-
= link_to comable.resume_shipment_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :resumed).merge(method: :post) do
|
43
|
+
= link_to comable.resume_shipment_admin_order_path(shipment.order, shipment_id: shipment.id), options_of_shipment_badge_for(shipment, state: :resumed).merge(method: :post) do
|
44
44
|
i.fa.fa-refresh
|
@@ -141,7 +141,7 @@
|
|
141
141
|
p
|
142
142
|
= ff.text_field :name, placeholder: ff.object.class.human_attribute_name(:name), data: { name: 'name' }
|
143
143
|
p.text-muted
|
144
|
-
= ff.text_field :
|
144
|
+
= ff.text_field :sku, placeholder: ff.object.class.human_attribute_name(:sku), data: { name: 'sku' }
|
145
145
|
td
|
146
146
|
= ff.text_field :price, placeholder: ff.object.class.human_attribute_name(:price), data: { name: 'price' }
|
147
147
|
td
|
@@ -39,8 +39,8 @@
|
|
39
39
|
.comable-page-body
|
40
40
|
- if @order.payment
|
41
41
|
= render 'payment_state', payment: @order.payment
|
42
|
-
-
|
43
|
-
= render 'shipment_state', shipment:
|
42
|
+
- @order.shipments.each do |shipment|
|
43
|
+
= render 'shipment_state', shipment: shipment
|
44
44
|
|
45
45
|
section.row
|
46
46
|
.col-lg-8
|
@@ -103,8 +103,9 @@
|
|
103
103
|
th
|
104
104
|
= @product.variants.human_attribute_name(:quantity)
|
105
105
|
tbody
|
106
|
-
|
107
|
-
=
|
106
|
+
- if @product.persisted?
|
107
|
+
= f.fields_for :variants do |ff|
|
108
|
+
= render 'comable/admin/shared/variants_fields', f: ff
|
108
109
|
= link_to_add_fields nil, f, :variants, class: 'hidden js-add-variant'
|
109
110
|
|
110
111
|
- if @product.persisted?
|
@@ -142,6 +143,22 @@
|
|
142
143
|
|
143
144
|
hr
|
144
145
|
|
146
|
+
fieldset
|
147
|
+
.col-md-3
|
148
|
+
legend
|
149
|
+
= Comable.t('admin.nav.products.property')
|
150
|
+
.help-block
|
151
|
+
|
152
|
+
.col-md-9
|
153
|
+
.form-group
|
154
|
+
table.table#properties
|
155
|
+
- @product.properties.each do |property|
|
156
|
+
= render 'comable/admin/products/property_fields', property_key: property['property_key'], property_value: property['property_value']
|
157
|
+
= f.hidden_field :property
|
158
|
+
= add_property_button_tag Comable.t('admin.nav.products.add_property')
|
159
|
+
|
160
|
+
hr
|
161
|
+
|
145
162
|
fieldset
|
146
163
|
.col-md-3
|
147
164
|
legend
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.form-group
|
2
|
+
= f.label :full_name
|
3
|
+
.row
|
4
|
+
.col-sm-6
|
5
|
+
= f.text_field :family_name, placeholder: f.object.class.human_attribute_name(:family_name)
|
6
|
+
.col-sm-6
|
7
|
+
= f.text_field :first_name, placeholder: f.object.class.human_attribute_name(:first_name)
|
8
|
+
|
9
|
+
.form-group
|
10
|
+
= f.label :zip_code
|
11
|
+
= f.text_field :zip_code, max_length: 8
|
12
|
+
|
13
|
+
.form-group
|
14
|
+
= f.label :state_name
|
15
|
+
= f.text_field :state_name
|
16
|
+
|
17
|
+
.form-group
|
18
|
+
= f.label :city
|
19
|
+
= f.text_field :city
|
20
|
+
|
21
|
+
.form-group
|
22
|
+
= f.label :detail
|
23
|
+
= f.text_field :detail
|
24
|
+
|
25
|
+
.form-group
|
26
|
+
= f.label :phone_number
|
27
|
+
= f.text_field :phone_number, max_length: 18
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.row.comable-stock
|
2
|
+
= f.hidden_field :_destroy, data: { name: 'destroy' }
|
3
|
+
|
4
|
+
.col-md-6
|
5
|
+
.form-group
|
6
|
+
= f.label :quantity
|
7
|
+
= f.text_field :quantity
|
8
|
+
|
9
|
+
.col-md-6
|
10
|
+
.form-group
|
11
|
+
= f.label :stock_location_id
|
12
|
+
= f.collection_select :stock_location_id, [f.object.try(:stock_location)].compact, :id, :name, {}, class: 'select2 ajax', data: { source: comable.admin_stock_locations_path }
|
13
|
+
|
14
|
+
.help-block.text-right
|
15
|
+
= link_to Comable.t('admin.actions.destroy'), 'javascript: void(0)', class: 'js-remove-comable-stock'
|
@@ -20,7 +20,6 @@ fieldset
|
|
20
20
|
= f.label :sku
|
21
21
|
= f.text_field :sku
|
22
22
|
|
23
|
-
= f.fields_for :
|
24
|
-
|
25
|
-
|
26
|
-
= ff.text_field :quantity
|
23
|
+
= f.fields_for :stocks do |ff|
|
24
|
+
= render 'comable/admin/shared/stocks_fields', f: ff
|
25
|
+
= link_to_add_fields Comable.t('admin.add_stocks'), f, :stocks
|
@@ -0,0 +1,37 @@
|
|
1
|
+
= error_messages_for @stock_location
|
2
|
+
|
3
|
+
= form_for [comable, :admin, @stock_location] do |f|
|
4
|
+
.hidden
|
5
|
+
= f.submit
|
6
|
+
|
7
|
+
fieldset
|
8
|
+
.col-md-3
|
9
|
+
legend
|
10
|
+
= Comable.t('admin.general')
|
11
|
+
|
12
|
+
.col-md-9
|
13
|
+
.form-group
|
14
|
+
= f.label :name
|
15
|
+
= f.text_field :name
|
16
|
+
|
17
|
+
.form-group
|
18
|
+
.checkbox
|
19
|
+
= f.label :active do
|
20
|
+
= f.check_box :active
|
21
|
+
= f.object.class.human_attribute_name(:active)
|
22
|
+
|
23
|
+
.form-group
|
24
|
+
.checkbox
|
25
|
+
= f.label :default do
|
26
|
+
= f.check_box :default
|
27
|
+
= f.object.class.human_attribute_name(:default)
|
28
|
+
|
29
|
+
fieldset
|
30
|
+
.col-md-3
|
31
|
+
legend
|
32
|
+
= f.object.class.human_attribute_name(:address)
|
33
|
+
.help-block
|
34
|
+
|
35
|
+
.col-md-9
|
36
|
+
= f.fields_for :address do |ff|
|
37
|
+
= render 'comable/admin/shared/address_form', f: ff
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
7
|
+
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.stock_location'), comable.admin_stock_locations_path
|
12
|
+
li.active
|
13
|
+
= @stock_location.name
|
14
|
+
|
15
|
+
.comable-page-body
|
16
|
+
= render 'form'
|
17
|
+
hr
|
18
|
+
.panel.panel-danger
|
19
|
+
.panel-heading type="button" data-toggle="collapse" data-target="#comable-danger"
|
20
|
+
strong
|
21
|
+
span.fa.fa-angle-down>
|
22
|
+
= Comable.t('admin.actions.destroy')
|
23
|
+
#comable-danger.collapse
|
24
|
+
.panel-body
|
25
|
+
p
|
26
|
+
= Comable.t('admin.confirmation_to_remove_product')
|
27
|
+
= link_to Comable.t('admin.actions.destroy'), comable.admin_stock_location_path(@stock_location), method: :delete, class: 'btn btn-danger'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
ul.pull-right.list-inline
|
4
|
+
li
|
5
|
+
= link_to Comable.t('admin.actions.new'), comable.new_admin_stock_location_path, class: 'btn btn-default'
|
6
|
+
|
7
|
+
h1.page-header
|
8
|
+
= Comable.t('admin.nav.stock_location')
|
9
|
+
small<
|
10
|
+
| #{@stock_locations.size} #{Comable.t('admin.results')}
|
11
|
+
|
12
|
+
.comable-page-body
|
13
|
+
- if @stock_locations.empty?
|
14
|
+
= Comable.t('admin.not_found')
|
15
|
+
- else
|
16
|
+
table.table.table-striped
|
17
|
+
thead
|
18
|
+
th
|
19
|
+
= @stock_locations.klass.human_attribute_name(:name)
|
20
|
+
tbody
|
21
|
+
- @stock_locations.each do |stock_location|
|
22
|
+
tr
|
23
|
+
td
|
24
|
+
= link_to stock_location.name, comable.admin_stock_location_path(stock_location)
|
25
|
+
- unless stock_location.active
|
26
|
+
span.fa.fa-eye-slash.text-muted<
|
27
|
+
- if stock_location.default
|
28
|
+
span.fa.fa-check.text-primary<
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
7
|
+
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.stock_location'), comable.admin_stock_locations_path
|
12
|
+
li.active
|
13
|
+
= Comable.t('admin.actions.new')
|
14
|
+
|
15
|
+
.comable-page-body
|
16
|
+
= render 'form'
|
@@ -14,21 +14,13 @@
|
|
14
14
|
.help-block
|
15
15
|
|
16
16
|
.col-md-9
|
17
|
-
.form-group
|
18
|
-
= f.label :code
|
19
|
-
= f.text_field :code
|
20
|
-
|
21
17
|
.form-group
|
22
18
|
= f.label :quantity
|
23
19
|
= f.text_field :quantity
|
24
20
|
|
25
|
-
-
|
26
|
-
|
27
|
-
|
28
|
-
= f.label :sku_h_choice_name, @stock.sku_h_item_name
|
29
|
-
= f.text_field :sku_h_choice_name
|
21
|
+
.form-group
|
22
|
+
= f.label :stock_location_id
|
23
|
+
= f.collection_select :stock_location_id, [@stock.stock_location].compact, :id, :name, {}, class: 'select2 ajax', data: { source: comable.admin_stock_locations_path }
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
= f.label :sku_v_choice_name, @stock.sku_v_item_name
|
34
|
-
= f.text_field :sku_v_choice_name
|
25
|
+
.help-block.text-right
|
26
|
+
= link_to Comable.t('admin.remove'), 'javascript: void(0)', class: 'remove-fields'
|
@@ -66,16 +66,13 @@
|
|
66
66
|
- @stocks.each do |stock|
|
67
67
|
tr
|
68
68
|
td
|
69
|
+
p
|
70
|
+
= link_to stock.variant.product.name, comable.admin_product_variant_path(stock.variant.product, stock.variant)
|
69
71
|
- if stock.variant.options.any?
|
70
|
-
p
|
71
|
-
= link_to stock.variant.product.name, comable.admin_product_variant_path(stock.variant.product, stock.variant)
|
72
72
|
p
|
73
73
|
- stock.variant.options.each do |option|
|
74
74
|
span.comable-variant-name
|
75
75
|
= option.value
|
76
|
-
- else
|
77
|
-
p
|
78
|
-
= link_to stock.variant.product.name, comable.admin_product_path(stock.variant.product)
|
79
76
|
td
|
80
77
|
= stock.variant.sku
|
81
78
|
td
|
@@ -50,30 +50,4 @@
|
|
50
50
|
|
51
51
|
.col-md-9
|
52
52
|
= f.fields_for :bill_address do |ff|
|
53
|
-
|
54
|
-
= ff.label :full_name
|
55
|
-
.row
|
56
|
-
.col-sm-6
|
57
|
-
= ff.text_field :family_name, placeholder: ff.object.class.human_attribute_name(:family_name)
|
58
|
-
.col-sm-6
|
59
|
-
= ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
|
60
|
-
|
61
|
-
.form-group
|
62
|
-
= ff.label :zip_code
|
63
|
-
= ff.text_field :zip_code, max_length: 8
|
64
|
-
|
65
|
-
.form-group
|
66
|
-
= ff.label :state_name
|
67
|
-
= ff.text_field :state_name
|
68
|
-
|
69
|
-
.form-group
|
70
|
-
= ff.label :city
|
71
|
-
= ff.text_field :city
|
72
|
-
|
73
|
-
.form-group
|
74
|
-
= ff.label :detail
|
75
|
-
= ff.text_field :detail
|
76
|
-
|
77
|
-
.form-group
|
78
|
-
= ff.label :phone_number
|
79
|
-
= ff.text_field :phone_number, max_length: 18
|
53
|
+
= render 'comable/admin/shared/address_form', f: ff
|
@@ -28,4 +28,4 @@
|
|
28
28
|
.panel-body
|
29
29
|
p
|
30
30
|
= Comable.t('admin.confirmation_to_remove_product')
|
31
|
-
= link_to Comable.t('admin.actions.destroy'), comable.
|
31
|
+
= link_to Comable.t('admin.actions.destroy'), comable.admin_product_variant_path(@product, @variant), method: :delete, class: 'btn btn-danger'
|
data/config/routes.rb
CHANGED
@@ -21,8 +21,9 @@ require 'jquery-turbolinks'
|
|
21
21
|
require 'awesome_admin_layout'
|
22
22
|
require 'ace-rails-ap'
|
23
23
|
|
24
|
-
require 'bootstrap3-datetimepicker-rails'
|
25
24
|
require 'momentjs-rails'
|
25
|
+
require 'bootstrap3-datetimepicker-rails'
|
26
|
+
require 'select2-rails'
|
26
27
|
|
27
28
|
module Comable
|
28
29
|
module Backend
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comable-backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YOSHIDA Hiroki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: comable-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.7.0.
|
19
|
+
version: 0.7.0.beta2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.0.
|
26
|
+
version: 0.7.0.beta2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -460,6 +460,20 @@ dependencies:
|
|
460
460
|
- - ">="
|
461
461
|
- !ruby/object:Gem::Version
|
462
462
|
version: 4.7.14
|
463
|
+
- !ruby/object:Gem::Dependency
|
464
|
+
name: select2-rails
|
465
|
+
requirement: !ruby/object:Gem::Requirement
|
466
|
+
requirements:
|
467
|
+
- - "~>"
|
468
|
+
- !ruby/object:Gem::Version
|
469
|
+
version: '4.0'
|
470
|
+
type: :runtime
|
471
|
+
prerelease: false
|
472
|
+
version_requirements: !ruby/object:Gem::Requirement
|
473
|
+
requirements:
|
474
|
+
- - "~>"
|
475
|
+
- !ruby/object:Gem::Version
|
476
|
+
version: '4.0'
|
463
477
|
description: Provide backend functions for Comable.
|
464
478
|
email:
|
465
479
|
- hyoshida@appirits.com
|
@@ -478,6 +492,7 @@ files:
|
|
478
492
|
- app/assets/javascripts/comable/admin/pages.coffee
|
479
493
|
- app/assets/javascripts/comable/admin/products.coffee
|
480
494
|
- app/assets/javascripts/comable/admin/search.coffee
|
495
|
+
- app/assets/javascripts/comable/admin/stocks.coffee
|
481
496
|
- app/assets/javascripts/comable/admin/themes.coffee
|
482
497
|
- app/assets/javascripts/comable/admin/variants.coffee
|
483
498
|
- app/assets/stylesheets/comable/admin/_common.scss
|
@@ -508,6 +523,7 @@ files:
|
|
508
523
|
- app/controllers/comable/admin/payment_methods_controller.rb
|
509
524
|
- app/controllers/comable/admin/products_controller.rb
|
510
525
|
- app/controllers/comable/admin/shipment_methods_controller.rb
|
526
|
+
- app/controllers/comable/admin/stock_locations_controller.rb
|
511
527
|
- app/controllers/comable/admin/stocks_controller.rb
|
512
528
|
- app/controllers/comable/admin/store_controller.rb
|
513
529
|
- app/controllers/comable/admin/themes_controller.rb
|
@@ -548,9 +564,11 @@ files:
|
|
548
564
|
- app/views/comable/admin/payment_methods/index.slim
|
549
565
|
- app/views/comable/admin/payment_methods/new.slim
|
550
566
|
- app/views/comable/admin/products/_form.slim
|
567
|
+
- app/views/comable/admin/products/_property_fields.slim
|
551
568
|
- app/views/comable/admin/products/edit.slim
|
552
569
|
- app/views/comable/admin/products/index.slim
|
553
570
|
- app/views/comable/admin/products/new.slim
|
571
|
+
- app/views/comable/admin/shared/_address_form.slim
|
554
572
|
- app/views/comable/admin/shared/_advanced_search.slim
|
555
573
|
- app/views/comable/admin/shared/_condition_fields.slim
|
556
574
|
- app/views/comable/admin/shared/_footer.slim
|
@@ -559,6 +577,7 @@ files:
|
|
559
577
|
- app/views/comable/admin/shared/_notifier.slim
|
560
578
|
- app/views/comable/admin/shared/_option_type_fields.slim
|
561
579
|
- app/views/comable/admin/shared/_option_types_fields.slim
|
580
|
+
- app/views/comable/admin/shared/_stocks_fields.slim
|
562
581
|
- app/views/comable/admin/shared/_value_fields.slim
|
563
582
|
- app/views/comable/admin/shared/_variant_form.slim
|
564
583
|
- app/views/comable/admin/shared/_variants_fields.slim
|
@@ -567,6 +586,10 @@ files:
|
|
567
586
|
- app/views/comable/admin/shipment_methods/edit.slim
|
568
587
|
- app/views/comable/admin/shipment_methods/index.slim
|
569
588
|
- app/views/comable/admin/shipment_methods/new.slim
|
589
|
+
- app/views/comable/admin/stock_locations/_form.slim
|
590
|
+
- app/views/comable/admin/stock_locations/edit.slim
|
591
|
+
- app/views/comable/admin/stock_locations/index.slim
|
592
|
+
- app/views/comable/admin/stock_locations/new.slim
|
570
593
|
- app/views/comable/admin/stocks/_form.slim
|
571
594
|
- app/views/comable/admin/stocks/edit.slim
|
572
595
|
- app/views/comable/admin/stocks/index.slim
|
@@ -623,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
623
646
|
version: 1.3.1
|
624
647
|
requirements: []
|
625
648
|
rubyforge_project:
|
626
|
-
rubygems_version: 2.
|
649
|
+
rubygems_version: 2.4.5
|
627
650
|
signing_key:
|
628
651
|
specification_version: 4
|
629
652
|
summary: Provide backend functions for Comable.
|