introspective_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +279 -0
- data/LICENSE +22 -0
- data/MIT-LICENSE +20 -0
- data/README.md +52 -0
- data/Rakefile +26 -0
- data/bin/rails +12 -0
- data/introspective_admin.gemspec +38 -0
- data/lib/introspective_admin/base.rb +170 -0
- data/lib/introspective_admin/version.rb +3 -0
- data/lib/introspective_admin.rb +4 -0
- data/lib/tasks/introspective_admin_tasks.rake +4 -0
- data/spec/admin/company_admin_spec.rb +72 -0
- data/spec/admin/job_admin_spec.rb +61 -0
- data/spec/admin/location_admin_spec.rb +65 -0
- data/spec/admin/project__admin_spec.rb +71 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/admin/company_admin.rb +4 -0
- data/spec/dummy/app/admin/job_admin.rb +4 -0
- data/spec/dummy/app/admin/location_admin.rb +4 -0
- data/spec/dummy/app/admin/project_admin.rb +6 -0
- data/spec/dummy/app/admin/role_admin.rb +5 -0
- data/spec/dummy/app/admin/user_admin.rb +9 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/abstract_adapter.rb +13 -0
- data/spec/dummy/app/models/admin_user.rb +6 -0
- data/spec/dummy/app/models/chat.rb +18 -0
- data/spec/dummy/app/models/chat_message.rb +34 -0
- data/spec/dummy/app/models/chat_message_user.rb +17 -0
- data/spec/dummy/app/models/chat_user.rb +16 -0
- data/spec/dummy/app/models/company.rb +12 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/job.rb +10 -0
- data/spec/dummy/app/models/locatable.rb +6 -0
- data/spec/dummy/app/models/location.rb +26 -0
- data/spec/dummy/app/models/location_beacon.rb +16 -0
- data/spec/dummy/app/models/location_gps.rb +64 -0
- data/spec/dummy/app/models/project.rb +20 -0
- data/spec/dummy/app/models/project_job.rb +7 -0
- data/spec/dummy/app/models/role.rb +25 -0
- data/spec/dummy/app/models/team.rb +9 -0
- data/spec/dummy/app/models/team_user.rb +13 -0
- data/spec/dummy/app/models/user/chatter.rb +79 -0
- data/spec/dummy/app/models/user.rb +75 -0
- data/spec/dummy/app/models/user_location.rb +28 -0
- data/spec/dummy/app/models/user_project_job.rb +16 -0
- data/spec/dummy/app/views/layouts/application.html.erb +13 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +32 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +11 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +43 -0
- data/spec/dummy/config/initializers/active_admin.rb +7 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +260 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141002205024_devise_create_users.rb +42 -0
- data/spec/dummy/db/migrate/20141002211055_devise_create_admin_users.rb +48 -0
- data/spec/dummy/db/migrate/20141002211057_create_active_admin_comments.rb +19 -0
- data/spec/dummy/db/migrate/20141002220722_add_lockable_to_users.rb +8 -0
- data/spec/dummy/db/migrate/20150406213646_create_companies.rb +11 -0
- data/spec/dummy/db/migrate/20150414213154_add_user_authentication_token.rb +11 -0
- data/spec/dummy/db/migrate/20150415222005_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20150505181635_create_chats.rb +9 -0
- data/spec/dummy/db/migrate/20150505181636_create_chat_users.rb +11 -0
- data/spec/dummy/db/migrate/20150505181640_create_chat_messages.rb +11 -0
- data/spec/dummy/db/migrate/20150507191529_create_chat_message_users.rb +11 -0
- data/spec/dummy/db/migrate/20150601200526_create_locations.rb +12 -0
- data/spec/dummy/db/migrate/20150601200533_create_locatables.rb +10 -0
- data/spec/dummy/db/migrate/20150601212924_create_location_beacons.rb +15 -0
- data/spec/dummy/db/migrate/20150601213542_create_location_gps.rb +12 -0
- data/spec/dummy/db/migrate/20150609201823_create_user_locations.rb +14 -0
- data/spec/dummy/db/migrate/20150617232519_create_projects.rb +10 -0
- data/spec/dummy/db/migrate/20150617232521_create_jobs.rb +9 -0
- data/spec/dummy/db/migrate/20150617232522_create_project_jobs.rb +11 -0
- data/spec/dummy/db/migrate/20150623170133_create_user_project_jobs.rb +12 -0
- data/spec/dummy/db/migrate/20150701234929_create_teams.rb +11 -0
- data/spec/dummy/db/migrate/20150701234930_create_team_users.rb +11 -0
- data/spec/dummy/db/migrate/20150727214950_add_confirmable_to_devise.rb +11 -0
- data/spec/dummy/db/migrate/20150820190524_add_user_names.rb +6 -0
- data/spec/dummy/db/migrate/20150909225019_add_password_to_project.rb +5 -0
- data/spec/dummy/db/schema.rb +261 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +13 -0
- data/spec/support/blueprints.rb +119 -0
- data/spec/support/location_helper.rb +56 -0
- metadata +420 -0
@@ -0,0 +1,260 @@
|
|
1
|
+
require 'devise'
|
2
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
3
|
+
# Many of these configuration options can be set straight in your model.
|
4
|
+
Devise.setup do |config|
|
5
|
+
# The secret key used by Devise. Devise uses this key to generate
|
6
|
+
# random tokens. Changing this key will render invalid all existing
|
7
|
+
# confirmation, reset password and unlock tokens in the database.
|
8
|
+
config.secret_key = '111ac0356c712deb49e3153ab04eda25c4aa36c837765e8f34f7737110e092adc94280f5071f1a6900132cfb3996676965425fc9a32cc0ec20c7c6fc63969d51'
|
9
|
+
|
10
|
+
# ==> Mailer Configuration
|
11
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
12
|
+
# note that it will be overwritten if you use your own mailer class
|
13
|
+
# with default "from" parameter.
|
14
|
+
config.mailer_sender = 'dummy@test.com'
|
15
|
+
|
16
|
+
# Configure the class responsible to send e-mails.
|
17
|
+
# config.mailer = 'Devise::Mailer'
|
18
|
+
|
19
|
+
# ==> ORM configuration
|
20
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
21
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
22
|
+
# available as additional gems.
|
23
|
+
require 'devise/orm/active_record'
|
24
|
+
|
25
|
+
# ==> Configuration for any authentication mechanism
|
26
|
+
# Configure which keys are used when authenticating a user. The default is
|
27
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
28
|
+
# authenticating a user, both parameters are required. Remember that those
|
29
|
+
# parameters are used only when authenticating and not when retrieving from
|
30
|
+
# session. If you need permissions, you should implement that in a before filter.
|
31
|
+
# You can also supply a hash where the value is a boolean determining whether
|
32
|
+
# or not authentication should be aborted when the value is not present.
|
33
|
+
# config.authentication_keys = [ :email ]
|
34
|
+
|
35
|
+
# Configure parameters from the request object used for authentication. Each entry
|
36
|
+
# given should be a request method and it will automatically be passed to the
|
37
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
38
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
39
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
40
|
+
# config.request_keys = []
|
41
|
+
|
42
|
+
# Configure which authentication keys should be case-insensitive.
|
43
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
44
|
+
# to authenticate or find a user. Default is :email.
|
45
|
+
config.case_insensitive_keys = [ :email ]
|
46
|
+
|
47
|
+
# Configure which authentication keys should have whitespace stripped.
|
48
|
+
# These keys will have whitespace before and after removed upon creating or
|
49
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
50
|
+
config.strip_whitespace_keys = [ :email ]
|
51
|
+
|
52
|
+
# Tell if authentication through request.params is enabled. True by default.
|
53
|
+
# It can be set to an array that will enable params authentication only for the
|
54
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
55
|
+
# enable it only for database (email + password) authentication.
|
56
|
+
# config.params_authenticatable = true
|
57
|
+
|
58
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
59
|
+
# It can be set to an array that will enable http authentication only for the
|
60
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
61
|
+
# enable it only for database authentication. The supported strategies are:
|
62
|
+
# :database = Support basic authentication with authentication key + password
|
63
|
+
# config.http_authenticatable = false
|
64
|
+
|
65
|
+
# If http headers should be returned for AJAX requests. True by default.
|
66
|
+
# config.http_authenticatable_on_xhr = true
|
67
|
+
|
68
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
69
|
+
# config.http_authentication_realm = 'Application'
|
70
|
+
|
71
|
+
# It will change confirmation, password recovery and other workflows
|
72
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
73
|
+
# Does not affect registerable.
|
74
|
+
# config.paranoid = true
|
75
|
+
|
76
|
+
# By default Devise will store the user in session. You can skip storage for
|
77
|
+
# particular strategies by setting this option.
|
78
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
79
|
+
# may want to disable generating routes to Devise's sessions controller by
|
80
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
81
|
+
config.skip_session_storage = [:http_auth]
|
82
|
+
|
83
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
84
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
85
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
86
|
+
# from the server. You can disable this option at your own risk.
|
87
|
+
# config.clean_up_csrf_token_on_authentication = true
|
88
|
+
|
89
|
+
# ==> Configuration for :database_authenticatable
|
90
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
91
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
92
|
+
#
|
93
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
94
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
95
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
96
|
+
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
97
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
98
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
99
|
+
|
100
|
+
# Setup a pepper to generate the encrypted password.
|
101
|
+
# config.pepper = 'ddbaee3a470626533816cc347decce699130ee5eb72ef545cb12f2c6c1f2e75b6b7c6e2cc98bcdf7e2675acacc6b1874c1cbe21e5a3b3927e85551c987a96650'
|
102
|
+
|
103
|
+
# ==> Configuration for :confirmable
|
104
|
+
# A period that the user is allowed to access the website even without
|
105
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
106
|
+
# able to access the website for two days without confirming their account,
|
107
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
108
|
+
# the user cannot access the website without confirming their account.
|
109
|
+
# config.allow_unconfirmed_access_for = 2.days
|
110
|
+
|
111
|
+
# A period that the user is allowed to confirm their account before their
|
112
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
113
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
114
|
+
# their account can't be confirmed with the token any more.
|
115
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
116
|
+
# before confirming their account.
|
117
|
+
# config.confirm_within = 3.days
|
118
|
+
|
119
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
120
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
121
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
122
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
123
|
+
config.reconfirmable = true
|
124
|
+
|
125
|
+
# Defines which key will be used when confirming an account
|
126
|
+
# config.confirmation_keys = [ :email ]
|
127
|
+
|
128
|
+
# ==> Configuration for :rememberable
|
129
|
+
# The time the user will be remembered without asking for credentials again.
|
130
|
+
# config.remember_for = 2.weeks
|
131
|
+
|
132
|
+
# Invalidates all the remember me tokens when the user signs out.
|
133
|
+
config.expire_all_remember_me_on_sign_out = true
|
134
|
+
|
135
|
+
# If true, extends the user's remember period when remembered via cookie.
|
136
|
+
# config.extend_remember_period = false
|
137
|
+
|
138
|
+
# Options to be passed to the created cookie. For instance, you can set
|
139
|
+
# secure: true in order to force SSL only cookies.
|
140
|
+
# config.rememberable_options = {}
|
141
|
+
|
142
|
+
# ==> Configuration for :validatable
|
143
|
+
# Range for password length.
|
144
|
+
config.password_length = 6..64
|
145
|
+
|
146
|
+
# Email regex used to validate email formats. It simply asserts that
|
147
|
+
# one (and only one) @ exists in the given string. This is mainly
|
148
|
+
# to give user feedback and not to assert the e-mail validity.
|
149
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
150
|
+
|
151
|
+
# ==> Configuration for :timeoutable
|
152
|
+
# The time you want to timeout the user session without activity. After this
|
153
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
154
|
+
# config.timeout_in = 30.minutes
|
155
|
+
|
156
|
+
# If true, expires auth token on session timeout.
|
157
|
+
# config.expire_auth_token_on_timeout = false
|
158
|
+
|
159
|
+
# ==> Configuration for :lockable
|
160
|
+
# Defines which strategy will be used to lock an account.
|
161
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
162
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
163
|
+
# config.lock_strategy = :failed_attempts
|
164
|
+
|
165
|
+
# Defines which key will be used when locking and unlocking an account
|
166
|
+
# config.unlock_keys = [ :email ]
|
167
|
+
|
168
|
+
# Defines which strategy will be used to unlock an account.
|
169
|
+
# :email = Sends an unlock link to the user email
|
170
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
171
|
+
# :both = Enables both strategies
|
172
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
173
|
+
# config.unlock_strategy = :both
|
174
|
+
|
175
|
+
# Number of authentication tries before locking an account if lock_strategy
|
176
|
+
# is failed attempts.
|
177
|
+
# config.maximum_attempts = 20
|
178
|
+
|
179
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
180
|
+
# config.unlock_in = 1.hour
|
181
|
+
|
182
|
+
# Warn on the last attempt before the account is locked.
|
183
|
+
# config.last_attempt_warning = false
|
184
|
+
|
185
|
+
# ==> Configuration for :recoverable
|
186
|
+
#
|
187
|
+
# Defines which key will be used when recovering the password for an account
|
188
|
+
# config.reset_password_keys = [ :email ]
|
189
|
+
|
190
|
+
# Time interval you can reset your password with a reset password key.
|
191
|
+
# Don't put a too small interval or your users won't have the time to
|
192
|
+
# change their passwords.
|
193
|
+
config.reset_password_within = 6.hours
|
194
|
+
|
195
|
+
# ==> Configuration for :encryptable
|
196
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
197
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
198
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
199
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
200
|
+
# REST_AUTH_SITE_KEY to pepper).
|
201
|
+
#
|
202
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
203
|
+
# config.encryptor = :sha512
|
204
|
+
|
205
|
+
# ==> Scopes configuration
|
206
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
207
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
208
|
+
# are using only default views.
|
209
|
+
# config.scoped_views = false
|
210
|
+
|
211
|
+
# Configure the default scope given to Warden. By default it's the first
|
212
|
+
# devise role declared in your routes (usually :user).
|
213
|
+
# config.default_scope = :user
|
214
|
+
|
215
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
216
|
+
# only the current scope. By default, Devise signs out all scopes.
|
217
|
+
# config.sign_out_all_scopes = true
|
218
|
+
|
219
|
+
# ==> Navigation configuration
|
220
|
+
# Lists the formats that should be treated as navigational. Formats like
|
221
|
+
# :html, should redirect to the sign in page when the user does not have
|
222
|
+
# access, but formats like :xml or :json, should return 401.
|
223
|
+
#
|
224
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
225
|
+
# should add them to the navigational formats lists.
|
226
|
+
#
|
227
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
228
|
+
# config.navigational_formats = ['*/*', :html]
|
229
|
+
|
230
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
231
|
+
config.sign_out_via = :delete
|
232
|
+
|
233
|
+
# ==> OmniAuth
|
234
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
235
|
+
# up on your models and hooks.
|
236
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
237
|
+
|
238
|
+
# ==> Warden configuration
|
239
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
240
|
+
# change the failure app, you can configure them inside the config.warden block.
|
241
|
+
#
|
242
|
+
# config.warden do |manager|
|
243
|
+
# manager.intercept_401 = false
|
244
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
245
|
+
# end
|
246
|
+
|
247
|
+
# ==> Mountable engine configurations
|
248
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
249
|
+
# is mountable, there are some extra configurations to be taken into account.
|
250
|
+
# The following options are available, assuming the engine is mounted as:
|
251
|
+
#
|
252
|
+
# mount MyEngine, at: '/my_engine'
|
253
|
+
#
|
254
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
255
|
+
# config.router_name = :my_engine
|
256
|
+
#
|
257
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
258
|
+
# so you need to do it manually. For the users scope, it would be:
|
259
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
260
|
+
end
|
@@ -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,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,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 993285c8b7c44547fa1cf053bf88fa75d6f8fdf33d8e033b8915e025b252c620ef102e9c16a463c3a60b356cf5b57f27ebb35eb90f4f2674bda82c69cac4142d
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: ca9d4587a556cfc28464dcf7f9d73b396e53b814cd339a469bc817011485510d3a9d1d6a7fa08f65cce65bcd55727a7110de0077a952f50ce58a956b255c6903
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
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
|
+
|
34
|
+
t.timestamps null: false
|
35
|
+
end
|
36
|
+
|
37
|
+
add_index :users, :email, unique: true
|
38
|
+
add_index :users, :reset_password_token, unique: true
|
39
|
+
# add_index :users, :confirmation_token, unique: true
|
40
|
+
# add_index :users, :unlock_token, unique: true
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class DeviseCreateAdminUsers < ActiveRecord::Migration
|
2
|
+
def migrate(direction)
|
3
|
+
super
|
4
|
+
# Create a default user
|
5
|
+
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if direction == :up
|
6
|
+
end
|
7
|
+
|
8
|
+
def change
|
9
|
+
create_table(:admin_users) do |t|
|
10
|
+
## Database authenticatable
|
11
|
+
t.string :email, null: false, default: ""
|
12
|
+
t.string :encrypted_password, null: false, default: ""
|
13
|
+
|
14
|
+
## Recoverable
|
15
|
+
t.string :reset_password_token
|
16
|
+
t.datetime :reset_password_sent_at
|
17
|
+
|
18
|
+
## Rememberable
|
19
|
+
t.datetime :remember_created_at
|
20
|
+
|
21
|
+
## Trackable
|
22
|
+
t.integer :sign_in_count, default: 0, null: false
|
23
|
+
t.datetime :current_sign_in_at
|
24
|
+
t.datetime :last_sign_in_at
|
25
|
+
t.string :current_sign_in_ip
|
26
|
+
t.string :last_sign_in_ip
|
27
|
+
|
28
|
+
## Confirmable
|
29
|
+
# t.string :confirmation_token
|
30
|
+
# t.datetime :confirmed_at
|
31
|
+
# t.datetime :confirmation_sent_at
|
32
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
33
|
+
|
34
|
+
## Lockable
|
35
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
36
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
37
|
+
# t.datetime :locked_at
|
38
|
+
|
39
|
+
|
40
|
+
t.timestamps null: false
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index :admin_users, :email, unique: true
|
44
|
+
add_index :admin_users, :reset_password_token, unique: true
|
45
|
+
# add_index :admin_users, :confirmation_token, unique: true
|
46
|
+
# add_index :admin_users, :unlock_token, unique: true
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateActiveAdminComments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :active_admin_comments do |t|
|
4
|
+
t.string :namespace
|
5
|
+
t.text :body
|
6
|
+
t.string :resource_id, null: false, foreign_key: false
|
7
|
+
t.string :resource_type, null: false
|
8
|
+
t.references :author, polymorphic: true
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
add_index :active_admin_comments, [:namespace]
|
12
|
+
add_index :active_admin_comments, [:author_type, :author_id]
|
13
|
+
add_index :active_admin_comments, [:resource_type, :resource_id]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :active_admin_comments
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateCompanies < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :companies do |t|
|
4
|
+
t.string :name, limit: 256, null: false
|
5
|
+
t.string :short_name, limit: 10, null: false
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :companies, :name, unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddUserAuthenticationToken < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :users, :authentication_token, :string
|
4
|
+
add_index :users, :authentication_token, :unique => true
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
remove_index :users, :authentication_token
|
9
|
+
remove_column :users, :authentication_token
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateRoles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :roles do |t|
|
4
|
+
t.integer :user_id, null: false
|
5
|
+
t.references :ownable, polymorphic: true, index: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :roles, [:user_id,:ownable_type,:ownable_id], unique: true
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_users do |t|
|
4
|
+
t.references :chat, chat: true, index: true, foreign_key: true
|
5
|
+
t.references :user, index: true, foreign_key: false
|
6
|
+
t.datetime :departed_at
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatMessages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_messages do |t|
|
4
|
+
t.references :chat, chat: true, index: true, foreign_key: true
|
5
|
+
t.integer :author_id, references: :users, index: true, foreign_key: false
|
6
|
+
t.text :message
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatMessageUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_message_users do |t|
|
4
|
+
t.references :chat_message, index: true, foreign_key: true
|
5
|
+
t.references :user, index: true, foreign_key: false
|
6
|
+
t.timestamp :read_at
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLocations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :locations do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.string :kind
|
6
|
+
t.integer :parent_location_id, index: true, foreign_key: false
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :locations, [:parent_location_id,:kind,:name], unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateLocationBeacons < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :location_beacons do |t|
|
4
|
+
t.references :location
|
5
|
+
t.references :company, null: false
|
6
|
+
t.string :mac_address, limit: 12
|
7
|
+
t.string :uuid, null: false, limit: 32
|
8
|
+
t.integer :major, null: false
|
9
|
+
t.integer :minor, null: false
|
10
|
+
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
add_index :location_beacons, [:company_id,:uuid,:major,:minor], name: "index_location_beacons_unique_company_identifier", unique: true
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLocationGps < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :location_gps do |t|
|
4
|
+
t.references :location, index: true, foreign_key: true
|
5
|
+
t.float :lat, null: false
|
6
|
+
t.float :lng, null: false
|
7
|
+
t.float :alt, default: 0
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateUserLocations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :user_locations do |t|
|
4
|
+
t.references :user, index: true, foreign_key: true
|
5
|
+
t.references :location, index: true, foreign_key: true
|
6
|
+
t.references :detectable, polymorphic: true, index: true
|
7
|
+
t.float :lat
|
8
|
+
t.float :lng
|
9
|
+
t.float :alt
|
10
|
+
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|