Some cleaning up, for rubocop

This commit is contained in:
echarp 2018-05-23 09:24:42 +02:00
parent ad01be89c4
commit 4002695e5d
3 changed files with 8 additions and 10 deletions

View File

@ -36,10 +36,9 @@ class EventsController < ApplicationController
respond_to do |format|
if @event.save
format.html { redirect_to :root, notice: t('.ok') }
# 201 means :created
format.json { render action: 'show', status: 201, location: @event }
format.json { render action: :show, status: :created, location: @event }
else
format.html { render action: 'new' }
format.html { render action: :new }
status = :unprocessable_entity
format.json { render json: @event.errors, status: status }
end
@ -63,7 +62,7 @@ class EventsController < ApplicationController
format.html { redirect_to @event, notice: t('.ok') }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.html { render action: :edit }
status = :unprocessable_entity
format.json { render json: @event.errors, status: status }
end

View File

@ -27,8 +27,7 @@ class OrgasController < ApplicationController
respond_to do |format|
if @orga.save
format.html { redirect_to @orga, notice: t('.ok') }
# 201 means :created
format.json { render action: 'show', status: 201, location: @orga }
format.json { render action: 'show', status: :created, location: @orga }
else
format.html { render action: 'new' }
format.json { render json: @orga.errors, status: :unprocessable_entity }

View File

@ -30,14 +30,14 @@
= f.label :address
= f.text_field :address, list: :addresses
%datalist#addresses
- Event.where('address is not null').group(:address).order('count(address) desc').pluck(:address).each do |address|
%option= address
- Event.where('address is not null').group(:address).order('1 desc').count.each do |r|
%option= r[0]
.field.city.required
= f.label :city
= f.text_field :city, required: true, list: :cities
%datalist#cities
- Event.group(:city).order('count(city) desc').pluck(:city).each do |city|
%option= city
- Event.group(:city).order('1 desc').count.each do |r|
%option= r[0]
.field.region.required
= f.label :region
= render partial: '/regions/selector', locals: { f: f }