Commit Graph

17 Commits

Author SHA1 Message Date
Javi Martín
28aafbd4bc Add and apply Style/InvertibleUnlessCondition rule
This rule was added in rubocop 1.44.0. It's useful to avoid accidental
`unless !condition` clauses.

Note we aren't replacing `unless zero?` with `if nonzero?` because we
never use `nonzero?`; using it sounds like `if !zero?`.

Replacing `unless any?` with `if none?` is only consistent if we also replace
`unless present?` with `if blank?`, so we're also adding this case. For
consistency, we're also replacing `unless blank?` with `if present?`.

We're also simplifying code dealing with `> 0` conditions in order to
make the code (hopefully) easier to understand.

Also for consistency, we're enabling the `Style/InverseMethods` rule,
which follows a similar idea.
2023-09-07 19:14:03 +02:00
Senén Rodero Rodríguez
3fa3c90db6 Fix map markers navigation for keyboard users
By using the bindPopup function instead of the click event
popups work when using the keyboard.

Note that now we are loading all the map markers in the first
request in a single query to the database (needed when there
is a lot or markers to show). Because of that we removed the
AJAX endpoint.
2023-06-26 20:33:35 +02:00
Javi Martín
aa5f5235de Simplify creating a map location from a heading 2023-05-04 15:27:15 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
234a5108a4 Use strings for class_name
As mentioned in the Rails console:

DEPRECATION WARNING: Passing a class to the `class_name` is deprecated
and will raise an ArgumentError in Rails 5.2. It eagerloads more classes
than necessary and potentially creates circular dependencies. Please
pass the class name as a string.
2019-05-28 14:26:18 +02:00
Angel Perez
01c1ac2b10 Replace all occurrences of ActiveRecord::Base with ApplicationRecord 2019-04-17 17:40:56 +02:00
Julian Herrero
c5a7492128 add some improvements on budget headings
Show information about longitude and latitude in a budget heading
Show information about custom content in a budget heading
Fix render of map (zoom scrollable and points clickable)
Fix typo in app/models/map_location.rb
2019-01-02 10:46:46 +01:00
Julian Herrero
25e1afea48 fix map rendering for budget headings 2018-12-14 15:37:22 +01:00
Bertocq
a44c830cd4 Fix MapLocation json_data to return mappable ids
Until we correctly make MapLocation relation with mappables a polymorphic
one... we'll need to return the investment_id and proposal_id values.

Right now it was returning the MapLocation ID, and the JS was making a
call searching for an Investment with the MapLocation ID... sometimes
finding a record with same ID but totally NOT the one associated to the
MapLocation.
2018-04-25 20:05:19 +02:00
María Checa
cd1a0548ba Add map_location#json_data method 2018-03-27 15:17:31 +02:00
Bertocq
24b1e64113 Validate MapLocation lat/long/zoom have numeric values 2018-02-02 21:37:50 +01:00
Angel Perez
665a5b57ab Empty instances of MapLocation won't result in a new DB record (#2220) 2018-01-26 09:26:48 -04:00
rgarcia
7889efd6ee Fix map location update
When editing the map of a proposal or investment(the mappable) the
updated_at attribute of the mappable was not been updated and so the
map still displayed the old location after updating it
2017-12-20 12:43:49 +01:00
taitus
51c53b6f31 Add missing specs from Maps on New, Edit and Show. 2017-09-27 14:50:54 +02:00
Senén Rodero Rodríguez
011ef41ae1 Add map location missing specs 2017-09-27 14:50:03 +02:00
Senén Rodero Rodríguez
130e4533ac Allow to render map without marker on new forms. 2017-09-27 14:48:12 +02:00
Senén Rodero Rodríguez
5956207a00 Add map locations. Each map location can belongs to proposal or budget investment. 2017-09-27 14:48:12 +02:00