Commit Graph

922 Commits

Author SHA1 Message Date
Alberto
f345786cc0 Merge pull request #2622 from consul/selected-investments-map
Adds message to selected budget investments
2018-06-06 19:21:24 +02:00
decabeza
0bf31bde6c Updates all active to is-active classes 2018-06-06 12:02:13 +02:00
Alberto
a05f6ac61a Merge pull request #2641 from consul/homepage
Add customization of homepage from admin section
2018-06-01 19:18:44 +02:00
rgarcia
b672a4550d Add option to configure feed items displayed in homepage 2018-05-29 19:58:04 +02:00
decabeza
316c816836 Expands cards if feed processes is not enabled 2018-05-28 18:52:59 +02:00
decabeza
7732a6704c Adds styles and i18n for homepage 2018-05-28 18:17:26 +02:00
decabeza
50fd540797 Adds styles and missing i18n for admin homepage 2018-05-28 18:17:26 +02:00
iagirre
2821985552 Change 'Calculate Winners button' to budget_investments index.
Move the button so that it appears in the Winners tab of the
budget_investments index.

When the budget is in "Balloting projects", "Reviewing Ballots"
or "Finished budget" phases, the button will appear as a button
(clickable). If there are no winners calculated yet, the text
will be "Calculate winner investments"; if there are, the text
will be "Recalculate winner investments".

If the budget is in another phase, the button will be
disabled and a message will appear: 'The budget has to stay on
phase "Balloting projects", "Reviewing Ballots" or
"Finished budget" in order to calculate winners projects'
2018-05-28 15:12:28 +02:00
decabeza
f1e722ac5c Adds message to selected budget investments 2018-05-10 14:54:34 +02:00
decabeza
5bcec351ef Improves admin content translatable ui 2018-05-10 09:01:12 +02:00
iagirre
471c9730cc Refactorings
- Cleanup Translatable module (`translation_params` method too large)
- Move globalize_helpers partial to admin folder
- Use any class for method translation_params
- Helpers in `GlobalizeHelpers` make sure all are in use and see if they can be more legible
- Review js name clases and methods see if they can be more legible
- Refactor milestone views into partials with nice spacing between attributes
2018-05-09 16:58:47 +02:00
iagirre
951d1c1695 Use a helper with yield Globalize.with_locale
A helper has been created to encapsule the logic
of Globalize.with_locale. Now, to call that function,
globalize(locale) do is called.
2018-05-09 16:07:21 +02:00
iagirre
8b9d1ebd33 Make portuguese locale work
There was a problem with the portuguese locale.
The locale was pt-BR, but `globalize_accessors` gem
doesn't allow the creation of methods using locales
with that format.

To avoid transforming pt-BR to pt and lose the distinction
of the different variations of the language, a function has
been added to transform pt-BR into pt_br (without changing
the locale itself). That way, when globalize uses the locales,
all of them will have a valid format (downcased and underscored)
AND they will be always the same (comparing pt-BR with pt_br
doesn't work).
2018-05-09 16:07:21 +02:00
iagirre
285e02ce96 Highlight current locale when changing locale from select
When the locale changes the corresponding tab is
highlighted automatically.
When a language is added to the milestone, the tab
is highlighted automatically.
2018-05-09 16:07:21 +02:00
iagirre
b318c2be46 Add feature to delete a translation
To delete a translation, a link has been added. This
link works for the selected language. It hides all the
things related to a language (the tab and the text_area)
and empties the text area, so that the value is blank
in the param hash. A variable called `delete_translations[]`
is changed.

e.g. If admin wants to remove English language,
delete_translations[:en] will be 1; if not, it will be 0.

When the milestone is updated, there is a before_action
callback that cleans the selected languages for deletion
(looking the delete_translations[] variable).
Because of the deleted translations are blank in param hash,
them won't be saved in DB.
2018-05-09 16:07:12 +02:00
rgarcia
f7486b9238 Add Globalize to Milestones 2018-05-09 16:05:44 +02:00
Alberto García
223c06f588 Merge pull request #2567 from consul/mode-view
Mode view
2018-04-27 19:28:54 +02:00
Bertocq
b364fc475e Move assigned_valuators from helper to model
There's no good reason to call assigned_valuators(investment) when the
logic can be at the model.

Also removed the valuator_groups texts to be added in an independent
method
2018-04-11 21:07:01 +02:00
Raimond Garcia
1692abc54a Merge pull request #2374 from wairbut-m2c/upload_documents_feature
Upload documents feature
2018-04-05 19:39:12 +02:00
decabeza
ef00eaa765 Adds missing content to budget investments mode view
This feature was already on Madrid fork and missing on backport
2018-04-05 14:53:22 +02:00
rgarcia
39c6ac4a91 Display message in budget's index when there are no budgets
When there are no budgets we were seeing an exception in the budgets’
index

There are two parts to take into account here:
1) Making sure there is a current_budget present, otherwise we display
the “no budgets” message

2) The map helper is called from the controller, so we need to make
sure current_budget is present there too

Note: We could have added a bunch of `try` statements in the budgets’s
index, instead of using a conditional, however there are quite a few
`current_budget` calls so it seems more appropriate to use a conditional
2018-04-05 14:25:32 +02:00
rgarcia
00c965b715 Clean up 2018-04-04 13:19:01 +02:00
rgarcia
7e839e7815 Filter by valuator group 2018-04-03 20:56:31 +02:00
decabeza
c4dc7bc831 Adds view mode on debates 2018-04-02 17:28:39 +02:00
decabeza
bdedb023d1 Adds view mode on proposals 2018-04-02 17:27:52 +02:00
María Checa
cd1a0548ba Add map_location#json_data method 2018-03-27 15:17:31 +02:00
Raimond Garcia
c1d7378c92 Merge pull request #2504 from consul/budget_group_name_edit
Allow Budget Group names to be edited
2018-03-22 22:12:04 +01:00
Alberto García
eba4a3c6cb Merge pull request #2528 from consul/budgets-message
Heading link on budgets message
2018-03-09 13:25:39 +01:00
Bertocq
6e843730b0 Replace format_price for Budget#formatted_amount
ApplicationHelper#format_price and Budget#formatted_amount has the same
objective and code, but the Budget#formatted_amount method also uses the
currency of the Budget to correctly give currencies format.

By replacing usage of format_price with formatted_amount we can remove
format_price and have a single location for currency format logic.
2018-03-08 13:26:36 +01:00
decabeza
d70c46e578 Extract BudgetHeadingsHelper#heading_link & use it
Why:

The logic to construct the link to a heading (if it exists) is in three
different places, this is a clear candidate for a helper method.

How:

Just checking at the helper method if `assigned_heading` and `budget`
has values and composing the link if so.
2018-03-08 11:50:23 +01:00
Bertocq
b72e43168b Use user locale instead of default locale to format currencies 2018-03-08 10:20:05 +01:00
Raúl Fuentes
6d8d44a5e3 Added interface and methods for edit the name of a Budget::Group if the budget is still inthe drafting phase 2018-03-02 09:16:57 +01:00
Bertocq
dbe723079e Disable guide page when Budget is not accepting
Why:

When there is not Budget accepting (Investment creation) the guide page
doesn't have much sense as it will give the user an option that can't be
used (creating an Investment).

How:

Using `Budget.current&.accepting?` conditional at GuidesHelper to link
to new proposal link instead of guide page, and adding an scenario to
guides feature spec for it.
2018-02-26 10:01:30 +01:00
Bertocq
38f7a222f5 Add error message for invalid Newsletter user segment
Instead of the name of the User Segment we'll display an error message
2018-02-21 11:46:30 +01:00
Bertocq
4becd0eb35 Change Newsletter's segment_recipient to string
Why:

Newsletter attribute `segment_recipient` is an integer to be used as
enum. There's no advantage to store a number instead of an string if the
ammount of elements in the table is not going to be huge, or we can take
advantage of using an enum.

Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS
would be a maintenance burden.

How:

* Migration to change segment_recipient column from integer to string
* Removing enumeration from Newsletter model class
* Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients
or integer values
2018-02-21 11:46:11 +01:00
Bertocq
3f91e920f6 Enable rubocop Performance/RedundantMatch cop & fix issues
Some cop offenses have been stashed into rubocop_todo.yml for now
2018-02-10 21:26:02 +01:00
Bertocq
2341a2f70b Add by_budget scope to Investment and use it 2018-02-10 16:36:14 +01:00
Bertocq
bd10285431 Fix line length at budget investments helper 2018-02-10 16:30:07 +01:00
Raúl Fuentes
ecdbc4a3f7 added balloting to the list of phases allowed to see all the links 2018-02-10 15:27:40 +01:00
Raúl Fuentes
5b16d395e7 Added logic to not show invetment links is the budget phase isn't reviewing_ballots or finished 2018-02-10 15:27:40 +01:00
Bertocq
ea089c1b87 Add missing legislation proposal commentable path 2018-02-03 23:54:22 +01:00
Angel Perez
1f50e284a9 'Current applied filters' message handles multiple filters in use 2018-01-31 07:21:51 -04:00
Raimond Garcia
b5cb5e2563 Merge pull request #2387 from wairbut-m2c/show_only_current_budget_tags_in_admin_budget
Show only current budget tags in admin budget
2018-01-29 20:14:10 +01:00
Vicente Mendoza
ff5112f96b Changed the budgets helper so just search for the current budget 2018-01-26 11:30:02 +01:00
Angel Perez
e04dc5b8f2 Add sorting options for Admin::BudgetInvestments (#2336) 2018-01-25 08:18:04 -04:00
Vicente Mendoza
410caced3e test added for changes at documentable's view 2018-01-24 12:48:06 +01:00
Raúl Fuentes
82b750de68 moved duplicated code to helper 2018-01-23 15:42:01 +01:00
rgarcia
d3d05f9cee Add guide to create a proposal or investment
During a Participatory Budget, some users are getting confused and
creating a proposal instead of a budget investment. This intermediate
page should help them create investments

Adding a feature flag just in case other forks don’t need this feature
and setting seeds and dev_seeds for appropriate initial setup
2018-01-18 21:09:21 +01:00
Bertocq
06a1785445 Prevent empty html to be safe rendered to html with links 2018-01-18 17:55:21 +01:00
Bertocq
986ee9c87d Correctly render budget description with html & links 2018-01-18 16:18:27 +01:00