comable_backend 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/comable/admin/application.coffee +21 -14
  3. data/app/assets/stylesheets/comable/admin/_common.scss +264 -0
  4. data/app/assets/stylesheets/comable/admin/_dashboard.scss +81 -0
  5. data/app/assets/stylesheets/comable/admin/_errors.scss +18 -0
  6. data/app/assets/stylesheets/comable/admin/_mixins.scss +16 -0
  7. data/app/assets/stylesheets/comable/admin/_orders.scss +54 -0
  8. data/app/assets/stylesheets/comable/admin/_overrides.scss +4 -0
  9. data/app/assets/stylesheets/comable/admin/_products.scss +18 -0
  10. data/app/assets/stylesheets/comable/admin/_user_sessions.scss +57 -0
  11. data/app/assets/stylesheets/comable/admin/_variables.scss +44 -0
  12. data/app/assets/stylesheets/comable/admin/application.scss +15 -597
  13. data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +83 -0
  14. data/app/assets/stylesheets/comable/admin/overrides/jstree.scss +71 -0
  15. data/app/assets/stylesheets/comable/admin/overrides/pace.scss +4 -0
  16. data/app/assets/stylesheets/comable/admin/overrides/tagit.scss +22 -0
  17. data/app/controllers/comable/admin/application_controller.rb +3 -0
  18. data/app/controllers/comable/admin/categories_controller.rb +3 -0
  19. data/app/controllers/comable/admin/customers_controller.rb +6 -0
  20. data/app/controllers/comable/admin/orders_controller.rb +3 -0
  21. data/app/controllers/comable/admin/payment_methods_controller.rb +7 -1
  22. data/app/controllers/comable/admin/products_controller.rb +10 -4
  23. data/app/controllers/comable/admin/shipment_methods_controller.rb +7 -1
  24. data/app/controllers/comable/admin/stocks_controller.rb +16 -20
  25. data/app/controllers/comable/admin/store_controller.rb +3 -0
  26. data/app/controllers/comable/admin/user_sessions_controller.rb +7 -0
  27. data/app/helpers/comable/admin/application_helper.rb +16 -0
  28. data/app/views/comable/admin/categories/index.slim +83 -86
  29. data/app/views/comable/admin/customers/edit.slim +64 -79
  30. data/app/views/comable/admin/customers/index.slim +60 -59
  31. data/app/views/comable/admin/customers/show.slim +83 -88
  32. data/app/views/comable/admin/dashboard/show.slim +59 -57
  33. data/app/views/comable/admin/orders/_google_map.slim +22 -0
  34. data/app/views/comable/admin/orders/index.slim +67 -70
  35. data/app/views/comable/admin/orders/show.slim +98 -68
  36. data/app/views/comable/admin/payment_methods/_form.slim +26 -41
  37. data/app/views/comable/admin/payment_methods/edit.slim +25 -26
  38. data/app/views/comable/admin/payment_methods/index.slim +38 -50
  39. data/app/views/comable/admin/payment_methods/new.slim +14 -15
  40. data/app/views/comable/admin/products/_form.slim +124 -101
  41. data/app/views/comable/admin/products/_image_fields.slim +15 -0
  42. data/app/views/comable/admin/products/edit.slim +39 -38
  43. data/app/views/comable/admin/products/index.slim +64 -70
  44. data/app/views/comable/admin/products/new.slim +14 -15
  45. data/app/views/comable/admin/shared/_footer.slim +8 -0
  46. data/app/views/comable/admin/shared/_header.slim +31 -0
  47. data/app/views/comable/admin/shared/_notifier.slim +5 -0
  48. data/app/views/comable/admin/shared/_sidebar.slim +52 -0
  49. data/app/views/comable/admin/shipment_methods/_form.slim +23 -43
  50. data/app/views/comable/admin/shipment_methods/edit.slim +25 -26
  51. data/app/views/comable/admin/shipment_methods/index.slim +35 -47
  52. data/app/views/comable/admin/shipment_methods/new.slim +14 -15
  53. data/app/views/comable/admin/stocks/_form.slim +27 -33
  54. data/app/views/comable/admin/stocks/edit.slim +35 -44
  55. data/app/views/comable/admin/stocks/index.slim +57 -76
  56. data/app/views/comable/admin/stocks/new.slim +16 -15
  57. data/app/views/comable/admin/store/_form.slim +26 -42
  58. data/app/views/comable/admin/store/edit.slim +10 -11
  59. data/app/views/comable/admin/user_sessions/new.slim +25 -0
  60. data/app/views/layouts/comable/admin/application.slim +14 -96
  61. data/config/routes.rb +4 -1
  62. data/lib/comable/backend/engine.rb +2 -1
  63. metadata +93 -53
  64. data/app/assets/stylesheets/comable/admin/products.css +0 -4
@@ -1,94 +1,79 @@
1
- #comable-customer
2
- ol.breadcrumb
3
- li
4
- = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
- li
6
- = link_to Comable.t('admin.nav.customer'), comable.admin_customers_path
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
- h1.page-header
13
- = @customer.human_id
14
- small<
15
- = Comable.t('honorific', name: @customer.bill_full_name)
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
- .panel.panel-inverse
21
- .panel-heading
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
- fieldset
34
- .form-group
35
- .col-sm-3.control-label
36
- = f.label :email
37
- .col-sm-6
38
- = f.text_field :email
25
+ fieldset
26
+ .col-sm-3
27
+ legend
28
+ = Comable.t('admin.general')
29
+ .help-block
39
30
 
40
- .form-group
41
- .col-sm-3.control-label
42
- = f.label :password
43
- .col-sm-6
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
- fieldset
47
- legend.text-center.text-muted
48
- = f.object.class.human_attribute_name(:bill_address)
36
+ .form-group
37
+ = f.label :email
38
+ = f.text_field :email
49
39
 
50
- = f.fields_for :bill_address do |ff|
51
- .form-group
52
- .col-sm-3.control-label
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
- .form-group
60
- .col-sm-3.control-label
61
- = ff.label :zip_code
62
- .col-sm-6
63
- = ff.text_field :zip_code, max_length: 8
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
- .form-group
66
- .col-sm-3.control-label
67
- = ff.label :state_name
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 :state_name
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 :city
59
+ = ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
76
60
 
77
- .form-group
78
- .col-sm-3.control-label
79
- = ff.label :detail
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
- .form-group
84
- .col-sm-3.control-label
85
- = ff.label :phone_number
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
- .panel-footer
90
- = link_to Comable.t('admin.actions.cancel'), comable.admin_customer_path(@customer), class: 'btn btn-default'
91
- .pull-right
92
- = f.submit
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
- nav.col-sm-4
77
+ .form-group
78
+ = ff.label :phone_number
79
+ = ff.text_field :phone_number, max_length: 18
@@ -1,68 +1,69 @@
1
- #comable-customer
2
- ol.breadcrumb
3
- li
4
- = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
- li.active
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
- h1.page-header
9
- = Comable.t('admin.nav.customer')
10
- small<
11
- = @customers.total_count
12
- = Comable.t('admin.results')
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
- .row
15
- section.col-sm-8
34
+ section
16
35
  - if @customers.empty?
17
36
  = Comable.t('admin.not_found')
18
37
  - else
19
- .panel.panel-inverse
20
- .panel-heading
21
- .panel-title
22
- = Comable.t('admin.index')
23
- table.table.table-striped
24
- thead
25
- th
26
- = sort_link [:comable, @q], :id
27
- th
28
- = sort_link [:comable, @q], :email
29
- th
30
- = @customers.klass.human_attribute_name(:bill_full_name)
31
- th
32
- = @customers.klass.human_attribute_name(:bill_address)
33
- th
34
- = @customers.klass.human_attribute_name(:orders)
35
- tbody
36
- - @customers.each do |customer|
37
- tr
38
- td
39
- = link_to customer.human_id, comable.admin_customer_path(customer)
40
- td
41
- = customer.email
42
- td
43
- = customer.bill_full_name
44
- td
45
- - if customer.bill_address
46
- span> = customer.bill_address.state_name
47
- span> = customer.bill_address.city
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
- #comable-customer
2
- ol.breadcrumb
3
- li
4
- = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
- li
6
- = link_to Comable.t('admin.nav.customer'), comable.admin_customers_path
7
- li.active
8
- = @customer.human_id
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
- h1.page-header
11
- = @customer.human_id
12
- small<
13
- = Comable.t('honorific', name: @customer.bill_full_name)
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
- .row
16
- section.col-sm-8
17
- .panel.panel-inverse
18
- .panel-heading
19
- .panel-title
20
- = Comable.t('admin.nav.customers.detail')
21
- .panel-body
22
- dl.dl-horizontal
23
- dt
24
- = @customer.class.human_attribute_name(:role)
25
- dd
26
- = @customer.role.text
27
- dt
28
- = @customer.class.human_attribute_name(:email)
29
- dd
30
- = @customer.email
31
- dt
32
- = @customer.class.human_attribute_name(:bill_address)
33
- dd
34
- - if @customer.bill_address
35
- ul.list-unstyled
36
- li = @customer.bill_address.zip_code
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
- .panel.panel-inverse
48
- .panel-heading
49
- .panel-title
50
- = Comable.t('admin.nav.customers.new_orders', count: 5)
51
- table.table
52
- thead
53
- tr
54
- th
55
- = @customer.orders.klass.human_attribute_name(:code)
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
- td
70
- = link_to order.code, comable.admin_order_path(order)
71
- td
72
- = order.human_state_name
73
- td
74
- = order.bill_full_name
75
- td
76
- ul.list-unstyled
77
- - order.order_details.each do |order_detail|
78
- li
79
- | #{order_detail.name_with_sku} x #{order_detail.quantity}
80
- td
81
- = number_to_currency order.total_price
82
- td
83
- = l order.completed_at
84
- .panel-footer.text-right
85
- = link_to Comable.t('admin.more'), comable.admin_orders_path(search_customer_id: @customer.id), class: 'btn btn-default'
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
- nav.col-sm-4
88
- #comable-affix data-spy="affix"
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
- #comable-dashboard
2
- h1.page-header
3
- = Comable.t('admin.nav.dashboard')
1
+ .comable-page
2
+ .comable-page-heading
3
+ h1.page-header
4
+ = Comable.t('admin.nav.dashboard')
4
5
 
5
- section.row
6
- .col-sm-4
7
- - number = @this_week_orders.count
8
- = render 'widget',
9
- title: Comable.t('admin.new_orders'),
10
- number: number_with_delimiter(number),
11
- progress: (number.to_f / @last_week_orders.count) * 100,
12
- color: 'green',
13
- fa: 'shopping-cart'
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
- .col-sm-4
16
- - number = @this_week_orders.sum(:total_price)
17
- = render 'widget',
18
- title: Comable.t('admin.sales'),
19
- number: number_to_currency(number),
20
- progress: (number.to_f / @last_week_orders.sum(:total_price)) * 100,
21
- color: 'blue',
22
- fa: 'dollar'
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
- / TODO: Comment out after adding timestamp columns
25
- .col-sm-4
26
- - number = @this_week_customers.count
27
- = render 'widget',
28
- title: Comable.t('admin.new_users'),
29
- number: number_with_delimiter(number),
30
- progress: (number.to_f / @last_week_customers.count) * 100,
31
- color: 'black',
32
- fa: 'user'
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
- section.row
35
- .col-sm-12
36
- .panel
37
- .panel-body
38
- #comable-morris.morris style="height: 300px;"
36
+ section
37
+ .col-sm-12
38
+ .panel.panel-default
39
+ .panel-body
40
+ #comable-morris.morris style="height: 300px;"
39
41
 
40
- javascript:
41
- morris_data = #{raw @this_month_orders.to_morris};
42
- morris_keys = #{raw Comable::Order.morris_keys};
43
- morris_labels = ['#{Comable.t('admin.order_count')}', '#{Comable.t('admin.sales')}'];
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
- coffee:
46
- new Morris.Line({
47
- # ID of the element in which to draw the chart.
48
- element: 'comable-morris',
49
- # Chart data records -- each entry in this array corresponds to a point on
50
- # the chart.
51
- data: morris_data,
52
- # The name of the data record attribute that contains x-values.
53
- xkey: 'date',
54
- # A list of names of data record attributes that contain y-values.
55
- ykeys: morris_keys,
56
- # Labels for the ykeys -- will be displayed when you hover over the
57
- # chart.
58
- labels: morris_labels,
59
- xLabelAngle: 45,
60
- xLabels: ['day'],
61
- lineColors: ['#00acac', '#348fe2'],
62
- hideHover: 'auto'
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...