Skip to content

Commit

Permalink
Necessidade de alteração do terminador de linha de CRLF para LF alter…
Browse files Browse the repository at this point in the history
…ado automaticamente pelo windows

Co-authored-by: Marcella Aleo <[email protected]>
  • Loading branch information
Vinigperuzzi and cellaaleo committed Jul 3, 2024
1 parent 23621f4 commit 7730fcb
Show file tree
Hide file tree
Showing 57 changed files with 1,724 additions and 1,722 deletions.
66 changes: 33 additions & 33 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'
gem 'rails', '~> 7.1.3.1'

gem 'bootsnap', require: false
gem 'cpf_cnpj'
gem 'cssbundling-rails'
gem 'devise'
gem 'image_processing', '>= 1.2'
gem 'jbuilder'
gem 'jsbundling-rails'
gem 'puma', '~> 6.0'
gem 'sprockets-rails'
gem 'sqlite3', '~> 1.4'
gem 'stimulus-rails'
gem 'turbo-rails'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

group :development, :test do
gem 'cuprite'
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'factory_bot_rails'
gem 'rspec-rails'
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
end

group :test do
gem 'capybara', '>= 2.15'
gem 'simplecov', require: false
end
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'
gem 'rails', '~> 7.1.3.1'

gem 'bootsnap', require: false
gem 'cpf_cnpj'
gem 'cssbundling-rails'
gem 'devise'
gem 'image_processing', '>= 1.2'
gem 'jbuilder'
gem 'jsbundling-rails'
gem 'puma', '~> 6.0'
gem 'sprockets-rails'
gem 'sqlite3', '~> 1.4'
gem 'stimulus-rails'
gem 'turbo-rails'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

group :development, :test do
gem 'cuprite'
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'factory_bot_rails'
gem 'rspec-rails'
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
end

group :test do
gem 'capybara', '>= 2.15'
gem 'simplecov', require: false
end
96 changes: 48 additions & 48 deletions app/controllers/common_areas_controller.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
class CommonAreasController < ApplicationController
before_action :authenticate_manager!, only: %i[new edit create update]
before_action :set_condo, only: %i[new create]
before_action :set_common_area, only: %i[show edit update]

def show
redirect_to(root_path, notice: t('alerts.common_area.not_allowed')) unless manager_signed_in?
end

def new
@common_area = CommonArea.new
end

def edit; end

def create
@common_area = @condo.common_areas.create(common_area_params)
if @common_area.save
redirect_to @common_area, notice: t('notices.common_area.created')
else
flash[:alert] = t('alerts.common_area.not_created')
render :new, status: :unprocessable_entity
end
end

def update
if @common_area.update(common_area_params)
redirect_to @common_area, notice: t('notices.common_area.updated')
else
flash[:alert] = t('alerts.common_area.not_updated')
render :edit, status: :unprocessable_entity
end
end

private

def set_condo
@condo = Condo.find(params[:condo_id])
end

def set_common_area
@common_area = CommonArea.find(params[:id])
end

def common_area_params
params.require(:common_area).permit(:name, :description, :max_occupancy, :rules)
end
end
class CommonAreasController < ApplicationController
before_action :authenticate_manager!, only: %i[new edit create update]
before_action :set_condo, only: %i[new create]
before_action :set_common_area, only: %i[show edit update]

def show
redirect_to(root_path, notice: t('alerts.common_area.not_allowed')) unless manager_signed_in?
end

def new
@common_area = CommonArea.new
end

def edit; end

def create
@common_area = @condo.common_areas.create(common_area_params)
if @common_area.save
redirect_to @common_area, notice: t('notices.common_area.created')
else
flash[:alert] = t('alerts.common_area.not_created')
render :new, status: :unprocessable_entity
end
end

def update
if @common_area.update(common_area_params)
redirect_to @common_area, notice: t('notices.common_area.updated')
else
flash[:alert] = t('alerts.common_area.not_updated')
render :edit, status: :unprocessable_entity
end
end

private

def set_condo
@condo = Condo.find(params[:condo_id])
end

def set_common_area
@common_area = CommonArea.find(params[:id])
end

def common_area_params
params.require(:common_area).permit(:name, :description, :max_occupancy, :rules)
end
end
86 changes: 43 additions & 43 deletions app/controllers/condos_controller.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
class CondosController < ApplicationController
before_action :authenticate_manager!, only: %i[new create edit update]
before_action :set_condo, only: %i[show edit update]

def show; end

def new
@condo = Condo.new
end

def edit; end

def create
@condo = Condo.new(condo_params)

if @condo.save
redirect_to @condo, notice: t('notices.condo.created')
else
flash.now[:alert] = t('alerts.condo.not_created')
render :new, status: :unprocessable_entity
end
end

def update
if @condo.update(condo_params)
redirect_to @condo, notice: t('notices.condo.updated')
else
flash.now[:alert] = t('alerts.condo.not_updated')
render :edit, status: :unprocessable_entity
end
end

private

def condo_params
params.require(:condo).permit(:name, :registration_number,
address_attributes: %i[public_place number neighborhood city state zip])
end

def set_condo
@condo = Condo.find(params[:id])
end
end
class CondosController < ApplicationController
before_action :authenticate_manager!, only: %i[new create edit update]
before_action :set_condo, only: %i[show edit update]

def show; end

def new
@condo = Condo.new
end

def edit; end

def create
@condo = Condo.new(condo_params)

if @condo.save
redirect_to @condo, notice: t('notices.condo.created')
else
flash.now[:alert] = t('alerts.condo.not_created')
render :new, status: :unprocessable_entity
end
end

def update
if @condo.update(condo_params)
redirect_to @condo, notice: t('notices.condo.updated')
else
flash.now[:alert] = t('alerts.condo.not_updated')
render :edit, status: :unprocessable_entity
end
end

private

def condo_params
params.require(:condo).permit(:name, :registration_number,
address_attributes: %i[public_place number neighborhood city state zip])
end

def set_condo
@condo = Condo.find(params[:id])
end
end
36 changes: 18 additions & 18 deletions app/controllers/floors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
class FloorsController < ApplicationController
before_action :assure_floor_type_registration, only: [:show]

def show
@tower = Tower.find params[:tower_id]
end

private

def assure_floor_type_registration
@floor = Floor.find params[:id]

return if @floor.return_unit_types.present?

redirect_to edit_floor_units_condo_tower_path(@floor.tower.condo, @floor.tower),
alert: t('alerts.floor.not_ready')
end
end
class FloorsController < ApplicationController
before_action :assure_floor_type_registration, only: [:show]

def show
@tower = Tower.find params[:tower_id]
end

private

def assure_floor_type_registration
@floor = Floor.find params[:id]

return if @floor.return_unit_types.present?

redirect_to edit_floor_units_condo_tower_path(@floor.tower.condo, @floor.tower),
alert: t('alerts.floor.not_ready')
end
end
14 changes: 7 additions & 7 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class HomeController < ApplicationController
def index
redirect_to signup_choice_path unless manager_signed_in?
end

def signup; end
end
class HomeController < ApplicationController
def index
redirect_to signup_choice_path unless manager_signed_in?
end

def signup; end
end
50 changes: 25 additions & 25 deletions app/controllers/managers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
class ManagersController < ApplicationController
before_action :authenticate_manager!, only: %i[new create]

def new
@manager = Manager.new
end

def create
@manager = Manager.new(manager_params)
if @manager.save
redirect_to root_path, notice: <<~NOTICE
Administrador cadastrado com sucesso - Nome: #{@manager.full_name} | Email: #{@manager.email}
NOTICE
else
flash[:alert] = t('alerts.manager.not_created')
render :new, status: :unprocessable_entity
end
end

private

def manager_params
params.require(:manager).permit(:full_name, :registration_number, :email, :password, :user_image)
end
end
class ManagersController < ApplicationController
before_action :authenticate_manager!, only: %i[new create]

def new
@manager = Manager.new
end

def create
@manager = Manager.new(manager_params)
if @manager.save
redirect_to root_path, notice: <<~NOTICE
Administrador cadastrado com sucesso - Nome: #{@manager.full_name} | Email: #{@manager.email}
NOTICE
else
flash[:alert] = t('alerts.manager.not_created')
render :new, status: :unprocessable_entity
end
end

private

def manager_params
params.require(:manager).permit(:full_name, :registration_number, :email, :password, :user_image)
end
end
Loading

0 comments on commit 7730fcb

Please sign in to comment.