device_tracker 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +4 -0
- data/Gemfile +4 -0
- data/Rakefile +10 -0
- data/Readme.md +32 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/device_tracker.gemspec +63 -0
- data/exe/device_tracker +91 -0
- data/lib/device_tracker/app.rb +22 -0
- data/lib/device_tracker/config-schema.json +111 -0
- data/lib/device_tracker/config.ru +9 -0
- data/lib/device_tracker/controllers/application_controller.rb +226 -0
- data/lib/device_tracker/controllers/devices_controller.rb +315 -0
- data/lib/device_tracker/controllers/heartbeat_controller.rb +50 -0
- data/lib/device_tracker/controllers/os_controller.rb +38 -0
- data/lib/device_tracker/controllers/transactions_controller.rb +18 -0
- data/lib/device_tracker/controllers/users_controller.rb +131 -0
- data/lib/device_tracker/db/migrate/20150521071815_create_users.rb +14 -0
- data/lib/device_tracker/db/migrate/20150521082155_create_devices.rb +19 -0
- data/lib/device_tracker/db/migrate/20150521120335_create_operating_systems.rb +9 -0
- data/lib/device_tracker/db/migrate/20150527162242_create_transactions.rb +12 -0
- data/lib/device_tracker/db/migrate/20151027073050_create_heartbeat.rb +11 -0
- data/lib/device_tracker/db/migrate/20151028132946_add_user_verification.rb +8 -0
- data/lib/device_tracker/db/migrate/20151028141328_remove_is_active_from_users.rb +6 -0
- data/lib/device_tracker/db/migrate/20151029085629_add_password_reset_code_to_users.rb +8 -0
- data/lib/device_tracker/db/migrate/20151030130341_add_missing_column_to_devices.rb +8 -0
- data/lib/device_tracker/db/migrate/20151102141601_add_serial_number_to_devices.rb +8 -0
- data/lib/device_tracker/db/schema.rb +61 -0
- data/lib/device_tracker/db/seeds.rb +21 -0
- data/lib/device_tracker/dependencies.rb +16 -0
- data/lib/device_tracker/device_tracker.rb +18 -0
- data/lib/device_tracker/helpers/application_helper.rb +116 -0
- data/lib/device_tracker/helpers/user_helper.rb +24 -0
- data/lib/device_tracker/models/device.rb +42 -0
- data/lib/device_tracker/models/heartbeat.rb +7 -0
- data/lib/device_tracker/models/operating_system.rb +7 -0
- data/lib/device_tracker/models/transaction.rb +62 -0
- data/lib/device_tracker/models/user.rb +28 -0
- data/lib/device_tracker/public/css/bootstrap-sortable.css +100 -0
- data/lib/device_tracker/public/css/bootstrap.min.css +5 -0
- data/lib/device_tracker/public/css/custom.css +88 -0
- data/lib/device_tracker/public/favicon/android-chrome-144x144.png +0 -0
- data/lib/device_tracker/public/favicon/android-chrome-192x192.png +0 -0
- data/lib/device_tracker/public/favicon/android-chrome-36x36.png +0 -0
- data/lib/device_tracker/public/favicon/android-chrome-48x48.png +0 -0
- data/lib/device_tracker/public/favicon/android-chrome-72x72.png +0 -0
- data/lib/device_tracker/public/favicon/android-chrome-96x96.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-114x114.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-120x120.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-144x144.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-152x152.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-180x180.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-57x57.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-60x60.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-72x72.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-76x76.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon-precomposed.png +0 -0
- data/lib/device_tracker/public/favicon/apple-touch-icon.png +0 -0
- data/lib/device_tracker/public/favicon/browserconfig.xml +12 -0
- data/lib/device_tracker/public/favicon/favicon-16x16.png +0 -0
- data/lib/device_tracker/public/favicon/favicon-32x32.png +0 -0
- data/lib/device_tracker/public/favicon/favicon-96x96.png +0 -0
- data/lib/device_tracker/public/favicon/favicon.ico +0 -0
- data/lib/device_tracker/public/favicon/manifest.json +41 -0
- data/lib/device_tracker/public/favicon/mstile-144x144.png +0 -0
- data/lib/device_tracker/public/favicon/mstile-150x150.png +0 -0
- data/lib/device_tracker/public/favicon/mstile-310x150.png +0 -0
- data/lib/device_tracker/public/favicon/mstile-310x310.png +0 -0
- data/lib/device_tracker/public/favicon/mstile-70x70.png +0 -0
- data/lib/device_tracker/public/favicon/safari-pinned-tab.svg +21 -0
- data/lib/device_tracker/public/favicon.png +0 -0
- data/lib/device_tracker/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/device_tracker/public/fonts/glyphicons-halflings-regular.svg +288 -0
- data/lib/device_tracker/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/device_tracker/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/device_tracker/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/lib/device_tracker/public/js/bootstrap-sortable.js +211 -0
- data/lib/device_tracker/public/js/bootstrap.min.js +7 -0
- data/lib/device_tracker/public/js/jquery-2.1.4.min.js +4 -0
- data/lib/device_tracker/version.rb +4 -0
- data/lib/device_tracker/views/404.erb +25 -0
- data/lib/device_tracker/views/_alert.erb +5 -0
- data/lib/device_tracker/views/_device_form.erb +52 -0
- data/lib/device_tracker/views/_device_list.erb +47 -0
- data/lib/device_tracker/views/_footer.erb +3 -0
- data/lib/device_tracker/views/_header.erb +97 -0
- data/lib/device_tracker/views/_heartbeat_list.erb +25 -0
- data/lib/device_tracker/views/_user_form.erb +30 -0
- data/lib/device_tracker/views/devices/edit.erb +11 -0
- data/lib/device_tracker/views/devices/index.erb +12 -0
- data/lib/device_tracker/views/devices/new.erb +10 -0
- data/lib/device_tracker/views/devices/show.erb +283 -0
- data/lib/device_tracker/views/devices/users.erb +14 -0
- data/lib/device_tracker/views/emails/new_password.erb +17 -0
- data/lib/device_tracker/views/emails/password_reset.erb +18 -0
- data/lib/device_tracker/views/emails/registration.erb +16 -0
- data/lib/device_tracker/views/emails/reminder.erb +15 -0
- data/lib/device_tracker/views/emails/verification.erb +18 -0
- data/lib/device_tracker/views/forgot_password.erb +6 -0
- data/lib/device_tracker/views/index.erb +38 -0
- data/lib/device_tracker/views/layout.erb +8 -0
- data/lib/device_tracker/views/login.erb +14 -0
- data/lib/device_tracker/views/operating_system/operating_systems.json.jbuilder +9 -0
- data/lib/device_tracker/views/os/manage.erb +38 -0
- data/lib/device_tracker/views/transactions/_transactions_list.erb +18 -0
- data/lib/device_tracker/views/transactions/index.erb +3 -0
- data/lib/device_tracker/views/users/edit.erb +9 -0
- data/lib/device_tracker/views/users/manage.erb +31 -0
- data/lib/device_tracker/views/users/new.erb +7 -0
- metadata +505 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
<h1>Device Tracker - Reminder</h1>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Hello, <%= @device.user.name %><br><br>
|
5
|
+
It seems that you checked out the <a href="<%= @device_url %>"><%= @device.full_name %></a> on the <b><%= @device.checked_out_since_formatted %></b>.
|
6
|
+
Just to let you know that people will start to wonder where this device has gone!
|
7
|
+
<br>
|
8
|
+
<br>
|
9
|
+
So let someone know that you intend on keeping the device, or return it please.
|
10
|
+
|
11
|
+
<br>
|
12
|
+
<br>
|
13
|
+
Thanks,<br>
|
14
|
+
Device Tracker Team
|
15
|
+
</p>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<h1>Device Tracker - New Account</h1>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Hello, <%= @user.name %><br><br>
|
5
|
+
|
6
|
+
Your account has now been verified.
|
7
|
+
|
8
|
+
<br>
|
9
|
+
<br>
|
10
|
+
<a href="<%= @get_started_link %>">
|
11
|
+
Click here to get started
|
12
|
+
</a>
|
13
|
+
|
14
|
+
<br>
|
15
|
+
<br>
|
16
|
+
Thanks,<br>
|
17
|
+
Device Tracker Team
|
18
|
+
</p>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<form class="form-signin" method="post" action="/forgot-password">
|
2
|
+
<h2 class="form-signin-heading">What's your email?</h2>
|
3
|
+
<label for="email" class="sr-only">Email address</label>
|
4
|
+
<input type="email" class="form-control" id="email" name="email" placeholder="Email" autofocus="" required="">
|
5
|
+
<button class="btn btn-lg btn-primary btn-sm pull-right" type="submit">Request Password</button>
|
6
|
+
</form>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="jumbotron">
|
2
|
+
<div class="container">
|
3
|
+
<h1>Device Tracker</h1>
|
4
|
+
<p>Welcome to the BBC Sport device <b>Device Tracker</b>. The aim of this application is to monitor
|
5
|
+
the use of devices across BBC Sport and stop them going walkies!</p>
|
6
|
+
<p><a class="btn btn-primary btn-lg" href="/devices" role="button">Checkout a Device</a></p>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<table class="table table-hover">
|
11
|
+
<thead>
|
12
|
+
<tr>
|
13
|
+
<th>Device</th>
|
14
|
+
<th>Withdrawn by</th>
|
15
|
+
<th>Since</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% @devices.each do |device| %>
|
20
|
+
<tr class="clickable-row <%= device.passed_use_by_date? ? "danger" : "" %>" data-url="/devices/<%= device.id %>">
|
21
|
+
<td><%= device.full_name %></td>
|
22
|
+
<td><%= device.user.name %></td>
|
23
|
+
<td><%= device.checked_out_since_formatted %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<script type="text/javascript">
|
30
|
+
$(document).ready(function() {
|
31
|
+
$('.clickable-row').on('click', function() {
|
32
|
+
var $this = $(this),
|
33
|
+
url = $this.data('url');
|
34
|
+
|
35
|
+
window.location.href = url;
|
36
|
+
});
|
37
|
+
});
|
38
|
+
</script>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<form class="form-signin" method="post" action="/login">
|
2
|
+
<h2 class="form-signin-heading">Please sign in</h2>
|
3
|
+
<label for="email" class="sr-only">Email address</label>
|
4
|
+
<input type="email" class="form-control" id="email" name="user[email]" value="<%= flash[:email] %>" placeholder="Email" autofocus="" required="">
|
5
|
+
<label for="password" class="sr-only">Password</label>
|
6
|
+
<input type="password" class="form-control" id="password" name="user[password]" placeholder="Password" required="">
|
7
|
+
|
8
|
+
<div class="form-group">
|
9
|
+
<a href="/forgot-password">Forgot password?</a> |
|
10
|
+
<a href="/users/new">Register an account</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<button class="btn btn-lg btn-primary btn-sm pull-right" type="submit">Sign in</button>
|
14
|
+
</form>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<h1>Operating Systems</h1>
|
2
|
+
<div>
|
3
|
+
<div>
|
4
|
+
<form action="/os/create" method="post">
|
5
|
+
<div class="form-group">
|
6
|
+
<label for="name">Name</label>
|
7
|
+
<input type="text" name="os[name]" id="name" class="form-control" placeholder="iOS 9.1">
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<label for="api-level">API Level</label>
|
11
|
+
<input type="text" name="os[api_level]" id="api-level" class="form-control" placeholder="22">
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<button type="submit" class="btn btn-success">Add</button>
|
15
|
+
</form>
|
16
|
+
</div>
|
17
|
+
<table class="table table-hover table-condensed top-margin-large">
|
18
|
+
<thead>
|
19
|
+
<tr>
|
20
|
+
<th>Name</th>
|
21
|
+
<th></th>
|
22
|
+
</tr>
|
23
|
+
</thead>
|
24
|
+
<tbody>
|
25
|
+
<% @os.each do |os| %>
|
26
|
+
<tr>
|
27
|
+
<td><%= os.name %></td>
|
28
|
+
<td width="10%">
|
29
|
+
<form method="post" action="/os/<%= os.id %>/delete">
|
30
|
+
<input type="hidden" name="_method" value="delete">
|
31
|
+
<button class="btn btn-danger btn-xs btn-full-width" type="submit">Delete</button>
|
32
|
+
</form>
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<table class="table table-hover">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Type</th>
|
5
|
+
<th>Description</th>
|
6
|
+
<th>Time of Transaction</th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<% @transactions.each do |transaction| %>
|
11
|
+
<tr>
|
12
|
+
<td> <%= transaction.transaction_type %> </td>
|
13
|
+
<td> <%= transaction.description %> </td>
|
14
|
+
<td> <%= transaction.created_at %> </td>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h2>Editing: <%= @user.name %></h2>
|
2
|
+
<p>Once you have finished editing your account, just hit save and your profile will be updated immediately.</p>
|
3
|
+
<br>
|
4
|
+
|
5
|
+
<form method="post" action="/users/<%= @user.id %>" class="form-horizontal">
|
6
|
+
<input type="hidden" name="_method" value="put" />
|
7
|
+
<%= partial :user_form %>
|
8
|
+
<button type="submit" class="btn btn-success pull-right">Save</button>
|
9
|
+
</form>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<table class="table table-hover sortable">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Username</th>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Information</th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% @users.each do |user| %>
|
12
|
+
<tr class="<%= user.is_verified? ? "" : "active" %>">
|
13
|
+
<td width="20%"><%= user.username %></td>
|
14
|
+
<td width="20%"><%= user.name %></td>
|
15
|
+
<td width="50%">
|
16
|
+
<b>Email: </b><a href="mailto:<%= user.email %>"><%= user.email %></a><br>
|
17
|
+
<b>Administrator: </b><%= user.is_admin? == true ? "Yes" : "No"%><br>
|
18
|
+
<b>Device count: </b><%= user.devices.size %><br>
|
19
|
+
<b>Account Verified: </b><%= user.is_verified? == true ? "Yes" : "No" %><br>
|
20
|
+
</td>
|
21
|
+
<td width="10%">
|
22
|
+
<a href="/users/<%= user.id %>/edit" class="btn btn-warning btn-full-width btn-xs padding-bottom">Edit</a>
|
23
|
+
<form method="post" action="/users/<%= user.id %>/delete">
|
24
|
+
<input type="hidden" name="_method" value="delete">
|
25
|
+
<button class="btn btn-danger btn-xs btn-full-width" type="submit">Delete</button>
|
26
|
+
</form>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|