-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from cul/hours-128
HOURS-128 Reenable wifi density and implement a management UI
- Loading branch information
Showing
21 changed files
with
300 additions
and
121 deletions.
There are no files selected for viewing
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 +1 @@ | ||
ruby-2.7.5 | ||
ruby-3.0.3 |
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,27 @@ | ||
module EditLocationHelper | ||
# <label for="location_access_points_2"><input type="checkbox" value="2" name="location[access_points][]" id="location_access_points_2" />2 (Location 2)</label> | ||
def access_point_checkboxes(access_point_branches, count_iterator, current_values = []) | ||
content_tag(:ul) do | ||
access_point_branches.map do |branch| | ||
branch_tag = content_tag(:li, class: ['form-check']) do | ||
cb_index = count_iterator.next | ||
content_tag(:label, for: "location_access_points_#{cb_index}", class: ['form-check-label']) do | ||
checked = current_values.include?(branch.id) | ||
cb_attrs = { | ||
type: 'checkbox', value: branch.id, name: "location[access_points][]", | ||
id: "location_access_points_#{cb_index}", checked: checked, class: ['form-check-input'] | ||
} | ||
tag(:input, cb_attrs).safe_concat("#{branch.name}").safe_concat(content_tag(:em, branch.updated_at ? "updated: #{branch.updated_at}" : "aggregate data", class: "ml-1")) | ||
end | ||
end | ||
if branch.children.size > 0 | ||
child_tag = content_tag(:li) do | ||
access_point_checkboxes(branch.children.values, count_iterator) | ||
end | ||
branch_tag.safe_concat child_tag | ||
end | ||
branch_tag | ||
end.join.html_safe | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class AccessPoint < ApplicationRecord | ||
has_many :access_points_locations | ||
has_many :locations, through: :access_points_locations | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class AccessPointsLocation < ApplicationRecord | ||
belongs_to :location | ||
belongs_to :access_point | ||
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div> | ||
<h2>Internal Server Error</h2> | ||
|
||
<p>Please contact a site administrator to report an error at this location.</p> | ||
</div> |
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,5 @@ | ||
<div> | ||
<h2>Location not found</h2> | ||
|
||
<p>Contact a site administrator if you think this is an error.</p> | ||
</div> |
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 |
---|---|---|
@@ -1,73 +1,7 @@ | ||
development: | ||
data_url: https://hours.library.columbia.edu/wifi-density.json | ||
data_cache_duration: <%= 10.minutes %> | ||
locations: | ||
avery: | ||
cuit_location_ids: | ||
- 124 | ||
high: 100 | ||
business: | ||
cuit_location_ids: | ||
- 96 | ||
high: 100 | ||
butler-24: | ||
cuit_location_ids: | ||
- 115 | ||
high: 1900 | ||
eastasian: | ||
cuit_location_ids: | ||
- 98 | ||
high: 300 | ||
lehman: | ||
cuit_location_ids: | ||
- 109 | ||
high: 1300 | ||
math: | ||
cuit_location_ids: | ||
- 141 | ||
high: 600 | ||
science-engineering: | ||
cuit_location_ids: | ||
- 100 | ||
high: 240 | ||
social-work: | ||
cuit_location_ids: | ||
- 123 | ||
high: 100 | ||
|
||
test: | ||
data_url: https://hours.library.columbia.edu/wifi-density.json | ||
data_cache_duration: <%= 1.second %> | ||
locations: | ||
avery: | ||
cuit_location_ids: | ||
- 124 | ||
high: 100 | ||
business: | ||
cuit_location_ids: | ||
- 96 | ||
high: 100 | ||
butler-24: | ||
cuit_location_ids: | ||
- 115 | ||
high: 1900 | ||
eastasian: | ||
cuit_location_ids: | ||
- 98 | ||
high: 300 | ||
lehman: | ||
cuit_location_ids: | ||
- 109 | ||
high: 1300 | ||
math: | ||
cuit_location_ids: | ||
- 141 | ||
high: 600 | ||
science-engineering: | ||
cuit_location_ids: | ||
- 100 | ||
high: 240 | ||
social-work: | ||
cuit_location_ids: | ||
- 123 | ||
high: 100 |
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
9 changes: 9 additions & 0 deletions
9
db/migrate/20240710150406_add_location_suppress_display_switch.rb
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,9 @@ | ||
class AddLocationSuppressDisplaySwitch < ActiveRecord::Migration[6.0] | ||
def up | ||
add_column :locations, :suppress_display, :boolean, default: false | ||
end | ||
|
||
def down | ||
remove_column :locations, :suppress_display | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class AddLocationAccessPoints < ActiveRecord::Migration[6.0] | ||
def change | ||
create_table :access_points do |t| | ||
t.integer :client_count | ||
t.timestamps null: false | ||
end | ||
create_table :access_points_locations do |t| | ||
t.timestamps null: false | ||
t.bigint :location_id, null: false | ||
t.bigint :access_point_id, null: false | ||
t.index :location_id | ||
t.index :access_point_id | ||
t.index [:location_id, :access_point_id], unique: true | ||
end | ||
add_column :locations, :wifi_connections_baseline, :int, null: true | ||
end | ||
end |
Oops, something went wrong.