office_clerk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +73 -0
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +63 -0
  6. data/Gemfile.lock +367 -0
  7. data/Guardfile +28 -0
  8. data/README.md +44 -0
  9. data/Rakefile +6 -0
  10. data/app/assets/images/admin/baskets-2.jpg +0 -0
  11. data/app/assets/images/admin/baskets.jpg +0 -0
  12. data/app/assets/images/admin/categories-2.jpg +0 -0
  13. data/app/assets/images/admin/categories.jpg +0 -0
  14. data/app/assets/images/admin/clerks-2.jpg +0 -0
  15. data/app/assets/images/admin/clerks.jpg +0 -0
  16. data/app/assets/images/admin/orders-2.jpg +0 -0
  17. data/app/assets/images/admin/orders.jpg +0 -0
  18. data/app/assets/images/admin/products-2.jpg +0 -0
  19. data/app/assets/images/admin/products.jpg +0 -0
  20. data/app/assets/images/admin/purchases-2.jpg +0 -0
  21. data/app/assets/images/admin/purchases.jpg +0 -0
  22. data/app/assets/images/admin/suppliers-2.jpg +0 -0
  23. data/app/assets/images/admin/suppliers.jpg +0 -0
  24. data/app/assets/images/alpha.png +0 -0
  25. data/app/assets/images/down-icon.png +0 -0
  26. data/app/assets/images/header.gif +0 -0
  27. data/app/assets/images/hihih.jpg +0 -0
  28. data/app/assets/images/hue.png +0 -0
  29. data/app/assets/images/koe.jpg +0 -0
  30. data/app/assets/images/missing.png +0 -0
  31. data/app/assets/images/saturation.png +0 -0
  32. data/app/assets/images/shop/basket.jpg +0 -0
  33. data/app/assets/images/shop/farfalla-logo.jpg +0 -0
  34. data/app/assets/images/shop/header.gif +0 -0
  35. data/app/assets/images/shop/header.jpg +0 -0
  36. data/app/assets/images/shop/header.png +0 -0
  37. data/app/assets/images/shop/kansi.jpg +0 -0
  38. data/app/assets/images/shop/kansi.png +0 -0
  39. data/app/assets/images/shop/logo.png +0 -0
  40. data/app/assets/images/shop/menu-gourmet.jpg +0 -0
  41. data/app/assets/images/shop/menu-hius.jpg +0 -0
  42. data/app/assets/images/shop/menu-huonetuoksu.jpg +0 -0
  43. data/app/assets/images/shop/menu-info.jpg +0 -0
  44. data/app/assets/images/shop/menu-kasvo.jpg +0 -0
  45. data/app/assets/images/shop/menu-laukut.jpg +0 -0
  46. data/app/assets/images/shop/menu-luomu.jpg +0 -0
  47. data/app/assets/images/shop/menu-men.jpg +0 -0
  48. data/app/assets/images/shop/menu-oljy.jpg +0 -0
  49. data/app/assets/images/shop/menu-tuoksu1.jpg +0 -0
  50. data/app/assets/images/shop/menu-vaatteet.jpg +0 -0
  51. data/app/assets/images/shop/menu-valaisin.jpg +0 -0
  52. data/app/assets/images/shop/menu-vartalo.jpg +0 -0
  53. data/app/assets/images/shop/spacer.gif +0 -0
  54. data/app/assets/images/shop/tausta.jpg +0 -0
  55. data/app/assets/images/shop/tervetuloa.gif +0 -0
  56. data/app/assets/images/shop/valk.png +0 -0
  57. data/app/assets/images/shop/valk3.png +0 -0
  58. data/app/assets/images/shop/violetti-lev.jpg +0 -0
  59. data/app/assets/images/shop/violetti.jpg +0 -0
  60. data/app/assets/images/ui-anim_basic_16x16.gif +0 -0
  61. data/app/assets/images/up-icon.png +0 -0
  62. data/app/assets/javascripts/admin.js +29 -0
  63. data/app/assets/javascripts/shop.js +30 -0
  64. data/app/assets/stylesheets/admin.css.scss +129 -0
  65. data/app/assets/stylesheets/shop-receipt.css.scss +80 -0
  66. data/app/assets/stylesheets/shop.css.scss +403 -0
  67. data/app/controllers/admin_controller.rb +23 -0
  68. data/app/controllers/application_controller.rb +41 -0
  69. data/app/controllers/baskets_controller.rb +176 -0
  70. data/app/controllers/categories_controller.rb +69 -0
  71. data/app/controllers/clerks_controller.rb +64 -0
  72. data/app/controllers/orders_controller.rb +57 -0
  73. data/app/controllers/products_controller.rb +126 -0
  74. data/app/controllers/purchases_controller.rb +72 -0
  75. data/app/controllers/sessions_controller.rb +46 -0
  76. data/app/controllers/shop_controller.rb +90 -0
  77. data/app/controllers/suppliers_controller.rb +63 -0
  78. data/app/helpers/admin_helper.rb +28 -0
  79. data/app/helpers/application_helper.rb +25 -0
  80. data/app/helpers/baskets_helper.rb +4 -0
  81. data/app/helpers/categories_helper.rb +4 -0
  82. data/app/helpers/orders_helper.rb +4 -0
  83. data/app/helpers/products_helper.rb +4 -0
  84. data/app/helpers/purchases_helper.rb +4 -0
  85. data/app/helpers/shop_helper.rb +17 -0
  86. data/app/helpers/suppliers_helper.rb +4 -0
  87. data/app/mailers/.keep +0 -0
  88. data/app/models/basket.rb +114 -0
  89. data/app/models/category.rb +27 -0
  90. data/app/models/clerk.rb +46 -0
  91. data/app/models/item.rb +26 -0
  92. data/app/models/order.rb +72 -0
  93. data/app/models/product.rb +100 -0
  94. data/app/models/purchase.rb +26 -0
  95. data/app/models/supplier.rb +15 -0
  96. data/app/views/addresses/_form_fields.html.haml +4 -0
  97. data/app/views/addresses/show.html.haml +23 -0
  98. data/app/views/baskets/_small.html.haml +25 -0
  99. data/app/views/baskets/edit.html.haml +74 -0
  100. data/app/views/baskets/index.html.haml +55 -0
  101. data/app/views/baskets/show.html.haml +18 -0
  102. data/app/views/categories/_treeview.html.haml +8 -0
  103. data/app/views/categories/_triple.html.haml +12 -0
  104. data/app/views/categories/edit.html.haml +36 -0
  105. data/app/views/categories/index.html.haml +49 -0
  106. data/app/views/categories/show.html.haml +30 -0
  107. data/app/views/clerks/edit.html.haml +20 -0
  108. data/app/views/clerks/index.html.haml +37 -0
  109. data/app/views/clerks/show.html.haml +19 -0
  110. data/app/views/layouts/_admin_menu.html.haml +14 -0
  111. data/app/views/layouts/_google.haml +8 -0
  112. data/app/views/layouts/_messages.html.haml +5 -0
  113. data/app/views/layouts/admin.html.haml +42 -0
  114. data/app/views/layouts/shop.html.haml +96 -0
  115. data/app/views/orders/edit.html.haml +25 -0
  116. data/app/views/orders/index.html.haml +93 -0
  117. data/app/views/orders/show.html.haml +37 -0
  118. data/app/views/products/_line.html.haml +25 -0
  119. data/app/views/products/_name.html.haml +4 -0
  120. data/app/views/products/_online.html.haml +2 -0
  121. data/app/views/products/_triple.html.haml +12 -0
  122. data/app/views/products/edit.html.haml +42 -0
  123. data/app/views/products/index.html.haml +86 -0
  124. data/app/views/products/show.html.haml +94 -0
  125. data/app/views/purchases/edit.html.haml +9 -0
  126. data/app/views/purchases/index.html.haml +52 -0
  127. data/app/views/purchases/show.html.haml +32 -0
  128. data/app/views/sessions/new.html.haml +10 -0
  129. data/app/views/sessions/new_clerk.html.haml +22 -0
  130. data/app/views/shop/_groups.html.haml +8 -0
  131. data/app/views/shop/_menu.html.haml +5 -0
  132. data/app/views/shop/_sub.html.haml +0 -0
  133. data/app/views/shop/checkout.haml +142 -0
  134. data/app/views/shop/group.html.haml +9 -0
  135. data/app/views/shop/main_group.html.haml +9 -0
  136. data/app/views/shop/order.haml +104 -0
  137. data/app/views/shop/product.html.haml +67 -0
  138. data/app/views/shop/product_list.html.haml +50 -0
  139. data/app/views/shop/saved_search.html +6 -0
  140. data/app/views/shop/sub_group.html.haml +19 -0
  141. data/app/views/shop/tuotteista.html.haml +40 -0
  142. data/app/views/shop/welcome.html.haml +103 -0
  143. data/app/views/suppliers/edit.html.haml +10 -0
  144. data/app/views/suppliers/index.html.haml +40 -0
  145. data/app/views/suppliers/show.html.haml +27 -0
  146. data/bin/bundle +3 -0
  147. data/bin/rails +8 -0
  148. data/bin/rake +8 -0
  149. data/bin/rspec +7 -0
  150. data/bin/spring +18 -0
  151. data/config.ru +7 -0
  152. data/config/application.example.yml +13 -0
  153. data/config/application.rb +59 -0
  154. data/config/application.yml +13 -0
  155. data/config/boot.rb +7 -0
  156. data/config/database.yml +25 -0
  157. data/config/environment.rb +6 -0
  158. data/config/environments/development.rb +31 -0
  159. data/config/environments/production.rb +80 -0
  160. data/config/environments/test.rb +36 -0
  161. data/config/i18n-tasks.yml +11 -0
  162. data/config/initializers/attack.rb +32 -0
  163. data/config/initializers/backtrace_silencers.rb +7 -0
  164. data/config/initializers/filter_parameter_logging.rb +4 -0
  165. data/config/initializers/inflections.rb +16 -0
  166. data/config/initializers/migrate.rb +6 -0
  167. data/config/initializers/mime_types.rb +6 -0
  168. data/config/initializers/secret_token.rb +12 -0
  169. data/config/initializers/session_store.rb +3 -0
  170. data/config/initializers/simple_form.rb +149 -0
  171. data/config/initializers/simple_form_bootstrap.rb +48 -0
  172. data/config/initializers/wrap_parameters.rb +14 -0
  173. data/config/locales/config.yml +23 -0
  174. data/config/locales/en.yml +183 -0
  175. data/config/locales/fi.yml +211 -0
  176. data/config/routes.rb +108 -0
  177. data/db/migrate/20131224171442_clerks.rb +15 -0
  178. data/db/migrate/20131226110406_suppliers.rb +9 -0
  179. data/db/migrate/20131226143612_categories.rb +18 -0
  180. data/db/migrate/20131226143747_items.rb +14 -0
  181. data/db/migrate/20131226144134_orders.rb +21 -0
  182. data/db/migrate/20131226144316_baskets.rb +12 -0
  183. data/db/migrate/20131226151151_purchases.rb +11 -0
  184. data/db/migrate/20131226151332_products.rb +27 -0
  185. data/db/schema.rb +138 -0
  186. data/db/seeds.rb +4 -0
  187. data/lib/assets/.keep +0 -0
  188. data/lib/office_clerk.rb +20 -0
  189. data/lib/office_clerk/shipping_method.rb +35 -0
  190. data/lib/tasks/.keep +0 -0
  191. data/lib/tasks/import.rake +33 -0
  192. data/lib/templates/haml/scaffold/_form.html.haml +8 -0
  193. data/office_clerk.gemspec +46 -0
  194. data/public/404.html +58 -0
  195. data/public/422.html +58 -0
  196. data/public/500.html +57 -0
  197. data/public/favicon.ico +0 -0
  198. data/public/humans.txt +20 -0
  199. data/public/robots.txt +5 -0
  200. data/spec/controllers/baskets_controller_spec.rb +112 -0
  201. data/spec/controllers/categories_controller_spec.rb +133 -0
  202. data/spec/controllers/clerks_controller_spec.rb +70 -0
  203. data/spec/controllers/orders_controller_spec.rb +105 -0
  204. data/spec/controllers/products_controller_spec.rb +138 -0
  205. data/spec/controllers/purchases_controller_spec.rb +123 -0
  206. data/spec/controllers/sessions_controller_spec.rb +18 -0
  207. data/spec/controllers/suppliers_controller_spec.rb +137 -0
  208. data/spec/factories/addresses.rb +11 -0
  209. data/spec/factories/baskets.rb +15 -0
  210. data/spec/factories/categories.rb +8 -0
  211. data/spec/factories/clerks.rb +15 -0
  212. data/spec/factories/items.rb +19 -0
  213. data/spec/factories/orders.rb +9 -0
  214. data/spec/factories/products.rb +10 -0
  215. data/spec/factories/purchases.rb +10 -0
  216. data/spec/factories/suppliers.rb +7 -0
  217. data/spec/features/baskets/buttons_spec.rb +35 -0
  218. data/spec/features/baskets/edit_spec.rb +50 -0
  219. data/spec/features/baskets/index_spec.rb +12 -0
  220. data/spec/features/baskets/search_spec.rb +33 -0
  221. data/spec/features/baskets/show_spec.rb +21 -0
  222. data/spec/features/categories_spec.rb +21 -0
  223. data/spec/features/clerks_spec.rb +21 -0
  224. data/spec/features/orders_spec.rb +14 -0
  225. data/spec/features/products/index_spec.rb +30 -0
  226. data/spec/features/products/new_spec.rb +20 -0
  227. data/spec/features/purchases_spec.rb +14 -0
  228. data/spec/features/shops_spec.rb +18 -0
  229. data/spec/features/suppliers_spec.rb +18 -0
  230. data/spec/models/baskets/inventory_spec.rb +34 -0
  231. data/spec/models/baskets/items_spec.rb +37 -0
  232. data/spec/models/baskets/products_spec.rb +31 -0
  233. data/spec/models/category_spec.rb +18 -0
  234. data/spec/models/clerk/email_spec.rb +69 -0
  235. data/spec/models/clerk/password_spec.rb +83 -0
  236. data/spec/models/item_spec.rb +33 -0
  237. data/spec/models/locale_spec.rb +17 -0
  238. data/spec/models/order_spec.rb +19 -0
  239. data/spec/models/product_spec.rb +29 -0
  240. data/spec/models/purchase_spec.rb +8 -0
  241. data/spec/models/supplier_spec.rb +8 -0
  242. data/spec/routing/baskets_routing_spec.rb +35 -0
  243. data/spec/routing/categories_routing_spec.rb +35 -0
  244. data/spec/routing/orders_routing_spec.rb +35 -0
  245. data/spec/routing/products_routing_spec.rb +35 -0
  246. data/spec/routing/purchases_routing_spec.rb +35 -0
  247. data/spec/routing/suppliers_routing_spec.rb +35 -0
  248. data/spec/spec_helper.rb +74 -0
  249. data/spec/support/request_helper.rb +31 -0
  250. data/test/fixtures/baskets.yml +41993 -0
  251. data/test/fixtures/categories.yml +638 -0
  252. data/test/fixtures/clerks.yml +694 -0
  253. data/test/fixtures/items.yml +83651 -0
  254. data/test/fixtures/orders.yml +58918 -0
  255. data/test/fixtures/products.yml +110904 -0
  256. data/test/fixtures/purchases.yml +1755 -0
  257. data/test/fixtures/suppliers.yml +341 -0
  258. data/todo +8 -0
  259. metadata +607 -0
@@ -0,0 +1,13 @@
1
+ # Add account credentials and API keys here.
2
+ # See http://railsapps.github.io/rails-environment-variables.html
3
+ # This file should be listed in .gitignore to keep your settings secret!
4
+ # Each entry sets a local environment variable and overrides ENV variables in the Unix shell.
5
+ # For example, setting:
6
+ # GMAIL_USERNAME: Your_Gmail_Clerkname
7
+ # makes 'Your_Gmail_Clerkname' available as ENV["GMAIL_USERNAME"]
8
+
9
+ # Add application configuration variables here, as shown below.
10
+ #
11
+ ADMIN_NAME: First Clerk
12
+ ADMIN_EMAIL: user@example.com
13
+ ADMIN_PASSWORD: changeme
data/config/boot.rb ADDED
@@ -0,0 +1,7 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
4
+ # Set up gems listed in the Gemfile.
5
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
6
+
7
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/development.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,6 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ OfficeClerk::Application.initialize!
6
+
@@ -0,0 +1,31 @@
1
+ OfficeClerk::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true # Send email in development mode.
29
+ config.action_mailer.perform_deliveries = true
30
+
31
+ end
@@ -0,0 +1,80 @@
1
+ OfficeClerk::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ # config.assets.compile = true
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ config.assets.precompile += %w( admin.js admin.css shop.js shop.css)
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ #config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end
@@ -0,0 +1,36 @@
1
+ OfficeClerk::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+ end
@@ -0,0 +1,11 @@
1
+ base_locale: fi
2
+ locales: [fi]
3
+ data:
4
+ # a list of file globs to read from per-locale
5
+ read:
6
+ # add this one to also read from namespaced files, e.g. simple_form.en.yml:
7
+ - 'config/locales/*.%{locale}.yml'
8
+ # a list of {key pattern => file} routes, matched top to bottom
9
+ write:
10
+ # this is the default catch-all:
11
+ - 'config/locales/office.%{locale}.yml' # path is short for ['*', path]
@@ -0,0 +1,32 @@
1
+ # Block requests for php or cgi, jps and what else the people throw at us
2
+ Rack::Attack.blacklist('block admin probes') do |req|
3
+ # Request are blocked if the return value is truthy
4
+ ["php" , "jsp" , "cgi", "asp", "cfm," "proxy.txt", "soapCaller", "Win32" , "HNAP1" , "w00tw00t",
5
+ "pma" , "mysql" ,"msd" , "MySQL" , "jmx-console" , "ervlet" , "install"].each do |no|
6
+ return true if req.path.index(no)
7
+ end
8
+ false
9
+ end
10
+
11
+ # Block requests from people clearly out to break servers
12
+ Rack::Attack.blacklist('block admin probes') do |req|
13
+ [ "79.143.82.69" , "85.76.99.50", "127.0.0.1"].include? req.ip
14
+ end
15
+
16
+ # Throttle requests to 5 requests per second per ip
17
+ Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second) do |req|
18
+ # If the return value is truthy, the cache key for the return value
19
+ # is incremented and compared with the limit. In this case:
20
+ # "rack::attack:#{Time.now.to_i/1.second}:req/ip:#{req.ip}"
21
+ #
22
+ # If falsy, the cache key is neither incremented nor checked.
23
+
24
+ req.ip
25
+ end
26
+
27
+ # Always allow requests from shop
28
+ # (blacklist & throttles are skipped)
29
+ Rack::Attack.whitelist('allow from localhost') do |req|
30
+ # Requests are allowed if the return value is truthy
31
+ [ "85.76.112.161" , "85.76.99.50", "127.0.0.1"].include? req.ip
32
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,6 @@
1
+ # poor mans migration.
2
+ # Trying to keep the schema clean until version 1
3
+
4
+ #unless Basket.columns_hash["locked"]
5
+ # ActiveRecord::Base.connection.add_column :baskets, :locked, :date
6
+ #end
@@ -0,0 +1,6 @@
1
+ #Mime::Type.register_alias "application/pdf", :pdf
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new mime types for use in respond_to blocks:
5
+ # Mime::Type.register "text/richtext", :rtf
6
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ OfficeClerk::Application.config.secret_key_base = 'aa3a95b2c20f81ab2f5e3236233108b998d6cb1db12b32e17cd1154a04a574bd2a68652518f71fe11a3ca5deb6a848682dcd54f41acd3ad2d257a3dab3c3b2f5'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ OfficeClerk::Application.config.session_store :cookie_store, key: '_office_clerk_session'
@@ -0,0 +1,149 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, class: :input,
9
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
+ ## Extensions enabled by default
11
+ # Any of these extensions can be disabled for a
12
+ # given input by passing: `f.input EXTENSION_NAME => false`.
13
+ # You can make any of these extensions optional by
14
+ # renaming `b.use` to `b.optional`.
15
+
16
+ # Determines whether to use HTML5 (:email, :url, ...)
17
+ # and required attributes
18
+ b.use :html5
19
+
20
+ # Calculates placeholders automatically from I18n
21
+ # You can also pass a string as f.input placeholder: "Placeholder"
22
+ b.use :placeholder
23
+
24
+ ## Optional extensions
25
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for any of those
28
+ # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+ # Calculates maxlength from length validations for string inputs
31
+ b.optional :maxlength
32
+
33
+ # Calculates pattern from format validations for string inputs
34
+ b.optional :pattern
35
+
36
+ # Calculates min and max from length validations for numeric inputs
37
+ b.optional :min_max
38
+
39
+ # Calculates readonly automatically from readonly attributes
40
+ b.optional :readonly
41
+
42
+ ## Inputs
43
+ b.use :label_input
44
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
45
+ b.use :error, wrap_with: { tag: :span, class: :error }
46
+ end
47
+
48
+ # The default wrapper to be used by the FormBuilder.
49
+ config.default_wrapper = :default
50
+
51
+ # Define the way to render check boxes / radio buttons with labels.
52
+ # Defaults to :nested for bootstrap config.
53
+ # inline: input + label
54
+ # nested: label > input
55
+ config.boolean_style = :nested
56
+
57
+ # Default class for buttons
58
+ config.button_class = 'btn'
59
+
60
+ # Method used to tidy up errors. Specify any Rails Array method.
61
+ # :first lists the first message for each field.
62
+ # Use :to_sentence to list all errors for each field.
63
+ # config.error_method = :first
64
+
65
+ # Default tag used for error notification helper.
66
+ config.error_notification_tag = :div
67
+
68
+ # CSS class to add for error notification helper.
69
+ config.error_notification_class = 'error_notification'
70
+
71
+ # ID to add for error notification helper.
72
+ # config.error_notification_id = nil
73
+
74
+ # Series of attempts to detect a default label method for collection.
75
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+ # Series of attempts to detect a default value method for collection.
78
+ # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+ # config.collection_wrapper_tag = nil
82
+
83
+ # You can define the class to use on all collection wrappers. Defaulting to none.
84
+ # config.collection_wrapper_class = nil
85
+
86
+ # You can wrap each item in a collection of radio/check boxes with a tag,
87
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+ # SimpleForm will force this option to be a label.
89
+ # config.item_wrapper_tag = :span
90
+
91
+ # You can define a class to use in all item wrappers. Defaulting to none.
92
+ # config.item_wrapper_class = nil
93
+
94
+ # How the label text should be generated altogether with the required text.
95
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+ # You can define the class to use on all labels. Default is nil.
98
+ # config.label_class = nil
99
+
100
+ # You can define the class to use on all forms. Default is simple_form.
101
+ # config.form_class = :simple_form
102
+
103
+ # You can define which elements should obtain additional classes
104
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+ # Whether attributes are required by default (or not). Default is true.
107
+ # config.required_by_default = true
108
+
109
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+ # These validations are enabled in SimpleForm's internal config but disabled by default
111
+ # in this configuration, which is recommended due to some quirks from different browsers.
112
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+ # change this configuration to true.
114
+ config.browser_validations = false
115
+
116
+ # Collection of methods to detect if a file type was given.
117
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+ # Custom mappings for input types. This should be a hash containing a regexp
120
+ # to match as key, and the input type that will be used when the field name
121
+ # matches the regexp as value.
122
+ # config.input_mappings = { /count/ => :integer }
123
+
124
+ # Custom wrappers for input types. This should be a hash containing an input
125
+ # type as key and the wrapper that will be used for all inputs with specified type.
126
+ # config.wrapper_mappings = { string: :prepend }
127
+
128
+ # Default priority for time_zone inputs.
129
+ # config.time_zone_priority = nil
130
+
131
+ # Default priority for country inputs.
132
+ # config.country_priority = nil
133
+
134
+ # When false, do not use translations for labels.
135
+ # config.translate_labels = true
136
+
137
+ # Automatically discover new inputs in Rails' autoload path.
138
+ # config.inputs_discovery = true
139
+
140
+ # Cache SimpleForm inputs discovery
141
+ # config.cache_discovery = !Rails.env.development?
142
+
143
+ # Default class for inputs
144
+ config.input_class = "form-control"
145
+
146
+ # Defines if the default input wrapper class should be included in radio
147
+ # collection wrappers.
148
+ # config.include_default_input_wrapper_class = true
149
+ end