handcart 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -1
  3. data/app/assets/stylesheets/handcart/application.css +2 -2
  4. data/app/controllers/handcart/application_controller.rb +1 -0
  5. data/app/views/handcart/ip_addresses/index.html.haml +1 -6
  6. data/config/locales/en.bootstrap.yml +18 -0
  7. data/lib/handcart/version.rb +1 -1
  8. data/lib/handcart.rb +1 -0
  9. data/spec/dummy/app/assets/stylesheets/layout.css.scss +4 -0
  10. data/spec/dummy/app/controllers/master/companies_controller.rb +1 -1
  11. data/spec/dummy/app/controllers/master_controller.rb +1 -0
  12. data/spec/dummy/app/controllers/public_controller.rb +4 -0
  13. data/spec/dummy/app/controllers/subdomain_controller.rb +1 -1
  14. data/spec/dummy/app/views/ip_addresses/index.html.haml +4 -2
  15. data/spec/dummy/app/views/layouts/_navbar.html.haml +1 -5
  16. data/spec/dummy/app/views/layouts/application.html.haml +2 -2
  17. data/spec/dummy/app/views/layouts/master/_navbar.html.haml +9 -0
  18. data/spec/dummy/app/views/layouts/master.html.haml +54 -0
  19. data/spec/dummy/app/views/layouts/public.html.haml +14 -17
  20. data/spec/dummy/app/views/master/companies/_form.html.haml +10 -18
  21. data/spec/dummy/app/views/master/companies/edit.html.haml +1 -5
  22. data/spec/dummy/app/views/master/companies/index.html.haml +30 -22
  23. data/spec/dummy/app/views/master/companies/new.html.haml +1 -3
  24. data/spec/dummy/app/views/master/companies/show.html.haml +20 -11
  25. data/spec/dummy/app/views/public/blocked.html.haml +3 -0
  26. data/spec/dummy/config/locales/en.yml +11 -0
  27. data/spec/dummy/config/routes.rb +4 -2
  28. data/spec/dummy/log/development.log +20053 -0
  29. data/spec/dummy/log/test.log +2358 -0
  30. data/spec/dummy/tmp/cache/assets/development/sass/dc98e44780f42e6521ebbf14c4db22f6a78c41ef/layout.css.scssc +0 -0
  31. data/spec/dummy/tmp/cache/assets/development/sprockets/00f08604d8f776c21ada846caa6bbdb0 +0 -0
  32. data/spec/dummy/tmp/cache/assets/development/sprockets/0263bb05a0e6b1bbb810cd2f4d7673ec +0 -0
  33. data/spec/dummy/tmp/cache/assets/development/sprockets/029369cf8ac3e9e0b6dcd97be2f4c49f +0 -0
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/09f4c1aca54ad2a36967f2df2f81e8c4 +0 -0
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/0a87e84a465c32dab4ad98fc9c2a63a6 +0 -0
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/0b395be5ecda60a5af57d587f1141ab4 +0 -0
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/0f02e6ae06bc4a3cddeba71370b9725a +0 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/106c3f4e1fc71e9dc70abae55d432886 +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/159811a4b9b36a9fddf03e41ca8f9e77 +0 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/17647e7d117bd32eab4e45df47ac67dd +0 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/1b59e740d598d1aa24b3715659ad75e4 +0 -0
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/1bfdad4d3fa050d80426d6303a2267ea +0 -0
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/22eaff98c78726cf14701d84196b66d2 +0 -0
  45. data/spec/dummy/tmp/cache/assets/development/sprockets/26efc65ca6193b64fd767a821fb4b966 +0 -0
  46. data/spec/dummy/tmp/cache/assets/development/sprockets/2e705e0528152cd704e5c2735f9d504c +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  48. data/spec/dummy/tmp/cache/assets/development/sprockets/350c8c72b1dbd7a84f85424b5cd4def1 +0 -0
  49. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  50. data/spec/dummy/tmp/cache/assets/development/sprockets/3b1656b46a35a6120c3407b930d468ba +0 -0
  51. data/spec/dummy/tmp/cache/assets/development/sprockets/3b362be5f6b60c4800c552fde7b045eb +0 -0
  52. data/spec/dummy/tmp/cache/assets/development/sprockets/3e25506586171801c38ebc5dd9c47666 +0 -0
  53. data/spec/dummy/tmp/cache/assets/development/sprockets/3fa878a57cb0b42be266336564609b18 +0 -0
  54. data/spec/dummy/tmp/cache/assets/development/sprockets/406e93ddf863a3e0af86de082236c986 +0 -0
  55. data/spec/dummy/tmp/cache/assets/development/sprockets/41441c5b6158108c0a1546330ed56eef +0 -0
  56. data/spec/dummy/tmp/cache/assets/development/sprockets/45ab25244bc7a7b7bed42fe01caa6878 +0 -0
  57. data/spec/dummy/tmp/cache/assets/development/sprockets/47e5dd3b45ba04424ecc42c81f015afe +0 -0
  58. data/spec/dummy/tmp/cache/assets/development/sprockets/49d06f60db47faa83c8ce5def5ac20c9 +0 -0
  59. data/spec/dummy/tmp/cache/assets/development/sprockets/4ebff88fcdd6819ef4b63c094176a00a +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/4f52964b54c90695a4b5d92bcf9bf535 +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/52bd81a90f0de655ce390b5e352a756d +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/55412c223bdc1ae2a172a96403d402b4 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/58c9ead53e8c98abde8ba9f4c4862b06 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/5a090729252c3b1a3ffa88f976d1ac9f +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/605865fffcf6e4dc55c7cbcba3d4e01f +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/63b0e0532e0484132e61fc894b29f918 +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/69f7abb083a5343008bcba6c44de855b +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/6c6564ab3b132cc24a83e522c2876248 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/6e9d2e7aafa45c939731291fa453b8c2 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/7266502e559c7ad7bbe585128999f415 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/750fa0bee9c70a91e72497d2f0787ed3 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/76a356906034ebb7d3f1edea383df4df +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/7a815a1a3d9620c5e03dfcdc0de24436 +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/7efdaf15bce3bf81ff3d63bcdc260ef1 +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/8102cf6724f489a310fe3a6b764bb2e9 +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/8306463fbe9a61679c7e29914fc30061 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/8c924a4bf7fe2fc32f867164f98caf8f +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/929de757bf766a6bb375bdf26e0a40c7 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/995dfd030589cb8dafa38a482a964a6a +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/a2dde4b4f4a5869b431e268fc1b20fce +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/a5846dde80b078842fb21cba47e4ba58 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/a6a79bd215494799aaff25ea9664965f +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/aaafe63e42e6d7dc3923e06a5aee0a34 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/b66b48f9661f23aa3c5588d67d1fef2d +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/bacb89735f1c6bfe52a73e4d541a00f9 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/c1bf9e9fc1b3fa311ed5130bc8d26a56 +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/ca063dc0143516fea81c69d251791fbc +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/d1bec5a7c52bb09d51096ff25a14913b +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/d32fc7356f764b22ecbcebbcb9b47ee1 +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/d5b06b4a3dab1db6e512605222dc5334 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/d7799fbe35d038230ad7e1149c39256f +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/d822c4fab433c39caf65c804d7d845c1 +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/d8309081cb7ed785135d35b9280cbef2 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/eb5896a1cdcb574371c6341692bc0d15 +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/fc996723b5c9f2d40a14f420b65f0465 +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/fd074761725d9953f7e2605d65da4f90 +0 -0
  99. metadata +139 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27d609f5f8801213d67ddae823d59976c0016abf
4
- data.tar.gz: 01bce062c8bee95eb38ecbe931a1c4ce160e663b
3
+ metadata.gz: eb847b75e15d920aed108be9b5bb359f9a703ac2
4
+ data.tar.gz: a5597cab534cc5df286c77a117729caa44ee142b
5
5
  SHA512:
6
- metadata.gz: 633fd074412c2d921ab93775d34e00c61602bca5a2655a5c8da97cd2de17f10e4827242310017373fd201a81833993226bc6f75b9ca6507f0a4279bcf03d34ec
7
- data.tar.gz: 9c708debf635ce439e11c5358333d9987b40235cc649f6b63fd23949dc3e1d3167696164ade139158018421a67f1d3dced27c8dbfe6b231446246b37bc090639
6
+ metadata.gz: ff06fc331c819cdcb2089d16368152158869938f44a346b53c02b93eef10739b5950cb229392618cdbc73b156e49dcaf899ddf0244a0178205171107105f1063
7
+ data.tar.gz: cb817519edcc91c7430dbb48105c1a6a4cdc1fb4205c7b4e6f71c4dc4b2c80d786a159d98cbd629b56fad7faf1b2b11d76515ef3ec9052e1c2d853ac663bcafe
data/README.md CHANGED
@@ -4,10 +4,18 @@
4
4
 
5
5
  ### Installation
6
6
 
7
+ ###### RubyGems
8
+
7
9
  ```ruby
8
10
  gem 'handcart'
9
11
  ```
10
12
 
13
+ ###### Github
14
+
15
+ ```ruby
16
+ gem 'handcart', git: 'https://github.com/mark-d-holmberg/handcart'
17
+ ```
18
+
11
19
  ### Copy Migrations
12
20
 
13
21
  Handcart requires that you copy over its migrations in the following manner:
@@ -238,7 +246,7 @@ the franchisee:
238
246
 
239
247
  ```ruby
240
248
  # app/controllers/sessions_controller.rb
241
- enable_blocking("public#forbidden")
249
+ enable_blocking("public#blocked")
242
250
  ```
243
251
 
244
252
  The first argument indicates the controller and action which will be redirected to should the IP authorization strategy indicate
@@ -9,7 +9,7 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
- *=require twitter-bootstrap-static/bootstrap
13
- *=require twitter-bootstrap-static/fontawesome
12
+ *= require twitter-bootstrap-static/bootstrap
13
+ *= require twitter-bootstrap-static/fontawesome
14
14
  *= require_tree .
15
15
  */
@@ -1,4 +1,5 @@
1
1
  module Handcart
2
2
  class ApplicationController < ActionController::Base
3
+ helper BootstrapFlashHelper
3
4
  end
4
5
  end
@@ -14,18 +14,13 @@
14
14
  %th= Handcart::IpAddress.human_attribute_name(:blacklisted)
15
15
  %th
16
16
  %th
17
- %th
18
17
  %tbody
19
18
  - @ip_addresses.each do |ip_address|
20
19
  %tr
21
- %td= ip_address.address
20
+ %td= link_to ip_address.address, ip_address, title: t(".view_ip_address")
22
21
  %td= ip_address.subnet_mask
23
22
  %td= ip_address.handcart
24
23
  %td= ip_address.blacklisted? ? "Yes" : "No"
25
- %td.action-button
26
- .pull-right
27
- = link_to ip_address, class: 'btn', title: t(".view_ip_address") do
28
- %i.icon-eye-open
29
24
  %td.action-button
30
25
  .pull-right
31
26
  = link_to edit_ip_address_path(ip_address), class: 'btn', title: t(".edit_ip_address") do
@@ -0,0 +1,18 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ helpers:
6
+ actions: "Actions"
7
+ links:
8
+ back: "Back"
9
+ cancel: "Cancel"
10
+ confirm: "Are you sure?"
11
+ destroy: "Delete"
12
+ new: "New"
13
+ edit: "Edit"
14
+ titles:
15
+ edit: "Edit %{model}"
16
+ save: "Save %{model}"
17
+ new: "New %{model}"
18
+ delete: "Delete %{model}"
@@ -1,3 +1,3 @@
1
1
  module Handcart
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/handcart.rb CHANGED
@@ -6,6 +6,7 @@ require 'haml'
6
6
  require 'sass/rails'
7
7
  require "handcart/simple_form"
8
8
  require 'jquery-rails'
9
+ require 'twitter-bootstrap-rails'
9
10
 
10
11
  module Handcart
11
12
  module Strategies
@@ -2,3 +2,7 @@ footer {
2
2
  text-align: center;
3
3
  margin-top: 1em;
4
4
  }
5
+
6
+ td.action-button {
7
+ width: 2em;
8
+ }
@@ -45,7 +45,7 @@ class Master::CompaniesController < MasterController
45
45
  end
46
46
 
47
47
  def safe_params
48
- safe_attributes =[:name, :subdomain_id]
48
+ safe_attributes =[:name, :subdomain_id, :active]
49
49
  params.require(:company).permit(safe_attributes)
50
50
  end
51
51
  end
@@ -1,2 +1,3 @@
1
1
  class MasterController < ApplicationController
2
+ layout 'master'
2
3
  end
@@ -9,4 +9,8 @@ class PublicController < ApplicationController
9
9
  def forbidden
10
10
  end
11
11
 
12
+ def blocked
13
+ flash[:error] = "Your IP address has been blocked from accessing the system."
14
+ end
15
+
12
16
  end
@@ -1,6 +1,6 @@
1
1
  class SubdomainController < ApplicationController
2
2
 
3
- enable_blocking("public#forbidden")
3
+ enable_blocking("public#blocked")
4
4
 
5
5
  def index
6
6
  end
@@ -3,10 +3,12 @@
3
3
  %table.table.table-striped
4
4
  %thead
5
5
  %tr
6
- %th IP Address
7
- %th Subnet Mask
6
+ %th= Handcart::IpAddress.human_attribute_name(:address)
7
+ %th= Handcart::IpAddress.human_attribute_name(:subnet_mask)
8
+ %th= Handcart::IpAddress.human_attribute_name(:blacklisted)
8
9
  %tbody
9
10
  - @ip_addresses.each do |ip_address|
10
11
  %tr
11
12
  %td= ip_address.address
12
13
  %td= ip_address.subnet_mask
14
+ %td= ip_address.blacklisted? ? "Yes" : "No"
@@ -1,11 +1,7 @@
1
1
  %ul.nav
2
- %li
3
- = link_to handcart_path do
4
- %i.icon-heart
5
- Handcart
6
2
  - unless (Handcart.ip_authorization.ip_authorization_strategy == :none)
7
3
  %li{class: (params[:controller] == "ip_addresses") ? "active" : nil}
8
4
  = link_to main_app.ip_addresses_path do
9
5
  %i.icon-screenshot
10
- IP Addresses
6
+ My IP Addresses
11
7
 
@@ -17,14 +17,14 @@
17
17
  = javascript_include_tag "application"
18
18
 
19
19
  %body
20
- .navbar.navbar-fluid-top.navbar-inverse
20
+ .navbar.navbar-fluid-top
21
21
  .navbar-inner
22
22
  .container-fluid
23
23
  %a.btn.btn-navbar(data-target=".nav-collapse" data-toggle="collapse")
24
24
  %span.icon-bar
25
25
  %span.icon-bar
26
26
  %span.icon-bar
27
- %a.brand(href="#") Dummy
27
+ %a.brand(href=subdomain_root_path) Dummy
28
28
  = render "layouts/navbar"
29
29
 
30
30
  .container-fluid
@@ -0,0 +1,9 @@
1
+ %ul.nav
2
+ %li
3
+ = link_to handcart_path do
4
+ %i.icon-heart
5
+ Handcart
6
+ %li{class: (params[:controller] == "companies") ? "active" : nil}
7
+ = link_to main_app.companies_path do
8
+ %i.icon-briefcase
9
+ Companies
@@ -0,0 +1,54 @@
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=master_root_path)
28
+ Master Dummy Backend
29
+ = render "layouts/master/navbar"
30
+
31
+ .container-fluid
32
+ .row-fluid
33
+ - if content_for?(:sidebar)
34
+ .span9
35
+ %div.flash-message
36
+ = bootstrap_flash
37
+ - if content_for?(:sub_title)
38
+ .page-header
39
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
40
+ %div= yield
41
+ .span3
42
+ .well.sidebar-nav
43
+ %ul.nav.nav-list= yield(:sidebar)
44
+ - else
45
+ .span12
46
+ %div.flash-message
47
+ = bootstrap_flash
48
+ - if content_for?(:sub_title)
49
+ .page-header
50
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
51
+ %div= yield
52
+
53
+ %footer
54
+ %p &copy; Handcart #{Date.today.year}
@@ -17,25 +17,22 @@
17
17
  = javascript_include_tag "application"
18
18
 
19
19
  %body
20
+ .navbar.navbar-fluid-top
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=root_url) Public Dummy Frontend
20
28
  .container-fluid
21
29
  .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
30
+ .span12
31
+ %div.flash-message= bootstrap_flash
32
+ - if content_for?(:sub_title)
33
+ .page-header
34
+ %h3.sub-title.inline= content_for?(:sub_title) ? yield(:sub_title) : t('.default_sub_title')
35
+ %div= yield
39
36
 
40
37
  %footer
41
38
  %p &copy; Handcart #{Date.today.year}
@@ -1,19 +1,11 @@
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
1
+ = simple_form_for @company, html: { class: 'form-horizontal' } do |f|
2
+ = f.error_notification
8
3
 
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'
4
+ .form-inputs
5
+ = f.input :name
6
+ = f.association :subdomain, collection: f.object.new_record? ? Handcart::Subdomain.unallocated : Handcart::Subdomain.unallocated_or_current(@company)
7
+ = f.input :active, as: :select, include_blank: false
8
+
9
+ .form-actions
10
+ = f.button :submit, class: 'btn btn-primary'
11
+ = link_to 'Cancel', companies_path, class: 'btn'
@@ -1,7 +1,3 @@
1
- %h1 Editing company
1
+ - title "Edit Company"
2
2
 
3
3
  = render 'form'
4
-
5
- = link_to 'Show', @company
6
- \|
7
- = link_to 'Back', companies_path
@@ -1,25 +1,33 @@
1
- %h1 Listing companies
1
+ - title "Companies", false
2
2
 
3
- %table.table
4
- %tr
5
- %th Name
6
- %th Subdomain
7
- %th
8
- %th
9
- %th
3
+ .page-header
4
+ %h3.sub-title.inline
5
+ Companies
6
+ %span
7
+ = link_to new_company_path, class: 'btn btn-primary', title: 'New Company' do
8
+ %i.icon-plus
10
9
 
11
- - @companies.each do |company|
10
+ %table.table.table-striped.table-hover#companies_index
11
+ %thead
12
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
13
+ %th Name
14
+ %th Subdomain
15
+ %th Active
16
+ %th
17
+ %th
18
+ %tbody
19
+ - @companies.each do |company|
20
+ %tr
21
+ %td= link_to company.name, company
22
+ %td
23
+ - if company.subdomain
24
+ = link_to company.subdomain.name, handcart.subdomain_path(company.subdomain)
25
+ - else
26
+ None
27
+ %td= company.active? ? "Yes" : "No"
28
+ %td.action-button
29
+ = link_to edit_company_path(company), class: 'btn', title: "Edit Company" do
30
+ %i.icon-pencil
31
+ %td.action-button
32
+ = link_to company, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', title: "Remove Company" do
33
+ %i.icon-remove
@@ -1,5 +1,3 @@
1
- %h1 New company
1
+ - title "New Company"
2
2
 
3
3
  = render 'form'
4
-
5
- = link_to 'Back', companies_path
@@ -1,12 +1,21 @@
1
- %p#notice= notice
1
+ - title "Company : #{@company.to_s}"
2
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
3
+ %table.table.table-striped
4
+ %thead
5
+ %tr
6
+ %th= Company.human_attribute_name(:name)
7
+ %th= Company.human_attribute_name(:subdomain)
8
+ %th= Company.human_attribute_name(:active)
9
+ %th
10
+ %tbody
11
+ %tr
12
+ %td= @company.name
13
+ %td
14
+ - if @company.subdomain.present?
15
+ = link_to @company.subdomain.name, handcart.subdomain_path(@company.subdomain)
16
+ - else
17
+ None
18
+ %td= @company.active? ? "Yes" : "No"
19
+ %td.action-button
20
+ = link_to edit_company_path(@company), class: 'btn', title: "Edit Company" do
21
+ %i.icon-pencil
@@ -0,0 +1,3 @@
1
+ - title "Blocked"
2
+
3
+ This is where people who are IP blocked will be redirected to.
@@ -1,5 +1,16 @@
1
1
  en:
2
+ activerecord:
3
+ attributes:
4
+ company:
5
+ name: "Name"
6
+ subdomain: "Subdomain"
2
7
  layouts:
8
+ master:
9
+ navbar:
10
+ main_app: 'Master Dummy Backend'
11
+ default_title: 'Master Dummy Backend'
12
+ default_sub_title: ''
13
+ title: "Master Dummy Backend : %{title}"
3
14
  application:
4
15
  navbar:
5
16
  main_app: 'Dummy'
@@ -1,8 +1,9 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- mount Handcart::Engine => "/handcart"
4
-
5
3
  constraints(subdomain: /master/) do
4
+ # Handcart is managed from the master backend
5
+ mount Handcart::Engine => "/handcart"
6
+
6
7
  scope module: 'master' do
7
8
  resources :companies
8
9
  match '/', to: 'dashboard#index', via: [:get], as: :master_root
@@ -17,6 +18,7 @@ Rails.application.routes.draw do
17
18
 
18
19
  constraints Handcart::DomainConstraint.default_constraint do
19
20
  match '/forbidden', to: 'public#forbidden', as: :public_forbidden, via: [:get]
21
+ match '/blocked', to: 'public#blocked', as: :public_blocked, via: [:get]
20
22
  root to: 'public#index'
21
23
  end
22
24