comable_backend 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/comable/admin/application.coffee +21 -14
- data/app/assets/stylesheets/comable/admin/_common.scss +264 -0
- data/app/assets/stylesheets/comable/admin/_dashboard.scss +81 -0
- data/app/assets/stylesheets/comable/admin/_errors.scss +18 -0
- data/app/assets/stylesheets/comable/admin/_mixins.scss +16 -0
- data/app/assets/stylesheets/comable/admin/_orders.scss +54 -0
- data/app/assets/stylesheets/comable/admin/_overrides.scss +4 -0
- data/app/assets/stylesheets/comable/admin/_products.scss +18 -0
- data/app/assets/stylesheets/comable/admin/_user_sessions.scss +57 -0
- data/app/assets/stylesheets/comable/admin/_variables.scss +44 -0
- data/app/assets/stylesheets/comable/admin/application.scss +15 -597
- data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +83 -0
- data/app/assets/stylesheets/comable/admin/overrides/jstree.scss +71 -0
- data/app/assets/stylesheets/comable/admin/overrides/pace.scss +4 -0
- data/app/assets/stylesheets/comable/admin/overrides/tagit.scss +22 -0
- data/app/controllers/comable/admin/application_controller.rb +3 -0
- data/app/controllers/comable/admin/categories_controller.rb +3 -0
- data/app/controllers/comable/admin/customers_controller.rb +6 -0
- data/app/controllers/comable/admin/orders_controller.rb +3 -0
- data/app/controllers/comable/admin/payment_methods_controller.rb +7 -1
- data/app/controllers/comable/admin/products_controller.rb +10 -4
- data/app/controllers/comable/admin/shipment_methods_controller.rb +7 -1
- data/app/controllers/comable/admin/stocks_controller.rb +16 -20
- data/app/controllers/comable/admin/store_controller.rb +3 -0
- data/app/controllers/comable/admin/user_sessions_controller.rb +7 -0
- data/app/helpers/comable/admin/application_helper.rb +16 -0
- data/app/views/comable/admin/categories/index.slim +83 -86
- data/app/views/comable/admin/customers/edit.slim +64 -79
- data/app/views/comable/admin/customers/index.slim +60 -59
- data/app/views/comable/admin/customers/show.slim +83 -88
- data/app/views/comable/admin/dashboard/show.slim +59 -57
- data/app/views/comable/admin/orders/_google_map.slim +22 -0
- data/app/views/comable/admin/orders/index.slim +67 -70
- data/app/views/comable/admin/orders/show.slim +98 -68
- data/app/views/comable/admin/payment_methods/_form.slim +26 -41
- data/app/views/comable/admin/payment_methods/edit.slim +25 -26
- data/app/views/comable/admin/payment_methods/index.slim +38 -50
- data/app/views/comable/admin/payment_methods/new.slim +14 -15
- data/app/views/comable/admin/products/_form.slim +124 -101
- data/app/views/comable/admin/products/_image_fields.slim +15 -0
- data/app/views/comable/admin/products/edit.slim +39 -38
- data/app/views/comable/admin/products/index.slim +64 -70
- data/app/views/comable/admin/products/new.slim +14 -15
- data/app/views/comable/admin/shared/_footer.slim +8 -0
- data/app/views/comable/admin/shared/_header.slim +31 -0
- data/app/views/comable/admin/shared/_notifier.slim +5 -0
- data/app/views/comable/admin/shared/_sidebar.slim +52 -0
- data/app/views/comable/admin/shipment_methods/_form.slim +23 -43
- data/app/views/comable/admin/shipment_methods/edit.slim +25 -26
- data/app/views/comable/admin/shipment_methods/index.slim +35 -47
- data/app/views/comable/admin/shipment_methods/new.slim +14 -15
- data/app/views/comable/admin/stocks/_form.slim +27 -33
- data/app/views/comable/admin/stocks/edit.slim +35 -44
- data/app/views/comable/admin/stocks/index.slim +57 -76
- data/app/views/comable/admin/stocks/new.slim +16 -15
- data/app/views/comable/admin/store/_form.slim +26 -42
- data/app/views/comable/admin/store/edit.slim +10 -11
- data/app/views/comable/admin/user_sessions/new.slim +25 -0
- data/app/views/layouts/comable/admin/application.slim +14 -96
- data/config/routes.rb +4 -1
- data/lib/comable/backend/engine.rb +2 -1
- metadata +93 -53
- data/app/assets/stylesheets/comable/admin/products.css +0 -4
@@ -1,94 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
li
|
8
|
-
= link_to @customer.human_id, comable.admin_customer_path(@customer)
|
9
|
-
li.active
|
10
|
-
= Comable.t('admin.nav.customers.edit')
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.customer'), comable.admin_customers_path
|
12
|
+
li>
|
13
|
+
= link_to @customer.human_id, comable.admin_customer_path(@customer)
|
14
|
+
li.active
|
15
|
+
= Comable.t('admin.actions.edit')
|
16
|
+
|
17
|
+
.comable-page-body
|
18
|
+
section
|
19
|
+
= error_messages_for @customer
|
16
20
|
|
17
|
-
.row
|
18
|
-
section.col-sm-8
|
19
21
|
= form_for @customer, url: comable.admin_customer_path(@customer) do |f|
|
20
|
-
.
|
21
|
-
.
|
22
|
-
.panel-title
|
23
|
-
= Comable.t('admin.nav.customers.edit')
|
24
|
-
.panel-body
|
25
|
-
.form-horizontal
|
26
|
-
fieldset
|
27
|
-
.form-group
|
28
|
-
.col-sm-3.control-label
|
29
|
-
= f.label :role
|
30
|
-
.col-sm-6
|
31
|
-
= f.select :role, @customer.class.role.options, {}, disabled: (@customer == current_customer)
|
22
|
+
.hidden
|
23
|
+
= f.submit
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
= f.text_field :email
|
25
|
+
fieldset
|
26
|
+
.col-sm-3
|
27
|
+
legend
|
28
|
+
= Comable.t('admin.general')
|
29
|
+
.help-block
|
39
30
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
= f.password_field :password
|
31
|
+
.col-sm-9
|
32
|
+
.form-group
|
33
|
+
= f.label :role
|
34
|
+
= f.select :role, @customer.class.role.options, {}, disabled: (@customer == current_customer)
|
45
35
|
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
.form-group
|
37
|
+
= f.label :email
|
38
|
+
= f.text_field :email
|
49
39
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
= ff.label :full_name
|
54
|
-
.col-sm-3
|
55
|
-
= ff.text_field :family_name, placeholder: ff.object.class.human_attribute_name(:family_name)
|
56
|
-
.col-sm-3
|
57
|
-
= ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
|
40
|
+
.form-group
|
41
|
+
= f.label :password
|
42
|
+
= f.password_field :password
|
58
43
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
44
|
+
- if @customer.bill_address
|
45
|
+
fieldset
|
46
|
+
.col-sm-3
|
47
|
+
legend
|
48
|
+
= f.object.class.human_attribute_name(:bill_address)
|
49
|
+
.help-block
|
64
50
|
|
65
|
-
|
66
|
-
|
67
|
-
|
51
|
+
.col-sm-9
|
52
|
+
= f.fields_for :bill_address do |ff|
|
53
|
+
.form-group
|
54
|
+
= ff.label :full_name
|
55
|
+
.row
|
68
56
|
.col-sm-6
|
69
|
-
= ff.text_field :
|
70
|
-
|
71
|
-
.form-group
|
72
|
-
.col-sm-3.control-label
|
73
|
-
= ff.label :city
|
57
|
+
= ff.text_field :family_name, placeholder: ff.object.class.human_attribute_name(:family_name)
|
74
58
|
.col-sm-6
|
75
|
-
= ff.text_field :
|
59
|
+
= ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
|
76
60
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
.col-sm-6
|
81
|
-
= ff.text_field :detail
|
61
|
+
.form-group
|
62
|
+
= ff.label :zip_code
|
63
|
+
= ff.text_field :zip_code, max_length: 8
|
82
64
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
.col-sm-6
|
87
|
-
= ff.text_field :phone_number, max_length: 18
|
65
|
+
.form-group
|
66
|
+
= ff.label :state_name
|
67
|
+
= ff.text_field :state_name
|
88
68
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
93
76
|
|
94
|
-
|
77
|
+
.form-group
|
78
|
+
= ff.label :phone_number
|
79
|
+
= ff.text_field :phone_number, max_length: 18
|
@@ -1,68 +1,69 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
ul.pull-right.list-inline
|
4
|
+
li
|
5
|
+
.btn-group role="group"
|
6
|
+
= link_to_previous_page @customers, '<', class: 'btn btn-default' do
|
7
|
+
.btn.btn-default disabled="disabled"
|
8
|
+
| <
|
9
|
+
= link_to_next_page @customers, '>', class: 'btn btn-default' do
|
10
|
+
.btn.btn-default disabled="disabled"
|
11
|
+
| >
|
12
|
+
|
13
|
+
h1.page-header
|
6
14
|
= Comable.t('admin.nav.customer')
|
15
|
+
small<
|
16
|
+
= @customers.total_count
|
17
|
+
= Comable.t('admin.results')
|
7
18
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
19
|
+
.comable-page-body
|
20
|
+
.comable-search
|
21
|
+
= search_form_for @q, url: comable.admin_customers_path do |f|
|
22
|
+
.input-group
|
23
|
+
span.input-group-btn
|
24
|
+
button.btn.btn-default.dropdown-toggle type="button" data-toggle="dropdown"
|
25
|
+
i.fa.fa-search
|
26
|
+
span.caret<
|
27
|
+
ul.dropdown-menu role="menu"
|
28
|
+
li
|
29
|
+
= link_to Comable.t('admin.clear_search_conditions'), comable.admin_customers_path
|
30
|
+
= f.text_field :email_cont, class: 'form-control'
|
31
|
+
span.input-group-btn
|
32
|
+
= f.submit Comable.t('admin.search'), class: 'btn btn-default'
|
13
33
|
|
14
|
-
|
15
|
-
section.col-sm-8
|
34
|
+
section
|
16
35
|
- if @customers.empty?
|
17
36
|
= Comable.t('admin.not_found')
|
18
37
|
- else
|
19
|
-
.
|
20
|
-
|
21
|
-
|
22
|
-
=
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
= customer.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
span> = customer.bill_address.detail
|
49
|
-
td
|
50
|
-
= customer.orders.count
|
51
|
-
= Comable.t('admin.times')
|
38
|
+
table.table.table-striped
|
39
|
+
thead
|
40
|
+
th
|
41
|
+
= sort_link [:comable, @q], :id
|
42
|
+
th
|
43
|
+
= sort_link [:comable, @q], :email
|
44
|
+
th
|
45
|
+
= @customers.klass.human_attribute_name(:bill_full_name)
|
46
|
+
th
|
47
|
+
= @customers.klass.human_attribute_name(:bill_address)
|
48
|
+
th
|
49
|
+
= @customers.klass.human_attribute_name(:orders)
|
50
|
+
tbody
|
51
|
+
- @customers.each do |customer|
|
52
|
+
tr
|
53
|
+
td
|
54
|
+
= link_to customer.human_id, comable.admin_customer_path(customer)
|
55
|
+
td
|
56
|
+
= customer.email
|
57
|
+
td
|
58
|
+
= customer.bill_full_name
|
59
|
+
td
|
60
|
+
- if customer.bill_address
|
61
|
+
span> = customer.bill_address.state_name
|
62
|
+
span> = customer.bill_address.city
|
63
|
+
span> = customer.bill_address.detail
|
64
|
+
td
|
65
|
+
= customer.orders.count
|
66
|
+
= Comable.t('admin.times')
|
52
67
|
|
53
68
|
.text-center
|
54
69
|
= paginate @customers, theme: :comable_backend
|
55
|
-
|
56
|
-
nav.col-sm-4
|
57
|
-
#comable-affix
|
58
|
-
.panel
|
59
|
-
.panel-body
|
60
|
-
= search_form_for @q, url: comable.admin_customers_path do |f|
|
61
|
-
.form-horizontal
|
62
|
-
.form-group
|
63
|
-
.col-sm-3.control-label
|
64
|
-
= f.label :email
|
65
|
-
.col-sm-9
|
66
|
-
= f.text_field :email_cont
|
67
|
-
.text-right
|
68
|
-
= f.submit Comable.t('admin.search'), class: 'btn btn-default'
|
@@ -1,93 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
ul.pull-right.list-inline
|
4
|
+
li.btn-group
|
5
|
+
= link_to comable.edit_admin_customer_path(@customer), class: 'btn btn-default' do
|
6
|
+
span.fa.fa-edit>
|
7
|
+
= Comable.t('admin.actions.edit')
|
8
|
+
= link_to Comable.t('admin.nav.order'), comable.admin_orders_path(q: { customer_id_eq: @customer.id }), class: 'btn btn-default'
|
9
|
+
li
|
10
|
+
/ TODO: Comment out after implemented.
|
11
|
+
/ = link_to Comable.t('admin.nav.orders.cart'), '#', class: 'btn btn-default'
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
h1.page-header
|
14
|
+
ol.breadcrumb
|
15
|
+
li>
|
16
|
+
= link_to Comable.t('admin.nav.customer'), comable.admin_customers_path
|
17
|
+
li.active
|
18
|
+
= @customer.human_id
|
19
|
+
- if @customer.bill_full_name
|
20
|
+
small<
|
21
|
+
= Comable.t('honorific', name: @customer.bill_full_name)
|
14
22
|
|
15
|
-
.
|
16
|
-
section
|
17
|
-
.
|
18
|
-
|
19
|
-
.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
= @customer.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
li = @customer.bill_address.full_name
|
38
|
-
li = @customer.bill_address.state_name
|
39
|
-
li = @customer.bill_address.city
|
40
|
-
li = @customer.bill_address.detail
|
41
|
-
li = "#{@customer.bill_address.class.human_attribute_name(:phone_number)}: #{@customer.bill_address.phone_number}"
|
42
|
-
.panel-footer.text-right
|
43
|
-
= link_to comable.edit_admin_customer_path(@customer), class: 'btn btn-default' do
|
44
|
-
span.fa.fa-edit>
|
45
|
-
= Comable.t('admin.actions.edit')
|
23
|
+
.comable-page-body
|
24
|
+
section
|
25
|
+
dl.dl-horizontal
|
26
|
+
dt
|
27
|
+
= @customer.class.human_attribute_name(:role)
|
28
|
+
dd
|
29
|
+
= @customer.role.text
|
30
|
+
dt
|
31
|
+
= @customer.class.human_attribute_name(:email)
|
32
|
+
dd
|
33
|
+
= @customer.email
|
34
|
+
- if @customer.bill_address
|
35
|
+
dt
|
36
|
+
= @customer.class.human_attribute_name(:bill_address)
|
37
|
+
dd
|
38
|
+
ul.list-unstyled
|
39
|
+
li = @customer.bill_address.zip_code
|
40
|
+
li = @customer.bill_address.full_name
|
41
|
+
li = @customer.bill_address.state_name
|
42
|
+
li = @customer.bill_address.city
|
43
|
+
li = @customer.bill_address.detail
|
44
|
+
li = "#{@customer.bill_address.class.human_attribute_name(:phone_number)}: #{@customer.bill_address.phone_number}"
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
th
|
57
|
-
= @customer.orders.klass.human_attribute_name(:state)
|
58
|
-
th
|
59
|
-
= @customer.orders.klass.human_attribute_name(:bill_full_name)
|
60
|
-
th
|
61
|
-
= @customer.orders.klass.human_attribute_name(:order_details)
|
62
|
-
th
|
63
|
-
= @customer.orders.klass.human_attribute_name(:total_price)
|
64
|
-
th
|
65
|
-
= @customer.orders.klass.human_attribute_name(:completed_at)
|
66
|
-
tbody
|
67
|
-
- @customer.orders.limit(5).each do |order|
|
46
|
+
- if @customer.orders.any?
|
47
|
+
section
|
48
|
+
.panel.panel-default
|
49
|
+
.panel-heading
|
50
|
+
.panel-title
|
51
|
+
= Comable.t('admin.nav.customers.new_orders', count: 5)
|
52
|
+
|
53
|
+
table.table
|
54
|
+
thead
|
68
55
|
tr
|
69
|
-
|
70
|
-
=
|
71
|
-
|
72
|
-
=
|
73
|
-
|
74
|
-
=
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
56
|
+
th
|
57
|
+
= @customer.orders.klass.human_attribute_name(:code)
|
58
|
+
th
|
59
|
+
= @customer.orders.klass.human_attribute_name(:state)
|
60
|
+
th
|
61
|
+
= @customer.orders.klass.human_attribute_name(:bill_full_name)
|
62
|
+
th
|
63
|
+
= @customer.orders.klass.human_attribute_name(:order_details)
|
64
|
+
th
|
65
|
+
= @customer.orders.klass.human_attribute_name(:total_price)
|
66
|
+
th
|
67
|
+
= @customer.orders.klass.human_attribute_name(:completed_at)
|
68
|
+
tbody
|
69
|
+
- @customer.orders.limit(5).each do |order|
|
70
|
+
tr
|
71
|
+
td
|
72
|
+
= link_to order.code, comable.admin_order_path(order)
|
73
|
+
td
|
74
|
+
= order.human_state_name
|
75
|
+
td
|
76
|
+
= order.bill_full_name
|
77
|
+
td
|
78
|
+
ul.list-unstyled
|
79
|
+
- order.order_details.each do |order_detail|
|
80
|
+
li
|
81
|
+
| #{order_detail.name_with_sku} x #{order_detail.quantity}
|
82
|
+
td
|
83
|
+
= number_to_currency order.total_price
|
84
|
+
td
|
85
|
+
= l order.completed_at
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
.panel
|
90
|
-
.list-group
|
91
|
-
= link_to Comable.t('admin.nav.order'), comable.admin_orders_path(q: { customer_id_eq: @customer.id }), class: 'list-group-item'
|
92
|
-
/ TODO: Comment out after implemented.
|
93
|
-
/ = link_to Comable.t('admin.nav.orders.cart'), '#', class: 'list-group-item'
|
87
|
+
.panel-footer.text-right
|
88
|
+
= link_to Comable.t('admin.more'), comable.admin_orders_path(search_customer_id: @customer.id), class: 'btn btn-default'
|
@@ -1,63 +1,65 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
h1.page-header
|
4
|
+
= Comable.t('admin.nav.dashboard')
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
.comable-page-body
|
7
|
+
section
|
8
|
+
.col-sm-4
|
9
|
+
- number = @this_week_orders.count
|
10
|
+
= render 'widget',
|
11
|
+
title: Comable.t('admin.new_orders'),
|
12
|
+
number: number_with_delimiter(number),
|
13
|
+
progress: (number.to_f / @last_week_orders.count) * 100,
|
14
|
+
color: 'green',
|
15
|
+
fa: 'shopping-cart'
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
.col-sm-4
|
18
|
+
- number = @this_week_orders.sum(:total_price)
|
19
|
+
= render 'widget',
|
20
|
+
title: Comable.t('admin.sales'),
|
21
|
+
number: number_to_currency(number),
|
22
|
+
progress: (number.to_f / @last_week_orders.sum(:total_price)) * 100,
|
23
|
+
color: 'blue',
|
24
|
+
fa: 'dollar'
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
/ TODO: Comment out after adding timestamp columns
|
27
|
+
.col-sm-4
|
28
|
+
- number = @this_week_customers.count
|
29
|
+
= render 'widget',
|
30
|
+
title: Comable.t('admin.new_users'),
|
31
|
+
number: number_with_delimiter(number),
|
32
|
+
progress: (number.to_f / @last_week_customers.count) * 100,
|
33
|
+
color: 'black',
|
34
|
+
fa: 'user'
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
section
|
37
|
+
.col-sm-12
|
38
|
+
.panel.panel-default
|
39
|
+
.panel-body
|
40
|
+
#comable-morris.morris style="height: 300px;"
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
javascript:
|
43
|
+
morris_data = #{raw @this_month_orders.to_morris};
|
44
|
+
morris_keys = #{raw Comable::Order.morris_keys};
|
45
|
+
morris_labels = ['#{Comable.t('admin.order_count')}', '#{Comable.t('admin.sales')}'];
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
47
|
+
coffee:
|
48
|
+
new Morris.Line({
|
49
|
+
# ID of the element in which to draw the chart.
|
50
|
+
element: 'comable-morris',
|
51
|
+
# Chart data records -- each entry in this array corresponds to a point on
|
52
|
+
# the chart.
|
53
|
+
data: morris_data,
|
54
|
+
# The name of the data record attribute that contains x-values.
|
55
|
+
xkey: 'date',
|
56
|
+
# A list of names of data record attributes that contain y-values.
|
57
|
+
ykeys: morris_keys,
|
58
|
+
# Labels for the ykeys -- will be displayed when you hover over the
|
59
|
+
# chart.
|
60
|
+
labels: morris_labels,
|
61
|
+
xLabelAngle: 45,
|
62
|
+
xLabels: ['day'],
|
63
|
+
lineColors: ['#00acac', '#348fe2'],
|
64
|
+
hideHover: 'auto'
|
65
|
+
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/ TODO: Refactoring
|
2
|
+
= javascript_include_tag '//maps.google.com/maps/api/js?v=3&sensor=false'
|
3
|
+
|
4
|
+
coffee:
|
5
|
+
window.initialize_google_map = (element_id, address) ->
|
6
|
+
google_map = new google.maps.Map(document.getElementById(element_id), { zoom: 15 })
|
7
|
+
google_geo = new google.maps.Geocoder()
|
8
|
+
google_geo.geocode({ address: address }, (result, status) =>
|
9
|
+
return if status != google.maps.GeocoderStatus.OK
|
10
|
+
location = result[0].geometry.location
|
11
|
+
google_map.setCenter(location)
|
12
|
+
new google.maps.Marker({ map: google_map, position: location })
|
13
|
+
)
|
14
|
+
|
15
|
+
javascript:
|
16
|
+
$(document).ready(function() {
|
17
|
+
initialize_google_map('#{id}', '#{address.full_address}');
|
18
|
+
})
|
19
|
+
|
20
|
+
.comable-map
|
21
|
+
.comable-google-map id="#{id}"
|
22
|
+
| Loading map...
|