devise-i18n-bootstrap 0.3.0.beta → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/app/views/devise/_links.erb +3 -3
  4. data/app/views/devise/confirmations/new.html.erb +10 -7
  5. data/app/views/devise/mailer/confirmation_instructions.html.erb +6 -4
  6. data/app/views/devise/mailer/reset_password_instructions.html.erb +5 -5
  7. data/app/views/devise/mailer/unlock_instructions.html.erb +4 -4
  8. data/app/views/devise/passwords/edit.html.erb +11 -10
  9. data/app/views/devise/passwords/new.html.erb +10 -7
  10. data/app/views/devise/registrations/edit.html.erb +24 -16
  11. data/app/views/devise/registrations/new.html.erb +12 -13
  12. data/app/views/devise/sessions/_navbar_new.html.erb +18 -0
  13. data/app/views/devise/sessions/new.html.erb +13 -15
  14. data/app/views/devise/shared/_links.erb +6 -6
  15. data/app/views/devise/unlocks/new.html.erb +11 -7
  16. data/config/locales/de.yml +3 -3
  17. data/config/locales/en.yml +10 -1
  18. data/config/locales/hu.yml +70 -10
  19. data/lib/devise-i18n-bootstrap.rb +4 -21
  20. data/lib/devise_i18n_bootstrap/engine.rb +20 -0
  21. data/lib/devise_i18n_bootstrap/version.rb +3 -0
  22. data/lib/generators/devise/views/i18n_templates/i18n_templates_generator.rb +1 -1
  23. data/spec/controllers/home_controller_spec.rb +12 -0
  24. data/spec/devise_i18n_bootstrap_spec.rb +12 -0
  25. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  26. data/spec/dummy/app/controllers/home_controller.rb +6 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/helpers/home_helper.rb +2 -0
  29. data/spec/dummy/app/models/user.rb +7 -0
  30. data/spec/dummy/config/application.rb +23 -0
  31. data/spec/dummy/config/boot.rb +5 -0
  32. data/spec/dummy/config/environment.rb +5 -0
  33. data/spec/dummy/config/environments/development.rb +38 -0
  34. data/spec/dummy/config/environments/production.rb +82 -0
  35. data/spec/dummy/config/environments/test.rb +40 -0
  36. data/spec/dummy/config/initializers/assets.rb +8 -0
  37. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  39. data/spec/dummy/config/initializers/devise.rb +256 -0
  40. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/spec/dummy/config/initializers/inflections.rb +16 -0
  42. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/simple_form.rb +165 -0
  45. data/spec/dummy/config/initializers/simple_form_bootstrap.rb +128 -0
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/spec/dummy/config/routes.rb +60 -0
  48. data/spec/dummy/db/migrate/20140729100536_devise_create_users.rb +41 -0
  49. data/spec/dummy/db/schema.rb +43 -0
  50. data/spec/features/sessions_spec.rb +1 -0
  51. data/spec/spec_helper.rb +28 -0
  52. metadata +204 -21
  53. data/.document +0 -5
  54. data/.project +0 -12
  55. data/.rspec +0 -1
  56. data/Gemfile +0 -9
  57. data/Rakefile +0 -30
  58. data/VERSION +0 -1
  59. data/devise-i18n-bootstrap.gemspec +0 -95
  60. data/spec/devise-i18n-bootstrap_spec.rb +0 -8
@@ -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,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,165 @@
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 => true`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable 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
+
47
+ ## full_messages_for
48
+ # If you want to display the full error message for the attribute, you can
49
+ # use the component :full_error, like:
50
+ #
51
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
52
+ end
53
+
54
+ # The default wrapper to be used by the FormBuilder.
55
+ config.default_wrapper = :default
56
+
57
+ # Define the way to render check boxes / radio buttons with labels.
58
+ # Defaults to :nested for bootstrap config.
59
+ # inline: input + label
60
+ # nested: label > input
61
+ config.boolean_style = :nested
62
+
63
+ # Default class for buttons
64
+ config.button_class = 'btn'
65
+
66
+ # Method used to tidy up errors. Specify any Rails Array method.
67
+ # :first lists the first message for each field.
68
+ # Use :to_sentence to list all errors for each field.
69
+ # config.error_method = :first
70
+
71
+ # Default tag used for error notification helper.
72
+ config.error_notification_tag = :div
73
+
74
+ # CSS class to add for error notification helper.
75
+ config.error_notification_class = 'error_notification'
76
+
77
+ # ID to add for error notification helper.
78
+ # config.error_notification_id = nil
79
+
80
+ # Series of attempts to detect a default label method for collection.
81
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
82
+
83
+ # Series of attempts to detect a default value method for collection.
84
+ # config.collection_value_methods = [ :id, :to_s ]
85
+
86
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
87
+ # config.collection_wrapper_tag = nil
88
+
89
+ # You can define the class to use on all collection wrappers. Defaulting to none.
90
+ # config.collection_wrapper_class = nil
91
+
92
+ # You can wrap each item in a collection of radio/check boxes with a tag,
93
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
94
+ # SimpleForm will force this option to be a label.
95
+ # config.item_wrapper_tag = :span
96
+
97
+ # You can define a class to use in all item wrappers. Defaulting to none.
98
+ # config.item_wrapper_class = nil
99
+
100
+ # How the label text should be generated altogether with the required text.
101
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
102
+
103
+ # You can define the class to use on all labels. Default is nil.
104
+ # config.label_class = nil
105
+
106
+ # You can define the class to use on all forms. Default is simple_form.
107
+ # config.form_class = :simple_form
108
+
109
+ # You can define which elements should obtain additional classes
110
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
111
+
112
+ # Whether attributes are required by default (or not). Default is true.
113
+ # config.required_by_default = true
114
+
115
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
116
+ # These validations are enabled in SimpleForm's internal config but disabled by default
117
+ # in this configuration, which is recommended due to some quirks from different browsers.
118
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
119
+ # change this configuration to true.
120
+ config.browser_validations = false
121
+
122
+ # Collection of methods to detect if a file type was given.
123
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
124
+
125
+ # Custom mappings for input types. This should be a hash containing a regexp
126
+ # to match as key, and the input type that will be used when the field name
127
+ # matches the regexp as value.
128
+ # config.input_mappings = { /count/ => :integer }
129
+
130
+ # Custom wrappers for input types. This should be a hash containing an input
131
+ # type as key and the wrapper that will be used for all inputs with specified type.
132
+ # config.wrapper_mappings = { string: :prepend }
133
+
134
+ # Namespaces where SimpleForm should look for custom input classes that
135
+ # override default inputs.
136
+ # config.custom_inputs_namespaces << "CustomInputs"
137
+
138
+ # Default priority for time_zone inputs.
139
+ # config.time_zone_priority = nil
140
+
141
+ # Default priority for country inputs.
142
+ # config.country_priority = nil
143
+
144
+ # When false, do not use translations for labels.
145
+ # config.translate_labels = true
146
+
147
+ # Automatically discover new inputs in Rails' autoload path.
148
+ # config.inputs_discovery = true
149
+
150
+ # Cache SimpleForm inputs discovery
151
+ # config.cache_discovery = !Rails.env.development?
152
+
153
+ # Default class for inputs
154
+ # config.input_class = nil
155
+
156
+ # Define the default class of the input wrapper of the boolean input.
157
+ # config.boolean_label_class = 'checkbox'
158
+
159
+ # Defines if the default input wrapper class should be included in radio
160
+ # collection wrappers.
161
+ # config.include_default_input_wrapper_class = true
162
+
163
+ # Defines which i18n scope will be used in Simple Form.
164
+ # config.i18n_scope = 'simple_form'
165
+ end
@@ -0,0 +1,128 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ config.error_notification_class = 'alert alert-danger'
4
+ config.button_class = 'btn btn-default'
5
+
6
+ config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
7
+ b.use :html5
8
+ b.use :placeholder
9
+ b.optional :maxlength
10
+ b.optional :pattern
11
+ b.optional :min_max
12
+ b.optional :readonly
13
+ b.use :label, class: 'control-label'
14
+
15
+ b.use :input, class: 'form-control'
16
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
17
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
18
+ end
19
+
20
+ config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
21
+ b.use :html5
22
+ b.use :placeholder
23
+ b.optional :maxlength
24
+ b.optional :readonly
25
+ b.use :label, class: 'control-label'
26
+
27
+ b.use :input
28
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
29
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
30
+ end
31
+
32
+ config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
33
+ b.use :html5
34
+ b.optional :readonly
35
+
36
+ b.wrapper tag: 'div', class: 'checkbox' do |ba|
37
+ ba.use :label_input
38
+ end
39
+
40
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
41
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
42
+ end
43
+
44
+ config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
45
+ b.use :html5
46
+ b.optional :readonly
47
+ b.use :label_input
48
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
49
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
50
+ end
51
+
52
+ config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
53
+ b.use :html5
54
+ b.use :placeholder
55
+ b.optional :maxlength
56
+ b.optional :pattern
57
+ b.optional :min_max
58
+ b.optional :readonly
59
+ b.use :label, class: 'col-sm-3 control-label'
60
+
61
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
62
+ ba.use :input, class: 'form-control'
63
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
64
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
65
+ end
66
+ end
67
+
68
+ config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
69
+ b.use :html5
70
+ b.use :placeholder
71
+ b.optional :maxlength
72
+ b.optional :readonly
73
+ b.use :label, class: 'col-sm-3 control-label'
74
+
75
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
76
+ ba.use :input
77
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
78
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
79
+ end
80
+ end
81
+
82
+ config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
83
+ b.use :html5
84
+ b.optional :readonly
85
+
86
+ b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
87
+ wr.wrapper tag: 'div', class: 'checkbox' do |ba|
88
+ ba.use :label_input, class: 'col-sm-9'
89
+ end
90
+
91
+ wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
92
+ wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
93
+ end
94
+ end
95
+
96
+ config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
97
+ b.use :html5
98
+ b.optional :readonly
99
+
100
+ b.use :label, class: 'col-sm-3 control-label'
101
+
102
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
103
+ ba.use :input
104
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
105
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
106
+ end
107
+ end
108
+
109
+ config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
110
+ b.use :html5
111
+ b.use :placeholder
112
+ b.optional :maxlength
113
+ b.optional :pattern
114
+ b.optional :min_max
115
+ b.optional :readonly
116
+ b.use :label, class: 'sr-only'
117
+
118
+ b.use :input, class: 'form-control'
119
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
120
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
121
+ end
122
+
123
+ # Wrappers for forms and inputs using the Bootstrap toolkit.
124
+ # Check the Bootstrap docs (http://getbootstrap.com)
125
+ # to learn about the different styles for forms and inputs,
126
+ # buttons and other elements.
127
+ config.default_wrapper = :vertical_form
128
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,60 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+ root to: 'home#index'
4
+ get 'home/index'
5
+
6
+ # The priority is based upon order of creation: first created -> highest priority.
7
+ # See how all your routes lay out with "rake routes".
8
+
9
+ # You can have the root of your site routed with "root"
10
+ # root 'welcome#index'
11
+
12
+ # Example of regular route:
13
+ # get 'products/:id' => 'catalog#view'
14
+
15
+ # Example of named route that can be invoked with purchase_url(id: product.id)
16
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
17
+
18
+ # Example resource route (maps HTTP verbs to controller actions automatically):
19
+ # resources :products
20
+
21
+ # Example resource route with options:
22
+ # resources :products do
23
+ # member do
24
+ # get 'short'
25
+ # post 'toggle'
26
+ # end
27
+ #
28
+ # collection do
29
+ # get 'sold'
30
+ # end
31
+ # end
32
+
33
+ # Example resource route with sub-resources:
34
+ # resources :products do
35
+ # resources :comments, :sales
36
+ # resource :seller
37
+ # end
38
+
39
+ # Example resource route with more complex sub-resources:
40
+ # resources :products do
41
+ # resources :comments
42
+ # resources :sales do
43
+ # get 'recent', on: :collection
44
+ # end
45
+ # end
46
+
47
+ # Example resource route with concerns:
48
+ # concern :toggleable do
49
+ # post 'toggle'
50
+ # end
51
+ # resources :posts, concerns: :toggleable
52
+ # resources :photos, concerns: :toggleable
53
+
54
+ # Example resource route within a namespace:
55
+ # namespace :admin do
56
+ # # Directs /admin/products/* to Admin::ProductsController
57
+ # # (app/controllers/admin/products_controller.rb)
58
+ # resources :products
59
+ # end
60
+ end
@@ -0,0 +1,41 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ t.string :confirmation_token
24
+ t.datetime :confirmed_at
25
+ t.datetime :confirmation_sent_at
26
+ t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ t.datetime :locked_at
32
+
33
+ t.timestamps
34
+ end
35
+
36
+ add_index :users, :email, unique: true
37
+ add_index :users, :reset_password_token, unique: true
38
+ add_index :users, :confirmation_token, unique: true
39
+ add_index :users, :unlock_token, unique: true
40
+ end
41
+ end