iugusdk 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,8 @@ class Iugu::AccountController < Iugu::AccountSettingsController
47
47
 
48
48
  def select
49
49
  set_account(current_user, params[:id])
50
- redirect_to :back
50
+ #redirect_to :back
51
+ redirect_to IuguSDK::app_main_url
51
52
  rescue ActionController::RedirectBackError
52
53
  redirect_to(account_settings_path, :notice => "Account selected")
53
54
  end
@@ -67,8 +68,11 @@ class Iugu::AccountController < Iugu::AccountSettingsController
67
68
  currency = locale_to_currency I18n.locale
68
69
  create_parameters = {plan_identifier: plan_identifier, currency: currency, email: current_user.email}
69
70
  end
70
- current_user.accounts << Account.create(create_parameters)
71
- redirect_to account_settings_path
71
+ acc = Account.create(create_parameters)
72
+ current_user.accounts << acc
73
+ #redirect_to account_view_path(acc)
74
+ set_account(current_user, acc.id.to_param)
75
+ redirect_to IuguSDK::app_main_url
72
76
  end
73
77
 
74
78
  def generate_new_token
@@ -53,10 +53,10 @@ class Iugu::AccountDomainsController < Iugu::AccountSettingsController
53
53
  if @domain.verify
54
54
  redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_verified")
55
55
  else
56
- redirect_to account_domains_instructions_path(:account_id => params[:account_id], :domain_id => params[:domain_id]), :notice => I18n.t("iugu.notices.domain_not_verified")
56
+ redirect_to account_domains_instructions_path(:account_id => params[:account_id], :domain_id => params[:domain_id]), flash: { :error => I18n.t("iugu.notices.domain_not_verified") }
57
57
  end
58
58
  rescue
59
- redirect_to account_domains_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.domain_not_found")
59
+ redirect_to account_domains_index_path(params[:account_id]), flash: { :error => I18n.t("iugu.notices.domain_not_found") }
60
60
  end
61
61
  end
62
62
 
@@ -10,11 +10,13 @@ class Iugu::InvitationsController < Iugu::SettingsController
10
10
  end
11
11
 
12
12
  def create
13
+ flash[:group] = :user_invitation
13
14
  params[:user_invitation][:roles] = params[:user_invitation][:roles].try(:join, ',')
14
15
  params[:user_invitation][:account_id] = params[:account_id]
15
16
  params[:user_invitation][:invited_by] = current_user.id
16
17
  @user_invitation = UserInvitation.create(params[:user_invitation])
17
18
  unless @user_invitation.new_record?
19
+ flash[:group] = :general
18
20
  redirect_to account_users_index_path(params[:account_id]), :notice => I18n.t("iugu.notices.user_invited")
19
21
  else
20
22
  @account = Account.find(params[:account_id])
@@ -2,21 +2,23 @@
2
2
  = I18n.t("iugu.account_domains")
3
3
 
4
4
  - if flash[:group] == :account_domain
5
- .notice.notice-green
5
+ .alert.alert-success
6
6
  = flash[:notice]
7
7
 
8
8
  - if IuguSDK::enable_account_alias == true
9
9
  = simple_form_for @account, :url => update_subdomain_path(:id => @account.id), :method => :put do |f|
10
10
  - if @account.errors.any?
11
- .notice.notice-red
11
+ .alert.alert-danger
12
12
  %ul
13
13
  - @account.errors.full_messages.each do |msg|
14
14
  %li
15
15
  = msg
16
16
 
17
- .form-group
17
+ %div{ class: "input-group #{ "has-error" if @account.errors[:subdomain].present? }" }
18
18
  = f.text_field :subdomain, class: "form-control"
19
- = "." + IuguSDK::application_main_host
19
+ %span.input-group-addon
20
+ = "." + IuguSDK::application_main_host
21
+ %br
20
22
  = f.submit I18n.t("iugu.save"), :class => "btn btn-block btn-primary"
21
23
 
22
24
  - if IuguSDK::enable_custom_domain == true
@@ -26,13 +28,13 @@
26
28
  = simple_form_for @account_domain, :url => create_domain_path(@account.id) do |f|
27
29
 
28
30
  - if @account_domain.errors.any?
29
- .notice.notice-red{ :style => "margin-bottom: 15px" }
31
+ .alert.alert-danger{ :style => "margin-bottom: 15px" }
30
32
  %ul
31
33
  - @account_domain.errors.full_messages.each do |msg|
32
34
  %li
33
35
  = msg
34
36
 
35
- .form-group
37
+ %div{ class: "form-group #{ "has-error" if @account_domain.errors[:url].present? }" }
36
38
  = f.text_field :url, :placeholder => "Domínio", class: "form-control"
37
39
  = f.submit I18n.t("iugu.add"), :class => "btn btn-primary btn-block"
38
40
 
@@ -1,5 +1,4 @@
1
1
  - content_for :title do "Account Users" end
2
-
3
2
  %h1
4
3
  Usuários
5
4
 
@@ -2,14 +2,9 @@
2
2
  Convidar um usuário
3
3
 
4
4
  = simple_form_for @user_invitation, role: "form", :url => create_invite_path(@account.id), :method => :post do |f|
5
- - if @user_invitation.errors.any?
6
- .notice.notice-red{ :style => "margin-bottom: 15px" }
7
- %ul
8
- - @user_invitation.errors.full_messages.each do |msg|
9
- %li
10
- = msg
5
+ = render partial: "iugu/shared/notices", locals: { group: :user_invitation, resource: @user_invitation }
11
6
 
12
- .form-group
7
+ .form-group{ class: "#{ "has-error" if @user_invitation.errors[:email].present? }" }
13
8
  = f.email_field :email, :placeholder => "e-mail", :class => "form-control"
14
9
 
15
10
  %div
@@ -1,5 +1,5 @@
1
1
  - if @account.errors.any?
2
- .notice.notice-red{ :style => "margin-bottom: 15px" }
2
+ .alert.alert-danger{ :style => "margin-bottom: 15px" }
3
3
  %ul
4
4
  - @account.errors.full_messages.each do |msg|
5
5
  %li
@@ -25,11 +25,10 @@
25
25
  %hr
26
26
 
27
27
  - if current_user.is?(:owner, @account)
28
- - if flash[:group] == :account_update
29
- = flash[:notice]
28
+ = render partial: "iugu/shared/notices", locals: { group: :account_update, resource: @account }
30
29
 
31
30
  = simple_form_for @account, role: "form", :url => account_update_path(@account), :method => :put do |f|
32
- .form-group
31
+ .form-group{ class: "#{ "has-error" if @account.errors[:name].present? }" }
33
32
  = f.text_field :name, :placeholder => I18n.t("activerecord.attributes.name"), class: "form-control"
34
33
 
35
34
  = f.submit I18n.t("iugu.save"), :class => "btn btn-lg btn-primary btn-block"
@@ -1,26 +1,20 @@
1
- %div{ :style => "position:relative;height:1px;width:1px;display:inline"}
2
- %a{ name: group, :style => "display: block; position: absolute; top: -80px; width: 2px; height: 2px" }
1
+ - flash[:group] = :general if flash[:group].blank?
3
2
  - if flash[:group] == group
4
3
 
5
4
  - [:notice, :warning, :error, :info].each do |flash_type|
6
5
  - color = nil
7
- - color = "green" if flash_type == :notice
8
- - color = "red" if flash_type == :error
9
- - color = "blue" if flash_type == :info
6
+ - color = "success" if flash_type == :notice
7
+ - color = "danger" if flash_type == :error
8
+ - color = "info" if flash_type == :info
9
+ - color = "warning" if flash_type == :warning
10
10
 
11
11
  - if flash[flash_type]
12
- %div{ class: (color ? "notice notice-#{color}" : "notice") }
13
- %button.close{ :'data-dismiss' => "notice" }
14
- &times;
15
- %h4.notice-heading
16
- = flash[flash_type]
12
+ %div{ class: (color ? "alert alert-#{color}" : "alert") }
13
+ = flash[flash_type]
17
14
 
18
15
  - resource = nil unless resource
19
16
  - if resource && resource.errors.any?
20
- .notice.notice-red
21
- %h4.notice-heading
22
- = I18n.t "simple_form.error_notification.default_message"
23
-
17
+ .alert.alert-danger
24
18
  - if resource.errors.any?
25
19
  %ul
26
20
  - resource.errors.full_messages.each do |msg|
@@ -1,3 +1,3 @@
1
1
  module IuguSDK
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iugusdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-10-18 00:00:00.000000000 Z
14
+ date: 2013-10-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -940,7 +940,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
940
940
  version: '0'
941
941
  segments:
942
942
  - 0
943
- hash: 350128318697639413
943
+ hash: -856814466176584110
944
944
  required_rubygems_version: !ruby/object:Gem::Requirement
945
945
  none: false
946
946
  requirements:
@@ -949,7 +949,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
949
949
  version: '0'
950
950
  segments:
951
951
  - 0
952
- hash: 350128318697639413
952
+ hash: -856814466176584110
953
953
  requirements: []
954
954
  rubyforge_project:
955
955
  rubygems_version: 1.8.24