chili_pepper 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +27 -0
  5. data/app/assets/javascripts/chili_pepper/dishes.js.coffee +9 -0
  6. data/app/assets/javascripts/chili_pepper/items.js.coffee +10 -0
  7. data/app/assets/javascripts/chili_pepper/layout.js.coffee +10 -0
  8. data/app/assets/javascripts/chili_pepper/menus.js.coffee +0 -0
  9. data/app/assets/javascripts/chili_pepper/sections.js.coffee +12 -0
  10. data/app/assets/javascripts/chili_pepper.js +15 -0
  11. data/app/assets/stylesheets/chili_pepper/application.css +13 -0
  12. data/app/assets/stylesheets/chili_pepper/dishes.css +4 -0
  13. data/app/assets/stylesheets/chili_pepper/items.css +4 -0
  14. data/app/assets/stylesheets/chili_pepper/menus.css +4 -0
  15. data/app/assets/stylesheets/chili_pepper/sections.css +4 -0
  16. data/app/controllers/chili_pepper/application_controller.rb +4 -0
  17. data/app/controllers/chili_pepper/dishes_controller.rb +82 -0
  18. data/app/controllers/chili_pepper/items_controller.rb +34 -0
  19. data/app/controllers/chili_pepper/menus_controller.rb +95 -0
  20. data/app/controllers/chili_pepper/sections_controller.rb +80 -0
  21. data/app/decorators/chili_pepper/item_decorator.rb +54 -0
  22. data/app/decorators/chili_pepper/menu_decorator.rb +97 -0
  23. data/app/decorators/chili_pepper/section_decorator.rb +19 -0
  24. data/app/helpers/chili_pepper/application_helper.rb +23 -0
  25. data/app/helpers/chili_pepper/dishes_helper.rb +4 -0
  26. data/app/helpers/chili_pepper/items_helper.rb +4 -0
  27. data/app/helpers/chili_pepper/menus_helper.rb +4 -0
  28. data/app/helpers/chili_pepper/sections_helper.rb +4 -0
  29. data/app/models/chili_pepper/admin.rb +26 -0
  30. data/app/models/chili_pepper/dish.rb +28 -0
  31. data/app/models/chili_pepper/item.rb +32 -0
  32. data/app/models/chili_pepper/menu.rb +70 -0
  33. data/app/models/chili_pepper/section.rb +29 -0
  34. data/app/views/chili_pepper/dishes/_form.html.haml +26 -0
  35. data/app/views/chili_pepper/dishes/edit.html.haml +9 -0
  36. data/app/views/chili_pepper/dishes/new.html.haml +9 -0
  37. data/app/views/chili_pepper/items/_item.html.haml +18 -0
  38. data/app/views/chili_pepper/menus/_form.html.haml +29 -0
  39. data/app/views/chili_pepper/menus/_navigation.html.haml +12 -0
  40. data/app/views/chili_pepper/menus/edit.html.haml +7 -0
  41. data/app/views/chili_pepper/menus/new.html.haml +7 -0
  42. data/app/views/chili_pepper/menus/show.html.haml +13 -0
  43. data/app/views/chili_pepper/sections/_column.html.haml +8 -0
  44. data/app/views/chili_pepper/sections/_form.html.haml +10 -0
  45. data/app/views/chili_pepper/sections/_section_nav_item.html.haml +6 -0
  46. data/app/views/chili_pepper/sections/edit.html.haml +8 -0
  47. data/app/views/chili_pepper/sections/new.html.haml +8 -0
  48. data/app/views/chili_pepper/sections/show.html.haml +25 -0
  49. data/app/views/devise/confirmations/new.html.haml +9 -0
  50. data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
  51. data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
  52. data/app/views/devise/mailer/unlock_instructions.html.haml +5 -0
  53. data/app/views/devise/passwords/edit.html.haml +14 -0
  54. data/app/views/devise/passwords/new.html.haml +9 -0
  55. data/app/views/devise/registrations/edit.html.haml +30 -0
  56. data/app/views/devise/registrations/new.html.haml +17 -0
  57. data/app/views/devise/sessions/new.html.haml +16 -0
  58. data/app/views/devise/shared/_links.haml +19 -0
  59. data/app/views/devise/unlocks/new.html.haml +9 -0
  60. data/app/views/layouts/chili_pepper/menu.html.haml +42 -0
  61. data/config/initializers/devise.rb +259 -0
  62. data/config/initializers/friendly_id.rb +88 -0
  63. data/config/initializers/simple_form.rb +145 -0
  64. data/config/locales/devise.en.yml +59 -0
  65. data/config/locales/simple_form.en.yml +26 -0
  66. data/config/routes.rb +21 -0
  67. data/db/migrate/20140428211712_create_chili_pepper_menus.rb +11 -0
  68. data/db/migrate/20140508093442_add_attributes_to_menus.rb +9 -0
  69. data/db/migrate/20140508094807_create_friendly_id_slugs.rb +15 -0
  70. data/db/migrate/20140514134818_create_chili_pepper_sections.rb +12 -0
  71. data/db/migrate/20140514141708_add_slug_to_chili_pepper_sections.rb +6 -0
  72. data/db/migrate/20140514143903_create_chili_pepper_dishes.rb +11 -0
  73. data/db/migrate/20140514144108_create_chili_pepper_items.rb +13 -0
  74. data/db/migrate/20140514144550_add_vegetarian_option_to_chili_pepper_dishes.rb +5 -0
  75. data/db/migrate/20140514153016_add_published_status_to_menus.rb +5 -0
  76. data/db/migrate/20140612152411_devise_create_chili_pepper_admins.rb +42 -0
  77. data/db/migrate/20140616162854_add_pictures_to_dishes.rb +5 -0
  78. data/db/migrate/20140616163025_add_attachements_to_menus.rb +6 -0
  79. data/db/migrate/20140616163238_add_attachments_to_sections.rb +5 -0
  80. data/lib/chili_pepper/configuration.rb +9 -0
  81. data/lib/chili_pepper/engine.rb +45 -0
  82. data/lib/chili_pepper/version.rb +3 -0
  83. data/lib/chili_pepper.rb +17 -0
  84. data/lib/tasks/auto_annotate_models.rake +34 -0
  85. data/lib/tasks/chili_pepper_tasks.rake +4 -0
  86. data/lib/templates/haml/scaffold/_form.html.haml +10 -0
  87. metadata +464 -0
@@ -0,0 +1,259 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # config.secret_key = '8b7745a63e1f0d2eb52171b2c27d98506423207679dfa1ec6210e55b23c85aa7dd5f1fc65c16f425c36871132253ea5334d778c64b7c2bbaeee28f03a1c50da2'
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14
+
15
+ config.router_name = :chili_pepper
16
+ config.parent_controller = 'ActionController::Base'
17
+
18
+ # Configure the class responsible to send e-mails.
19
+ # config.mailer = 'Devise::Mailer'
20
+
21
+ # ==> ORM configuration
22
+ # Load and configure the ORM. Supports :active_record (default) and
23
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
24
+ # available as additional gems.
25
+ require 'devise/orm/active_record'
26
+
27
+ # ==> Configuration for any authentication mechanism
28
+ # Configure which keys are used when authenticating a user. The default is
29
+ # just :email. You can configure it to use [:username, :subdomain], so for
30
+ # authenticating a user, both parameters are required. Remember that those
31
+ # parameters are used only when authenticating and not when retrieving from
32
+ # session. If you need permissions, you should implement that in a before filter.
33
+ # You can also supply a hash where the value is a boolean determining whether
34
+ # or not authentication should be aborted when the value is not present.
35
+ # config.authentication_keys = [ :email ]
36
+
37
+ # Configure parameters from the request object used for authentication. Each entry
38
+ # given should be a request method and it will automatically be passed to the
39
+ # find_for_authentication method and considered in your model lookup. For instance,
40
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
41
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
42
+ # config.request_keys = []
43
+
44
+ # Configure which authentication keys should be case-insensitive.
45
+ # These keys will be downcased upon creating or modifying a user and when used
46
+ # to authenticate or find a user. Default is :email.
47
+ config.case_insensitive_keys = [ :email ]
48
+
49
+ # Configure which authentication keys should have whitespace stripped.
50
+ # These keys will have whitespace before and after removed upon creating or
51
+ # modifying a user and when used to authenticate or find a user. Default is :email.
52
+ config.strip_whitespace_keys = [ :email ]
53
+
54
+ # Tell if authentication through request.params is enabled. True by default.
55
+ # It can be set to an array that will enable params authentication only for the
56
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
57
+ # enable it only for database (email + password) authentication.
58
+ # config.params_authenticatable = true
59
+
60
+ # Tell if authentication through HTTP Auth is enabled. False by default.
61
+ # It can be set to an array that will enable http authentication only for the
62
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
63
+ # enable it only for database authentication. The supported strategies are:
64
+ # :database = Support basic authentication with authentication key + password
65
+ # config.http_authenticatable = false
66
+
67
+ # If http headers should be returned for AJAX requests. True by default.
68
+ # config.http_authenticatable_on_xhr = true
69
+
70
+ # The realm used in Http Basic Authentication. 'Application' by default.
71
+ # config.http_authentication_realm = 'Application'
72
+
73
+ # It will change confirmation, password recovery and other workflows
74
+ # to behave the same regardless if the e-mail provided was right or wrong.
75
+ # Does not affect registerable.
76
+ # config.paranoid = true
77
+
78
+ # By default Devise will store the user in session. You can skip storage for
79
+ # particular strategies by setting this option.
80
+ # Notice that if you are skipping storage for all authentication paths, you
81
+ # may want to disable generating routes to Devise's sessions controller by
82
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
83
+ config.skip_session_storage = [:http_auth]
84
+
85
+ # By default, Devise cleans up the CSRF token on authentication to
86
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
87
+ # requests for sign in and sign up, you need to get a new CSRF token
88
+ # from the server. You can disable this option at your own risk.
89
+ # config.clean_up_csrf_token_on_authentication = true
90
+
91
+ # ==> Configuration for :database_authenticatable
92
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
93
+ # using other encryptors, it sets how many times you want the password re-encrypted.
94
+ #
95
+ # Limiting the stretches to just one in testing will increase the performance of
96
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
97
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
98
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
99
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
100
+ config.stretches = Rails.env.test? ? 1 : 10
101
+
102
+ # Setup a pepper to generate the encrypted password.
103
+ # config.pepper = '9e5986bb50f023635aaa7e9a32bf9658d16760b8fbfbeedb9d663298116ce0475085949727dcf247803c6cf5a733f9e666dc8a6245503cd3f0dcaf01576702a2'
104
+
105
+ # ==> Configuration for :confirmable
106
+ # A period that the user is allowed to access the website even without
107
+ # confirming their account. For instance, if set to 2.days, the user will be
108
+ # able to access the website for two days without confirming their account,
109
+ # access will be blocked just in the third day. Default is 0.days, meaning
110
+ # the user cannot access the website without confirming their account.
111
+ # config.allow_unconfirmed_access_for = 2.days
112
+
113
+ # A period that the user is allowed to confirm their account before their
114
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
115
+ # their account within 3 days after the mail was sent, but on the fourth day
116
+ # their account can't be confirmed with the token any more.
117
+ # Default is nil, meaning there is no restriction on how long a user can take
118
+ # before confirming their account.
119
+ # config.confirm_within = 3.days
120
+
121
+ # If true, requires any email changes to be confirmed (exactly the same way as
122
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
123
+ # db field (see migrations). Until confirmed, new email is stored in
124
+ # unconfirmed_email column, and copied to email column on successful confirmation.
125
+ config.reconfirmable = true
126
+
127
+ # Defines which key will be used when confirming an account
128
+ # config.confirmation_keys = [ :email ]
129
+
130
+ # ==> Configuration for :rememberable
131
+ # The time the user will be remembered without asking for credentials again.
132
+ # config.remember_for = 2.weeks
133
+
134
+ # If true, extends the user's remember period when remembered via cookie.
135
+ # config.extend_remember_period = false
136
+
137
+ # Options to be passed to the created cookie. For instance, you can set
138
+ # secure: true in order to force SSL only cookies.
139
+ # config.rememberable_options = {}
140
+
141
+ # ==> Configuration for :validatable
142
+ # Range for password length.
143
+ config.password_length = 8..128
144
+
145
+ # Email regex used to validate email formats. It simply asserts that
146
+ # one (and only one) @ exists in the given string. This is mainly
147
+ # to give user feedback and not to assert the e-mail validity.
148
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
149
+
150
+ # ==> Configuration for :timeoutable
151
+ # The time you want to timeout the user session without activity. After this
152
+ # time the user will be asked for credentials again. Default is 30 minutes.
153
+ # config.timeout_in = 30.minutes
154
+
155
+ # If true, expires auth token on session timeout.
156
+ # config.expire_auth_token_on_timeout = false
157
+
158
+ # ==> Configuration for :lockable
159
+ # Defines which strategy will be used to lock an account.
160
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
161
+ # :none = No lock strategy. You should handle locking by yourself.
162
+ # config.lock_strategy = :failed_attempts
163
+
164
+ # Defines which key will be used when locking and unlocking an account
165
+ # config.unlock_keys = [ :email ]
166
+
167
+ # Defines which strategy will be used to unlock an account.
168
+ # :email = Sends an unlock link to the user email
169
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
170
+ # :both = Enables both strategies
171
+ # :none = No unlock strategy. You should handle unlocking by yourself.
172
+ # config.unlock_strategy = :both
173
+
174
+ # Number of authentication tries before locking an account if lock_strategy
175
+ # is failed attempts.
176
+ # config.maximum_attempts = 20
177
+
178
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
179
+ # config.unlock_in = 1.hour
180
+
181
+ # Warn on the last attempt before the account is locked.
182
+ # config.last_attempt_warning = false
183
+
184
+ # ==> Configuration for :recoverable
185
+ #
186
+ # Defines which key will be used when recovering the password for an account
187
+ # config.reset_password_keys = [ :email ]
188
+
189
+ # Time interval you can reset your password with a reset password key.
190
+ # Don't put a too small interval or your users won't have the time to
191
+ # change their passwords.
192
+ config.reset_password_within = 6.hours
193
+
194
+ # ==> Configuration for :encryptable
195
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
196
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
197
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
198
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
199
+ # REST_AUTH_SITE_KEY to pepper).
200
+ #
201
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
202
+ # config.encryptor = :sha512
203
+
204
+ # ==> Scopes configuration
205
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
206
+ # "users/sessions/new". It's turned off by default because it's slower if you
207
+ # are using only default views.
208
+ # config.scoped_views = false
209
+
210
+ # Configure the default scope given to Warden. By default it's the first
211
+ # devise role declared in your routes (usually :user).
212
+ # config.default_scope = :user
213
+
214
+ # Set this configuration to false if you want /users/sign_out to sign out
215
+ # only the current scope. By default, Devise signs out all scopes.
216
+ # config.sign_out_all_scopes = true
217
+
218
+ # ==> Navigation configuration
219
+ # Lists the formats that should be treated as navigational. Formats like
220
+ # :html, should redirect to the sign in page when the user does not have
221
+ # access, but formats like :xml or :json, should return 401.
222
+ #
223
+ # If you have any extra navigational formats, like :iphone or :mobile, you
224
+ # should add them to the navigational formats lists.
225
+ #
226
+ # The "*/*" below is required to match Internet Explorer requests.
227
+ # config.navigational_formats = ['*/*', :html]
228
+
229
+ # The default HTTP method used to sign out a resource. Default is :delete.
230
+ config.sign_out_via = :delete
231
+
232
+ # ==> OmniAuth
233
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
234
+ # up on your models and hooks.
235
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
236
+
237
+ # ==> Warden configuration
238
+ # If you want to use other strategies, that are not supported by Devise, or
239
+ # change the failure app, you can configure them inside the config.warden block.
240
+ #
241
+ # config.warden do |manager|
242
+ # manager.intercept_401 = false
243
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
244
+ # end
245
+
246
+ # ==> Mountable engine configurations
247
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
248
+ # is mountable, there are some extra configurations to be taken into account.
249
+ # The following options are available, assuming the engine is mounted as:
250
+ #
251
+ # mount MyEngine, at: '/my_engine'
252
+ #
253
+ # The router that invoked `devise_for`, in the example above, would be:
254
+ # config.router_name = :my_engine
255
+ #
256
+ # When using omniauth, Devise cannot automatically set Omniauth path,
257
+ # so you need to do it manually. For the users scope, it would be:
258
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
259
+ end
@@ -0,0 +1,88 @@
1
+ # FriendlyId Global Configuration
2
+ #
3
+ # Use this to set up shared configuration options for your entire application.
4
+ # Any of the configuration options shown here can also be applied to single
5
+ # models by passing arguments to the `friendly_id` class method or defining
6
+ # methods in your model.
7
+ #
8
+ # To learn more, check out the guide:
9
+ #
10
+ # http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+ FriendlyId.defaults do |config|
13
+ # ## Reserved Words
14
+ #
15
+ # Some words could conflict with Rails's routes when used as slugs, or are
16
+ # undesirable to allow as slugs. Edit this list as needed for your app.
17
+ config.use :reserved
18
+
19
+ config.reserved_words = %w(new edit index session login logout users admin
20
+ stylesheets assets javascripts images)
21
+
22
+ # ## Friendly Finders
23
+ #
24
+ # Uncomment this to use friendly finders in all models. By default, if
25
+ # you wish to find a record by its friendly id, you must do:
26
+ #
27
+ # MyModel.friendly.find('foo')
28
+ #
29
+ # If you uncomment this, you can do:
30
+ #
31
+ # MyModel.find('foo')
32
+ #
33
+ # This is significantly more convenient but may not be appropriate for
34
+ # all applications, so you must explicity opt-in to this behavior. You can
35
+ # always also configure it on a per-model basis if you prefer.
36
+ #
37
+ # Something else to consider is that using the :finders addon boosts
38
+ # performance because it will avoid Rails-internal code that makes runtime
39
+ # calls to `Module.extend`.
40
+ #
41
+ # config.use :finders
42
+ #
43
+ # ## Slugs
44
+ #
45
+ # Most applications will use the :slugged module everywhere. If you wish
46
+ # to do so, uncomment the following line.
47
+ #
48
+ # config.use :slugged
49
+ #
50
+ # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+ # 'slug', but you can change it if you wish.
52
+ #
53
+ # config.slug_column = 'slug'
54
+ #
55
+ # When FriendlyId can not generate a unique ID from your base method, it appends
56
+ # a UUID, separated by a single dash. You can configure the character used as the
57
+ # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+ # with two dashes.
59
+ #
60
+ # config.sequence_separator = '-'
61
+ #
62
+ # ## Tips and Tricks
63
+ #
64
+ # ### Controlling when slugs are generated
65
+ #
66
+ # As of FriendlyId 5.0, new slugs are generated only when the slug field is
67
+ # nil, but if you're using a column as your base method can change this
68
+ # behavior by overriding the `should_generate_new_friendly_id` method that
69
+ # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
70
+ # more like 4.0.
71
+ #
72
+ # config.use Module.new {
73
+ # def should_generate_new_friendly_id?
74
+ # slug.blank? || <your_column_name_here>_changed?
75
+ # end
76
+ # }
77
+ #
78
+ # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
79
+ # languages that don't use the Roman alphabet, that's not usually suffient. Here
80
+ # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
81
+ # you use this, don't forget to add "babosa" to your Gemfile.
82
+ #
83
+ # config.use Module.new {
84
+ # def normalize_friendly_id(text)
85
+ # text.to_slug.normalize! :transliterations => [:russian, :latin]
86
+ # end
87
+ # }
88
+ end
@@ -0,0 +1,145 @@
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, tag: :li, 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 => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for 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
+ end
47
+
48
+ # The default wrapper to be used by the FormBuilder.
49
+ config.default_wrapper = :default
50
+
51
+ # Define the way to render check boxes / radio buttons with labels.
52
+ # Defaults to :nested for bootstrap config.
53
+ # inline: input + label
54
+ # nested: label > input
55
+ config.boolean_style = :nested
56
+
57
+ # Default class for buttons
58
+ config.button_class = 'btn'
59
+
60
+ # Method used to tidy up errors. Specify any Rails Array method.
61
+ # :first lists the first message for each field.
62
+ # Use :to_sentence to list all errors for each field.
63
+ # config.error_method = :first
64
+
65
+ # Default tag used for error notification helper.
66
+ config.error_notification_tag = :div
67
+
68
+ # CSS class to add for error notification helper.
69
+ config.error_notification_class = 'alert alert-error'
70
+
71
+ # ID to add for error notification helper.
72
+ # config.error_notification_id = nil
73
+
74
+ # Series of attempts to detect a default label method for collection.
75
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+ # Series of attempts to detect a default value method for collection.
78
+ # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+ # config.collection_wrapper_tag = nil
82
+
83
+ # You can define the class to use on all collection wrappers. Defaulting to none.
84
+ # config.collection_wrapper_class = nil
85
+
86
+ # You can wrap each item in a collection of radio/check boxes with a tag,
87
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+ # SimpleForm will force this option to be a label.
89
+ # config.item_wrapper_tag = :span
90
+
91
+ # You can define a class to use in all item wrappers. Defaulting to none.
92
+ # config.item_wrapper_class = nil
93
+
94
+ # How the label text should be generated altogether with the required text.
95
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+ # You can define the class to use on all labels. Default is nil.
98
+ config.label_class = 'control-label'
99
+
100
+ # You can define the class to use on all forms. Default is simple_form.
101
+ # config.form_class = :simple_form
102
+
103
+ # You can define which elements should obtain additional classes
104
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+ # Whether attributes are required by default (or not). Default is true.
107
+ # config.required_by_default = true
108
+
109
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+ # These validations are enabled in SimpleForm's internal config but disabled by default
111
+ # in this configuration, which is recommended due to some quirks from different browsers.
112
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+ # change this configuration to true.
114
+ config.browser_validations = false
115
+
116
+ # Collection of methods to detect if a file type was given.
117
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+ # Custom mappings for input types. This should be a hash containing a regexp
120
+ # to match as key, and the input type that will be used when the field name
121
+ # matches the regexp as value.
122
+ # config.input_mappings = { /count/ => :integer }
123
+
124
+ # Custom wrappers for input types. This should be a hash containing an input
125
+ # type as key and the wrapper that will be used for all inputs with specified type.
126
+ # config.wrapper_mappings = { string: :prepend }
127
+
128
+ # Default priority for time_zone inputs.
129
+ # config.time_zone_priority = nil
130
+
131
+ # Default priority for country inputs.
132
+ # config.country_priority = nil
133
+
134
+ # When false, do not use translations for labels.
135
+ # config.translate_labels = true
136
+
137
+ # Automatically discover new inputs in Rails' autoload path.
138
+ # config.inputs_discovery = true
139
+
140
+ # Cache SimpleForm inputs discovery
141
+ # config.cache_discovery = !Rails.env.development?
142
+
143
+ # Default class for inputs
144
+ # config.input_class = nil
145
+ end
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid email or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account will be locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,26 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Labels and hints examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+
data/config/routes.rb ADDED
@@ -0,0 +1,21 @@
1
+ ChiliPepper::Engine.routes.draw do
2
+
3
+ devise_for :admins, class_name: 'ChiliPepper::Admin', module: :devise
4
+
5
+ resources :menus
6
+ resources :menus do
7
+ collection { post :sort }
8
+ resources :sections, path: '', except: [:index] do
9
+ collection { post :sort }
10
+ end
11
+ end
12
+
13
+ resources :dishes do
14
+ get :autocomplete_dish_name, on: :collection
15
+ end
16
+
17
+ resources :items do
18
+ collection { post :sort }
19
+ end
20
+
21
+ end
@@ -0,0 +1,11 @@
1
+ class CreateChiliPepperMenus < ActiveRecord::Migration
2
+ def change
3
+ create_table :chili_pepper_menus do |t|
4
+ t.string :name
5
+ t.integer :position
6
+ t.string :description
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class AddAttributesToMenus < ActiveRecord::Migration
2
+ def change
3
+ add_column :chili_pepper_menus, :slug, :string
4
+ add_index :chili_pepper_menus, :slug, unique: true
5
+ add_column :chili_pepper_menus, :menu_type, :integer
6
+ add_column :chili_pepper_menus, :availability, :string
7
+ add_column :chili_pepper_menus, :price, :decimal, :precision => 5, :scale => 2
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class CreateFriendlyIdSlugs < ActiveRecord::Migration
2
+ def change
3
+ create_table :friendly_id_slugs do |t|
4
+ t.string :slug, :null => false
5
+ t.integer :sluggable_id, :null => false
6
+ t.string :sluggable_type, :limit => 50
7
+ t.string :scope
8
+ t.datetime :created_at
9
+ end
10
+ add_index :friendly_id_slugs, :sluggable_id
11
+ add_index :friendly_id_slugs, [:slug, :sluggable_type]
12
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true
13
+ add_index :friendly_id_slugs, :sluggable_type
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ class CreateChiliPepperSections < ActiveRecord::Migration
2
+ def change
3
+ create_table :chili_pepper_sections do |t|
4
+ t.integer :menu_id
5
+ t.text :description
6
+ t.string :name
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddSlugToChiliPepperSections < ActiveRecord::Migration
2
+ def change
3
+ add_column :chili_pepper_sections, :slug, :string
4
+ add_index :chili_pepper_sections, :slug, unique: true
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class CreateChiliPepperDishes < ActiveRecord::Migration
2
+ def change
3
+ create_table :chili_pepper_dishes do |t|
4
+ t.string :name
5
+ t.string :description, limit: 255
6
+ t.integer :coeliac
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end