-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fce97b4
commit dd2e168
Showing
43 changed files
with
618 additions
and
100 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.map { | ||
width: 100%; | ||
height: 100%; | ||
aspect-ratio: 1; | ||
cursor: default; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,3 +227,4 @@ a.subtle-link { | |
text-decoration: underline; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module Ui | ||
class ExperimentsController < ApplicationController | ||
def show | ||
find_experiment! | ||
return unless authorize_experiment! :show?, :show_experiment_forbidden | ||
@title = I18n.t(:show_experiment_title, name: @experiment.name) | ||
add_breadcrumbs( | ||
[I18n.t(:show_user_title, owner: helpers.possessive(@experiment.owner, current_user)), ui_user_path(@experiment.owner.username)], | ||
[@title, ui_experiment_path(@experiment.id)] | ||
) | ||
render "show", layout: "base" | ||
end | ||
|
||
def readings | ||
find_experiment! | ||
return unless authorize_experiment! :show?, :show_experiment_forbidden | ||
return unless find_measurement! | ||
@title = I18n.t(:readings_experiment_title, name: @experiment.name) | ||
add_breadcrumbs( | ||
[I18n.t(:show_user_title, owner: helpers.possessive(@experiment.owner, current_user)), ui_user_path(@experiment.owner.username)], | ||
[I18n.t(:show_experiment_title, name: @experiment.name), ui_experiment_path(@experiment.id)], | ||
[@title, readings_ui_experiment_path(@experiment.id)] | ||
) | ||
render "readings", layout: "base" | ||
end | ||
|
||
private | ||
|
||
def find_experiment! | ||
@experiment = Experiment.find(params[:id]) | ||
end | ||
|
||
def find_measurement! | ||
@measurement = params[:measurement_id] && Measurement.find(params[:measurement_id]) | ||
if @measurement | ||
return @measurement | ||
else | ||
measurement = @experiment.all_measurements.first | ||
redirect_to measurement ? readings_ui_experiment_path(@experiment, measurement_id: measurement.id) : ui_experiment_path(@experiment) | ||
return nil | ||
end | ||
end | ||
|
||
def authorize_experiment!(action, alert) | ||
return true if authorize? @experiment, action | ||
flash[:alert] = I18n.t(alert) | ||
redirect_to current_user ? ui_user_path(current_user.username) : login_path | ||
return false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,7 @@ def tags | |
tag_sensors.map(&:name) | ||
end | ||
|
||
def is_raw? | ||
tags&.include?("raw") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<div class="device row border-top g-0"> | ||
<%= link_to(ui_device_path(device.id), class: "device-link") do %> | ||
<div class="device listing row border-top g-0 z-0"> | ||
<%= link_to(ui_device_path(device.id), class: "listing-link z-1") do %> | ||
<span class="sr-only"><%= device.name %></span> | ||
<% end %> | ||
<div class="col-12 col-md-3"> | ||
<%= render partial: "ui/devices/map", locals: { device: device} %> | ||
<% if device.latitude && device.longitude %> | ||
<%= render partial: "ui/shared/map", locals: { points: [{lat: device.latitude, lng: device.longitude}] } %> | ||
<% end %> | ||
</div> | ||
<div class="col-12 col-md-9 p-3 pb-4"> | ||
<h3 class="mb-1"><%= device.name %></h3> | ||
<h3 class="mb-1 text-break"><%= device.name %></h3> | ||
<%= render partial: "ui/devices/meta", locals: { device: device, hide_owner: local_assigns[:hide_owner] } %> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.