comable-backend 0.6.0

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 (117) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +97 -0
  4. data/app/assets/javascripts/comable/admin/application.coffee +76 -0
  5. data/app/assets/javascripts/comable/admin/categories.coffee +59 -0
  6. data/app/assets/javascripts/comable/admin/dashboard.coffee +32 -0
  7. data/app/assets/javascripts/comable/admin/dispatcher.coffee +21 -0
  8. data/app/assets/javascripts/comable/admin/orders.coffee +44 -0
  9. data/app/assets/javascripts/comable/admin/pages.coffee +69 -0
  10. data/app/assets/javascripts/comable/admin/products.coffee +21 -0
  11. data/app/assets/javascripts/comable/admin/search.coffee +35 -0
  12. data/app/assets/javascripts/comable/admin/themes.coffee +64 -0
  13. data/app/assets/stylesheets/comable/admin/_common.scss +153 -0
  14. data/app/assets/stylesheets/comable/admin/_dashboard.scss +81 -0
  15. data/app/assets/stylesheets/comable/admin/_errors.scss +18 -0
  16. data/app/assets/stylesheets/comable/admin/_flow.scss +149 -0
  17. data/app/assets/stylesheets/comable/admin/_mixins.scss +16 -0
  18. data/app/assets/stylesheets/comable/admin/_orders.scss +54 -0
  19. data/app/assets/stylesheets/comable/admin/_overrides.scss +4 -0
  20. data/app/assets/stylesheets/comable/admin/_pages.scss +30 -0
  21. data/app/assets/stylesheets/comable/admin/_products.scss +18 -0
  22. data/app/assets/stylesheets/comable/admin/_themes.scss +71 -0
  23. data/app/assets/stylesheets/comable/admin/_user_sessions.scss +57 -0
  24. data/app/assets/stylesheets/comable/admin/_variables.scss +38 -0
  25. data/app/assets/stylesheets/comable/admin/application.scss +26 -0
  26. data/app/assets/stylesheets/comable/admin/overrides/awesome_admin_layout.scss +25 -0
  27. data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +81 -0
  28. data/app/assets/stylesheets/comable/admin/overrides/jstree.scss +71 -0
  29. data/app/assets/stylesheets/comable/admin/overrides/tagit.scss +22 -0
  30. data/app/controllers/comable/admin/application_controller.rb +58 -0
  31. data/app/controllers/comable/admin/categories_controller.rb +17 -0
  32. data/app/controllers/comable/admin/dashboard_controller.rb +19 -0
  33. data/app/controllers/comable/admin/orders_controller.rb +102 -0
  34. data/app/controllers/comable/admin/pages_controller.rb +72 -0
  35. data/app/controllers/comable/admin/payment_methods_controller.rb +59 -0
  36. data/app/controllers/comable/admin/products_controller.rb +82 -0
  37. data/app/controllers/comable/admin/shipment_methods_controller.rb +57 -0
  38. data/app/controllers/comable/admin/stocks_controller.rb +81 -0
  39. data/app/controllers/comable/admin/store_controller.rb +42 -0
  40. data/app/controllers/comable/admin/themes_controller.rb +101 -0
  41. data/app/controllers/comable/admin/trackers_controller.rb +58 -0
  42. data/app/controllers/comable/admin/user_sessions_controller.rb +8 -0
  43. data/app/controllers/comable/admin/users_controller.rb +47 -0
  44. data/app/helpers/comable/admin/application_helper.rb +53 -0
  45. data/app/helpers/comable/admin/orders_helper.rb +30 -0
  46. data/app/helpers/comable/admin/pages_helper.rb +6 -0
  47. data/app/helpers/comable/admin/products_helper.rb +6 -0
  48. data/app/helpers/comable/admin/shipment_methods_helper.rb +6 -0
  49. data/app/helpers/comable/admin/stores_helper.rb +6 -0
  50. data/app/helpers/comable/admin/themes_helper.rb +69 -0
  51. data/app/views/comable/admin/categories/index.slim +40 -0
  52. data/app/views/comable/admin/dashboard/_widget.slim +13 -0
  53. data/app/views/comable/admin/dashboard/show.slim +43 -0
  54. data/app/views/comable/admin/orders/_google_map.slim +39 -0
  55. data/app/views/comable/admin/orders/_payment_state.slim +40 -0
  56. data/app/views/comable/admin/orders/_shipment_state.slim +44 -0
  57. data/app/views/comable/admin/orders/edit.slim +170 -0
  58. data/app/views/comable/admin/orders/index.slim +95 -0
  59. data/app/views/comable/admin/orders/show.slim +177 -0
  60. data/app/views/comable/admin/pages/_form.slim +69 -0
  61. data/app/views/comable/admin/pages/edit.slim +31 -0
  62. data/app/views/comable/admin/pages/index.slim +55 -0
  63. data/app/views/comable/admin/pages/new.slim +16 -0
  64. data/app/views/comable/admin/payment_methods/_form.slim +35 -0
  65. data/app/views/comable/admin/payment_methods/edit.slim +27 -0
  66. data/app/views/comable/admin/payment_methods/index.slim +40 -0
  67. data/app/views/comable/admin/payment_methods/new.slim +16 -0
  68. data/app/views/comable/admin/products/_form.slim +137 -0
  69. data/app/views/comable/admin/products/edit.slim +41 -0
  70. data/app/views/comable/admin/products/index.slim +95 -0
  71. data/app/views/comable/admin/products/new.slim +16 -0
  72. data/app/views/comable/admin/shared/_advanced_search.slim +7 -0
  73. data/app/views/comable/admin/shared/_condition_fields.slim +15 -0
  74. data/app/views/comable/admin/shared/_footer.slim +8 -0
  75. data/app/views/comable/admin/shared/_grouping_fields.slim +8 -0
  76. data/app/views/comable/admin/shared/_image_fields.slim +15 -0
  77. data/app/views/comable/admin/shared/_notifier.slim +5 -0
  78. data/app/views/comable/admin/shared/_value_fields.slim +1 -0
  79. data/app/views/comable/admin/shared/export.xlsx.axlsx +17 -0
  80. data/app/views/comable/admin/shipment_methods/_form.slim +29 -0
  81. data/app/views/comable/admin/shipment_methods/edit.slim +27 -0
  82. data/app/views/comable/admin/shipment_methods/index.slim +37 -0
  83. data/app/views/comable/admin/shipment_methods/new.slim +16 -0
  84. data/app/views/comable/admin/stocks/_form.slim +34 -0
  85. data/app/views/comable/admin/stocks/edit.slim +37 -0
  86. data/app/views/comable/admin/stocks/index.slim +81 -0
  87. data/app/views/comable/admin/stocks/new.slim +18 -0
  88. data/app/views/comable/admin/store/_form.slim +32 -0
  89. data/app/views/comable/admin/store/edit.slim +12 -0
  90. data/app/views/comable/admin/themes/_editor.slim +8 -0
  91. data/app/views/comable/admin/themes/_form.slim +31 -0
  92. data/app/views/comable/admin/themes/edit.slim +35 -0
  93. data/app/views/comable/admin/themes/index.slim +37 -0
  94. data/app/views/comable/admin/themes/new.slim +16 -0
  95. data/app/views/comable/admin/themes/show_file.slim +93 -0
  96. data/app/views/comable/admin/trackers/_form.slim +109 -0
  97. data/app/views/comable/admin/trackers/edit.slim +27 -0
  98. data/app/views/comable/admin/trackers/index.slim +37 -0
  99. data/app/views/comable/admin/trackers/new.slim +16 -0
  100. data/app/views/comable/admin/user_sessions/new.slim +25 -0
  101. data/app/views/comable/admin/users/edit.slim +79 -0
  102. data/app/views/comable/admin/users/index.slim +71 -0
  103. data/app/views/comable/admin/users/show.slim +88 -0
  104. data/app/views/kaminari/comable_backend/_first_page.html.slim +2 -0
  105. data/app/views/kaminari/comable_backend/_gap.html.slim +2 -0
  106. data/app/views/kaminari/comable_backend/_last_page.html.slim +2 -0
  107. data/app/views/kaminari/comable_backend/_next_page.html.slim +2 -0
  108. data/app/views/kaminari/comable_backend/_page.html.slim +3 -0
  109. data/app/views/kaminari/comable_backend/_paginator.html.slim +15 -0
  110. data/app/views/kaminari/comable_backend/_prev_page.html.slim +2 -0
  111. data/app/views/layouts/comable/admin/application.slim +36 -0
  112. data/config/initializers/awesome_admin_layout.rb +110 -0
  113. data/config/routes.rb +63 -0
  114. data/lib/comable/backend.rb +1 -0
  115. data/lib/comable/backend/engine.rb +67 -0
  116. data/lib/tasks/comable_backend_tasks.rake +4 -0
  117. metadata +514 -0
@@ -0,0 +1,37 @@
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_theme_path, class: 'btn btn-default'
6
+
7
+ h1.page-header
8
+ = Comable.t('admin.nav.theme')
9
+ small<
10
+ | #{@themes.size} #{Comable.t('admin.results')}
11
+
12
+ .comable-page-body
13
+ - if @themes.empty?
14
+ = Comable.t('admin.not_found')
15
+ - else
16
+ table.table.table-striped
17
+ thead
18
+ th
19
+ = @themes.klass.human_attribute_name(:name)
20
+ th
21
+ = @themes.klass.human_attribute_name(:version)
22
+ th
23
+ = @themes.klass.human_attribute_name(:author)
24
+ tbody
25
+ - @themes.each do |theme|
26
+ tr
27
+ td
28
+ = link_to theme.display_name, comable.tree_admin_theme_path(theme)
29
+ - if current_store.theme != theme
30
+ span.fa.fa-eye-slash.text-muted<
31
+ td
32
+ = theme.version
33
+ td
34
+ - if theme.homepage
35
+ = link_to (theme.author.presence || theme.homepage), theme.homepage
36
+ - else
37
+ = theme.author
@@ -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.theme'), comable.admin_themes_path
12
+ li.active
13
+ = Comable.t('admin.actions.new')
14
+
15
+ .comable-page-body
16
+ = render 'form'
@@ -0,0 +1,93 @@
1
+ .comable-page
2
+ .comable-main-fixed-top
3
+ .comable-page-heading
4
+ ul.pull-right.list-inline
5
+ li
6
+ = link_to 'javascript:void();', class: 'btn btn-default', data: { toggle: 'modal', target: '#comable-help-modal' }
7
+ i.fa.fa-question-circle>
8
+ = Comable.t('admin.help')
9
+ li.btn-group
10
+ - if current_store.theme != @theme
11
+ = link_to comable.use_admin_theme_path(@theme), class: 'btn btn-default', method: 'put'
12
+ i.fa.fa-paint-brush>
13
+ = Comable.t('admin.use_this_theme')
14
+ = link_to comable.admin_theme_path(@theme), class: 'btn btn-default'
15
+ i.fa.fa-edit>
16
+ = Comable.t('admin.actions.property')
17
+ - if editable?
18
+ li
19
+ = link_to_save
20
+
21
+ h1.page-header
22
+ ol.breadcrumb
23
+ li>
24
+ = link_to Comable.t('admin.nav.theme'), comable.admin_themes_path
25
+ li.active
26
+ = @theme.display_name
27
+
28
+ .comable-page-body
29
+ .row
30
+ .col-md-3
31
+ #comable-file-tree
32
+ = display_views_directory_tree
33
+
34
+ .col-md-9
35
+ - if editable?
36
+ = render 'editor', code: @code, params: params
37
+ - else
38
+ #comable-theme-editor
39
+ .panel.panel-default
40
+ .panel-body
41
+ p
42
+ = Comable.t('admin.please_select_file_form_directory_tree_to_edit')
43
+ p
44
+ = Comable.t('admin.here_editor_will_be_displayed_and_you_can_edit_file')
45
+
46
+ .modal.fade#comable-help-modal tabindex="-1"
47
+ .modal-dialog
48
+ .modal-content
49
+ .modal-header
50
+ button.close type="button" data-dismiss="modal"
51
+ span
52
+ | &times;
53
+ h4.modal-title
54
+ = Comable.t('admin.help')
55
+ .modal-body
56
+ h4
57
+ = Comable.t('admin.about_sintax')
58
+ p
59
+ = Comable.t('admin.please_see_following_page_for_syntax')
60
+ span<
61
+ = link_to 'https://github.com/Shopify/liquid/wiki/Liquid-for-Designers', target: '_blank' do
62
+ | Liquid for Designers
63
+ i.fa.fa-external-link<
64
+
65
+ .row
66
+ .col-sm-6
67
+ h4
68
+ = Comable.t('admin.available_assigns')
69
+ dl
70
+ dt
71
+ = Comable.t('admin.available_assigns_in_all_pages')
72
+ - %w( current_store current_comable_user current_order current_trackers form_authenticity_token ).each do |method|
73
+ dd
74
+ code
75
+ | #{method}
76
+ - liquidable_models.each do |model|
77
+ dl
78
+ dt
79
+ = model.model_name.human
80
+ - model.available_liquid_methods.each do |method|
81
+ dd
82
+ code
83
+ | #{model.name.demodulize.underscore}.#{method}
84
+ .col-sm-6
85
+ h4
86
+ = Comable.t('admin.available_filters')
87
+ dl
88
+ dt
89
+ - helpers = [ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TranslationHelper, ActionView::Helpers::NumberHelper]
90
+ - helpers.map(&:public_instance_methods).flatten.sort.each do |method|
91
+ dd
92
+ code
93
+ | #{method}
@@ -0,0 +1,109 @@
1
+ = error_messages_for @tracker
2
+
3
+ = form_for [comable, :admin, @tracker] 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
+ .checkbox
15
+ = f.label :activated_flag do
16
+ = f.check_box :activated_flag
17
+ = f.object.class.human_attribute_name(:activated_flag)
18
+
19
+ .form-group
20
+ = f.label :name
21
+ = f.text_field :name
22
+
23
+ .form-group
24
+ = f.label :tracker_id
25
+ = f.text_field :tracker_id
26
+
27
+ .form-group
28
+ = f.label :code
29
+ = f.text_area :code, rows: (f.object.code ? f.object.code.lines.count : nil)
30
+
31
+ br
32
+
33
+ .panel.panel-default
34
+ .panel-heading type="button" data-toggle="collapse" data-target="#comable-help-code"
35
+ strong
36
+ span.fa.fa-angle-down>
37
+ = Comable.t('admin.help')
38
+ .collapse#comable-help-code
39
+ .panel-body.help-block
40
+ p
41
+ == Comable.t('admin.tracker_code_help_introduction')
42
+ p
43
+ = Comable.t('admin.list_of_usable_variables')
44
+ dl.dl-horizontal
45
+ dt
46
+ = Comable::Tracker.human_attribute_name(:tracker_id)
47
+ dd
48
+ | tracker_id
49
+ dt
50
+ = Comable::Order.human_attribute_name(:code)
51
+ dd
52
+ | order.code
53
+ dt
54
+ = Comable::Order.human_attribute_name(:payment_fee)
55
+ dd
56
+ | order.payment_fee
57
+ dt
58
+ = Comable::Order.human_attribute_name(:shipment_fee)
59
+ dd
60
+ | order.shipment_fee
61
+ dt
62
+ = Comable::Order.human_attribute_name(:item_total_price)
63
+ dd
64
+ | order.item_total_price
65
+ dt
66
+ = Comable::Order.human_attribute_name(:total_price)
67
+ dd
68
+ | order.total_price
69
+ dt
70
+ = Comable::Order.human_attribute_name(:order_items)
71
+ dd
72
+ | order.order_items
73
+ p
74
+ == Comable.t('admin.tracker_code_help_additional')
75
+ dl.dl-horizontal
76
+ dt
77
+ = Comable::OrderItem.human_attribute_name(:code)
78
+ dd
79
+ | order_item.code
80
+ dt
81
+ = Comable::OrderItem.human_attribute_name(:name)
82
+ dd
83
+ | order_item.name
84
+ dt
85
+ = Comable::OrderItem.human_attribute_name(:name_with_sku)
86
+ dd
87
+ | order_item.name_with_sku
88
+ dt
89
+ = Comable::OrderItem.human_attribute_name(:subtotal_price)
90
+ dd
91
+ | order_item.subtotal_price
92
+ dt
93
+ = Comable::OrderItem.human_attribute_name(:quantity)
94
+ dd
95
+ | order_item.quantity
96
+ dt
97
+ = Comable::OrderItem.human_attribute_name(:price)
98
+ dd
99
+ | order_item.price
100
+ p
101
+ = Comable.t('admin.mote_infomation_for_syntax')
102
+ | &nbsp;
103
+ = link_to 'http://liquidmarkup.org/', target: :_blank do
104
+ | Liquid Templating language
105
+ i.fa.fa-external-link<
106
+
107
+ .form-group
108
+ = f.label :place
109
+ = f.select :place, f.object.class.place.options
@@ -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.tracker'), comable.admin_trackers_path
12
+ li.active
13
+ = @tracker.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_tracker_path(@tracker), method: :delete, class: 'btn btn-danger'
@@ -0,0 +1,37 @@
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_tracker_path, class: 'btn btn-default'
6
+
7
+ h1.page-header
8
+ = Comable.t('admin.nav.tracker')
9
+ small<
10
+ | #{@trackers.total_count} #{Comable.t('admin.results')}
11
+
12
+ .comable-page-body
13
+ - if @trackers.empty?
14
+ = Comable.t('admin.not_found')
15
+ - else
16
+ table.table.table-striped
17
+ thead
18
+ th
19
+ = @trackers.klass.human_attribute_name(:name)
20
+ th
21
+ = @trackers.klass.human_attribute_name(:tracker_id)
22
+ th
23
+ = @trackers.klass.human_attribute_name(:place)
24
+ tbody
25
+ - @trackers.each do |tracker|
26
+ tr
27
+ td
28
+ = link_to tracker.name, comable.admin_tracker_path(tracker)
29
+ - unless tracker.activated_flag
30
+ span.fa.fa-eye-slash.text-muted<
31
+ td
32
+ = tracker.tracker_id
33
+ td
34
+ = tracker.place.text
35
+
36
+ .text-center
37
+ = paginate @trackers, theme: :comable_backend
@@ -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.tracker'), comable.admin_trackers_path
12
+ li.active
13
+ = Comable.t('admin.actions.new')
14
+
15
+ .comable-page-body
16
+ = render 'form'
@@ -0,0 +1,25 @@
1
+ - content_for :head do
2
+ link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet"
3
+
4
+ .comable-signin
5
+ .comable-signin-heading
6
+ h1.page-header
7
+ = Comable.app_name
8
+ small
9
+ | provides a simple way to add e-commerce features.
10
+
11
+ .comable-signin-body
12
+ = form_for resource, as: resource_name, url: session_path(resource_name) do |f|
13
+ .form-group
14
+ = f.email_field :email, placeholder: f.object.class.human_attribute_name(:email)
15
+
16
+ .form-group
17
+ = f.password_field :password, placeholder: f.object.class.human_attribute_name(:password)
18
+
19
+ .form-group
20
+ .checkbox
21
+ = f.label :remember_me do
22
+ = f.check_box :remember_me
23
+ = f.object.class.human_attribute_name(:remember_me)
24
+
25
+ = f.submit Comable.t('admin.sign_in'), class: 'btn btn-primary btn-block btn-lg'
@@ -0,0 +1,79 @@
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.user'), comable.admin_users_path
12
+ li>
13
+ = link_to @user.human_id, comable.admin_user_path(@user)
14
+ li.active
15
+ = Comable.t('admin.actions.edit')
16
+
17
+ .comable-page-body
18
+ section
19
+ = error_messages_for @user
20
+
21
+ = form_for @user, url: comable.admin_user_path(@user) do |f|
22
+ .hidden
23
+ = f.submit
24
+
25
+ fieldset
26
+ .col-md-3
27
+ legend
28
+ = Comable.t('admin.general')
29
+ .help-block
30
+
31
+ .col-md-9
32
+ .form-group
33
+ = f.label :role
34
+ = f.select :role, @user.class.role.options, {}, disabled: (@user == current_comable_user)
35
+
36
+ .form-group
37
+ = f.label :email
38
+ = f.text_field :email
39
+
40
+ .form-group
41
+ = f.label :password
42
+ = f.password_field :password
43
+
44
+ - if @user.bill_address
45
+ fieldset
46
+ .col-md-3
47
+ legend
48
+ = f.object.class.human_attribute_name(:bill_address)
49
+ .help-block
50
+
51
+ .col-md-9
52
+ = f.fields_for :bill_address do |ff|
53
+ .form-group
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