handcart 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +247 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/handcart/application.js +16 -0
  6. data/app/assets/stylesheets/handcart/application.css +15 -0
  7. data/app/assets/stylesheets/handcart/layout.css.scss +21 -0
  8. data/app/controllers/handcart/application_controller.rb +4 -0
  9. data/app/controllers/handcart/ip_addresses_controller.rb +56 -0
  10. data/app/controllers/handcart/subdomains_controller.rb +55 -0
  11. data/app/helpers/handcart/application_helper.rb +14 -0
  12. data/app/helpers/handcart/url_helper.rb +16 -0
  13. data/app/models/handcart/concerns/handcarts.rb +30 -0
  14. data/app/models/handcart/domain_constraint.rb +20 -0
  15. data/app/models/handcart/ip_address.rb +18 -0
  16. data/app/models/handcart/setting_constraint.rb +26 -0
  17. data/app/models/handcart/subdomain.rb +36 -0
  18. data/app/views/handcart/ip_addresses/_form.html.haml +12 -0
  19. data/app/views/handcart/ip_addresses/edit.html.haml +3 -0
  20. data/app/views/handcart/ip_addresses/index.html.haml +36 -0
  21. data/app/views/handcart/ip_addresses/new.html.haml +3 -0
  22. data/app/views/handcart/ip_addresses/show.html.haml +20 -0
  23. data/app/views/handcart/subdomains/_form.html.haml +9 -0
  24. data/app/views/handcart/subdomains/edit.html.haml +3 -0
  25. data/app/views/handcart/subdomains/index.html.haml +31 -0
  26. data/app/views/handcart/subdomains/new.html.haml +3 -0
  27. data/app/views/handcart/subdomains/show.html.haml +20 -0
  28. data/app/views/layouts/handcart/_navbar.html.haml +15 -0
  29. data/app/views/layouts/handcart/application.html.haml +60 -0
  30. data/config/handcart.json +6 -0
  31. data/config/locales/en.yml +61 -0
  32. data/config/routes.rb +5 -0
  33. data/db/migrate/20131009165427_create_handcart_subdomains.rb +9 -0
  34. data/db/migrate/20131203000934_create_handcart_ip_addresses.rb +12 -0
  35. data/lib/handcart.rb +67 -0
  36. data/lib/handcart/acts_as_handcart.rb +16 -0
  37. data/lib/handcart/controller_additions.rb +152 -0
  38. data/lib/handcart/engine.rb +27 -0
  39. data/lib/handcart/ip_authorization.rb +27 -0
  40. data/lib/handcart/simple_form.rb +179 -0
  41. data/lib/handcart/strategies/base_ip_strategy.rb +21 -0
  42. data/lib/handcart/strategies/containment_strategy.rb +16 -0
  43. data/lib/handcart/strategies/inclusion_strategy.rb +17 -0
  44. data/lib/handcart/templates/rspec/controller/controller_spec.rb +17 -0
  45. data/lib/handcart/templates/rspec/scaffold/routing_spec.rb +40 -0
  46. data/lib/handcart/version.rb +3 -0
  47. data/spec/controllers/handcart/ip_addresses_controller_spec.rb +134 -0
  48. data/spec/controllers/handcart/subdomains_controller_spec.rb +138 -0
  49. data/spec/dummy/README.rdoc +28 -0
  50. data/spec/dummy/Rakefile +6 -0
  51. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  52. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  53. data/spec/dummy/app/assets/stylesheets/layout.css.scss +4 -0
  54. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  55. data/spec/dummy/app/controllers/custom_constraints_controller.rb +2 -0
  56. data/spec/dummy/app/controllers/ip_addresses_controller.rb +7 -0
  57. data/spec/dummy/app/controllers/master/companies_controller.rb +51 -0
  58. data/spec/dummy/app/controllers/master/dashboard_controller.rb +4 -0
  59. data/spec/dummy/app/controllers/master_controller.rb +2 -0
  60. data/spec/dummy/app/controllers/public_controller.rb +12 -0
  61. data/spec/dummy/app/controllers/subdomain_controller.rb +8 -0
  62. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  63. data/spec/dummy/app/models/company.rb +7 -0
  64. data/spec/dummy/app/views/ip_addresses/index.html.haml +12 -0
  65. data/spec/dummy/app/views/ip_addresses/show.html.haml +1 -0
  66. data/spec/dummy/app/views/layouts/_navbar.html.haml +11 -0
  67. data/spec/dummy/app/views/layouts/application.html.haml +53 -0
  68. data/spec/dummy/app/views/layouts/public.html.haml +41 -0
  69. data/spec/dummy/app/views/master/companies/_form.html.haml +19 -0
  70. data/spec/dummy/app/views/master/companies/edit.html.haml +7 -0
  71. data/spec/dummy/app/views/master/companies/index.html.haml +25 -0
  72. data/spec/dummy/app/views/master/companies/new.html.haml +5 -0
  73. data/spec/dummy/app/views/master/companies/show.html.haml +12 -0
  74. data/spec/dummy/app/views/master/dashboard/index.html.haml +2 -0
  75. data/spec/dummy/app/views/public/forbidden.html.haml +3 -0
  76. data/spec/dummy/app/views/public/index.html.haml +2 -0
  77. data/spec/dummy/app/views/subdomain/index.html.haml +2 -0
  78. data/spec/dummy/bin/bundle +3 -0
  79. data/spec/dummy/bin/rails +4 -0
  80. data/spec/dummy/bin/rake +4 -0
  81. data/spec/dummy/config.ru +4 -0
  82. data/spec/dummy/config/application.rb +40 -0
  83. data/spec/dummy/config/boot.rb +5 -0
  84. data/spec/dummy/config/database.yml +26 -0
  85. data/spec/dummy/config/environment.rb +5 -0
  86. data/spec/dummy/config/environments/development.rb +29 -0
  87. data/spec/dummy/config/environments/production.rb +80 -0
  88. data/spec/dummy/config/environments/test.rb +36 -0
  89. data/spec/dummy/config/handcart.json +6 -0
  90. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  91. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  92. data/spec/dummy/config/initializers/handcart.rb +16 -0
  93. data/spec/dummy/config/initializers/inflections.rb +16 -0
  94. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  95. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  96. data/spec/dummy/config/initializers/session_store.rb +3 -0
  97. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  98. data/spec/dummy/config/locales/en.yml +12 -0
  99. data/spec/dummy/config/routes.rb +23 -0
  100. data/spec/dummy/db/migrate/20131010194534_create_companies.rb +10 -0
  101. data/spec/dummy/db/migrate/20131016183624_add_active_to_companies.rb +5 -0
  102. data/spec/dummy/db/schema.rb +41 -0
  103. data/spec/dummy/log/development.log +14 -0
  104. data/spec/dummy/log/test.log +786 -0
  105. data/spec/dummy/public/404.html +58 -0
  106. data/spec/dummy/public/422.html +58 -0
  107. data/spec/dummy/public/500.html +57 -0
  108. data/spec/dummy/spec/models/company_spec.rb +36 -0
  109. data/spec/dummy/spec/routing/custom_constraints_routing_spec.rb +37 -0
  110. data/spec/dummy/tmp/cache/assets/development/sass/27d34b7cbcb5b92ab03220c4d4b91379cc64c2c0/layout.css.scssc +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sass/dc98e44780f42e6521ebbf14c4db22f6a78c41ef/layout.css.scssc +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/05974a1f812cf4a61bb242d48722fd19 +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/063a74a7c73c9501ee373ef00111f159 +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/073d2b13ed9366ce539940749eb3844d +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/0d76367ded60510a66afc3dea891e76a +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/106c3f4e1fc71e9dc70abae55d432886 +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/13ae4613233656a42188d4d3ddbb7fc1 +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/18c826ba1d6dac1633cae2da25c0402a +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/247df6a90ce931f763db1ade5227d4b1 +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/2860df473a6cf4c483cd6f251fea3ae0 +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/2a99072e783dcef4637b38221531ea61 +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/2ab4b3177ab6c9d837c0905b61eedad5 +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/2b84c9cc30f71e24310dd1a4381caae8 +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/2bebf0981bc585e24939ca8ffe10081c +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/2c45a1517014fd239c930e48a71a93f0 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/2d5147f4ea70131b4e330cab38aeb1a1 +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/3124588878c79981009129f32d5fe408 +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/33325c558d8db2071bf8a938517e5af2 +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/350c8c72b1dbd7a84f85424b5cd4def1 +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/3a3d69c38e3b3d20e94420ebebd05a69 +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/3b1656b46a35a6120c3407b930d468ba +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/3c0fc39d9b84afb4937545b620cd2d72 +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/3fa878a57cb0b42be266336564609b18 +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/40f26b5e75d0f747e691c0b38529fb59 +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/42aa8e53e39d8f5247f1b3e89cb00adc +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/42e1f4c72bf58cf112dd11eae8ee768b +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/433be3db83a4d9f93f5d1fa2ae3bde4e +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/4b6f9f46d7a2e230321d7f8df06ea470 +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/4c17c77b444339bb3ab293047da0ff0d +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sprockets/4ee93c096bb850d38032eb457afebf69 +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sprockets/4f25edc4354919ba67721f488ba10e12 +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sprockets/58fb821d4a4a44fdb2a89d4f487a8390 +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sprockets/5f97a76ac644497413f4c8dc547ddea6 +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sprockets/6076ab56e9c62fd04155d6f6c43e575e +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/60b75d9635ed84e08a0b9a245d8a3202 +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/64ad9f343408809fdfb1df851186853d +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/6e79870e51ea835a6847f8c65e23e14b +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/6e9d2e7aafa45c939731291fa453b8c2 +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/78f915513059378e161ceb6f2d14fbd9 +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/8102cf6724f489a310fe3a6b764bb2e9 +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/81108a1123b15b10c7f7f2e0d1207267 +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/81b3dcc0aa61577b08de13ba5633dbc4 +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/83e686634b5ac6d4b183677ed2edda8b +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sprockets/8581aae276f167a9b7b2158641b0bf87 +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sprockets/94cb3819408e525700729fbd473432c8 +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sprockets/99eb5e50b6d0e5d0d6b6c37cbde33864 +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sprockets/a7c86e9a777f7789dd1c78d26a662a87 +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sprockets/a9e19eb45005fa24bc8b90b6a374089f +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sprockets/ac4492393938e58cede2b6277afb0bc6 +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sprockets/ad1d96635f4dae7eb22d1984947d7440 +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sprockets/af718c632887ccb6c1c35c4b65c61293 +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sprockets/b2f45720a78d375468b99bb25f121c4e +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sprockets/b559f2694561fc6c44e3319f507de1e7 +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sprockets/b6e8c6ba59755a8fe132457f81065f96 +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sprockets/b796b57f310287a7a619afa9d5b99952 +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sprockets/b7c36a1c00d7804d9e827d704c0dd811 +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sprockets/bc28a210f3df576c74059aff8233eae3 +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sprockets/bc414fbd5123e40c4f5e69f4c294f489 +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sprockets/c0181c32e0ed10ec8fa3049f9a80f551 +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sprockets/c17130f66131c854d6f8c2196902b596 +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sprockets/c4c0e10aa5c21ece42c0bfe998a5d8c0 +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sprockets/c63bcc000975adbdf423db3ad43eb93f +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sprockets/c962f9220062a6407dfc7d9447565273 +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sprockets/cb8b538b6fce61b500edebe63156bf62 +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sprockets/cfcef2015b7df990ed90006632877389 +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sprockets/cff56d2d0a8b8a25d4b0388d242be9c8 +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sprockets/d32fc7356f764b22ecbcebbcb9b47ee1 +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sprockets/d776667bae72eb3d582da5803fc931ca +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sprockets/dfc307d14a0cf64cf8c3a4e94fdbcfb9 +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sprockets/e4b6570b82329477bc7043183b64b105 +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sprockets/eff1316ad12dd5b8f4cbf0ba9e448229 +0 -0
  187. data/spec/dummy/tmp/cache/assets/development/sprockets/f2348b747b81ca6e3a24d5bd0b7023c4 +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sprockets/f6f921309fcc78b6850abcf2418279fe +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sprockets/f7e1dbf50c19c9d439de52caa4296164 +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sprockets/ff2adfc3ed446b68ac2d0077e8af34e2 +0 -0
  192. data/spec/factories/companies.rb +7 -0
  193. data/spec/factories/handcart_ip_addresses.rb +8 -0
  194. data/spec/factories/handcart_subdomains.rb +5 -0
  195. data/spec/models/handcart/base_ip_strategy_spec.rb +23 -0
  196. data/spec/models/handcart/containment_strategy_spec.rb +23 -0
  197. data/spec/models/handcart/domain_constraint_spec.rb +38 -0
  198. data/spec/models/handcart/engine_spec.rb +14 -0
  199. data/spec/models/handcart/handcart_spec.rb +38 -0
  200. data/spec/models/handcart/inclusion_strategy_spec.rb +29 -0
  201. data/spec/models/handcart/ip_address_spec.rb +51 -0
  202. data/spec/models/handcart/ip_authorization_spec.rb +17 -0
  203. data/spec/models/handcart/subdomain_spec.rb +153 -0
  204. data/spec/routing/handcart/ip_addresses_routing_spec.rb +38 -0
  205. data/spec/routing/handcart/subdomains_routing_spec.rb +38 -0
  206. data/spec/spec_helper.rb +65 -0
  207. data/spec/support/subdomains.rb +26 -0
  208. metadata +565 -0
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require twitter-bootstrap-static/bootstrap
13
+ *= require twitter-bootstrap-static/fontawesome
14
+ *= require_tree .
15
+ */
@@ -0,0 +1,4 @@
1
+ footer {
2
+ text-align: center;
3
+ margin-top: 1em;
4
+ }
@@ -0,0 +1,7 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+
6
+ helper Handcart::ApplicationHelper
7
+ end
@@ -0,0 +1,2 @@
1
+ class CustomConstraintsController < ApplicationController
2
+ end
@@ -0,0 +1,7 @@
1
+ class IpAddressesController < ApplicationController
2
+
3
+ def index
4
+ @ip_addresses = current_handcart.ip_addresses.permitted
5
+ end
6
+
7
+ end
@@ -0,0 +1,51 @@
1
+ class Master::CompaniesController < MasterController
2
+ before_action :set_company, only: [:show, :edit, :update, :destroy]
3
+
4
+ def index
5
+ @companies = Company.all
6
+ end
7
+
8
+ def show
9
+ end
10
+
11
+ def new
12
+ @company = Company.new
13
+ end
14
+
15
+ def edit
16
+ end
17
+
18
+ def create
19
+ @company = Company.new(safe_params)
20
+
21
+ if @company.save
22
+ redirect_to @company, notice: 'Company was successfully created.'
23
+ else
24
+ render :new
25
+ end
26
+ end
27
+
28
+ def update
29
+ if @company.update(safe_params)
30
+ redirect_to @company, notice: 'Company was successfully updated.'
31
+ else
32
+ render :edit
33
+ end
34
+ end
35
+
36
+ def destroy
37
+ @company.destroy
38
+ redirect_to companies_url, notice: 'Company was successfully destroyed.'
39
+ end
40
+
41
+ private
42
+
43
+ def set_company
44
+ @company = Company.find(params[:id])
45
+ end
46
+
47
+ def safe_params
48
+ safe_attributes =[:name, :subdomain_id]
49
+ params.require(:company).permit(safe_attributes)
50
+ end
51
+ end
@@ -0,0 +1,4 @@
1
+ class Master::DashboardController < MasterController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class MasterController < ApplicationController
2
+ end
@@ -0,0 +1,12 @@
1
+ class PublicController < ApplicationController
2
+ layout 'public'
3
+
4
+ enable_forwarding("subdomain#index", "public#forbidden", only: [:index])
5
+
6
+ def index
7
+ end
8
+
9
+ def forbidden
10
+ end
11
+
12
+ end
@@ -0,0 +1,8 @@
1
+ class SubdomainController < ApplicationController
2
+
3
+ enable_blocking("public#forbidden")
4
+
5
+ def index
6
+ end
7
+
8
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ class Company < ActiveRecord::Base
2
+ acts_as_handcart
3
+
4
+ def to_s
5
+ name
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ - title "IP Addresses"
2
+
3
+ %table.table.table-striped
4
+ %thead
5
+ %tr
6
+ %th IP Address
7
+ %th Subnet Mask
8
+ %tbody
9
+ - @ip_addresses.each do |ip_address|
10
+ %tr
11
+ %td= ip_address.address
12
+ %td= ip_address.subnet_mask
@@ -0,0 +1 @@
1
+ - title "IP Address : #{@ip_address.address}"
@@ -0,0 +1,11 @@
1
+ %ul.nav
2
+ %li
3
+ = link_to handcart_path do
4
+ %i.icon-heart
5
+ Handcart
6
+ - unless (Handcart.ip_authorization.ip_authorization_strategy == :none)
7
+ %li{class: (params[:controller] == "ip_addresses") ? "active" : nil}
8
+ = link_to main_app.ip_addresses_path do
9
+ %i.icon-screenshot
10
+ IP Addresses
11
+
@@ -0,0 +1,53 @@
1
+ !!! 5
2
+ %html(lang="en")
3
+ %head
4
+ %meta(charset="utf-8")
5
+ %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
6
+ %meta(name="viewport" content="width=device-width, initial-scale=1.0")
7
+ %title= content_for?(:title) ? t('.title', title: yield(:title)) : t('.default_title')
8
+ = csrf_meta_tags
9
+ / Le HTML5 shim, for IE6-8 support of HTML elements
10
+ /[if lt IE 9]
11
+ = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
12
+ = stylesheet_link_tag "application", media: "all"
13
+ = favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '144x144'
14
+ = favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '114x114'
15
+ = favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '72x72'
16
+ = favicon_link_tag 'apple-touch-icon-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png'
17
+ = javascript_include_tag "application"
18
+
19
+ %body
20
+ .navbar.navbar-fluid-top.navbar-inverse
21
+ .navbar-inner
22
+ .container-fluid
23
+ %a.btn.btn-navbar(data-target=".nav-collapse" data-toggle="collapse")
24
+ %span.icon-bar
25
+ %span.icon-bar
26
+ %span.icon-bar
27
+ %a.brand(href="#") Dummy
28
+ = render "layouts/navbar"
29
+
30
+ .container-fluid
31
+ .row-fluid
32
+ - if content_for?(:sidebar)
33
+ .span9
34
+ %div.flash-message
35
+ = bootstrap_flash
36
+ - if content_for?(:sub_title)
37
+ .page-header
38
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
39
+ %div= yield
40
+ .span3
41
+ .well.sidebar-nav
42
+ %ul.nav.nav-list= yield(:sidebar)
43
+ - else
44
+ .span12
45
+ %div.flash-message
46
+ = bootstrap_flash
47
+ - if content_for?(:sub_title)
48
+ .page-header
49
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
50
+ %div= yield
51
+
52
+ %footer
53
+ %p &copy; Handcart #{Date.today.year}
@@ -0,0 +1,41 @@
1
+ !!! 5
2
+ %html(lang="en")
3
+ %head
4
+ %meta(charset="utf-8")
5
+ %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
6
+ %meta(name="viewport" content="width=device-width, initial-scale=1.0")
7
+ %title= content_for?(:title) ? t('.title', title: yield(:title)) : t('.default_title')
8
+ = csrf_meta_tags
9
+ / Le HTML5 shim, for IE6-8 support of HTML elements
10
+ /[if lt IE 9]
11
+ = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
12
+ = stylesheet_link_tag "application", media: "all"
13
+ = favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '144x144'
14
+ = favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '114x114'
15
+ = favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '72x72'
16
+ = favicon_link_tag 'apple-touch-icon-precomposed.png', rel: 'apple-touch-icon-precomposed', type: 'image/png'
17
+ = javascript_include_tag "application"
18
+
19
+ %body
20
+ .container-fluid
21
+ .row-fluid
22
+ - if content_for?(:sidebar)
23
+ .span9
24
+ %div.flash-message= bootstrap_flash
25
+ - if content_for?(:sub_title)
26
+ .page-header
27
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
28
+ %div= yield
29
+ .span3
30
+ .well.sidebar-nav
31
+ %ul.nav.nav-list= yield(:sidebar)
32
+ - else
33
+ .span12
34
+ %div.flash-message= bootstrap_flash
35
+ - if content_for?(:sub_title)
36
+ .page-header
37
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
38
+ %div= yield
39
+
40
+ %footer
41
+ %p &copy; Handcart #{Date.today.year}
@@ -0,0 +1,19 @@
1
+ = form_for @company do |f|
2
+ - if @company.errors.any?
3
+ #error_explanation
4
+ %h2= "#{pluralize(@company.errors.count, "error")} prohibited this company from being saved:"
5
+ %ul
6
+ - @company.errors.full_messages.each do |msg|
7
+ %li= msg
8
+
9
+ .field
10
+ = f.label :name
11
+ = f.text_field :name
12
+ .field
13
+ = f.label :subdomain_id
14
+ - if f.object.new_record?
15
+ = f.collection_select :subdomain_id, Handcart::Subdomain.unallocated, :id, :name
16
+ - else
17
+ = f.collection_select :subdomain_id, Handcart::Subdomain.unallocated_or_current(@company), :id, :name
18
+ .actions
19
+ = f.submit 'Save'
@@ -0,0 +1,7 @@
1
+ %h1 Editing company
2
+
3
+ = render 'form'
4
+
5
+ = link_to 'Show', @company
6
+ \|
7
+ = link_to 'Back', companies_path
@@ -0,0 +1,25 @@
1
+ %h1 Listing companies
2
+
3
+ %table.table
4
+ %tr
5
+ %th Name
6
+ %th Subdomain
7
+ %th
8
+ %th
9
+ %th
10
+
11
+ - @companies.each do |company|
12
+ %tr
13
+ %td= company.name
14
+ %td
15
+ - if company.subdomain
16
+ = company.subdomain.name
17
+ - else
18
+ None
19
+ %td= link_to 'Show', company
20
+ %td= link_to 'Edit', edit_company_path(company)
21
+ %td= link_to 'Destroy', company, method: :delete, data: { confirm: 'Are you sure?' }
22
+
23
+ %br
24
+
25
+ = link_to 'New Company', new_company_path
@@ -0,0 +1,5 @@
1
+ %h1 New company
2
+
3
+ = render 'form'
4
+
5
+ = link_to 'Back', companies_path
@@ -0,0 +1,12 @@
1
+ %p#notice= notice
2
+
3
+ %p
4
+ %b Name:
5
+ = @company.name
6
+ %p
7
+ %b Subdomain:
8
+ = @company.subdomain_id
9
+
10
+ = link_to 'Edit', edit_company_path(@company)
11
+ \|
12
+ = link_to 'Back', companies_path
@@ -0,0 +1,2 @@
1
+ %h1 Master Dashboard
2
+ %p This is an example of the master dashboard backend.
@@ -0,0 +1,3 @@
1
+ - title "Forbidden"
2
+
3
+ This is where people who are not authorized will be rejected to.
@@ -0,0 +1,2 @@
1
+ %h1 Dummy
2
+ %p This is the public side of the dummy application.
@@ -0,0 +1,2 @@
1
+ - title "Welcome to: #{current_handcart.name}"
2
+ %p This is the index page for the subdomain
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,40 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
9
+
10
+ Bundler.require(*Rails.groups)
11
+ require "handcart"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
+ # config.time_zone = 'Central Time (US & Canada)'
22
+
23
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
+ # config.i18n.default_locale = :de
26
+
27
+ # Shutup about your error messages i18n
28
+ config.i18n.enforce_available_locales = false
29
+
30
+ config.generators do |g|
31
+ g.test_framework :rspec, fixture: false, view_specs: false
32
+ g.fixture_replacement :factory_girl, dir: "../factories"
33
+ g.template_engine :haml
34
+ g.stylesheet_engine :scss
35
+ g.assets false
36
+ g.helper false
37
+ end
38
+ end
39
+ end
40
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,26 @@
1
+ development:
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ database: handcart_dummy_development
5
+ pool: 5
6
+ username: root
7
+ password:
8
+ host: localhost
9
+
10
+ test:
11
+ adapter: mysql2
12
+ encoding: utf8
13
+ database: handcart_dummy_test
14
+ pool: 5
15
+ username: root
16
+ password:
17
+ host: localhost
18
+
19
+ production:
20
+ adapter: mysql2
21
+ encoding: utf8
22
+ database: handcart_dummy_production
23
+ pool: 5
24
+ username: root
25
+ password:
26
+ host: localhost