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,403 @@
1
+ // Place all the styles related to the shops controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
4
+ /*
5
+ *= require rails_bootstrap_forms
6
+ */
7
+
8
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans);
9
+
10
+ $highlight: #108BAD;
11
+ $highlight-1: scale-color($highlight, $lightness: 10%);
12
+ $highlight-2: scale-color($highlight, $lightness: 20%);
13
+ $highlight-3: scale-color($highlight, $lightness: 30%);
14
+ $highlight-7: scale-color($highlight, $lightness: 70%);
15
+ $highlight-8: scale-color($highlight, $lightness: 80%);
16
+ $highlight-9: scale-color($highlight, $lightness: 90%);
17
+ $secondary-color: #c7e1df;
18
+ $table-bg-accent: #E2EEF1;
19
+ $breadcrumb-bg: rgba(213,223,255,0.3);
20
+
21
+
22
+ ul.subcat {
23
+ font-size: .9em;
24
+ padding-left: 10px;
25
+ }
26
+
27
+ ul.cat {
28
+ padding-left: 0;
29
+
30
+ }
31
+
32
+ .navbar-nav li a {
33
+ font-size: 12px;
34
+ color: #E4DFDF; }
35
+
36
+ .main {
37
+ max-width: 92%;
38
+ margin: 70px auto 0; }
39
+
40
+ @import "bootstrap";
41
+
42
+ .top-bar-section ul {
43
+ background: #ffffff;
44
+ }
45
+
46
+ .logo {
47
+ background-image: image-url("shop/kansi.jpg");
48
+ background-repeat: no-repeat;
49
+ background-position: center center;
50
+ }
51
+
52
+ .top-bar-section form {
53
+ background-color: $highlight;
54
+ padding-right: 5px;
55
+ }
56
+
57
+ .right {
58
+ text-align: right;
59
+ }
60
+
61
+ .footer {
62
+ padding-top: 30px;
63
+ padding-left: 70px;
64
+ padding-right: 70px;
65
+ line-height: 140%;
66
+ font-size: .9em;
67
+ strong, b {
68
+ color: $highlight;
69
+ }
70
+ }
71
+
72
+
73
+
74
+
75
+ .menus {
76
+ padding: 8px;
77
+ margin: 0 auto;
78
+ }
79
+
80
+ .group-wrapper {
81
+ position: relative;
82
+ margin-top: 25px;
83
+ }
84
+
85
+
86
+ .group-wrapper h3, h5, {
87
+ position: absolute;
88
+ left: 0;
89
+ bottom: 0;
90
+ padding: 10px;
91
+ color: #FFF;
92
+ background: black;
93
+ /* fallback color */
94
+ background: rgba(3, 142, 235, 0.25);
95
+ text-shadow: black 1px 1px 03px;
96
+ margin: 0px;
97
+ width: 100%;
98
+ }
99
+
100
+ .group-wrapper.sub img {
101
+ height: auto;
102
+ max-width: 100%; }
103
+
104
+ .group-wrapper.side img {
105
+ height: auto;
106
+ width: 200px; }
107
+
108
+ .group-wrapper.side h5 {
109
+ font-size: 18px;
110
+ padding: 7px;
111
+ width: 200px;
112
+ }
113
+
114
+ .group-wrapper.checkout h5 {
115
+ color: #F19711;
116
+ background: black;
117
+ background: rgba(212, 232, 245, 0.45);
118
+ text-shadow: rgb(255, 255, 255) 0px 0px 10px;
119
+ }
120
+
121
+
122
+
123
+ .intro {
124
+ padding-top: 20px;
125
+ }
126
+
127
+ .intro2 {
128
+ width: 80%;
129
+ }
130
+
131
+ .img-responsive-prod {
132
+ display: block;
133
+ max-width: 100%;
134
+ max-height: 400px;}
135
+
136
+ .intro p {
137
+ font-size: .8em;
138
+ line-height: 130%;
139
+ margin-bottom: 12px;
140
+ }
141
+
142
+ .intro2 p {
143
+ font-size: .9em;
144
+ line-height: 130%;
145
+ margin-bottom: 12px;
146
+ }
147
+
148
+ .intro2 img, .intro3 img {
149
+ max-width: 150px;
150
+ padding-top: 25px;
151
+ padding-bottom: 20px;
152
+ }
153
+
154
+ .intro3 p {
155
+ font-size: .8em;
156
+ line-height: 130%;
157
+ margin-bottom: 12px;
158
+ }
159
+
160
+ .product-container {
161
+ margin-bottom: 31px;
162
+ padding: 0 0 86px;
163
+ text-align: center;
164
+ position: relative;
165
+ border: 1px solid #cae3fb;
166
+ box-shadow: 2px 2px 5px #E8EDF0;
167
+ border-radius: 4px;
168
+ height: 375px;
169
+ width: 185px;
170
+ }
171
+
172
+
173
+ .square-image {
174
+ height: 200px;}
175
+
176
+
177
+ .square-image img {
178
+ border-top-left-radius: 4px;
179
+ border-top-right-radius: 4px;
180
+ display: block;
181
+ height: 190px;
182
+ max-width: 100%;
183
+ margin: auto;
184
+ padding-top: 10px;
185
+ }
186
+
187
+
188
+
189
+ .product-fact {
190
+ height: 49px;
191
+ position: absolute;
192
+ padding-right: 24px;
193
+ padding-left: 24px;
194
+ width: 100%;
195
+ margin-bottom: 3px;
196
+ border-top: 1px solid #0078ff;
197
+ margin-right: 0;
198
+ text-align: left;
199
+ p {
200
+ font-size: 1.2rem;
201
+ color: #000000;
202
+ line-height: 110%;
203
+ margin-bottom: 3px;
204
+ }
205
+ }
206
+
207
+ h5.product-name {
208
+ font-style: bold;
209
+ margin-bottom: 3px;
210
+ }
211
+
212
+ h1.product-title {
213
+ font-size: 2.3rem;
214
+ color: $highlight;
215
+ }
216
+
217
+ #product-description {
218
+ line-height: 130%;
219
+ margin-top: 10px;
220
+ }
221
+
222
+ #inside-product-cart-form {
223
+ margin-top: 10px;
224
+ }
225
+
226
+ .product-price {
227
+ margin-top: 12px;
228
+ }
229
+
230
+ .price.selling {
231
+ color: $highlight;
232
+ font-weight: 300;
233
+ font-size: 1.8rem;
234
+ text-align: right;
235
+ }
236
+
237
+ .breadcrumb {
238
+ margin: 8px 15px 20px;
239
+ border-radius: 0px;
240
+ }
241
+
242
+ .list {
243
+ margin-top: 12px;
244
+ padding-top: 12px;
245
+ border-top: 1px dotted #0078ff;
246
+ float: left;
247
+ }
248
+
249
+ .basket-total {
250
+ font-size: .9em;
251
+ table {
252
+ border: 0px;
253
+ }
254
+ }
255
+
256
+ .frame {
257
+ margin-right: 0;
258
+ margin-left: 0;
259
+ border: 1px dotted #0078ff;
260
+ border-radius: 4px;
261
+ padding: 12px;
262
+ font-size: .75em;
263
+ }
264
+
265
+ @media screen
266
+ {
267
+ .no-screen, .no-screen *
268
+ {
269
+ display: none !important;
270
+ }
271
+ }
272
+
273
+ .navbar-inverse .navbar-inner {
274
+ border: 0px;
275
+ background-color: $highlight;
276
+ }
277
+
278
+ .carouselli {
279
+ margin-top: 50px;
280
+ margin: 50px auto 0;
281
+ width: 1000px;
282
+ text-align: center;
283
+ }
284
+
285
+ .carousel-control {
286
+ position: absolute;
287
+ top: 93%;
288
+ left: 15px;
289
+ width: 40px;
290
+ height: 40px;
291
+ margin-top: -20px;
292
+ font-size: 60px;
293
+ font-weight: 100;
294
+ line-height: 30px;
295
+ color: #ffffff;
296
+ text-align: center;
297
+ background: #BDB6B6;
298
+ border: 3px solid #ffffff;
299
+ -webkit-border-radius: 23px;
300
+ -moz-border-radius: 23px;
301
+ border-radius: 23px;
302
+ opacity: 0.5;
303
+ filter: alpha(opacity=50);
304
+ }
305
+
306
+ .carousel-control.right {
307
+ right: 15px;
308
+ }
309
+
310
+ body {
311
+ margin-top: 50px;
312
+ /* Required margin for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
313
+ }
314
+
315
+ .banner {
316
+ text-align: center;
317
+ background: image-url("shop/violetti-lev.jpg") no-repeat center center;
318
+ background-size: cover;
319
+ min-height: 500px;
320
+ margin-top: 15px;
321
+ }
322
+
323
+ .taustalogo {
324
+ background: url(/assets/shop/kansi.jpg) no-repeat scroll;
325
+ height: 107px;
326
+ }
327
+
328
+ .dropped {
329
+ top: 50px;
330
+ position: relative;
331
+ }
332
+
333
+ .dropdown-menu {
334
+ padding-left: 10px;
335
+ }
336
+
337
+ .navbar-inverse .navbar-nav > li > a {
338
+ color: #E2E7F6; }
339
+
340
+ .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus {
341
+ background-color: #0A6779; }
342
+
343
+
344
+ .alert {
345
+ padding: 8px 15px;
346
+ font-weight: 500;
347
+ border-radius: 0px; }
348
+
349
+
350
+ .alert-shop {
351
+ margin: 8px 0 10px;
352
+ background-color: $highlight-2;
353
+ color: #ffffff;
354
+ text-align: center;
355
+ }
356
+
357
+ .alert-danger {
358
+ margin: 10px 15px 0px 15px;
359
+ }
360
+
361
+ .alert-notice {
362
+ margin: 1px;
363
+ }
364
+
365
+ .highlight{
366
+ color: $highlight;
367
+ }
368
+
369
+ .bg-high1 {
370
+ background-color: $highlight-1;
371
+ }
372
+
373
+ .bg-high2 {
374
+ background-color: $highlight-2;
375
+ }
376
+
377
+ .bg-high3 {
378
+ background-color: $highlight-3;
379
+ }
380
+
381
+ .bg-high7 {
382
+ background-color: $highlight-7;
383
+ }
384
+
385
+ .bg-high8 {
386
+ background-color: $highlight-8;
387
+ }
388
+
389
+ .bg-high9 {
390
+ background-color: $highlight-9;
391
+ }
392
+
393
+
394
+ .welcome {
395
+ max-width: 92%;
396
+ margin: 20px auto 0; }
397
+
398
+ .btn-mega {
399
+ padding: 20px 32px;
400
+ font-size: 28px;
401
+ line-height: 1.33;
402
+ border-radius: 6px;
403
+ }
@@ -0,0 +1,23 @@
1
+ # encoding : utf-8
2
+ class AdminController < ApplicationController
3
+
4
+ layout "admin"
5
+
6
+ before_filter :clean_search , :only => [:index , :search]
7
+
8
+ before_filter :require_admin
9
+
10
+ def require_admin
11
+ clerk = current_clerk
12
+ return if clerk and clerk.admin
13
+ redirect_to sign_in_url
14
+ end
15
+
16
+ def clean_search
17
+ q = params[:q]
18
+ return unless q
19
+ q.keys.each do |key|
20
+ q.delete(key) if q[key].blank?
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,41 @@
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
+ helper_method :current_clerk , :current_basket
6
+
7
+ # users are stored in the session by email
8
+ # if user is not logged i , return nil
9
+ def current_clerk
10
+ return @current_clerk if @current_clerk
11
+ return nil unless session[:clerk_email]
12
+ @current_clerk = Clerk.where( :email => session[:clerk_email] ).limit(1).first
13
+ end
14
+
15
+ def error
16
+ logger.info "Error" + request.url
17
+ redirect_to "/"
18
+ end
19
+
20
+ # the current user has a shopping basket which is also stored in the session
21
+ # we *always* return a basket, even if we have to create one (and then store in the session)
22
+ # this is not associated with the user until an order is finalized at which point the order gets the users email (not id)
23
+ # that way people don't have to log in to order, but if they are we can retrieve their orders by email
24
+ def current_basket
25
+ return @current_basket unless @current_basket.nil?
26
+ if session[:current_basket]
27
+ @current_basket = Basket.where( :id => session[:current_basket] ).limit(1).first
28
+ end
29
+ if @current_basket.nil?
30
+ @current_basket = Basket.new(:kori_type => "Order")
31
+ @current_basket.save!
32
+ session[:current_basket] = @current_basket.id
33
+ end
34
+ @current_basket
35
+ end
36
+
37
+ # when the order is made and the basket locked, it's time to make a new one
38
+ def new_basket
39
+ session[:current_basket] = nil
40
+ end
41
+ end