-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new
status
attribute to DoorCode, and remove obsolete door-code…
…-related code (#596) * Add 'status' enum field to DoorCode. * Remove enabled field on DoorCode, remove requirement that a code always be assigned to a user, and delete obsolete doorbell controller code. * Add `blacklisted` DoorCode status.
- Loading branch information
Showing
17 changed files
with
82 additions
and
489 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,26 +1,5 @@ | ||
class Admin::DoorCodeController < ApplicationController | ||
before_action :ensure_admin | ||
|
||
def disable_door_code | ||
door_code = DoorCode.find(params[:id]) | ||
door_code.enabled = false | ||
door_code.save! | ||
flash[:message] = "#{door_code.user.name}'s door code is now disabled." | ||
redirect_to admin_memberships_path | ||
end | ||
|
||
def enable_door_code | ||
door_code = DoorCode.find(params[:id]) | ||
door_code.enabled = true | ||
door_code.save! | ||
flash[:message] = "#{door_code.user.name}'s door code is now enabled." | ||
redirect_to admin_memberships_path | ||
end | ||
|
||
def generate_new_for_user | ||
user = User.find(params[:id]) | ||
DoorCode.new_for_user(user) | ||
flash[:message] = "A door code was generated for #{user.name}." | ||
redirect_to admin_memberships_path | ||
end | ||
# TODO: add actions for new door code administration workflow | ||
end |
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddStatusToDoorCodes < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :door_codes, :status, string, null: false, default: "not_in_lock" | ||
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,5 @@ | ||
class RemoveEnabledFromDoorCodes < ActiveRecord::Migration[6.0] | ||
def change | ||
remove_column :door_codes, :enabled, :boolean | ||
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,6 @@ | ||
class MakeDoorCodeUserOptional < ActiveRecord::Migration[6.0] | ||
def change | ||
change_column_null :door_codes, :user_id, true | ||
change_column_default :door_codes, :user_id, nil | ||
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
Oops, something went wrong.