iugusdk 1.0.0.alpha.0

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 (207) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/images/application_logo.png +0 -0
  5. data/app/assets/javascripts/settings.js +10 -0
  6. data/app/assets/javascripts/settings_code.js.coffee.erb +0 -0
  7. data/app/assets/stylesheets/settings.sass +120 -0
  8. data/app/controllers/iugu/account_controller.rb +63 -0
  9. data/app/controllers/iugu/account_domains_controller.rb +64 -0
  10. data/app/controllers/iugu/account_roles_controller.rb +20 -0
  11. data/app/controllers/iugu/account_settings_controller.rb +17 -0
  12. data/app/controllers/iugu/account_users_controller.rb +43 -0
  13. data/app/controllers/iugu/application_domain_controller.rb +11 -0
  14. data/app/controllers/iugu/confirmations_controller.rb +2 -0
  15. data/app/controllers/iugu/invitations_controller.rb +49 -0
  16. data/app/controllers/iugu/omniauth_callbacks_controller.rb +23 -0
  17. data/app/controllers/iugu/passwords_controller.rb +2 -0
  18. data/app/controllers/iugu/profile_controller.rb +44 -0
  19. data/app/controllers/iugu/registrations_controller.rb +3 -0
  20. data/app/controllers/iugu/sessions_controller.rb +2 -0
  21. data/app/controllers/iugu/settings_controller.rb +11 -0
  22. data/app/controllers/iugu/unlocks_controller.rb +2 -0
  23. data/app/mailers/iugu_mailer.rb +16 -0
  24. data/app/models/account.rb +53 -0
  25. data/app/models/account_domain.rb +69 -0
  26. data/app/models/account_role.rb +24 -0
  27. data/app/models/account_user.rb +55 -0
  28. data/app/models/available_language.rb +10 -0
  29. data/app/models/social_account.rb +14 -0
  30. data/app/models/user.rb +107 -0
  31. data/app/models/user_invitation.rb +39 -0
  32. data/app/validators/email_validator.rb +17 -0
  33. data/app/views/iugu-old/account_settings.html.haml +17 -0
  34. data/app/views/iugu-old/login.html.haml +28 -0
  35. data/app/views/iugu-old/mails/confirmation_instructions.html.erb +5 -0
  36. data/app/views/iugu-old/mails/reset_password_instructions.html.erb +8 -0
  37. data/app/views/iugu-old/mails/unlock_instructions.html.erb +7 -0
  38. data/app/views/iugu-old/profile_settings.html.haml +76 -0
  39. data/app/views/iugu-old/signup.html.haml +36 -0
  40. data/app/views/iugu/account_domains/index.html.haml +33 -0
  41. data/app/views/iugu/account_domains/instructions.html.haml +0 -0
  42. data/app/views/iugu/account_roles/edit.html.haml +17 -0
  43. data/app/views/iugu/account_roles/update.html.haml +0 -0
  44. data/app/views/iugu/account_users/index.html.haml +23 -0
  45. data/app/views/iugu/account_users/view.html.haml +0 -0
  46. data/app/views/iugu/confirmations/new.html.haml +8 -0
  47. data/app/views/iugu/invitations/edit.html.haml +8 -0
  48. data/app/views/iugu/invitations/new.html.haml +13 -0
  49. data/app/views/iugu/mailer/confirmation_instructions.html.haml +4 -0
  50. data/app/views/iugu/mailer/invitation.html.haml +1 -0
  51. data/app/views/iugu/mailer/reset_password_instructions.html.haml +4 -0
  52. data/app/views/iugu/mailer/unlock_instructions.html.haml +5 -0
  53. data/app/views/iugu/passwords/edit.html.haml +11 -0
  54. data/app/views/iugu/passwords/new.html.haml +8 -0
  55. data/app/views/iugu/registrations/edit.html.haml +15 -0
  56. data/app/views/iugu/registrations/new.html.haml +11 -0
  57. data/app/views/iugu/sessions/new.html.haml +9 -0
  58. data/app/views/iugu/settings/account.html.haml +48 -0
  59. data/app/views/iugu/settings/accounts.html.haml +33 -0
  60. data/app/views/iugu/settings/profile.html.haml +96 -0
  61. data/app/views/iugu/shared/_links.haml +19 -0
  62. data/app/views/iugu/unlocks/new.html.haml +8 -0
  63. data/app/views/layouts/settings.html.haml +46 -0
  64. data/config/initializers/account_roles.rb +5 -0
  65. data/config/initializers/devise.rb +242 -0
  66. data/config/initializers/social_accounts.rb +16 -0
  67. data/config/locales/devise.en.yml +57 -0
  68. data/config/locales/devise.pt-BR.yml +55 -0
  69. data/config/locales/iugu.en.yml +73 -0
  70. data/config/locales/iugu.pt-BR.yml +73 -0
  71. data/config/routes.rb +77 -0
  72. data/db/migrate/20120528164634_create_account.rb +11 -0
  73. data/db/migrate/20120529134109_add_devise_to_users.rb +53 -0
  74. data/db/migrate/20120529162901_add_birthdate_and_name_to_user.rb +12 -0
  75. data/db/migrate/20120529174755_add_name_and_subscription_id_and_user_id_to_account.rb +13 -0
  76. data/db/migrate/20120529180814_create_account_users.rb +12 -0
  77. data/db/migrate/20120530114709_remove_user_id_from_accounts.rb +9 -0
  78. data/db/migrate/20120531171438_create_account_roles.rb +12 -0
  79. data/db/migrate/20120604131034_add_locale_to_user.rb +9 -0
  80. data/db/migrate/20120605142527_create_social_account.rb +15 -0
  81. data/db/migrate/20120612141130_set_locale.rb +6 -0
  82. data/db/migrate/20120613173114_remove_unique_from_user_email.rb +11 -0
  83. data/db/migrate/20120615180728_create_delayed_jobs.rb +22 -0
  84. data/db/migrate/20120629154429_create_user_invitations.rb +14 -0
  85. data/db/migrate/20120629195345_add_token_to_user_invitations.rb +8 -0
  86. data/db/migrate/20120705202827_add_roles_to_user_invitations.rb +8 -0
  87. data/db/migrate/20120716145846_create_account_domain.rb +14 -0
  88. data/db/migrate/20120719162426_add_subdomain_to_account.rb +9 -0
  89. data/lib/iugusdk.rb +73 -0
  90. data/lib/iugusdk/controllers/helpers.rb +45 -0
  91. data/lib/iugusdk/engine.rb +13 -0
  92. data/lib/iugusdk/locale_filter.rb +12 -0
  93. data/lib/iugusdk/root_tenancy_url.rb +22 -0
  94. data/lib/iugusdk/valid_tenancy_urls.rb +27 -0
  95. data/lib/iugusdk/version.rb +3 -0
  96. data/lib/tasks/iugusdk_tasks.rake +4 -0
  97. data/spec/controller_macros.rb +41 -0
  98. data/spec/controllers/account_controller_spec.rb +155 -0
  99. data/spec/controllers/account_domains_controller_spec.rb +173 -0
  100. data/spec/controllers/account_roles_controller_spec.rb +48 -0
  101. data/spec/controllers/account_settings_controller_spec.rb +42 -0
  102. data/spec/controllers/account_users_controller_spec.rb +145 -0
  103. data/spec/controllers/application_domain_controller_spec.rb +29 -0
  104. data/spec/controllers/invitations_controller_spec.rb +102 -0
  105. data/spec/controllers/profile_controller_spec.rb +125 -0
  106. data/spec/controllers/settings_controller_spec.rb +14 -0
  107. data/spec/dummy/Rakefile +7 -0
  108. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  109. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  110. data/spec/dummy/app/assets/stylesheets/default.sass +111 -0
  111. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  112. data/spec/dummy/app/controllers/dashboard_controller.rb +8 -0
  113. data/spec/dummy/app/controllers/my_dummy_controller.rb +9 -0
  114. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  115. data/spec/dummy/app/views/dashboard/index.html.haml +5 -0
  116. data/spec/dummy/app/views/dashboard/splash.html.haml +10 -0
  117. data/spec/dummy/app/views/layouts/application.html.erb +29 -0
  118. data/spec/dummy/app/views/layouts/dummy.html.erb +22 -0
  119. data/spec/dummy/app/views/my_dummy/index.html.haml +5 -0
  120. data/spec/dummy/config.ru +4 -0
  121. data/spec/dummy/config/account_roles.yml +3 -0
  122. data/spec/dummy/config/application.rb +66 -0
  123. data/spec/dummy/config/boot.rb +10 -0
  124. data/spec/dummy/config/database.yml +37 -0
  125. data/spec/dummy/config/environment.rb +5 -0
  126. data/spec/dummy/config/environments/development.rb +37 -0
  127. data/spec/dummy/config/environments/production.rb +60 -0
  128. data/spec/dummy/config/environments/test.rb +40 -0
  129. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  130. data/spec/dummy/config/initializers/inflections.rb +10 -0
  131. data/spec/dummy/config/initializers/iugusdk.rb +4 -0
  132. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  133. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  134. data/spec/dummy/config/initializers/session_store.rb +8 -0
  135. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  136. data/spec/dummy/config/locales/en.yml +5 -0
  137. data/spec/dummy/config/routes.rb +69 -0
  138. data/spec/dummy/config/social_accounts.yml +6 -0
  139. data/spec/dummy/db/schema.rb +95 -0
  140. data/spec/dummy/public/404.html +26 -0
  141. data/spec/dummy/public/422.html +26 -0
  142. data/spec/dummy/public/500.html +26 -0
  143. data/spec/dummy/public/favicon.ico +0 -0
  144. data/spec/dummy/script/rails +6 -0
  145. data/spec/dummy/tmp/cache/sass/1f198e4a81e57d6c86c6fff1f0e13592b233ebc2/prettify.cssc +0 -0
  146. data/spec/dummy/tmp/cache/sass/40796b6ca2cf9112b889007328d8a4c5fdc634d8/_css3.scssc +0 -0
  147. data/spec/dummy/tmp/cache/sass/40796b6ca2cf9112b889007328d8a4c5fdc634d8/_support.scssc +0 -0
  148. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/components.sassc +0 -0
  149. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/iugu-ux.sassc +0 -0
  150. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/mixins.sassc +0 -0
  151. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/reset.sassc +0 -0
  152. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/typography.sassc +0 -0
  153. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/utilities.sassc +0 -0
  154. data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/variables.sassc +0 -0
  155. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_appearance.scssc +0 -0
  156. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-clip.scssc +0 -0
  157. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-origin.scssc +0 -0
  158. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-size.scssc +0 -0
  159. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_border-radius.scssc +0 -0
  160. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box-shadow.scssc +0 -0
  161. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box-sizing.scssc +0 -0
  162. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box.scssc +0 -0
  163. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_columns.scssc +0 -0
  164. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_font-face.scssc +0 -0
  165. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_images.scssc +0 -0
  166. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_inline-block.scssc +0 -0
  167. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_opacity.scssc +0 -0
  168. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_shared.scssc +0 -0
  169. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_text-shadow.scssc +0 -0
  170. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_transform.scssc +0 -0
  171. data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_transition.scssc +0 -0
  172. data/spec/dummy/tmp/cache/sass/9da4e62a062dae83baa33f29455be2ba30cf5dce/_sprites.scssc +0 -0
  173. data/spec/dummy/tmp/cache/sass/db2a23483187bf5625185da2d6f47de2a6de4989/_base.scssc +0 -0
  174. data/spec/dummy/tmp/cache/sass/db2a23483187bf5625185da2d6f47de2a6de4989/_sprite-img.scssc +0 -0
  175. data/spec/dummy/tmp/cache/sass/e5be18dde92936a4632e65289dad5788ed73dd60/base_settings.sassc +0 -0
  176. data/spec/dummy/tmp/cache/sass/e5be18dde92936a4632e65289dad5788ed73dd60/settings.sassc +0 -0
  177. data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/application.sassc +0 -0
  178. data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/base_settings.sassc +0 -0
  179. data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/default.sassc +0 -0
  180. data/spec/dummy/tmp/cache/sass/eab9c0816f626278a6731ce2928de6fdbe99322b/_hacks.scssc +0 -0
  181. data/spec/dummy/tmp/restart.txt +0 -0
  182. data/spec/fabricators/account_domain_fabricator.rb +4 -0
  183. data/spec/fabricators/account_fabricator.rb +4 -0
  184. data/spec/fabricators/account_role_fabricator.rb +3 -0
  185. data/spec/fabricators/account_user_fabricator.rb +4 -0
  186. data/spec/fabricators/social_account_fabricator.rb +10 -0
  187. data/spec/fabricators/user_fabricator.rb +10 -0
  188. data/spec/fabricators/user_invitation_fabricator.rb +4 -0
  189. data/spec/mailers/iugu_mailer_spec.rb +22 -0
  190. data/spec/models/account_domain_spec.rb +111 -0
  191. data/spec/models/account_role_spec.rb +24 -0
  192. data/spec/models/account_spec.rb +155 -0
  193. data/spec/models/account_user_spec.rb +158 -0
  194. data/spec/models/social_account_spec.rb +36 -0
  195. data/spec/models/user_invitation_spec.rb +92 -0
  196. data/spec/models/user_spec.rb +187 -0
  197. data/spec/requests/account_domain_spec.rb +77 -0
  198. data/spec/requests/account_roles_spec.rb +45 -0
  199. data/spec/requests/account_spec.rb +97 -0
  200. data/spec/requests/account_users_spec.rb +129 -0
  201. data/spec/requests/omniauth_spec.rb +79 -0
  202. data/spec/requests/settings_spec.rb +53 -0
  203. data/spec/requests/user_invitation_spec.rb +40 -0
  204. data/spec/requests/user_spec.rb +34 -0
  205. data/spec/spec_helper.rb +116 -0
  206. data/spec/validators/email_validator_spec.rb +21 -0
  207. metadata +729 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2012 IUGU
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = IuguSDK
2
+
3
+ TO BE WRITTED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'IuguSdk'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+ Bundler::GemHelper.install_tasks
28
+
29
+ require 'rake/testtask'
30
+
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'test'
34
+ t.pattern = 'test/**/*_test.rb'
35
+ t.verbose = false
36
+ end
37
+
38
+
39
+ task :default => :test
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery-ui
9
+ //= require jquery_ujs
10
+ //= require settings_code
@@ -0,0 +1,120 @@
1
+ body.settings
2
+ margin: 0px
3
+ padding: 0px
4
+ background: #F0F0F0
5
+ font-family: "Arial"
6
+ margin-left: 20px
7
+ margin-right: 20px
8
+
9
+ h1,h2,h3,h4,h5,h6,p
10
+ padding: 0px
11
+ margin: 0px
12
+ margin-bottom: 20px
13
+
14
+ h1,h2,h3,h4,h5,h6,p,img,a
15
+ border: none
16
+
17
+ .header,.container
18
+ max-width: 640px
19
+ margin-left: auto
20
+ margin-right: auto
21
+ position: relative
22
+ min-width: 320px
23
+
24
+ .header
25
+ margin-top: 20px
26
+
27
+ .container
28
+ margin-top: 20px
29
+ background: #FFF
30
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), -1px 2px 2px rgba(0, 0, 0, 0.1)
31
+ -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), -1px 2px 2px rgba(0, 0, 0, 0.1)
32
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), -1px 2px 2px rgba(0, 0, 0, 0.1)
33
+
34
+ -webkit-border-radius: 5px
35
+ -moz-border-radius: 5px
36
+ border-radius: 5px
37
+
38
+ .wrapper
39
+ padding: 20px
40
+ position: relative
41
+
42
+ #btn-settings-back
43
+ position: absolute
44
+ top: 10px
45
+ right: 0px
46
+
47
+ .iugu-ui
48
+
49
+ .button,button,.button:visited
50
+ overflow: visible
51
+ white-space: nowrap
52
+ text-decoration: none !important
53
+ text-transform: uppercase
54
+ text-shadow: 1px 1px 0px #FFFFFF
55
+ filter: dropshadow(color=#FFFFFF, offx=1, offy=1)
56
+ font-family: "Myriad Pro", "Calibri", "Arial"
57
+ color: #575757
58
+ font-weight: bold
59
+ font-size: 14px
60
+ height: 40px
61
+ line-height: 40px
62
+ padding-left: 13px
63
+ padding-right: 13px
64
+ width: auto
65
+ margin: 0px
66
+ display: inline-block
67
+ cursor: pointer
68
+ box-sizing: border-box
69
+ -ms-box-sizing: border-box
70
+ -moz-box-sizing: border-box
71
+ -webkit-box-sizing: border-box
72
+ -webkit-border-radius: 5px
73
+ -moz-border-radius: 5px
74
+ border-radius: 5px
75
+ vertical-align: middle
76
+ margin-bottom: 4px
77
+ background: #efefef
78
+ background: -moz-linear-gradient(top, #efefef 0%, #d9d9d9 100%)
79
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#efefef), color-stop(100%,#d9d9d9))
80
+ background: -webkit-linear-gradient(top, #efefef 0%,#d9d9d9 100%)
81
+ background: -o-linear-gradient(top, #efefef 0%,#d9d9d9 100%)
82
+ background: -ms-linear-gradient(top, #efefef 0%,#d9d9d9 100%)
83
+ background: linear-gradient(top, #efefef 0%,#d9d9d9 100%)
84
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#d9d9d9',GradientType=0 )
85
+ box-shadow: inset -1px -1px 0px rgba(0,0,0, 0.35), inset 1px 1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
86
+ -moz-box-shadow: inset -1px -1px 0px rgba(0,0,0, 0.35), inset 1px 1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
87
+ -webkit-box-shadow: inset -1px -1px 0px rgba(0,0,0, 0.35), inset 1px 1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
88
+ -o-box-shadow: inset -1px -1px 0px rgba(0,0,0, 0.35), inset 1px 1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
89
+ border: 1px solid #cfcfcf
90
+
91
+ .button:active,button:active
92
+ box-shadow: inset 1px 1px 0px rgba(0,0,0, 0.35), inset -1px -1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
93
+ -moz-box-shadow: inset 1px 1px 0px rgba(0,0,0, 0.35), inset -1px -1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
94
+ -webkit-box-shadow: inset 1px 1px 0px rgba(0,0,0, 0.35), inset -1px -1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
95
+ -o-box-shadow: inset 1px 1px 0px rgba(0,0,0, 0.35), inset -1px -1px 0px rgba(255, 255, 255, 0.65), 0px 0px 1px rgba(0,0,0, 0.10)
96
+
97
+ .button-large
98
+ font-size: 30px !important
99
+ height: 70px !important
100
+ line-height: 70px !important
101
+ padding-left: 20px !important
102
+ padding-right: 20px !important
103
+
104
+
105
+ button::-moz-focus-inner
106
+ border: none
107
+ padding: 0px
108
+ margin: 0px
109
+
110
+ @media screen and (-webkit-min-device-pixel-ratio:0)
111
+ .button,button
112
+ padding-top: 1px
113
+ padding-bottom: -1px
114
+
115
+ .ie body .iugu-ui
116
+ .button
117
+ float: none
118
+ border-radius: 0px
119
+ line-height: 36px
120
+ background: #FF0000 !important
@@ -0,0 +1,63 @@
1
+ class Iugu::AccountController < Iugu::AccountSettingsController
2
+
3
+ def index
4
+ render 'iugu/settings/accounts'
5
+ end
6
+
7
+ def view
8
+ if params[:id]
9
+ @account = current_user.accounts.find(params[:id])
10
+ else
11
+ @account = current_user_account
12
+ end
13
+ @primary_domain = @account.account_domains.where(:primary => true).first if @account
14
+ render 'iugu/settings/account'
15
+ end
16
+
17
+ def destroy
18
+ begin
19
+ if account = current_user.accounts.find(params[:id])
20
+ if account.account_users.find_by_user_id(current_user.id).is?(:owner)
21
+ account.destroy
22
+ notice = I18n.t("iugu.account_destruction_in") + account.destruction_job.run_at.to_s
23
+ else
24
+ notice = I18n.t("errors.messages.only_owners_can_destroy_accounts")
25
+ end
26
+ end
27
+ rescue
28
+ notice = "Account not found"
29
+ end
30
+ redirect_to(account_settings_path, :notice => notice)
31
+ end
32
+
33
+ def cancel_destruction
34
+ begin
35
+ current_user.accounts.find(params[:id]).cancel_destruction if params[:id]
36
+ notice = I18n.t("iugu.account_destruction_undone")
37
+ rescue
38
+ notice = "Account not found"
39
+ end
40
+ redirect_to(account_settings_path, :notice => notice)
41
+ end
42
+
43
+ def select
44
+ select_account(current_user, params[:id])
45
+ redirect_to(account_settings_path, :notice => "Account selected")
46
+ end
47
+
48
+ def update
49
+ begin
50
+ @account = Account.find(params[:id])
51
+ @account.update_attributes(params[:account])
52
+ redirect_to(account_view_path(params[:id]))
53
+ rescue
54
+ raise ActionController::RoutingError.new('Not Found')
55
+ end
56
+ end
57
+
58
+ def create
59
+ current_user.accounts << Account.create
60
+ redirect_to account_settings_path
61
+ end
62
+
63
+ end
@@ -0,0 +1,64 @@
1
+ class Iugu::AccountDomainsController < Iugu::AccountSettingsController
2
+
3
+ def index
4
+ @account = current_user.accounts.find(params[:account_id])
5
+ @account_domains = @account.account_domains.where(:account_id => params[:account_id])
6
+ @account_domain = AccountDomain.new
7
+ end
8
+
9
+ def create
10
+ @account = current_user.accounts.find(params[:account_id])
11
+ if @account.account_domains << AccountDomain.create(params[:account_domain])
12
+ redirect_to account_domains_index_path(params[:account_id]), :notice => notice = I18n.t("iugu.notices.domain_created")
13
+ else
14
+ render :index
15
+ end
16
+ end
17
+
18
+ def destroy
19
+ begin
20
+ @account = current_user.accounts.find(params[:account_id])
21
+ @domain = @account.account_domains.find(params[:domain_id])
22
+ @domain.destroy
23
+ notice = I18n.t("iugu.notices.domain_destroyed")
24
+ rescue
25
+ notice = I18n.t("iugu.notices.domain_not_found")
26
+ end
27
+ redirect_to account_domains_index_path(params[:account_id]), :notice => notice
28
+ end
29
+
30
+ def instructions
31
+ begin
32
+ @account = current_user.accounts.find(params[:account_id])
33
+ @domain = @account.account_domains.find(params[:domain_id])
34
+ rescue
35
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_not_found")
36
+ end
37
+ end
38
+
39
+ def verify
40
+ begin
41
+ @account = current_user.accounts.find(params[:account_id])
42
+ @domain = @account.account_domains.find(params[:domain_id])
43
+ if @domain.verify
44
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_verified")
45
+ else
46
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_not_verified")
47
+ end
48
+ rescue
49
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_not_found")
50
+ end
51
+ end
52
+
53
+ def primary
54
+ begin
55
+ @account = current_user.accounts.find(params[:account_id])
56
+ @domain = @account.account_domains.find(params[:domain_id])
57
+ @domain.set_primary
58
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_set_primary")
59
+ rescue
60
+ redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_not_found")
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,20 @@
1
+ class Iugu::AccountRolesController < Iugu::SettingsController
2
+
3
+ def edit
4
+ @account = current_user.accounts.find(params[:id])
5
+ @account_user = @account.account_users.find_by_user_id(params[:user_id])
6
+ if current_user.is?(:owner, @account) || current_user.is?(:admin, @account)
7
+ render 'iugu/account_roles/edit'
8
+ else
9
+ render :file => "#{Rails.root}/public/422.html", :status => 550
10
+ end
11
+ end
12
+
13
+ def update
14
+ @account = current_user.accounts.find(params[:id])
15
+ @account_user = @account.account_users.find_by_user_id(params[:user_id])
16
+ @account_user.set_roles(params[:roles])
17
+ redirect_to account_users_index_path(@account.id), :notice => I18n.t("iugu.notices.roles_changed")
18
+ end
19
+
20
+ end
@@ -0,0 +1,17 @@
1
+ class Iugu::AccountSettingsController < Iugu::SettingsController
2
+ before_filter :block_removing
3
+
4
+ private
5
+
6
+ def block_removing
7
+ begin
8
+ if params[:account_id]
9
+ if Account.find(params[:account_id]).destroying?
10
+ render :file => "#{Rails.root}/public/422.html", :status => 550
11
+ end
12
+ end
13
+ rescue
14
+ raise ActionController::RoutingError.new('Not Found')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,43 @@
1
+ class Iugu::AccountUsersController < Iugu::AccountSettingsController
2
+
3
+ def index
4
+ @account = Account.find(params[:account_id])
5
+ @account_users = @account.account_users
6
+ render 'iugu/account_users/index'
7
+ end
8
+
9
+ def view
10
+ @account_user = AccountUser.find_by_account_id_and_user_id(params[:account_id], params[:user_id])
11
+ render 'iugu/account_users/view'
12
+ end
13
+
14
+ def destroy
15
+ if @account_user = AccountUser.find_by_account_id_and_user_id(params[:account_id], params[:user_id])
16
+ @account = Account.find(params[:account_id])
17
+ else
18
+ raise ActionController::RoutingError.new('Not Found')
19
+ end
20
+ if current_user.is?(:owner, @account) || current_user.is?(:owner, @account)
21
+ raise ActionController::RoutingError.new('Access Denied') if @account_user.user_id == current_user.id || @account_user.is?(:owner)
22
+ @account_user.destroy
23
+ else
24
+ raise ActionController::RoutingError.new('Access Denied')
25
+ end
26
+ redirect_to account_users_index_path(params[:account_id]), :notice => I18n.t("iugu.account_user_destruction_in") + @account_user.destruction_job.run_at.to_s
27
+ end
28
+
29
+ def cancel_destruction
30
+ if @account_user = AccountUser.find_by_account_id_and_user_id(params[:account_id], params[:user_id])
31
+ @account = Account.find(params[:account_id])
32
+ if current_user.is?(:owner, @account) || current_user.is?(:owner, @account)
33
+ @account_user.cancel_destruction
34
+ redirect_to account_users_index_path(params[:account_id]), :notice => I18n.t("iugu.account_user_destruction_undone")
35
+ else
36
+ raise ActionController::RoutingError.new('Access Denied')
37
+ end
38
+ else
39
+ raise ActionController::RoutingError.new('Not Found')
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,11 @@
1
+ class Iugu::ApplicationDomainController < ApplicationController
2
+
3
+ before_filter :get_account_from_domain
4
+
5
+ private
6
+
7
+ def get_account_from_domain
8
+ @account = Account.get_from_domain(params[:host]) if params[:host]
9
+ end
10
+
11
+ end
@@ -0,0 +1,2 @@
1
+ class Iugu::ConfirmationsController < Devise::ConfirmationsController
2
+ end
@@ -0,0 +1,49 @@
1
+ class Iugu::InvitationsController < Iugu::SettingsController
2
+ before_filter :check_permissions
3
+
4
+ def new
5
+ @user_invitation = UserInvitation.new
6
+ @account_id = params[:account_id]
7
+ end
8
+
9
+ def create
10
+ params[:user_invitation][:roles] = params[:user_invitation][:roles].try(:join, ',')
11
+ @user_invitation = UserInvitation.new(params[:user_invitation])
12
+ @user_invitation.invited_by = current_user.id
13
+ @user_invitation.account_id = params[:account_id]
14
+ @user_invitation.save
15
+ redirect_to account_users_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.user_invited")
16
+ end
17
+
18
+ def edit
19
+ if @user_invitation = UserInvitation.find_by_invitation_token(params[:invitation_token])
20
+ @inviter = User.find(@user_invitation.invited_by)
21
+ else
22
+ raise ActionController::RoutingError.new('Not Found')
23
+ end
24
+ end
25
+
26
+ def update
27
+ if @user_invitation = UserInvitation.find_by_invitation_token(params[:invitation_token])
28
+ @user_invitation.accept(current_user)
29
+ redirect_to root_path
30
+ else
31
+ raise ActionController::RoutingError.new('Not Found')
32
+ end
33
+ end
34
+
35
+
36
+ private
37
+
38
+ def check_permissions
39
+ if params[:account_id]
40
+ begin
41
+ account = current_user.accounts.find(params[:account_id])
42
+ rescue
43
+ raise ActionController::RoutingError.new('Access denied')
44
+ end
45
+ raise ActionController::RoutingError.new('Access denied') unless current_user.is?(:owner, account) || current_user.is?(:admin, account)
46
+ end
47
+ end
48
+
49
+ end