devise_users 0.0.1

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 (115) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/devise_users/application.js +36 -0
  6. data/app/assets/stylesheets/devise_users/application.css.less +15 -0
  7. data/app/assets/stylesheets/devise_users/devise_users.css.less +27 -0
  8. data/app/controllers/devise_users/application_controller.rb +39 -0
  9. data/app/controllers/devise_users/devise_users_controller.rb +75 -0
  10. data/app/helpers/devise_users/application_helper.rb +4 -0
  11. data/app/views/devise_users/devise_users/_form.html.erb +11 -0
  12. data/app/views/devise_users/devise_users/active_users.html.erb +60 -0
  13. data/app/views/devise_users/devise_users/edit.html.erb +11 -0
  14. data/app/views/devise_users/devise_users/index.html.erb +62 -0
  15. data/app/views/devise_users/devise_users/new.html.erb +11 -0
  16. data/app/views/devise_users/devise_users/search.html.erb +13 -0
  17. data/app/views/devise_users/devise_users/show.html.erb +47 -0
  18. data/app/views/devise_users/shared/_side_bar.html.erb +26 -0
  19. data/app/views/devise_users/shared/_user_bar.html.erb +20 -0
  20. data/app/views/layouts/devise_users/application.html.erb +71 -0
  21. data/config/initializers/assets.rb +1 -0
  22. data/config/initializers/simple_form.rb +165 -0
  23. data/config/initializers/simple_form_bootstrap.rb +129 -0
  24. data/config/locales/en.yml +4 -0
  25. data/config/locales/simple_form.en.yml +31 -0
  26. data/config/routes.rb +11 -0
  27. data/lib/devise_users.rb +16 -0
  28. data/lib/devise_users/engine.rb +14 -0
  29. data/lib/devise_users/version.rb +3 -0
  30. data/lib/tasks/devise_users_tasks.rake +4 -0
  31. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  32. data/spec/controllers/devise_users/devise_users_controller_spec.rb +29 -0
  33. data/spec/dummy/README.rdoc +28 -0
  34. data/spec/dummy/Rakefile +6 -0
  35. data/spec/dummy/app/assets/javascripts/application.js +14 -0
  36. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  38. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/app/models/user.rb +10 -0
  40. data/spec/dummy/app/views/application/index.html.erb +8 -0
  41. data/spec/dummy/app/views/layouts/application.html.erb +25 -0
  42. data/spec/dummy/bin/bundle +3 -0
  43. data/spec/dummy/bin/rails +4 -0
  44. data/spec/dummy/bin/rake +4 -0
  45. data/spec/dummy/config.ru +4 -0
  46. data/spec/dummy/config/application.rb +32 -0
  47. data/spec/dummy/config/boot.rb +5 -0
  48. data/spec/dummy/config/database.yml +25 -0
  49. data/spec/dummy/config/environment.rb +5 -0
  50. data/spec/dummy/config/environments/development.rb +37 -0
  51. data/spec/dummy/config/environments/production.rb +82 -0
  52. data/spec/dummy/config/environments/test.rb +39 -0
  53. data/spec/dummy/config/initializers/assets.rb +8 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  56. data/spec/dummy/config/initializers/datetime_format.rb +2 -0
  57. data/spec/dummy/config/initializers/devise.rb +259 -0
  58. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  59. data/spec/dummy/config/initializers/inflections.rb +16 -0
  60. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  61. data/spec/dummy/config/initializers/session_store.rb +3 -0
  62. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  63. data/spec/dummy/config/locales/devise.en.yml +60 -0
  64. data/spec/dummy/config/locales/en.yml +23 -0
  65. data/spec/dummy/config/routes.rb +6 -0
  66. data/spec/dummy/config/secrets.yml +22 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/migrate/20140903052246_devise_create_users.rb +42 -0
  69. data/spec/dummy/db/schema.rb +34 -0
  70. data/spec/dummy/db/test.sqlite3 +0 -0
  71. data/spec/dummy/log/development.log +21573 -0
  72. data/spec/dummy/log/test.log +201 -0
  73. data/spec/dummy/public/404.html +67 -0
  74. data/spec/dummy/public/422.html +67 -0
  75. data/spec/dummy/public/500.html +66 -0
  76. data/spec/dummy/public/favicon.ico +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/007dd1341ceef46d0544e3d0185ccf1d +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/02131eafeb1ac5c40cb70da552716e05 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/0471f60835d0fba3697eed3f6e391753 +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/12aba8cc060f17f9477fd5222fb31c26 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/1aa407c09eff002e639c0d9b441076b3 +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/320d9530536803b47b9ca451a2f786d8 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/3311cd7d4c65c245d019c650dfddd193 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/3b869cca45a858fe5d2e52fba7eb005c +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/46f01993ffd0416b87e11be390accf83 +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/4a546cec8628d7e8dce5c5ee9e898472 +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/53d3bc1ce9ed5cbd3f9bf30379cbed16 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/666a4e48a5214503ac5e56ed86d6049c +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/685aac9cc839d6dc5b28e1396ab22a2a +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/71fbb71291e0ce8f00d41accdbae252d +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/8122d1e4447d3c92cd163d2633033d1a +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/8350c9183f0af7278a44dae604dfdcca +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/8ad0e057d3555ce2bfe91c77d2a08c91 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/8c09980b6bb5011c76e46e68231bd42a +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/8d6cdb14decd04ffac8f3325731c629b +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/b9d8e35a5fe84f4d2c787744a76259ae +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/bb69f920e717f24c74444ee67934b1e5 +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/c39f488e87c6f3da861ea93a83cf0540 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/d0e40d6a415b5ec74a0d89befcb07ef8 +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/d6f2433a2b128ed4a3952ca1ea1319ce +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/da9447e5dd39a617efd489f6fa8123bd +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/e2ec7045dd8b30bdb063e4b87c8b0d6f +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/e392d27e6df799c2ba1da8c5e8f4c571 +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/e4c42cf1655614a3e290cf65a2471a1a +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/f3be039639abc6fbab3865922e15fe00 +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/f4cd836845062b0538b63d898fd7da73 +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  113. data/spec/rails_helper.rb +46 -0
  114. data/spec/spec_helper.rb +78 -0
  115. metadata +408 -0
@@ -0,0 +1,47 @@
1
+ <div class="row">
2
+ <div class="col-xs-12">
3
+ <div class="box">
4
+ <div class="box-header">
5
+ <h3 class="box-title"><%= @user.email %></h3>
6
+ </div><!-- /.box-header -->
7
+ <div class="box-body no-padding">
8
+ <table class="table table-condensed show-table">
9
+ <tbody>
10
+ <tr>
11
+ <td class="view-label">Sign in Count</td>
12
+ <td><%= @user.sign_in_count %></td>
13
+ </tr>
14
+ <tr>
15
+ <td class="view-label">Current Sign in At</td>
16
+ <td><%= @user.current_sign_in_at.in_time_zone if @user.current_sign_in_at.present? %></td>
17
+ </tr>
18
+ <tr>
19
+ <td class="view-label">Current Sign in IP</td>
20
+ <td><%= @user.current_sign_in_ip %></td>
21
+ </tr>
22
+ <tr>
23
+ <td class="view-label">Last Sign in At</td>
24
+ <td><%= @user.last_sign_in_at.in_time_zone if @user.last_sign_in_at.present? %></td>
25
+ </tr>
26
+ <tr>
27
+ <td class="view-label">Last Sign in IP</td>
28
+ <td><%= @user.last_sign_in_ip %></td>
29
+ </tr>
30
+ <tr>
31
+ <td class="view-label">Created At</td>
32
+ <td><%= @user.created_at.in_time_zone %></td>
33
+ </tr>
34
+ <tr>
35
+ <td class="view-label">Updated At</td>
36
+ <td><%= @user.updated_at.in_time_zone if @user.updated_at.present? %></td>
37
+ </tr>
38
+ </tbody>
39
+ </table>
40
+ </div><!-- /.box-body -->
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ <% content_for :header do %>
46
+ User Details
47
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <section class="sidebar">
2
+ <!-- search form -->
3
+ <form action="<%= search_users_path %>" method="get" class="sidebar-form">
4
+ <div class="input-group">
5
+ <input type="text" name="q" class="form-control" placeholder="Search Users..."/>
6
+ <span class="input-group-btn">
7
+ <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
8
+ </span>
9
+ </div>
10
+ </form>
11
+ <!-- /.search form -->
12
+ <!-- sidebar menu -->
13
+ <ul class="sidebar-menu">
14
+ <li class="<%= 'active' if @menu_item == :active_users %>">
15
+ <%= link_to root_path do %>
16
+ <i class="fa fa-clock-o"></i> <span>Active Users</span>
17
+ <% end %>
18
+ </li>
19
+ <li class="<%= 'active' if @menu_item == :user_list %>">
20
+ <%= link_to users_path do %>
21
+ <i class="fa fa-users"></i> <span>User List</span>
22
+ <small class="badge pull-right bg-green"><%= total_user_number %></small>
23
+ <% end %>
24
+ </li>
25
+ </ul>
26
+ </section><!-- /.sidebar -->
@@ -0,0 +1,20 @@
1
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
2
+ <i class="glyphicon glyphicon-user"></i>
3
+ <span><%= devise_resource_object.email %> <i class="caret"></i></span>
4
+ </a>
5
+ <ul class="dropdown-menu">
6
+ <!-- User image -->
7
+ <li class="user-header bg-light-blue">
8
+ <p>
9
+ <span class="color-white"><%= devise_resource_object.email %></span>
10
+ <small>Last login: <%= devise_resource_object.last_sign_in_at.in_time_zone if devise_resource_object.last_sign_in_at.present? %></small>
11
+ </p>
12
+ </li>
13
+ <!-- Menu Footer-->
14
+ <li class="user-footer">
15
+ <div class="pull-left"></div>
16
+ <div class="pull-right">
17
+ <%= link_to 'Sign Out', destroy_session_path(devise_resource_name), class: 'btn btn-default btn-flat', method: :delete %>
18
+ </div>
19
+ </li>
20
+ </ul>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <title>Devise Users</title>
8
+ <%= csrf_meta_tags %>
9
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
10
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
11
+
12
+ <%= stylesheet_link_tag "devise_users/ionicons.min", media: "all" %>
13
+ <%= stylesheet_link_tag "devise_users/AdminLTE", media: "all" %>
14
+ <%= stylesheet_link_tag "devise_users/sweet-alert", media: "all" %>
15
+ <%= stylesheet_link_tag "devise_users/application", media: "all" %>
16
+
17
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
18
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
19
+ <!--[if lt IE 9]>
20
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
21
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
22
+ <![endif]-->
23
+ </head>
24
+ <body class="skin-blue">
25
+ <header class="header">
26
+ <a href="<%= root_path %>" class="logo">
27
+ <i class="fa fa-users fa-reverse"></i> Devise Users
28
+ </a>
29
+ <nav class="navbar navbar-static-top" role="navigation">
30
+ <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
31
+ <span class="sr-only">Toggle navigation</span>
32
+ <span class="icon-bar"></span>
33
+ <span class="icon-bar"></span>
34
+ <span class="icon-bar"></span>
35
+ </a>
36
+ <div class="navbar-right">
37
+ <ul class="nav navbar-nav">
38
+ <li class="dropdown user user-menu">
39
+ <%= render '/devise_users/shared/user_bar' %>
40
+ </li>
41
+ </ul>
42
+ </div>
43
+ </nav>
44
+ </header>
45
+ <div class="wrapper row-offcanvas row-offcanvas-left">
46
+ <aside class="left-side sidebar-offcanvas">
47
+ <%= render '/devise_users/shared/side_bar' %>
48
+ <div style="text-align: center;margin-top: 30px;">
49
+ <%= link_to 'Create User', new_user_path, class: 'btn btn-primary' %>
50
+ </div>
51
+ </aside>
52
+
53
+ <aside class="right-side">
54
+ <section class="content-header">
55
+ <h1><%= yield :header %></h1>
56
+ </section>
57
+
58
+ <!-- Main content -->
59
+ <section class="content">
60
+ <%= yield %>
61
+ </section><!-- /.content -->
62
+ </aside><!-- /.right-side -->
63
+ </div><!-- ./wrapper -->
64
+
65
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
66
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
67
+ <%= javascript_include_tag "devise_users/AdminLTE" %>
68
+ <%= javascript_include_tag "devise_users/sweet-alert.min" %>
69
+ <%= javascript_include_tag "devise_users/application" %>
70
+ </body>
71
+ </html>
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.precompile += %w( devise_users/ionicons.min.css devise_users/AdminLTE.css devise_users/AdminLTE.js devise_users/sweet-alert.min.js devise_users/sweet-alert.css)
@@ -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,129 @@
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
+ config.boolean_label_class = nil
6
+
7
+ config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
8
+ b.use :html5
9
+ b.use :placeholder
10
+ b.optional :maxlength
11
+ b.optional :pattern
12
+ b.optional :min_max
13
+ b.optional :readonly
14
+ b.use :label, class: 'control-label'
15
+
16
+ b.use :input, class: 'form-control'
17
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
18
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
19
+ end
20
+
21
+ config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
22
+ b.use :html5
23
+ b.use :placeholder
24
+ b.optional :maxlength
25
+ b.optional :readonly
26
+ b.use :label, class: 'control-label'
27
+
28
+ b.use :input
29
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
30
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
31
+ end
32
+
33
+ config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
34
+ b.use :html5
35
+ b.optional :readonly
36
+
37
+ b.wrapper tag: 'div', class: 'checkbox' do |ba|
38
+ ba.use :label_input
39
+ end
40
+
41
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
42
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
43
+ end
44
+
45
+ config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
46
+ b.use :html5
47
+ b.optional :readonly
48
+ b.use :label_input
49
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
50
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
51
+ end
52
+
53
+ config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
54
+ b.use :html5
55
+ b.use :placeholder
56
+ b.optional :maxlength
57
+ b.optional :pattern
58
+ b.optional :min_max
59
+ b.optional :readonly
60
+ b.use :label, class: 'col-sm-3 control-label'
61
+
62
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
63
+ ba.use :input, class: 'form-control'
64
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
65
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
66
+ end
67
+ end
68
+
69
+ config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
70
+ b.use :html5
71
+ b.use :placeholder
72
+ b.optional :maxlength
73
+ b.optional :readonly
74
+ b.use :label, class: 'col-sm-3 control-label'
75
+
76
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
77
+ ba.use :input
78
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
79
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
80
+ end
81
+ end
82
+
83
+ config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
84
+ b.use :html5
85
+ b.optional :readonly
86
+
87
+ b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
88
+ wr.wrapper tag: 'div', class: 'checkbox' do |ba|
89
+ ba.use :label_input, class: 'col-sm-9'
90
+ end
91
+
92
+ wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
93
+ wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
94
+ end
95
+ end
96
+
97
+ config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
98
+ b.use :html5
99
+ b.optional :readonly
100
+
101
+ b.use :label, class: 'col-sm-3 control-label'
102
+
103
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
104
+ ba.use :input
105
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
106
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
107
+ end
108
+ end
109
+
110
+ config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
111
+ b.use :html5
112
+ b.use :placeholder
113
+ b.optional :maxlength
114
+ b.optional :pattern
115
+ b.optional :min_max
116
+ b.optional :readonly
117
+ b.use :label, class: 'sr-only'
118
+
119
+ b.use :input, class: 'form-control'
120
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
121
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
122
+ end
123
+
124
+ # Wrappers for forms and inputs using the Bootstrap toolkit.
125
+ # Check the Bootstrap docs (http://getbootstrap.com)
126
+ # to learn about the different styles for forms and inputs,
127
+ # buttons and other elements.
128
+ config.default_wrapper = :vertical_form
129
+ end