Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into issue_3118
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Apr 19, 2018
2 parents 121ae07 + f189d93 commit f99cd7f
Show file tree
Hide file tree
Showing 181 changed files with 4,197 additions and 1,369 deletions.
37 changes: 34 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,30 @@ jobs:
command: bundle exec erblint --lint-all
- store_test_results:
path: ~/rspec
generators:
<<: *defaults
steps:
- attach_workspace:
at: /app
- checkout
- restore_cache:
keys:
- bundler-dependencies-{{ checksum "Gemfile.lock" }}
- run:
name: Install ruby dependencies
command: bundle install
- save_cache:
key: bundler-dependencies-{{ checksum "Gemfile.lock" }}
paths:
- /usr/local/bundle/
- run:
name: Wait for db
command: dockerize -wait tcp://localhost:5432 -timeout 2m
- run:
name: Run generators RSpec
command: mkdir ~/rspec && cd decidim-generators && rake
- store_test_results:
path: ~/rspec
core:
<<: *defaults
steps:
Expand Down Expand Up @@ -628,19 +652,25 @@ workflows:
- build_design_app:
filters:
branches:
ignore:
ignore:
- l10n_master
- l10n_0.10-stable
- build_test_app:
filters:
branches:
ignore:
ignore:
- l10n_master
- l10n_0.10-stable
- main:
filters:
branches:
ignore:
ignore:
- l10n_master
- l10n_0.10-stable
- generators:
filters:
branches:
ignore:
- l10n_master
- l10n_0.10-stable
- core:
Expand Down Expand Up @@ -700,6 +730,7 @@ workflows:
- upload-coverage:
requires:
- main
- generators
- core
- assemblies
- initiatives
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ controller or added a new module you need to rename `feature` to `component`.
**Added**:

- **decidim-initiatives**: Decidim Initiatives Gem has been integrated into the main repository. [\#3125](https://github.com/decidim/decidim/pull/3125)
- **decidim-meetings** Add services offered in the meeting. [\#3150](https://github.com/decidim/decidim/pull/3150)
- **decidim-assemblies**: Adding news fields into assembly in terms of database [\#2942](https://github.com/decidim/decidim/pull/2942)
- **decidim-proposals**: Add configuration for set the number of proposals to be highlighted [\#3175](https://github.com/decidim/decidim/pull/3175)
- **decidim-meetings**: Add new fields to meetings registrations [\#3123](https://github.com/decidim/decidim/pull/3123)
Expand Down Expand Up @@ -47,9 +48,13 @@ controller or added a new module you need to rename `feature` to `component`.
- **decidim-surveys**: Allow multiple choice questions to have "free text options" where the user can customize the selected answer [\#3134](https://github.com/decidim/decidim/pull/3134)
- **decidim-surveys**: New question type to sort different options [\#3148](https://github.com/decidim/decidim/pull/3148)
- **decidim-budgets**: Setting to control the number of projects per page to be listed [\#3239](https://github.com/decidim/decidim/pull/3239)
- **decidim-admin**: Regular users can now be impersonated [\#3226](https://github.com/decidim/decidim/pull/3226)
- **decidim-admin**: All available authorization handlers can always be chosen for impersonation even after the first impersonation [\#3226](https://github.com/decidim/decidim/pull/3226)
- **decidim-generators**: New gem where all of decidim generators live, both to generate final application and decidim components (plugins).

**Changed**:

- **decidim-proposals**: Extract partials in Proposals into helper methors so that they can be reused in collaborative draft. (https://github.com/decidim/decidim/pull/3238)
- **decidim-admin**: Moved the following reusable javascript components from `decidim-surveys` component [\#3194](https://github.com/decidim/decidim/pull/3194)
- Nested resources (auto_buttons_by_position.component.js.es6, auto_label_by_position.component.js.es6, dynamic_fields.component.js.es6)
- Dependent inputs (field_dependent_inputs.component.js.es6)
Expand All @@ -64,6 +69,7 @@ controller or added a new module you need to rename `feature` to `component`.

**Fixed**:

- **decidim-proposals**: Fixes clicking on "see all" should remove the ellipsis sign. \#2894](https://github.com/decidim/decidim/pull/3238)
- **decidim-proposals**: Restore creation date in proposal detail page. [\#3249](https://github.com/decidim/decidim/pull/3249)
- **decidim-proposals**: Fix threshold_per_proposal method positive? for nil:NilClass when threshold is null or not defined. [\#3185](https://github.com/decidim/decidim/pull/3185)
- **decidim-proposals**: Fix when I create a proposal I see the draft proposal from someone else! [\#3170](https://github.com/decidim/decidim/pull/3083)
Expand Down Expand Up @@ -92,8 +98,13 @@ controller or added a new module you need to rename `feature` to `component`.
- **decidim-surveys**: Max choices selector not disabled when survey has already been answered [\#3133](https://github.com/decidim/decidim/pull/3133)
- **decidim-surveys**: Translated fields not disabled when survey has already been answered [\#3133](https://github.com/decidim/decidim/pull/3133)
- **decidim-admin**: Default managed user form displaying two buttons [\#3211](https://github.com/decidim/decidim/pull/3211)
- **decidim-admin**: Dropdown menus appearance on hover [\#3241](https://github.com/decidim/decidim/pull/3241)
- **decidim-admin**: Ability to select leaf categories from Admin change-category bulk action [\#3243](https://github.com/decidim/decidim/pull/3243)
- **decidim-admin**: Highlighted banner image is not required if already present in the organization [\#3244](https://github.com/decidim/decidim/pull/3244)
- **decidim-proposals**: Keep the user group (if set) as default value of author field on forms [\#3247](https://github.com/decidim/decidim/pull/3247)

**Removed**:

- **decidim**: Decidim executable has been moved to the `decidim-generators` gem.

Please check [0.10-stable](https://github.com/decidim/decidim/blob/0.10-stable/CHANGELOG.md) for previous changes.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PATH
decidim-comments (= 0.11.0.pre)
decidim-core (= 0.11.0.pre)
decidim-debates (= 0.11.0.pre)
decidim-generators (= 0.11.0.pre)
decidim-meetings (= 0.11.0.pre)
decidim-pages (= 0.11.0.pre)
decidim-participatory_processes (= 0.11.0.pre)
Expand Down Expand Up @@ -122,6 +123,8 @@ PATH
social-share-button (~> 1.0)
truncato
wicked
decidim-generators (0.11.0.pre)
decidim-core (= 0.11.0.pre)
decidim-meetings (0.11.0.pre)
cells-erb (~> 0.1.0)
cells-rails (~> 0.0.8)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Also, if you want to verify yourself against the default authorization handler u
| [Budgets](https://github.com/decidim/decidim/tree/master/decidim-budgets) | Adds a participatory budgets system to any participatory space. |
| [Comments](https://github.com/decidim/decidim/tree/master/decidim-comments) | The Comments module adds the ability to include comments to any resource which can be commentable by users. |
| [Core](https://github.com/decidim/decidim/tree/master/decidim-core) | The basics of Decidim: users, organizations, etc. This is the only required engine to run Decidim, all the others are optional. |
| [Generators](https://github.com/decidim/decidim/tree/master/decidim-generators) | It helps you with generating decidim applications & new components. It provides the `decidim` executable.
| [Participatory Processes](https://github.com/decidim/decidim/tree/master/decidim-participatory_processes) | The main concept of a Decidim installation: participatory processes. |
| [Dev](https://github.com/decidim/decidim/tree/master/decidim-dev) | Aids the local development of Decidim's components. |
| [Meeting](https://github.com/decidim/decidim/tree/master/decidim-meetings) | The Meeting module adds meeting to any participatory space. It adds a CRUD engine to the admin and public view scoped inside the participatory space. |
Expand Down
24 changes: 0 additions & 24 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "generators/decidim/app_generator"
require "decidim/gem_manager"

RSpec::Core::RakeTask.new(:spec)
Expand All @@ -27,29 +26,6 @@ task :update_versions do
Decidim::GemManager.replace_versions
end

desc "Installs all gems locally."
task :install_all do
Decidim::GemManager.run_all(
"gem build %name && mv %name-%version.gem ..",
include_root: false
)

Decidim::GemManager.new(__dir__).run(
"gem build %name && gem install *.gem"
)
end

desc "Uninstalls all gems locally."
task :uninstall_all do
Decidim::GemManager.run_all(
"gem uninstall %name -v %version --executables --force"
)

Decidim::GemManager.new(__dir__).run(
"rm decidim-*.gem"
)
end

Decidim::GemManager.all_dirs(include_root: false) do |dir|
manager = Decidim::GemManager.new(dir)
name = manager.short_name
Expand Down
1 change: 1 addition & 0 deletions decidim-admin/app/assets/config/decidim_admin_manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//= link decidim/admin/application.js
//= link decidim/admin/managed_users.js
//= link decidim/admin/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// = require ./subform_toggler.component

((exports) => {
const { SubformTogglerComponent } = exports.DecidimAdmin;

const subformToggler = new SubformTogglerComponent({
controllerSelect: $("select#impersonate_user_authorization_handler_name"),
subformWrapperClass: "authorization-handler"
});

subformToggler.run();
})(window);
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
((exports) => {
class SubformTogglerComponent {
constructor(options = {}) {
this.controllerSelect = options.controllerSelect;
this.subformWrapperClass = options.subformWrapperClass;
this._bindEvent();
this.run();
}

run() {
let $controllerSelect = this.controllerSelect;
let subformWrapperClass = this.subformWrapperClass;
let value = $controllerSelect.val();

let $form = $controllerSelect.parents("form");
let $subforms = $form.find(`.${subformWrapperClass}`);
let $selectedSubform = $subforms.filter(`#${subformWrapperClass}-${value}`)

$subforms.find("input,textarea").prop("disabled", true);
$subforms.hide();

$selectedSubform.find("input,textarea").prop("disabled", false);
$selectedSubform.show();
}

_bindEvent() {
this.controllerSelect.on("change", () => {
this.run();
});
}
}

exports.DecidimAdmin = exports.DecidimAdmin || {};
exports.DecidimAdmin.SubformTogglerComponent = SubformTogglerComponent;
})(window);
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
box-shadow: 0 3px 5px rgba(0, 0, 0, .3);
min-width: 100px;

li{
padding: 8px 8px 0;
}

li:hover{
background-color: darken($white, 5%) !important;
}

a{
color: $body-font-color;
padding: .5rem;
padding: 16px;
}

a:hover{
Expand All @@ -40,6 +36,12 @@
}
}

.dropdown-inverted.dropdown.menu{
.is-active > a{
color: $anchor-color;
}
}

.dropdown-menu-inverted_label{
vertical-align: middle;
}
69 changes: 0 additions & 69 deletions decidim-admin/app/commands/decidim/admin/create_managed_user.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
module Decidim
module Admin
# A command with all the business logic to impersonate a managed user.
class ImpersonateManagedUser < Rectify::Command
class ImpersonateUser < Rectify::Command
# Public: Initializes the command.
#
# form - The form with the authorization info
# user - The user to impersonate
def initialize(form, user)
def initialize(form)
@form = form
@user = user
end

# Executes the command. Broadcasts these events:
Expand All @@ -20,31 +19,38 @@ def initialize(form, user)
#
# Returns nothing.
def call
return broadcast(:invalid) unless user.managed? && authorization_valid?
return broadcast(:invalid) unless form.valid?

transaction do
user.save! unless user.persisted?

create_authorization

create_impersonation_log
end

create_impersonation_log
enqueue_expire_job

broadcast(:ok)
end

private

attr_reader :user, :form
attr_reader :form

def authorization_valid?
return false unless form.valid?
Decidim::Authorization.where(
user: user,
name: form.authorization.handler_name,
unique_id: form.authorization.unique_id
).any?
def user
form.user
end

def create_authorization
Authorization.create_or_update_from(form.authorization)
end

def create_impersonation_log
Decidim::ImpersonationLog.create!(
admin: form.current_user,
user: user,
reason: form.reason,
started_at: Time.current
)
end
Expand Down
Loading

0 comments on commit f99cd7f

Please sign in to comment.