Commit Graph

130 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
70a9fb7355 Do not call initialize_modules after every ajax call
We were calling initialize_modules after every ajax call only to apply the
application javascript to new elements added though ajax calls, this is not
always needed because some ajax calls do not add new elements to the user
interface so there is no new elements to initialize. This technique was working
fine in most cases but was causing different kind of problems at some pages where
some elements where being unnecessarily reinitiliazed causing the execution of the
element associated scripts as many times as the element was initialized. This fix
should relief a little bit of work to users browsers.

After this change we had to fix some pieces of javascript:

Regarding LegistationAnnotatable module, since we are not re-initializing Annotator
app we cannot destroy it so now we only need to insert the new annotation into annotator
interface to keep it properly updated.

Regarding Comments module, we do not need anymore the initialization check because this
code only will be fired once now we do not launch application initialization after ajax
calls. Also, when a new comment is created its added to the DOM through AJAX and include
some elements that needs javascript initialization to work. By using
"Delegated event handlers" [1] new comments will be initialized automatically when added.

[1] https://api.jquery.com/on/#direct-and-delegated-events
2020-05-09 08:17:55 +02:00
taitus
162462fc32 Use en-GB locale when current locale is not include in application.js
When a current locale is not defined on applicaton.js, datepicker load
the last jquery-ui/i18n/datepicker-xx defined.
Add 'jquery-ui/i18n/datepicker-en-GB' as last "require" to use when a current locale is not defined.
2020-02-19 15:58:55 +01:00
taitus
11cdcb72ef Add the rest of the languages available in "available_locales"
Of all the available locales on application.rb, the only ones that do not
have a correspondence with:
https://github.com/jquery/jquery-ui/tree/master/ui/i18n are [:so, :val]
2020-02-18 17:57:21 +01:00
Alceu Medeiros
6c3509fbf5 Add datepicker translations to available locales 2020-02-18 17:42:46 +01:00
Javi Martín
82b0a6a92d Remove new CSV report generation
The new CSV report was more configurable and could work on proposals,
processes and comments. However, it had several issues.

In the public area, by default it generated a blank file.

In the admin section, the report was hard to configure and it generated
a file with less quality than the old system.

So until we improve this system, we're bringing back the old investment
CSV exporter.

This commit reverts most of commit 9d1ca3bf.
2019-11-06 00:04:02 +01:00
Javi Martín
e314701d49 Extract method to pluralize text in JavaScript
This way we can reuse it in other places.
2019-10-31 15:03:57 +01:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javi Martín
6ef07f8a54 Use text_area instead of cktext_area
We're going to change CKEditor to an inline editor, and the "ckeditor"
gem doesn't provide an option to do so.

Since using `cktext_area` would automatically generate a "classic"
iframe CKEditor, we need to use `text_area` and load the editor using
JavaScript. Personally I prefer this option anyway.

Note in the jQuery selector we need to use `textarea.html-area`; using
just `.html-area` would fail if there's an error message associated to
the textarea, since Rails will add the `.html-area` class to the error
message.
2019-10-25 16:34:25 +02:00
cyrillefr
44b2a07878 Moderate legislation proposals (#3602)
Moderate legislation proposals

- added a controller for moderation/legislation
- updated view to appropriate link + added route
- added a spec
- Feature test
- test for faded
- javascripts for visual effects
2019-10-05 04:02:39 +02:00
Javi Martín
5211f47842 Add and apply ESLint spacing rules
For now we're only adding rules related to spacing and double quotes,
following the same rules we use in Ruby, which are the same rules
CoffeeScript followed when compiling these files.

We're also using the recommended ESLint rules, which will warn us about
many JavaScript common pitfalls, the `strict` rule which enforces using
strict mode, and the `no-console` rule, which will prevent us from
shipping code meant for debugging.

Although it's arguably more common to use the JSON format to define
these rules, I've chosen YAML because it's the format we use in all our
linters.
2019-09-11 14:03:24 +02:00
Javi Martín
d93a029ce5 Convert CofeeScript to JavaScript
Compiled using `coffee -c` with CoffeeScript 1.12.6.
2019-09-11 14:03:24 +02:00
Javi Martín
d8be18d6a9 Use double quotes in CoffeeScript
We accidentally added some single quotes recently.
2019-09-11 03:14:17 +02:00
Javi Martín
86e704d8a4 Use strict mode in JavaScript
Strict mode is supported by 98% of the browsers, including Internet
Explorer 10, and it helps developers avoid common JavaScript pitfalls.
2019-09-11 03:14:17 +02:00
Javi Martín
f28a5cc49b Remove unused piwik-related code
This code requires the variable `_paq` to be set somewhere, but we never
set it.

In the past Decide Madrid added some custom JavaScript using this code.
However, in CONSUL we're using Ahoy to track events, and we don't have
any documentation about adding custom JavaScript to use piwik nor we've
got any other piwik integration.
2019-09-11 01:56:27 +02:00
Javi Martín
a9d28bee15 Remove unused code in App.Cookies
The `removeCookie` function is never called, and the `initialize`
function doesn't do anything. The only functions we use here are
`getCookie` and `saveCookie`.
2019-09-11 01:56:27 +02:00
Javi Martín
bf20c93e99 Remove legacy annotations JavaScript file
This code isn't used since commit 54e59a8a.
2019-09-11 01:56:27 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
German Galia
74083df10f Add historic fields to participatory budget 2019-06-12 18:03:53 +02:00
Raimond Garcia
259e05c3e0 Merge pull request #3410 from LextrendIT/report_generation
Report generation, download CSV
2019-06-12 11:45:59 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
lalo
4740aeaddf Add columns selector JS component and change Rails view to use it 2019-06-11 14:33:40 +02:00
voodoorai2000
24dde9c35e Delete valuation 2019-05-31 15:43:06 +02:00
Javi Martín
b4a1f0db51 Rename file to initialize Foundation
Naming it "Dropdown" was misleading.
2019-05-21 13:50:16 +02:00
Javi Martín
8094417828 Remove best_in_place
It was only used in one place, so it's best to remove it and use the
patterns we use everywhere else.
2019-04-29 12:37:28 -05:00
decabeza
5bbf325c1f Remove copy link on dashboard polls 2019-04-24 14:01:08 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Senén Rodero Rodríguez
b417e9db31 Initialize new question answers coccon callback
After adding new question we need to initialize new answers
sets.
2019-03-21 14:51:17 +01:00
Senén Rodero Rodríguez
045c950c3b Add poll question answers script for nested fields
Set poll questions answers given_order value dinamically with JS to
allow to create multiple answers with correct given_order.
2019-03-21 14:51:17 +01:00
Julian Herrero
1ece761beb Render map properly when changing between setting tabs 2019-03-19 18:14:57 +01:00
Julian Herrero
d9eaea4ea0 Use double quotes in app/assets 2019-03-15 09:26:00 +01:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Juan Salvador Pérez García
488e7e081f Merge branch 'dashboard' into rebase_consul_master 2018-09-27 09:18:27 +02:00
Alberto
fb19aafee7 Merge pull request #2778 from wairbut-m2c/backport/investments-moderation
Allow budget investments to be moderated
2018-07-27 12:34:17 +02:00
Bertocq
f695a7faf3 Add AdminNotification management at admin panel
In the same fashion Newsletters is managed, with the only difference that
the preview is using the notification partial in the same way the index
of notifications.
2018-07-25 18:33:45 +02:00
Angel Perez
1990092fdf Allow moderators to hide inappropriate investments 2018-07-20 18:42:33 -04:00
Juan Salvador Pérez García
f439fc7371 Fixes #218
Added check in poll card that allows setting the value of
results_enabled flag.

Access to stats/results now is controlled with abilities.

Polls related to proposals will be accessible to the proposal author
like they were administrators.
2018-07-17 17:59:12 +02:00
Juan Salvador Pérez García
889a15a9bf Poll view redesigned for the dashboard.
Poll view has been redesigned. Now polls are shown like cards. There is
a link that allow sharing the poll.
2018-07-17 17:58:22 +02:00
iagirre
88a8aaa083 Add hide button in the user interface
The little menu with the hide notification link and block user link
has been added to each proposal notification.

JS for adding the fade efect has also been added.
2018-07-02 18:19:08 +02:00
rgarcia
f7486b9238 Add Globalize to Milestones 2018-05-09 16:05:44 +02:00
iagirre
3a62fc9bda Add UI to let manager change users password
A submenu has been added to the side menu's
'Edit user account' option. This submenu has
two options:

- Reset password via email: an email is send
so that the user can change their password by
themselves.
- Reset password manually: the manager has to
write the password manually (or generate a random
one).

The passwords generated by the random password
generator don't contain characters like $ or !.
It uses some capital letters, some other lower
case letters and some numbers. Ambiguous
characters like 1, l, I has been removed.
2018-04-02 09:43:24 +02:00
María Checa
d786284ce9 Added newsletter custom stylesheets and js alert 2018-02-14 16:06:02 +01:00
María Checa
4e5c8f4903 Added js file for alert 2018-01-17 19:11:46 +01:00
iagirre
5a3e701e8d Polls' stats migrated from Madrid's fork and sortable functions added for tables 2017-10-23 13:19:22 +02:00
iagirre
2b10b59e2a Order in the admin page using jquery-ui sortable widget. 2017-10-10 16:38:29 +02:00
María Checa
bcfd1a844a Poll voter token 2017-10-06 20:44:47 +02:00
BertoCQ
121109f967 Merge branch 'master' into feature/1924#poll_shifts_creation 2017-09-28 13:03:34 +02:00
María Checa
08cdf93ecc Switch date selects for shift tasks 2017-09-28 10:40:48 +02:00
Senén Rodero Rodríguez
6c1d1c2cde Add map settings to backend. Install leaflet assets to render maps. 2017-09-27 14:46:02 +02:00
Senén Rodero Rodríguez
966ff4dc03 User new direct uploads controllers action on imageable. 2017-09-26 13:56:06 +02:00
Senén Rodero Rodríguez
824dd26d5a User new direct uploads controllers action on documentable. Skipped spec. 2017-09-26 13:55:51 +02:00