Adding rubocop sample config (#547)

* Adding rubocop sample config

* Removing double_quotes enforcement

* Using same rubocop yaml as in Plots2

* Autofixing rubocop offenses

* Fixing conditions for CC

Co-Authored-By: Sasha Boginsky <41092741+sashadev-sky@users.noreply.github.com>

* Adding Performance cop and fixing some offenses

* Fixing rubocop offenses and warnings

* Downgrading rubocop version since https://github.com/publiclab/mapknitter/pull/547#issuecomment-497359929
This commit is contained in:
Álax de Carvalho Alves
2019-06-01 12:30:56 -03:00
committed by Jeffrey Warren
parent dc69769bec
commit 713e387bdb
29 changed files with 1708 additions and 297 deletions

View File

@@ -12,7 +12,7 @@ class AnnotationsController < ApplicationController
geojson = params[:annotation]
respond_to do |format|
format.json {
format.json do
@annotation = @map.annotations.create(
annotation_type: geojson[:properties][:annotation_type],
coordinates: geojson[:geometry][:coordinates],
@@ -21,7 +21,7 @@ class AnnotationsController < ApplicationController
)
@annotation.user_id = current_user.id if logged_in?
redirect_to map_annotation_url(@map, @annotation) if @annotation.save
}
end
end
end
@@ -33,14 +33,14 @@ class AnnotationsController < ApplicationController
def update
@annotation = Annotation.find params[:id]
geojson = params[:annotation]
if @annotation.user_id.nil? || current_user.can_edit?(@annotation)
Annotation.update(@annotation.id,
coordinates: geojson[:geometry][:coordinates],
text: geojson[:properties][:textContent],
style: geojson[:properties][:style])
render file: 'annotations/update.json.erb',
content_type: 'application/json'
end
return if @annotation.user_id.nil? || current_user.can_edit?(@annotation)
Annotation.update(@annotation.id,
coordinates: geojson[:geometry][:coordinates],
text: geojson[:properties][:textContent],
style: geojson[:properties][:style])
render file: 'annotations/update.json.erb',
content_type: 'application/json'
end
def destroy