disco_app 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +37 -0
  3. data/app/assets/images/disco_app/icon.svg +1 -0
  4. data/app/assets/javascripts/disco_app/components/filterable_shop_list.js.jsx +60 -0
  5. data/app/assets/javascripts/disco_app/components/shop_filter_tab.js.jsx +34 -0
  6. data/app/assets/javascripts/disco_app/components/shop_filter_tabs.js.jsx +21 -0
  7. data/app/assets/javascripts/disco_app/components/shop_list.js.jsx +144 -0
  8. data/app/assets/javascripts/disco_app/components/shop_row.js.jsx +27 -0
  9. data/app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx +29 -0
  10. data/app/assets/javascripts/disco_app/components.js +5 -0
  11. data/app/assets/javascripts/disco_app/disco_app.js +7 -0
  12. data/app/assets/javascripts/disco_app/frame.js +152 -0
  13. data/app/assets/javascripts/disco_app/shopify-turbolinks.js +7 -0
  14. data/app/assets/stylesheets/disco_app/bootstrap/_custom.scss +54 -0
  15. data/app/assets/stylesheets/disco_app/bootstrap/_variables.scss +872 -0
  16. data/app/assets/stylesheets/disco_app/disco/_buttons.scss +31 -0
  17. data/app/assets/stylesheets/disco_app/disco/_cards.scss +52 -0
  18. data/app/assets/stylesheets/disco_app/disco/_forms.scss +23 -0
  19. data/app/assets/stylesheets/disco_app/disco/_grid.scss +58 -0
  20. data/app/assets/stylesheets/disco_app/disco/_sections.scss +61 -0
  21. data/app/assets/stylesheets/disco_app/disco/_tables.scss +57 -0
  22. data/app/assets/stylesheets/disco_app/disco/_tabs.scss +61 -0
  23. data/app/assets/stylesheets/disco_app/disco/_type.scss +39 -0
  24. data/app/assets/stylesheets/disco_app/disco/mixins/_flexbox.scss +394 -0
  25. data/app/assets/stylesheets/disco_app/disco_app.scss +16 -0
  26. data/app/assets/stylesheets/disco_app/frame/_buttons.scss +54 -0
  27. data/app/assets/stylesheets/disco_app/frame/_forms.scss +26 -0
  28. data/app/assets/stylesheets/disco_app/frame/_layout.scss +77 -0
  29. data/app/assets/stylesheets/disco_app/frame/_type.scss +32 -0
  30. data/app/assets/stylesheets/disco_app/frame.scss +9 -0
  31. data/app/controllers/disco_app/admin/app_settings_controller.rb +3 -0
  32. data/app/controllers/disco_app/admin/application_controller.rb +3 -0
  33. data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +24 -0
  34. data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +20 -0
  35. data/app/controllers/disco_app/admin/concerns/plans_controller.rb +51 -0
  36. data/app/controllers/disco_app/admin/concerns/shops_controller.rb +7 -0
  37. data/app/controllers/disco_app/admin/plans_controller.rb +3 -0
  38. data/app/controllers/disco_app/admin/resources/shops_controller.rb +3 -0
  39. data/app/controllers/disco_app/admin/shops_controller.rb +3 -0
  40. data/app/controllers/disco_app/charges_controller.rb +47 -0
  41. data/app/controllers/disco_app/concerns/app_proxy_controller.rb +40 -0
  42. data/app/controllers/disco_app/concerns/authenticated_controller.rb +56 -0
  43. data/app/controllers/disco_app/concerns/carrier_request_controller.rb +21 -0
  44. data/app/controllers/disco_app/frame_controller.rb +9 -0
  45. data/app/controllers/disco_app/install_controller.rb +27 -0
  46. data/app/controllers/disco_app/subscriptions_controller.rb +32 -0
  47. data/app/controllers/disco_app/webhooks_controller.rb +46 -0
  48. data/app/controllers/sessions_controller.rb +28 -0
  49. data/app/helpers/disco_app/application_helper.rb +28 -0
  50. data/app/jobs/disco_app/app_installed_job.rb +3 -0
  51. data/app/jobs/disco_app/app_uninstalled_job.rb +3 -0
  52. data/app/jobs/disco_app/concerns/app_installed_job.rb +39 -0
  53. data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +20 -0
  54. data/app/jobs/disco_app/concerns/shop_update_job.rb +16 -0
  55. data/app/jobs/disco_app/concerns/subscription_changed_job.rb +7 -0
  56. data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +52 -0
  57. data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +61 -0
  58. data/app/jobs/disco_app/shop_job.rb +27 -0
  59. data/app/jobs/disco_app/shop_update_job.rb +3 -0
  60. data/app/jobs/disco_app/subscription_changed_job.rb +3 -0
  61. data/app/jobs/disco_app/synchronise_carrier_service_job.rb +3 -0
  62. data/app/jobs/disco_app/synchronise_webhooks_job.rb +3 -0
  63. data/app/models/disco_app/app_settings.rb +3 -0
  64. data/app/models/disco_app/application_charge.rb +18 -0
  65. data/app/models/disco_app/concerns/app_settings.rb +7 -0
  66. data/app/models/disco_app/concerns/plan.rb +26 -0
  67. data/app/models/disco_app/concerns/plan_code.rb +15 -0
  68. data/app/models/disco_app/concerns/shop.rb +80 -0
  69. data/app/models/disco_app/concerns/subscription.rb +48 -0
  70. data/app/models/disco_app/concerns/synchronises.rb +39 -0
  71. data/app/models/disco_app/plan.rb +3 -0
  72. data/app/models/disco_app/plan_code.rb +3 -0
  73. data/app/models/disco_app/recurring_application_charge.rb +18 -0
  74. data/app/models/disco_app/session_storage.rb +18 -0
  75. data/app/models/disco_app/shop.rb +3 -0
  76. data/app/models/disco_app/subscription.rb +3 -0
  77. data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +45 -0
  78. data/app/resources/disco_app/admin/resources/shop_resource.rb +4 -0
  79. data/app/services/disco_app/carrier_request_service.rb +15 -0
  80. data/app/services/disco_app/charges_service.rb +81 -0
  81. data/app/services/disco_app/proxy_service.rb +17 -0
  82. data/app/services/disco_app/subscription_service.rb +46 -0
  83. data/app/services/disco_app/webhook_service.rb +30 -0
  84. data/app/views/disco_app/admin/app_settings/edit.html.erb +5 -0
  85. data/app/views/disco_app/admin/plans/_form.html.erb +75 -0
  86. data/app/views/disco_app/admin/plans/edit.html.erb +7 -0
  87. data/app/views/disco_app/admin/plans/index.html.erb +41 -0
  88. data/app/views/disco_app/admin/plans/new.html.erb +7 -0
  89. data/app/views/disco_app/admin/shops/index.html.erb +12 -0
  90. data/app/views/disco_app/charges/activate.html.erb +1 -0
  91. data/app/views/disco_app/charges/create.html.erb +1 -0
  92. data/app/views/disco_app/charges/new.html.erb +12 -0
  93. data/app/views/disco_app/frame/frame.html.erb +36 -0
  94. data/app/views/disco_app/install/installing.html.erb +7 -0
  95. data/app/views/disco_app/install/uninstalling.html.erb +1 -0
  96. data/app/views/disco_app/proxy_errors/404.html.erb +1 -0
  97. data/app/views/disco_app/shared/_card.html.erb +14 -0
  98. data/app/views/disco_app/shared/_section.html.erb +17 -0
  99. data/app/views/disco_app/subscriptions/new.html.erb +25 -0
  100. data/app/views/layouts/admin/_navbar.html.erb +25 -0
  101. data/app/views/layouts/admin.html.erb +23 -0
  102. data/app/views/layouts/application.html.erb +18 -0
  103. data/app/views/layouts/embedded_app.html.erb +41 -0
  104. data/app/views/layouts/embedded_app_modal.html.erb +17 -0
  105. data/app/views/sessions/new.html.erb +26 -0
  106. data/config/routes.rb +46 -0
  107. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +15 -0
  108. data/db/migrate/20150525162112_add_status_to_shops.rb +5 -0
  109. data/db/migrate/20150525171422_add_meta_to_shops.rb +11 -0
  110. data/db/migrate/20150629210346_add_charge_status_to_shop.rb +5 -0
  111. data/db/migrate/20150814214025_add_more_meta_to_shops.rb +15 -0
  112. data/db/migrate/20151017231302_create_disco_app_plans.rb +13 -0
  113. data/db/migrate/20151017232027_create_disco_app_subscriptions.rb +15 -0
  114. data/db/migrate/20151017234409_move_shop_to_disco_app_engine.rb +5 -0
  115. data/db/migrate/20160112233706_create_disco_app_sessions.rb +12 -0
  116. data/db/migrate/20160113194418_add_shop_id_to_disco_app_sessions.rb +6 -0
  117. data/db/migrate/20160223111044_create_disco_app_settings.rb +8 -0
  118. data/db/migrate/20160301223215_update_plans.rb +22 -0
  119. data/db/migrate/20160301224558_update_subscriptions.rb +13 -0
  120. data/db/migrate/20160302104816_create_disco_app_recurring_application_charges.rb +14 -0
  121. data/db/migrate/20160302105259_create_disco_app_application_charges.rb +14 -0
  122. data/db/migrate/20160302134728_drop_charge_status_from_shops.rb +5 -0
  123. data/db/migrate/20160302142941_add_shopify_attributes_to_charges.rb +8 -0
  124. data/db/migrate/20160331093148_create_disco_app_plan_codes.rb +14 -0
  125. data/db/migrate/20160401044420_add_status_to_plan_codes.rb +5 -0
  126. data/db/migrate/20160401045551_add_amount_and_plan_code_to_disco_app_subscriptions.rb +7 -0
  127. data/db/migrate/20160425205211_add_source_to_disco_app_subscriptions.rb +5 -0
  128. data/db/migrate/20160426033520_add_trial_period_days_to_disco_app_subscriptions.rb +5 -0
  129. data/lib/disco_app/configuration.rb +39 -0
  130. data/lib/disco_app/constants.rb +4 -0
  131. data/lib/disco_app/engine.rb +26 -0
  132. data/lib/disco_app/session.rb +14 -0
  133. data/lib/disco_app/support/file_fixtures.rb +23 -0
  134. data/lib/disco_app/test_help.rb +11 -0
  135. data/lib/disco_app/version.rb +3 -0
  136. data/lib/disco_app.rb +7 -0
  137. data/lib/generators/disco_app/USAGE +5 -0
  138. data/lib/generators/disco_app/adminify/adminify_generator.rb +35 -0
  139. data/lib/generators/disco_app/disco_app_generator.rb +164 -0
  140. data/lib/generators/disco_app/mailify/mailify_generator.rb +54 -0
  141. data/lib/generators/disco_app/monitorify/monitorify_generator.rb +28 -0
  142. data/lib/generators/disco_app/monitorify/templates/config/newrelic.yml +26 -0
  143. data/lib/generators/disco_app/monitorify/templates/initializers/rollbar.rb +12 -0
  144. data/lib/generators/disco_app/reactify/reactify_generator.rb +45 -0
  145. data/lib/generators/disco_app/templates/assets/javascripts/application.js +17 -0
  146. data/lib/generators/disco_app/templates/assets/stylesheets/application.scss +5 -0
  147. data/lib/generators/disco_app/templates/config/puma.rb +15 -0
  148. data/lib/generators/disco_app/templates/controllers/home_controller.rb +7 -0
  149. data/lib/generators/disco_app/templates/initializers/disco_app.rb +19 -0
  150. data/lib/generators/disco_app/templates/initializers/session_store.rb +2 -0
  151. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +7 -0
  152. data/lib/generators/disco_app/templates/initializers/shopify_session_repository.rb +7 -0
  153. data/lib/generators/disco_app/templates/root/Procfile +2 -0
  154. data/lib/generators/disco_app/templates/views/home/index.html.erb +2 -0
  155. data/lib/tasks/carrier_service.rake +10 -0
  156. data/lib/tasks/sessions.rake +9 -0
  157. data/lib/tasks/start.rake +3 -0
  158. data/lib/tasks/webhooks.rake +10 -0
  159. data/test/controllers/disco_app/admin/shops_controller_test.rb +54 -0
  160. data/test/controllers/disco_app/charges_controller_test.rb +92 -0
  161. data/test/controllers/disco_app/install_controller_test.rb +50 -0
  162. data/test/controllers/disco_app/subscriptions_controller_test.rb +68 -0
  163. data/test/controllers/disco_app/webhooks_controller_test.rb +58 -0
  164. data/test/controllers/home_controller_test.rb +92 -0
  165. data/test/controllers/proxy_controller_test.rb +42 -0
  166. data/test/disco_app_test.rb +7 -0
  167. data/test/dummy/Rakefile +6 -0
  168. data/test/dummy/app/assets/javascripts/application.js +17 -0
  169. data/test/dummy/app/assets/stylesheets/application.scss +5 -0
  170. data/test/dummy/app/controllers/application_controller.rb +6 -0
  171. data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +8 -0
  172. data/test/dummy/app/controllers/home_controller.rb +7 -0
  173. data/test/dummy/app/controllers/proxy_controller.rb +8 -0
  174. data/test/dummy/app/helpers/application_helper.rb +2 -0
  175. data/test/dummy/app/jobs/disco_app/app_installed_job.rb +16 -0
  176. data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +11 -0
  177. data/test/dummy/app/jobs/products_create_job.rb +7 -0
  178. data/test/dummy/app/jobs/products_delete_job.rb +7 -0
  179. data/test/dummy/app/jobs/products_update_job.rb +7 -0
  180. data/test/dummy/app/models/disco_app/shop.rb +15 -0
  181. data/test/dummy/app/models/product.rb +6 -0
  182. data/test/dummy/app/views/home/index.html.erb +2 -0
  183. data/test/dummy/bin/bundle +3 -0
  184. data/test/dummy/bin/rails +4 -0
  185. data/test/dummy/bin/rake +4 -0
  186. data/test/dummy/bin/setup +29 -0
  187. data/test/dummy/config/application.rb +38 -0
  188. data/test/dummy/config/boot.rb +5 -0
  189. data/test/dummy/config/database.codeship.yml +23 -0
  190. data/test/dummy/config/database.yml +20 -0
  191. data/test/dummy/config/environment.rb +5 -0
  192. data/test/dummy/config/environments/development.rb +41 -0
  193. data/test/dummy/config/environments/production.rb +85 -0
  194. data/test/dummy/config/environments/test.rb +42 -0
  195. data/test/dummy/config/initializers/assets.rb +11 -0
  196. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  197. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  198. data/test/dummy/config/initializers/disco_app.rb +19 -0
  199. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  200. data/test/dummy/config/initializers/inflections.rb +16 -0
  201. data/test/dummy/config/initializers/mime_types.rb +4 -0
  202. data/test/dummy/config/initializers/omniauth.rb +9 -0
  203. data/test/dummy/config/initializers/session_store.rb +2 -0
  204. data/test/dummy/config/initializers/shopify_app.rb +7 -0
  205. data/test/dummy/config/initializers/shopify_session_repository.rb +7 -0
  206. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  207. data/test/dummy/config/locales/en.yml +23 -0
  208. data/test/dummy/config/routes.rb +10 -0
  209. data/test/dummy/config/secrets.yml +22 -0
  210. data/test/dummy/config.ru +4 -0
  211. data/test/dummy/db/migrate/20160307182229_create_products.rb +11 -0
  212. data/test/dummy/db/schema.rb +140 -0
  213. data/test/dummy/public/404.html +67 -0
  214. data/test/dummy/public/422.html +67 -0
  215. data/test/dummy/public/500.html +66 -0
  216. data/test/dummy/public/favicon.ico +0 -0
  217. data/test/fixtures/api/widget_store/charges/activate_application_charge_request.json +16 -0
  218. data/test/fixtures/api/widget_store/charges/activate_application_charge_response.json +1 -0
  219. data/test/fixtures/api/widget_store/charges/activate_recurring_application_charge_request.json +20 -0
  220. data/test/fixtures/api/widget_store/charges/activate_recurring_application_charge_response.json +1 -0
  221. data/test/fixtures/api/widget_store/charges/create_application_charge_request.json +9 -0
  222. data/test/fixtures/api/widget_store/charges/create_application_charge_response.json +16 -0
  223. data/test/fixtures/api/widget_store/charges/create_recurring_application_charge_request.json +9 -0
  224. data/test/fixtures/api/widget_store/charges/create_recurring_application_charge_response.json +20 -0
  225. data/test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_request.json +9 -0
  226. data/test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_response.json +20 -0
  227. data/test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json +16 -0
  228. data/test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json +20 -0
  229. data/test/fixtures/api/widget_store/charges/get_declined_application_charge_response.json +16 -0
  230. data/test/fixtures/api/widget_store/charges/get_declined_recurring_application_charge_response.json +20 -0
  231. data/test/fixtures/api/widget_store/charges/get_pending_application_charge_response.json +16 -0
  232. data/test/fixtures/api/widget_store/charges/get_pending_recurring_application_charge_response.json +20 -0
  233. data/test/fixtures/api/widget_store/shop.json +46 -0
  234. data/test/fixtures/api/widget_store/webhooks.json +1 -0
  235. data/test/fixtures/disco_app/application_charges.yml +11 -0
  236. data/test/fixtures/disco_app/plan_codes.yml +13 -0
  237. data/test/fixtures/disco_app/plans.yml +37 -0
  238. data/test/fixtures/disco_app/recurring_application_charges.yml +11 -0
  239. data/test/fixtures/disco_app/shops.yml +10 -0
  240. data/test/fixtures/disco_app/subscriptions.yml +21 -0
  241. data/test/fixtures/products.yml +4 -0
  242. data/test/fixtures/webhooks/app_uninstalled.json +46 -0
  243. data/test/fixtures/webhooks/product_created.json +167 -0
  244. data/test/fixtures/webhooks/product_deleted.json +3 -0
  245. data/test/fixtures/webhooks/product_updated.json +167 -0
  246. data/test/integration/synchronises_test.rb +55 -0
  247. data/test/jobs/disco_app/app_installed_job_test.rb +55 -0
  248. data/test/jobs/disco_app/app_uninstalled_job_test.rb +30 -0
  249. data/test/models/disco_app/plan_test.rb +5 -0
  250. data/test/models/disco_app/session_test.rb +31 -0
  251. data/test/models/disco_app/shop_test.rb +27 -0
  252. data/test/services/disco_app/charges_service_test.rb +105 -0
  253. data/test/services/disco_app/subscription_service_test.rb +60 -0
  254. data/test/support/test_file_fixtures.rb +29 -0
  255. data/test/support/test_shopify_api.rb +16 -0
  256. data/test/test_helper.rb +52 -0
  257. metadata +663 -0
@@ -0,0 +1,394 @@
1
+ // Flexbox Mixins
2
+ // http://philipwalton.github.io/solved-by-flexbox/
3
+ // https://github.com/philipwalton/solved-by-flexbox
4
+ //
5
+ // Copyright (c) 2013 Brian Franco
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a
8
+ // copy of this software and associated documentation files (the
9
+ // "Software"), to deal in the Software without restriction, including
10
+ // without limitation the rights to use, copy, modify, merge, publish,
11
+ // distribute, sublicense, and/or sell copies of the Software, and to
12
+ // permit persons to whom the Software is furnished to do so, subject to
13
+ // the following conditions:
14
+ // The above copyright notice and this permission notice shall be included
15
+ // in all copies or substantial portions of the Software.
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ //
24
+ // This is a set of mixins for those who want to mess around with flexbox
25
+ // using the native support of current browsers. For full support table
26
+ // check: http://caniuse.com/flexbox
27
+ //
28
+ // Basically this will use:
29
+ //
30
+ // * Fallback, old syntax (IE10, mobile webkit browsers - no wrapping)
31
+ // * Final standards syntax (FF, Safari, Chrome, IE11, Opera)
32
+ //
33
+ // This was inspired by:
34
+ //
35
+ // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
36
+ //
37
+ // With help from:
38
+ //
39
+ // * http://w3.org/tr/css3-flexbox/
40
+ // * http://the-echoplex.net/flexyboxes/
41
+ // * http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx
42
+ // * http://css-tricks.com/using-flexbox/
43
+ // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
44
+ // * https://developer.mozilla.org/en-us/docs/web/guide/css/flexible_boxes
45
+
46
+ //----------------------------------------------------------------------
47
+
48
+ // Flexbox Containers
49
+ //
50
+ // The 'flex' value causes an element to generate a block-level flex
51
+ // container box.
52
+ //
53
+ // The 'inline-flex' value causes an element to generate a inline-level
54
+ // flex container box.
55
+ //
56
+ // display: flex | inline-flex
57
+ //
58
+ // http://w3.org/tr/css3-flexbox/#flex-containers
59
+ //
60
+ // (Placeholder selectors for each type, for those who rather @extend)
61
+
62
+ @mixin flexbox {
63
+ display: -webkit-box;
64
+ display: -webkit-flex;
65
+ display: -moz-flex;
66
+ display: -ms-flexbox;
67
+ display: flex;
68
+ }
69
+
70
+ %flexbox { @include flexbox; }
71
+
72
+ //----------------------------------
73
+
74
+ @mixin inline-flex {
75
+ display: -webkit-inline-box;
76
+ display: -webkit-inline-flex;
77
+ display: -moz-inline-flex;
78
+ display: -ms-inline-flexbox;
79
+ display: inline-flex;
80
+ }
81
+
82
+ %inline-flex { @include inline-flex; }
83
+
84
+ //----------------------------------------------------------------------
85
+
86
+ // Flexbox Direction
87
+ //
88
+ // The 'flex-direction' property specifies how flex items are placed in
89
+ // the flex container, by setting the direction of the flex container's
90
+ // main axis. This determines the direction that flex items are laid out in.
91
+ //
92
+ // Values: row | row-reverse | column | column-reverse
93
+ // Default: row
94
+ //
95
+ // http://w3.org/tr/css3-flexbox/#flex-direction-property
96
+
97
+ @mixin flex-direction($value: row) {
98
+ @if $value == row-reverse {
99
+ -webkit-box-direction: reverse;
100
+ -webkit-box-orient: horizontal;
101
+ } @else if $value == column {
102
+ -webkit-box-direction: normal;
103
+ -webkit-box-orient: vertical;
104
+ } @else if $value == column-reverse {
105
+ -webkit-box-direction: reverse;
106
+ -webkit-box-orient: vertical;
107
+ } @else {
108
+ -webkit-box-direction: normal;
109
+ -webkit-box-orient: horizontal;
110
+ }
111
+ -webkit-flex-direction: $value;
112
+ -moz-flex-direction: $value;
113
+ -ms-flex-direction: $value;
114
+ flex-direction: $value;
115
+ }
116
+ // Shorter version:
117
+ @mixin flex-dir($args...) { @include flex-direction($args...); }
118
+
119
+ //----------------------------------------------------------------------
120
+
121
+ // Flexbox Wrap
122
+ //
123
+ // The 'flex-wrap' property controls whether the flex container is single-line
124
+ // or multi-line, and the direction of the cross-axis, which determines
125
+ // the direction new lines are stacked in.
126
+ //
127
+ // Values: nowrap | wrap | wrap-reverse
128
+ // Default: nowrap
129
+ //
130
+ // http://w3.org/tr/css3-flexbox/#flex-wrap-property
131
+
132
+ @mixin flex-wrap($value: nowrap) {
133
+ // No Webkit Box fallback.
134
+ -webkit-flex-wrap: $value;
135
+ -moz-flex-wrap: $value;
136
+ @if $value == nowrap {
137
+ -ms-flex-wrap: none;
138
+ } @else {
139
+ -ms-flex-wrap: $value;
140
+ }
141
+ flex-wrap: $value;
142
+ }
143
+
144
+ //----------------------------------------------------------------------
145
+
146
+ // Flexbox Flow (shorthand)
147
+ //
148
+ // The 'flex-flow' property is a shorthand for setting the 'flex-direction'
149
+ // and 'flex-wrap' properties, which together define the flex container's
150
+ // main and cross axes.
151
+ //
152
+ // Values: <flex-direction> | <flex-wrap>
153
+ // Default: row nowrap
154
+ //
155
+ // http://w3.org/tr/css3-flexbox/#flex-flow-property
156
+
157
+ @mixin flex-flow($values: (row nowrap)) {
158
+ // No Webkit Box fallback.
159
+ -webkit-flex-flow: $values;
160
+ -moz-flex-flow: $values;
161
+ -ms-flex-flow: $values;
162
+ flex-flow: $values;
163
+ }
164
+
165
+ //----------------------------------------------------------------------
166
+
167
+ // Flexbox Order
168
+ //
169
+ // The 'order' property controls the order in which flex items appear within
170
+ // their flex container, by assigning them to ordinal groups.
171
+ //
172
+ // Default: 0
173
+ //
174
+ // http://w3.org/tr/css3-flexbox/#order-property
175
+
176
+ @mixin order($int: 0) {
177
+ -webkit-box-ordinal-group: $int + 1;
178
+ -webkit-order: $int;
179
+ -moz-order: $int;
180
+ -ms-flex-order: $int;
181
+ order: $int;
182
+ }
183
+
184
+ //----------------------------------------------------------------------
185
+
186
+ // Flexbox Grow
187
+ //
188
+ // The 'flex-grow' property sets the flex grow factor. Negative numbers
189
+ // are invalid.
190
+ //
191
+ // Default: 0
192
+ //
193
+ // http://w3.org/tr/css3-flexbox/#flex-grow-property
194
+
195
+ @mixin flex-grow($int: 0) {
196
+ -webkit-box-flex: $int;
197
+ -webkit-flex-grow: $int;
198
+ -moz-flex-grow: $int;
199
+ -ms-flex-positive: $int;
200
+ flex-grow: $int;
201
+ }
202
+
203
+ //----------------------------------------------------------------------
204
+
205
+ // Flexbox Shrink
206
+ //
207
+ // The 'flex-shrink' property sets the flex shrink factor. Negative numbers
208
+ // are invalid.
209
+ //
210
+ // Default: 1
211
+ //
212
+ // http://w3.org/tr/css3-flexbox/#flex-shrink-property
213
+
214
+ @mixin flex-shrink($int: 1) {
215
+ -webkit-flex-shrink: $int;
216
+ -moz-flex-shrink: $int;
217
+ -ms-flex-negative: $int;
218
+ flex-shrink: $int;
219
+ }
220
+
221
+ //----------------------------------------------------------------------
222
+
223
+ // Flexbox Basis
224
+ //
225
+ // The 'flex-basis' property sets the flex basis. Negative lengths are invalid.
226
+ //
227
+ // Values: Like "width"
228
+ // Default: auto
229
+ //
230
+ // http://www.w3.org/TR/css3-flexbox/#flex-basis-property
231
+
232
+ @mixin flex-basis($value: auto) {
233
+ -webkit-flex-basis: $value;
234
+ -moz-flex-basis: $value;
235
+ -ms-flex-preferred-size: $value;
236
+ flex-basis: $value;
237
+ }
238
+
239
+ //----------------------------------------------------------------------
240
+
241
+ // Flexbox "Flex" (shorthand)
242
+ //
243
+ // The 'flex' property specifies the components of a flexible length: the
244
+ // flex grow factor and flex shrink factor, and the flex basis. When an
245
+ // element is a flex item, 'flex' is consulted instead of the main size
246
+ // property to determine the main size of the element. If an element is
247
+ // not a flex item, 'flex' has no effect.
248
+ //
249
+ // Values: none | <flex-grow> <flex-shrink> || <flex-basis>
250
+ // Default: See individual properties (1 1 0).
251
+ //
252
+ // http://w3.org/tr/css3-flexbox/#flex-property
253
+
254
+ @mixin flex($fg: 1, $fs: null, $fb: null) {
255
+
256
+ // Set a variable to be used by box-flex properties
257
+ $fg-boxflex: $fg;
258
+
259
+ // Box-Flex only supports a flex-grow value so let's grab the
260
+ // first item in the list and just return that.
261
+ @if type-of($fg) == 'list' {
262
+ $fg-boxflex: nth($fg, 1);
263
+ }
264
+
265
+ -webkit-box-flex: $fg-boxflex;
266
+ -webkit-flex: $fg $fs $fb;
267
+ -moz-box-flex: $fg-boxflex;
268
+ -moz-flex: $fg $fs $fb;
269
+ -ms-flex: $fg $fs $fb;
270
+ flex: $fg $fs $fb;
271
+ }
272
+
273
+ //----------------------------------------------------------------------
274
+
275
+ // Flexbox Justify Content
276
+ //
277
+ // The 'justify-content' property aligns flex items along the main axis
278
+ // of the current line of the flex container. This is done after any flexible
279
+ // lengths and any auto margins have been resolved. Typically it helps distribute
280
+ // extra free space leftover when either all the flex items on a line are
281
+ // inflexible, or are flexible but have reached their maximum size. It also
282
+ // exerts some control over the alignment of items when they overflow the line.
283
+ //
284
+ // Note: 'space-*' values not supported in older syntaxes.
285
+ //
286
+ // Values: flex-start | flex-end | center | space-between | space-around
287
+ // Default: flex-start
288
+ //
289
+ // http://w3.org/tr/css3-flexbox/#justify-content-property
290
+
291
+ @mixin justify-content($value: flex-start) {
292
+ @if $value == flex-start {
293
+ -webkit-box-pack: start;
294
+ -ms-flex-pack: start;
295
+ } @else if $value == flex-end {
296
+ -webkit-box-pack: end;
297
+ -ms-flex-pack: end;
298
+ } @else if $value == space-between {
299
+ -webkit-box-pack: justify;
300
+ -ms-flex-pack: justify;
301
+ } @else if $value == space-around {
302
+ -ms-flex-pack: distribute;
303
+ } @else {
304
+ -webkit-box-pack: $value;
305
+ -ms-flex-pack: $value;
306
+ }
307
+ -webkit-justify-content: $value;
308
+ -moz-justify-content: $value;
309
+ justify-content: $value;
310
+ }
311
+ // Shorter version:
312
+ @mixin flex-just($args...) { @include justify-content($args...); }
313
+
314
+ //----------------------------------------------------------------------
315
+
316
+ // Flexbox Align Items
317
+ //
318
+ // Flex items can be aligned in the cross axis of the current line of the
319
+ // flex container, similar to 'justify-content' but in the perpendicular
320
+ // direction. 'align-items' sets the default alignment for all of the flex
321
+ // container's items, including anonymous flex items. 'align-self' allows
322
+ // this default alignment to be overridden for individual flex items. (For
323
+ // anonymous flex items, 'align-self' always matches the value of 'align-items'
324
+ // on their associated flex container.)
325
+ //
326
+ // Values: flex-start | flex-end | center | baseline | stretch
327
+ // Default: stretch
328
+ //
329
+ // http://w3.org/tr/css3-flexbox/#align-items-property
330
+
331
+ @mixin align-items($value: stretch) {
332
+ @if $value == flex-start {
333
+ -webkit-box-align: start;
334
+ -ms-flex-align: start;
335
+ } @else if $value == flex-end {
336
+ -webkit-box-align: end;
337
+ -ms-flex-align: end;
338
+ } @else {
339
+ -webkit-box-align: $value;
340
+ -ms-flex-align: $value;
341
+ }
342
+ -webkit-align-items: $value;
343
+ -moz-align-items: $value;
344
+ align-items: $value;
345
+ }
346
+
347
+ //----------------------------------
348
+
349
+ // Flexbox Align Self
350
+ //
351
+ // Values: auto | flex-start | flex-end | center | baseline | stretch
352
+ // Default: auto
353
+
354
+ @mixin align-self($value: auto) {
355
+ // No Webkit Box Fallback.
356
+ -webkit-align-self: $value;
357
+ -moz-align-self: $value;
358
+ @if $value == flex-start {
359
+ -ms-flex-item-align: start;
360
+ } @else if $value == flex-end {
361
+ -ms-flex-item-align: end;
362
+ } @else {
363
+ -ms-flex-item-align: $value;
364
+ }
365
+ align-self: $value;
366
+ }
367
+
368
+ //----------------------------------------------------------------------
369
+
370
+ // Flexbox Align Content
371
+ //
372
+ // The 'align-content' property aligns a flex container's lines within the
373
+ // flex container when there is extra space in the cross-axis, similar to
374
+ // how 'justify-content' aligns individual items within the main-axis. Note,
375
+ // this property has no effect when the flexbox has only a single line.
376
+ //
377
+ // Values: flex-start | flex-end | center | space-between | space-around | stretch
378
+ // Default: stretch
379
+ //
380
+ // http://w3.org/tr/css3-flexbox/#align-content-property
381
+
382
+ @mixin align-content($value: stretch) {
383
+ // No Webkit Box Fallback.
384
+ -webkit-align-content: $value;
385
+ -moz-align-content: $value;
386
+ @if $value == flex-start {
387
+ -ms-flex-line-pack: start;
388
+ } @else if $value == flex-end {
389
+ -ms-flex-line-pack: end;
390
+ } @else {
391
+ -ms-flex-line-pack: $value;
392
+ }
393
+ align-content: $value;
394
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // Styles for Disco applications.
3
+ // --------------------------------------------------
4
+
5
+ @import 'bootstrap-sprockets';
6
+ @import 'bootstrap/variables';
7
+ @import 'bootstrap/custom';
8
+ @import 'disco/mixins/flexbox';
9
+ @import 'disco/grid';
10
+ @import 'disco/type';
11
+ @import 'disco/sections';
12
+ @import 'disco/cards';
13
+ @import 'disco/buttons';
14
+ @import 'disco/forms';
15
+ @import 'disco/tables';
16
+ @import 'disco/tabs';
@@ -0,0 +1,54 @@
1
+ //
2
+ // Buttons
3
+ // --------------------------------------------------
4
+
5
+ // Base button
6
+ .btn {
7
+ cursor: pointer;
8
+ display: inline-block;
9
+ height: 32px;
10
+ line-height: 30px;
11
+ padding: 0 9px;
12
+ border-radius: 4px;
13
+
14
+ white-space: nowrap;
15
+ vertical-align: middle;
16
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
17
+ font-size: 13px;
18
+
19
+ -webkit-user-select: none;
20
+ -moz-user-select: none;
21
+ -o-user-select: none;
22
+ user-select: none;
23
+ -webkit-appearance: none;
24
+
25
+ &:hover {
26
+ text-decoration: none;
27
+ }
28
+ }
29
+
30
+ // Default button
31
+ .btn, .btn-default {
32
+ background-color: #fcfcfc;
33
+ border: 1px solid #e3e3e3;
34
+ color: #479ccf;
35
+
36
+ &:hover, &:focus, &.focus {
37
+ background-color: #efefef;
38
+ border-color: #d6d6d6;
39
+ color: #479ccf;
40
+ }
41
+ }
42
+
43
+ // Primary button
44
+ .btn-primary {
45
+ background-color: #479ccf;
46
+ border: 1px solid #2f82b4;
47
+ color: #fff;
48
+
49
+ &:hover, &:focus, &.focus {
50
+ background-color: #3491c8;
51
+ border-color: #2a74a0;
52
+ color: #fff;
53
+ }
54
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // Forms
3
+ // --------------------------------------------------
4
+
5
+ form {
6
+ margin: 40px 0;
7
+ }
8
+
9
+ input[type="text"],
10
+ input[type="url"], {
11
+ vertical-align: top;
12
+ height: 32px;
13
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
14
+ font-size: 13px;
15
+ padding: 5px;
16
+ margin: 0;
17
+ border: 1px solid #ccc;
18
+ display: inline-block;
19
+ color: #222;
20
+ border-radius: 4px;
21
+
22
+ &:focus, &.focus {
23
+ border: 1px solid #479ccf;
24
+ outline: 0;
25
+ }
26
+ }
@@ -0,0 +1,77 @@
1
+ //
2
+ // Layout
3
+ // --------------------------------------------------
4
+
5
+ * {
6
+ -webkit-box-sizing: border-box;
7
+ -moz-box-sizing: border-box;
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ #sidebar {
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ bottom: 0;
16
+ width: $sidebar-width;
17
+
18
+ background: #31373d;
19
+ box-shadow: -1px 0 0 #2b3136 inset;
20
+ }
21
+
22
+ #header {
23
+ position: absolute;
24
+ top: 0;
25
+ left: $sidebar-width;
26
+ right: 0;
27
+ height: $header-height;
28
+
29
+ background: #ffffff;
30
+ border-bottom: 1px solid #e6e6e6;
31
+ border-color: rgba(0,0,0, .07);
32
+ }
33
+
34
+ #header-title {
35
+ position: absolute;
36
+ bottom: 12px;
37
+ left: 20px;
38
+
39
+ max-width: 718px;
40
+ white-space: nowrap;
41
+ text-overflow: ellipsis;
42
+ overflow: hidden;
43
+ }
44
+
45
+ #header-title-icon {
46
+ margin: 5px 10px 0 0;
47
+ float: left;
48
+ }
49
+
50
+ #header-actions {
51
+ position: absolute;
52
+ bottom: 12px;
53
+ right: 20px;
54
+
55
+ .btn {
56
+ margin: 0 0 0 5px;
57
+ }
58
+ }
59
+
60
+ #content-wrapper {
61
+ position: absolute;
62
+ top: $header-height;
63
+ left: $sidebar-width;
64
+ bottom: 0;
65
+ right: 0;
66
+ }
67
+
68
+ #content {
69
+ width: 100%;
70
+ height: 100%;
71
+ border: none;
72
+ }
73
+
74
+ #iframe {
75
+ padding: 40px 0;
76
+ text-align: center;
77
+ }
@@ -0,0 +1,32 @@
1
+ //
2
+ // Type
3
+ // --------------------------------------------------
4
+
5
+ @font-face {
6
+ font-family: 'ProximaNovaLight';
7
+ src: local('ProximaNovaLight'), local('ProximaNova-Light');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ // Base
13
+ html, body {
14
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
15
+ font-size: 13px;
16
+ }
17
+
18
+ // Headers
19
+ h1 {
20
+ font-size: 24px;
21
+ line-height: 32px;
22
+ height: 32px;
23
+ font-family: ProximaNovaLight,"Helvetica Neue",Helvetica,Arial,sans-serif;
24
+ font-weight: 300;
25
+ margin: 0;
26
+ padding: 0;
27
+ }
28
+
29
+ // Text utilities
30
+ .text-muted {
31
+ color: #ccc;
32
+ }
@@ -0,0 +1,9 @@
1
+ // Set variables
2
+ $sidebar-width: 197px;
3
+ $header-height: 57px;
4
+
5
+ // Include components
6
+ @import "frame/layout";
7
+ @import "frame/type";
8
+ @import "frame/buttons";
9
+ @import "frame/forms";
@@ -0,0 +1,3 @@
1
+ class DiscoApp::Admin::AppSettingsController < DiscoApp::Admin::ApplicationController
2
+ include DiscoApp::Admin::Concerns::AppSettingsController
3
+ end
@@ -0,0 +1,3 @@
1
+ class DiscoApp::Admin::ApplicationController < ActionController::Base
2
+ include DiscoApp::Admin::Concerns::AuthenticatedController
3
+ end
@@ -0,0 +1,24 @@
1
+ module DiscoApp::Admin::Concerns::AppSettingsController
2
+ extend ActiveSupport::Concern
3
+
4
+ def edit
5
+ @app_settings = DiscoApp::AppSettings.instance
6
+ end
7
+
8
+ def update
9
+ @app_settings = DiscoApp::AppSettings.instance
10
+ if @app_settings.update_attributes(app_settings_params)
11
+ flash[:success] = 'Settings updated.'
12
+ redirect_to edit_admin_app_settings_path
13
+ else
14
+ render 'edit'
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def app_settings_params
21
+ params.require(:app_settings)
22
+ end
23
+
24
+ end
@@ -0,0 +1,20 @@
1
+ module DiscoApp::Admin::Concerns::AuthenticatedController
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+
6
+ protect_from_forgery with: :exception
7
+ before_action :authenticate_administrator
8
+ layout 'admin'
9
+
10
+ end
11
+
12
+ private
13
+
14
+ def authenticate_administrator
15
+ authenticate_or_request_with_http_basic do |username, password|
16
+ (not username.blank?) && (not password.blank?) && username == ENV['ADMIN_APP_USERNAME'] && password == ENV['ADMIN_APP_PASSWORD']
17
+ end
18
+ end
19
+
20
+ end