decidim-core 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/assets/config/decidim_core_manifest.js +1 -0
- data/app/assets/javascripts/decidim.js.es6 +3 -2
- data/app/assets/javascripts/decidim/append_elements.js.es6 +8 -0
- data/app/assets/javascripts/decidim/filters.js.es6 +22 -0
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +176 -0
- data/app/assets/javascripts/decidim/form_filter.component.test.js +151 -0
- data/app/assets/javascripts/decidim/inline_svg.js.es6 +12 -0
- data/app/assets/javascripts/decidim/user_registrations.js.es6 +22 -0
- data/app/assets/stylesheets/decidim/_variables.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_comments.scss +3 -6
- data/app/assets/stylesheets/decidim/modules/_cookie-bar.scss +22 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +9 -1
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +8 -5
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_timeline.scss +62 -80
- data/app/assets/stylesheets/decidim/modules/_typography.scss +20 -31
- data/app/assets/stylesheets/decidim/utils/_fontface.scss +4 -16
- data/app/assets/stylesheets/decidim/utils/_settings.scss +29 -26
- data/app/assets/stylesheets/decidim/utils/_variables.scss +22 -0
- data/app/commands/decidim/authorize_user.rb +17 -1
- data/app/commands/decidim/create_omniauth_registration.rb +92 -0
- data/app/commands/decidim/create_registration.rb +50 -0
- data/app/commands/decidim/invite_user.rb +50 -0
- data/app/commands/decidim/invite_user_again.rb +25 -0
- data/app/commands/decidim/remove_user_role.rb +26 -0
- data/app/controllers/concerns/decidim/feature_settings.rb +27 -0
- data/app/controllers/concerns/decidim/filter_resource.rb +71 -0
- data/app/controllers/concerns/decidim/form_factory.rb +21 -18
- data/app/controllers/concerns/decidim/needs_participatory_process.rb +2 -3
- data/app/controllers/decidim/devise/confirmations_controller.rb +2 -0
- data/app/controllers/decidim/devise/invitations_controller.rb +4 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +96 -0
- data/app/controllers/decidim/devise/passwords_controller.rb +2 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +34 -0
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -0
- data/app/controllers/decidim/pages_controller.rb +10 -2
- data/app/controllers/decidim/participatory_process_steps_controller.rb +16 -0
- data/app/controllers/decidim/participatory_processes_controller.rb +6 -11
- data/app/forms/decidim/form.rb +6 -6
- data/app/forms/decidim/invite_admin_form.rb +37 -0
- data/app/forms/decidim/omniauth_registration_form.rb +24 -0
- data/app/forms/decidim/registration_form.rb +41 -0
- data/app/helpers/decidim/filters_helper.rb +21 -0
- data/app/helpers/decidim/layout_helper.rb +17 -1
- data/app/helpers/decidim/omniauth_helper.rb +23 -0
- data/app/helpers/decidim/paginate_helper.rb +21 -0
- data/app/helpers/decidim/participatory_process_helper.rb +14 -0
- data/app/helpers/decidim/participatory_process_steps_helper.rb +17 -0
- data/app/mailers/decidim/decidim_devise_mailer.rb +2 -2
- data/app/models/decidim/feature.rb +40 -0
- data/app/models/decidim/identity.rb +12 -0
- data/app/models/decidim/organization.rb +3 -10
- data/app/models/decidim/user.rb +3 -1
- data/app/models/decidim/user_group.rb +18 -0
- data/app/models/decidim/user_group_membership.rb +9 -0
- data/app/services/decidim/authorization_handler.rb +13 -13
- data/app/services/decidim/resource_search.rb +52 -0
- data/app/uploaders/decidim/organization_logo_uploader.rb +1 -1
- data/app/views/decidim/authorizations/new.html.erb +3 -1
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +40 -0
- data/app/views/decidim/devise/registrations/new.html.erb +21 -1
- data/app/views/decidim/devise/sessions/new.html.erb +1 -0
- data/app/views/decidim/devise/shared/_links.html.erb +0 -8
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +21 -0
- data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +16 -0
- data/app/views/decidim/participatory_process_steps/_timeline.html.erb +7 -0
- data/app/views/decidim/participatory_process_steps/index.html.erb +12 -0
- data/app/views/decidim/participatory_processes/show.html.erb +5 -5
- data/app/views/decidim/shared/_login_modal.html.erb +30 -0
- data/app/views/devise/mailer/invite_admin.html.erb +17 -0
- data/app/views/devise/mailer/invite_admin.text.erb +15 -0
- data/app/views/devise/mailer/organization_admin_invitation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/organization_admin_invitation_instructions.text.erb +1 -1
- data/app/views/layouts/decidim/_application.html.erb +1 -0
- data/app/views/layouts/decidim/_header.html.erb +1 -1
- data/app/views/layouts/decidim/_meta.html.erb +1 -0
- data/app/views/layouts/decidim/_process_header.html.erb +12 -1
- data/app/views/layouts/decidim/_process_header_steps.html.erb +1 -0
- data/app/views/layouts/decidim/_social_meta.html.erb +11 -0
- data/app/views/layouts/decidim/participatory_process.html.erb +4 -0
- data/app/views/pages/home.html.erb +29 -2
- data/config/i18n-tasks.yml +1 -0
- data/config/initializers/devise.rb +10 -1
- data/config/locales/ca.yml +45 -3
- data/config/locales/en.yml +45 -3
- data/config/locales/es.yml +45 -3
- data/config/routes.rb +9 -2
- data/config/secrets.yml +36 -0
- data/db/migrate/20170110133113_add_configuration_to_features.rb +7 -0
- data/db/migrate/20170110153807_add_handler_to_organization.rb +5 -0
- data/db/migrate/20170116110851_create_identities.rb +11 -0
- data/db/migrate/20170116135237_loosen_step_requirements.rb +6 -0
- data/db/migrate/20170117142904_add_uniqueness_field_to_authorizations.rb +7 -0
- data/db/migrate/20170119145359_create_user_groups.rb +11 -0
- data/db/migrate/20170119150255_create_user_group_memberships.rb +12 -0
- data/db/migrate/20170119150649_add_show_statistics_to_organization.rb +5 -0
- data/db/migrate/20170120120733_add_user_groups_verified.rb +5 -0
- data/db/seeds.rb +45 -79
- data/lib/decidim/core.rb +8 -0
- data/lib/decidim/core/engine.rb +8 -0
- data/lib/decidim/core/test/factories.rb +188 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/devise_failure_app.rb +1 -0
- data/lib/decidim/feature_manifest.rb +27 -0
- data/lib/decidim/features/base_controller.rb +8 -3
- data/lib/decidim/features/settings_manifest.rb +94 -0
- data/lib/decidim/filter_form_builder.rb +56 -0
- data/lib/decidim/form_builder.rb +4 -7
- data/vendor/assets/javascripts/svg-injector.js +464 -0
- metadata +142 -26
- data/app/assets/stylesheets/decidim/modules/_owl-carousel.scss +0 -72
- data/app/assets/stylesheets/decidim/modules/_phase-nav.scss +0 -177
- data/app/assets/stylesheets/decidim/utils/_helpers.sass +0 -21
- data/app/assets/stylesheets/decidim/utils/_keyframes.sass +0 -13
- data/app/assets/stylesheets/decidim/utils/_mixins.sass +0 -33
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# Helper that provides methods to enable or disable omniauth buttons
|
4
|
+
module OmniauthHelper
|
5
|
+
# Public: returns true if the social provider is enabled
|
6
|
+
def social_provider_enabled?(provider)
|
7
|
+
Rails.application.secrets.dig(:omniauth, provider.to_s, "enabled")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Public: returns true if any provider is enabled
|
11
|
+
def any_social_provider_enabled?
|
12
|
+
User.omniauth_providers.any? do |provider|
|
13
|
+
social_provider_enabled? provider
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Public: normalize providers names to they can be used for buttons
|
18
|
+
# and icons.
|
19
|
+
def normalize_provider_name(provider)
|
20
|
+
provider.to_s.split("_").first
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# Helper to paginate collections.
|
4
|
+
module PaginateHelper
|
5
|
+
# Displays pagination links for the given collection, setting the correct
|
6
|
+
# theme. This mostly acts as a proxy for the underlying pagination engine.
|
7
|
+
#
|
8
|
+
# collection - a collection of elements that need to be paginated
|
9
|
+
# paginate_params - a Hash with options to delegate to the pagination helper.
|
10
|
+
def decidim_paginate(collection, paginate_params)
|
11
|
+
# Kaminari uses url_for to generate the url, but this doesn't play nice with our engine system
|
12
|
+
# and unless we remove these params they are added again as query string :(
|
13
|
+
default_params = {
|
14
|
+
participatory_process_id: nil,
|
15
|
+
feature_id: nil
|
16
|
+
}
|
17
|
+
|
18
|
+
paginate collection, theme: "decidim", params: paginate_params.merge(default_params)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -12,5 +12,19 @@ module Decidim
|
|
12
12
|
dates = [participatory_process_step.start_date, participatory_process_step.end_date]
|
13
13
|
dates.map { |date| date ? localize(date.to_date, format: :default) : "?" }.join(" - ")
|
14
14
|
end
|
15
|
+
|
16
|
+
# Public: Returns an icon given an instance of a Feature. It defaults to
|
17
|
+
# a question mark when no icon is found.
|
18
|
+
#
|
19
|
+
# feature - The feature to generate the icon for.
|
20
|
+
#
|
21
|
+
# Returns an HTML tag with the icon.
|
22
|
+
def feature_icon(feature)
|
23
|
+
if feature.manifest.icon
|
24
|
+
external_icon feature.manifest.icon
|
25
|
+
else
|
26
|
+
icon "question-mark"
|
27
|
+
end
|
28
|
+
end
|
15
29
|
end
|
16
30
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# Helper that provides a single method to give a class to a
|
4
|
+
# ParticipatoryProcessStep depending on their date.
|
5
|
+
module ParticipatoryProcessStepsHelper
|
6
|
+
# Returns the class for the given step depending on their end_date.
|
7
|
+
#
|
8
|
+
# step - the given ParticipatoryProcessStep
|
9
|
+
# past - a Boolean indicating if the step is past or not
|
10
|
+
#
|
11
|
+
# Returns a String.
|
12
|
+
def step_class(step, past)
|
13
|
+
status = past ? "" : "timeline__item--inactive"
|
14
|
+
step.active? ? "timeline__item--current" : status
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -17,8 +17,8 @@ module Decidim
|
|
17
17
|
with_user(user) do
|
18
18
|
@token = token
|
19
19
|
|
20
|
-
if opts[:invitation_instructions]
|
21
|
-
opts[:subject] = I18n.t("devise.mailer.
|
20
|
+
if opts[:invitation_instructions]
|
21
|
+
opts[:subject] = I18n.t("devise.mailer.#{opts[:invitation_instructions]}.subject", organization: user.organization.name)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -11,6 +11,8 @@ module Decidim
|
|
11
11
|
|
12
12
|
validates :participatory_process, presence: true
|
13
13
|
|
14
|
+
after_initialize :default_values
|
15
|
+
|
14
16
|
# Public: Finds the manifest this feature is associated to.
|
15
17
|
#
|
16
18
|
# Returns a FeatureManifest.
|
@@ -26,5 +28,43 @@ module Decidim
|
|
26
28
|
def manifest=(manifest)
|
27
29
|
self.manifest_name = manifest.name
|
28
30
|
end
|
31
|
+
|
32
|
+
def settings
|
33
|
+
settings_schema(:global).new(self[:settings]["global"])
|
34
|
+
end
|
35
|
+
|
36
|
+
def settings=(data)
|
37
|
+
self[:settings]["global"] = serialize_settings(settings_schema(:global), data)
|
38
|
+
end
|
39
|
+
|
40
|
+
def step_settings
|
41
|
+
participatory_process.steps.each_with_object({}) do |step, result|
|
42
|
+
result[step.id.to_s] = settings_schema(:step).new(self[:settings].dig("steps", step.id.to_s))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def step_settings=(data)
|
47
|
+
self[:settings]["steps"] = data.each_with_object({}) do |(key, value), result|
|
48
|
+
result[key.to_s] = serialize_settings(settings_schema(:step), value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def serialize_settings(schema, value)
|
55
|
+
if value.respond_to?(:attributes)
|
56
|
+
value.attributes
|
57
|
+
else
|
58
|
+
schema.new(value)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def settings_schema(name)
|
63
|
+
manifest.settings(name.to_sym).schema
|
64
|
+
end
|
65
|
+
|
66
|
+
def default_values
|
67
|
+
self[:settings] ||= {}
|
68
|
+
end
|
29
69
|
end
|
30
70
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# Store user's social identities
|
5
|
+
class Identity < ApplicationRecord
|
6
|
+
belongs_to :user, foreign_key: :decidim_user_id, class_name: Decidim::User
|
7
|
+
|
8
|
+
validates :user, presence: true
|
9
|
+
validates :provider, presence: true
|
10
|
+
validates :uid, presence: true, uniqueness: { scope: :provider }
|
11
|
+
end
|
12
|
+
end
|
@@ -6,7 +6,9 @@ module Decidim
|
|
6
6
|
class Organization < ApplicationRecord
|
7
7
|
has_many :participatory_processes, foreign_key: "decidim_organization_id", class_name: Decidim::ParticipatoryProcess, inverse_of: :organization
|
8
8
|
has_many :static_pages, foreign_key: "decidim_organization_id", class_name: Decidim::StaticPage, inverse_of: :organization
|
9
|
-
has_many :scopes, foreign_key: "decidim_organization_id", class_name: Decidim::Scope, inverse_of: :organization
|
9
|
+
has_many :scopes, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: Decidim::Scope, inverse_of: :organization
|
10
|
+
has_many :admins, -> { where("roles @> ?", "{admin}") }, foreign_key: "decidim_organization_id", class_name: Decidim::User
|
11
|
+
has_many :users, foreign_key: "decidim_organization_id", class_name: Decidim::User
|
10
12
|
|
11
13
|
validates :name, :host, uniqueness: true
|
12
14
|
|
@@ -16,14 +18,5 @@ module Decidim
|
|
16
18
|
def homepage_big_url
|
17
19
|
homepage_image.big.url
|
18
20
|
end
|
19
|
-
|
20
|
-
# Fetches the admins of the given organization.
|
21
|
-
#
|
22
|
-
# Returns an ActiveRecord::Relation.
|
23
|
-
def admins
|
24
|
-
@admins ||= Decidim::User
|
25
|
-
.where(organization: self)
|
26
|
-
.where("roles @> ?", "{admin}")
|
27
|
-
end
|
28
21
|
end
|
29
22
|
end
|
data/app/models/decidim/user.rb
CHANGED
@@ -5,10 +5,12 @@ module Decidim
|
|
5
5
|
# A User is a citizen that wants to join the platform to participate.
|
6
6
|
class User < ApplicationRecord
|
7
7
|
devise :invitable, :database_authenticatable, :registerable, :confirmable,
|
8
|
-
:recoverable, :rememberable, :trackable, :decidim_validatable
|
8
|
+
:recoverable, :rememberable, :trackable, :decidim_validatable,
|
9
|
+
:omniauthable, omniauth_providers: [:facebook, :twitter, :google_oauth2]
|
9
10
|
|
10
11
|
belongs_to :organization, foreign_key: "decidim_organization_id", class_name: Decidim::Organization
|
11
12
|
has_many :authorizations, foreign_key: "decidim_user_id", class_name: Decidim::Authorization, inverse_of: :user
|
13
|
+
has_many :identities, foreign_key: "decidim_user_id", class_name: Decidim::Identity
|
12
14
|
|
13
15
|
ROLES = %w(admin moderator official).freeze
|
14
16
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A UserGroup is an organization of citizens
|
5
|
+
class UserGroup < ApplicationRecord
|
6
|
+
has_many :users, through: :memberships, class_name: Decidim::User, foreign_key: :decidim_user_id
|
7
|
+
has_many :memberships, class_name: Decidim::UserGroupMembership, foreign_key: :decidim_user_group_id
|
8
|
+
|
9
|
+
validates :name, presence: true
|
10
|
+
validates :document_number, presence: true
|
11
|
+
validates :phone, presence: true
|
12
|
+
|
13
|
+
# Public: Mark the user group as verified
|
14
|
+
def verify!
|
15
|
+
update_attribute(:verified, true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A UserGroupMembership associate user with user groups
|
5
|
+
class UserGroupMembership < ApplicationRecord
|
6
|
+
belongs_to :user, class_name: Decidim::User, foreign_key: :decidim_user_id
|
7
|
+
belongs_to :user_group, class_name: Decidim::UserGroup, foreign_key: :decidim_user_group_id
|
8
|
+
end
|
9
|
+
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
module Decidim
|
3
3
|
# This is the base class for authorization handlers, all implementations
|
4
4
|
# should inherit from it.
|
5
|
-
# Each AuthorizationHandler
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# Each AuthorizationHandler is a form that will be used to check if the
|
6
|
+
# authorization is valid or not. When it is valid a new authorization will
|
7
|
+
# be created for the user.
|
8
|
+
#
|
9
|
+
# Feel free to use validations to assert fields against a remote API,
|
10
|
+
# local database, or whatever.
|
8
11
|
#
|
9
12
|
# It also sets two default attributes, `user` and `handler_name`.
|
10
13
|
class AuthorizationHandler < Form
|
@@ -15,6 +18,13 @@ module Decidim
|
|
15
18
|
# infer the class name of the authorization handler.
|
16
19
|
attribute :handler_name, String
|
17
20
|
|
21
|
+
# A unique ID to be implemented by the authorization handler that ensures
|
22
|
+
# no duplicates are created. This uniqueness check will be skipped if
|
23
|
+
# unique_id returns nil.
|
24
|
+
def unique_id
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
18
28
|
# THe attributes of the handler that should be exposed as form input when
|
19
29
|
# rendering the handler in a form.
|
20
30
|
#
|
@@ -23,16 +33,6 @@ module Decidim
|
|
23
33
|
attributes.except(:id, :user).keys
|
24
34
|
end
|
25
35
|
|
26
|
-
# Whether the authorization is valid or not. Each AuthorizationHandler
|
27
|
-
# implementation must implemement this method. This is were you check for
|
28
|
-
# validation errors or against third party systems to validate the
|
29
|
-
# authorization.
|
30
|
-
#
|
31
|
-
# Returns a Boolean.
|
32
|
-
def authorized?
|
33
|
-
raise NotImplementedError
|
34
|
-
end
|
35
|
-
|
36
36
|
# The String partial path so Rails can render the handler as a form. This
|
37
37
|
# is useful if you want to have a custom view to render the form instead of
|
38
38
|
# the default view.
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# This is the base class to be used by other search services.
|
4
|
+
# Searchlight documentation: https://github.com/nathanl/searchlight
|
5
|
+
class ResourceSearch < Searchlight::Search
|
6
|
+
# Initialize the Searchlight::Search base class with the options provided.
|
7
|
+
#
|
8
|
+
# scope - The scope used to create the base query
|
9
|
+
# options - A hash of options to modify the search. These options will be
|
10
|
+
# converted to methods by SearchLight so they can be used on filter #
|
11
|
+
# methods. (Default {})
|
12
|
+
def initialize(scope, options = {})
|
13
|
+
super(options)
|
14
|
+
@scope = scope
|
15
|
+
end
|
16
|
+
|
17
|
+
# Creates the SearchLight base query.
|
18
|
+
# Check if the option feature was provided.
|
19
|
+
def base_query
|
20
|
+
# raise order_start_time.inspect
|
21
|
+
raise "Missing feature" unless feature
|
22
|
+
|
23
|
+
@scope
|
24
|
+
.page(options[:page] || 1)
|
25
|
+
.per(options[:per_page] || 12)
|
26
|
+
.where(feature: feature)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Handle the category_id filter
|
30
|
+
def search_category_id
|
31
|
+
query.where(decidim_category_id: category_ids)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# Private: Creates an array of category ids.
|
37
|
+
# It contains categories' subcategories ids as well.
|
38
|
+
def category_ids
|
39
|
+
feature
|
40
|
+
.categories
|
41
|
+
.where(id: category_id)
|
42
|
+
.or(feature.categories.where(parent_id: category_id))
|
43
|
+
.pluck(:id)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Private: Since feature is not used by a search method we need
|
47
|
+
# to define the method manually.
|
48
|
+
def feature
|
49
|
+
options[:feature]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -11,8 +11,10 @@
|
|
11
11
|
<div class="card">
|
12
12
|
<div class="card__content">
|
13
13
|
<%= authorization_form_for(handler) do |form| %>
|
14
|
+
<%= form.error_for(:base) %>
|
15
|
+
|
14
16
|
<% if lookup_context.exists?(handler.to_partial_path, [], true) %>
|
15
|
-
<%= render partial: handler,
|
17
|
+
<%= render partial: handler.to_partial_path, locals: { handler: handler, form: form } %>
|
16
18
|
<% else %>
|
17
19
|
<%= form.all_fields %>
|
18
20
|
<div class="actions">
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<main class="wrapper">
|
2
|
+
<div class="row collapse">
|
3
|
+
<div class="row collapse">
|
4
|
+
<div class="columns large-8 large-centered text-center page-title">
|
5
|
+
<h1><%= t(".sign_up") %></h1>
|
6
|
+
<p>
|
7
|
+
<%= t(".subtitle") %>
|
8
|
+
</p>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="row">
|
13
|
+
<div class="columns large-6 medium-10 medium-centered">
|
14
|
+
<div class="card">
|
15
|
+
<div class="card__content">
|
16
|
+
<%= form_for(@form, as: resource_name, url: omniauth_registrations_path(resource_name), html: { class: "register-form new_user" }) do |f| %>
|
17
|
+
<div class="user-person">
|
18
|
+
<div class="field">
|
19
|
+
<%= f.text_field :name, help_text: t("devise.registrations.new.username_help") %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="field">
|
24
|
+
<%= f.email_field :email %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= f.hidden_field :uid %>
|
28
|
+
<%= f.hidden_field :provider %>
|
29
|
+
<%= f.hidden_field :oauth_signature %>
|
30
|
+
|
31
|
+
<div class="actions">
|
32
|
+
<%= f.submit t(".complete_profile"), class: "button expanded" %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</main>
|
@@ -17,7 +17,12 @@
|
|
17
17
|
<div class="columns large-6 medium-10 medium-centered">
|
18
18
|
<div class="card">
|
19
19
|
<div class="card__content">
|
20
|
-
<%= form_for(
|
20
|
+
<%= form_for(@form, as: resource_name, url: registration_path(resource_name), html: { class: "register-form new_user" }) do |f| %>
|
21
|
+
<fieldset class="text-center">
|
22
|
+
<legend class="text-center heading5"><%= t(".sign_up_as.legend") %></legend>
|
23
|
+
<%= f.collection_radio_buttons :sign_up_as, [["user", t(".sign_up_as.user")], ["user_group", t(".sign_up_as.user_group") ]], :first, :last %>
|
24
|
+
</fieldset>
|
25
|
+
|
21
26
|
<div class="user-person">
|
22
27
|
<div class="field">
|
23
28
|
<%= f.text_field :name, help_text: t(".username_help") %>
|
@@ -36,6 +41,20 @@
|
|
36
41
|
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
37
42
|
</div>
|
38
43
|
|
44
|
+
<div class="user-group-fields">
|
45
|
+
<div class="field">
|
46
|
+
<%= f.text_field :user_group_name %>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="field">
|
50
|
+
<%= f.text_field :user_group_document_number %>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<div class="field">
|
54
|
+
<%= f.text_field :user_group_phone %>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
|
39
58
|
<fieldset>
|
40
59
|
<div class="field">
|
41
60
|
<%= f.check_box :tos_agreement, label: t(".tos_agreement", link: link_to(t(".terms"), page_path("terms-and-conditions"))) %>
|
@@ -51,5 +70,6 @@
|
|
51
70
|
</div>
|
52
71
|
</div>
|
53
72
|
</div>
|
73
|
+
<%= render "decidim/devise/shared/omniauth_buttons" %>
|
54
74
|
</div>
|
55
75
|
</main>
|