decidim-admin 0.0.1.alpha4 → 0.0.1.alpha5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a26c9befb6f506188fa3f8a7480af9d897550538
4
- data.tar.gz: b0f904121eb74fda4e51e524d8adf48848a8ea0d
3
+ metadata.gz: 1bcb075ae6997dfee8724c29c8b31cde6d60df4a
4
+ data.tar.gz: b2e92083902a331ae3c462850f43a1350c8883f5
5
5
  SHA512:
6
- metadata.gz: 6a45697590c72aefcf5e8056ed3f7303770854b761bf529da30e0aa3364f74467acb1c1287d72a650ae190c001d67cfdc2d54f654b4bdbe312cac4002c8b6dff
7
- data.tar.gz: 0f95f10e319207a4ea52a217d17d45cb844bd98ad1e549897a09bd6a8db4549dda428f4dee54b228ac061fa3ba6d41b5bc412d9b3ed356615980fe5f3bd4ff56
6
+ metadata.gz: 11a6968f34ae49a3b20cbc2f14153599eb8d83d49c744f8004121e45922b6878a1f1894aaebfd67e91993c2d5c19d2cb6283ac7a40ec71712eaf3562a19f58b8
7
+ data.tar.gz: 4efdcc626a300fa04c9009e12d3120b93733f0e43de3876f89a4643ab95c19092f7947748491d86e0b7f41b752c898897019b0f10417025194a562b0f10d8efd
data/Rakefile CHANGED
@@ -1,9 +1,4 @@
1
1
  # frozen_string_literal: true
2
- begin
3
- require "bundler/setup"
4
- rescue LoadError
5
- puts "You must `gem install bundler` and `bundle install` to run rake tasks"
6
- end
7
2
 
8
3
  require "decidim/common_rake"
9
4
  require "rdoc/task"
@@ -11,11 +11,12 @@
11
11
  // about supported directives.
12
12
  //
13
13
  //= require jquery
14
- //= require jquery.turbolinks
15
14
  //= require jquery_ujs
16
15
  //= require foundation
16
+ //= require turbolinks
17
17
  //= require_self
18
18
 
19
- $(function(){ $(document).foundation(); });
19
+ $(document).on("turbolinks:load", function() {
20
+ $(function(){ $(document).foundation(); });
21
+ });
20
22
 
21
- //= require turbolinks
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # A command with all the business logic when creating a new participatory
5
+ # process in the system.
6
+ class CreateParticipatoryProcess < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # form - A form object with the params.
10
+ # organization - The Organization of the user that created the
11
+ # participatory process
12
+ def initialize(form, organization)
13
+ @form = form
14
+ @organization = organization
15
+ end
16
+
17
+ # Executes the command. Braodcasts these events:
18
+ #
19
+ # - :ok when everything is valid.
20
+ # - :invalid if the form wasn't valid and we couldn't proceed.
21
+ #
22
+ # Returns nothing.
23
+ def call
24
+ return broadcast(:invalid) if form.invalid?
25
+
26
+ create_participatory_process
27
+ broadcast(:ok)
28
+ end
29
+
30
+ private
31
+
32
+ attr_reader :form
33
+
34
+ def create_participatory_process
35
+ ParticipatoryProcess.create!(
36
+ title: form.title,
37
+ subtitle: form.subtitle,
38
+ slug: form.slug,
39
+ hashtag: form.hashtag,
40
+ description: form.description,
41
+ short_description: form.short_description,
42
+ organization: @organization
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # A command with all the business logic when creating a new participatory
5
+ # process in the system.
6
+ class UpdateParticipatoryProcess < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # participatory_process - the ParticipatoryProcess to update
10
+ # form - A form object with the params.
11
+ def initialize(participatory_process, form)
12
+ @participatory_process = participatory_process
13
+ @form = form
14
+ end
15
+
16
+ # Executes the command. Braodcasts these events:
17
+ #
18
+ # - :ok when everything is valid.
19
+ # - :invalid if the form wasn't valid and we couldn't proceed.
20
+ #
21
+ # Returns nothing.
22
+ def call
23
+ return broadcast(:invalid) if form.invalid?
24
+
25
+ update_participatory_process
26
+ broadcast(:ok)
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :form
32
+
33
+ def update_participatory_process
34
+ @participatory_process.update_attributes!(attributes)
35
+ end
36
+
37
+ def attributes
38
+ {
39
+ title: form.title,
40
+ subtitle: form.subtitle,
41
+ slug: form.slug,
42
+ hashtag: form.hashtag,
43
+ description: form.description,
44
+ short_description: form.short_description
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ # Shared behaviour for controllers that need authorization to work.
7
+ module NeedsAuthorization
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ include Pundit
12
+ after_action :verify_authorized
13
+
14
+ rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
15
+
16
+ private
17
+
18
+ # Overwrites the `policy` method from the `pundit` gem in order to be
19
+ # able to specify which policy class should be used in each case. This is
20
+ # due to `pundit` failing to correctly identify the policy class when the
21
+ # model class name is scoped and the policy class is in a different scope
22
+ # (eg. `Decidim::ParticipatoryProcess` and
23
+ # `Decidim::Admin::ParticipatoryProcessPolicy`). The original method does
24
+ # not let us specify the correct class.
25
+ #
26
+ # Remember that, in order to make this work, you'll need to define the
27
+ # `policy_class` method in the controller, which should only return a
28
+ # policy class name.
29
+ #
30
+ # record - the record that will be evaluated against the policy class.
31
+ def policy(record)
32
+ policies[record] ||= policy_class.new(current_user, record)
33
+ end
34
+
35
+ # Needed in order to make the `policy` method work. Overwirite it in the
36
+ # given controller and make it return a Policy class.
37
+ def policy_class
38
+ raise NotImplementedError, "Define this method and make it return a policy class name in order to make it work"
39
+ end
40
+
41
+ # Handles the case when a user visits a path that is not allowed to them.
42
+ # Redirects the user to the root path and shows a flash message telling
43
+ # them they are not authorized.
44
+ def user_not_authorized
45
+ flash[:alert] = t("actions.unauthorized", scope: "decidim.admin")
46
+ redirect_to(request.referrer || decidim_admin.root_path)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -4,6 +4,8 @@ module Decidim
4
4
  # The main application controller that inherits from Rails.
5
5
  class ApplicationController < ActionController::Base
6
6
  include NeedsOrganization
7
+ include NeedsAuthorization
8
+
7
9
  protect_from_forgery with: :exception, prepend: true
8
10
  end
9
11
  end
@@ -3,7 +3,18 @@ require_dependency "decidim/admin/application_controller"
3
3
 
4
4
  module Decidim
5
5
  module Admin
6
+ # Controller that shows a simple dashboard.
7
+ #
6
8
  class DashboardController < ApplicationController
9
+ def show
10
+ authorize :dashboard
11
+ end
12
+
13
+ private
14
+
15
+ def policy_class
16
+ Decidim::Admin::DashboardPolicy
17
+ end
7
18
  end
8
19
  end
9
20
  end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+ require_dependency "decidim/admin/application_controller"
3
+
4
+ module Decidim
5
+ module Admin
6
+ # Controller that allows managing all the Admins.
7
+ #
8
+ class ParticipatoryProcessesController < ApplicationController
9
+ def index
10
+ @participatory_processes = collection
11
+ authorize @participatory_processes
12
+ end
13
+
14
+ def new
15
+ @form = ParticipatoryProcessForm.new
16
+ authorize ParticipatoryProcess
17
+ end
18
+
19
+ def create
20
+ @form = ParticipatoryProcessForm.from_params(params)
21
+ authorize ParticipatoryProcess
22
+
23
+ CreateParticipatoryProcess.call(@form, current_organization) do
24
+ on(:ok) do
25
+ flash[:notice] = I18n.t("participatory_processes.create.success", scope: "decidim.admin")
26
+ redirect_to participatory_processes_path
27
+ end
28
+
29
+ on(:invalid) do
30
+ flash.now[:alert] = I18n.t("participatory_processes.create.error", scope: "decidim.admin")
31
+ render :new
32
+ end
33
+ end
34
+ end
35
+
36
+ def edit
37
+ @participatory_process = collection.find(params[:id])
38
+ authorize @participatory_process
39
+ @form = ParticipatoryProcessForm.from_model(@participatory_process)
40
+ end
41
+
42
+ def update
43
+ @participatory_process = collection.find(params[:id])
44
+ authorize @participatory_process
45
+ @form = ParticipatoryProcessForm.from_params(params)
46
+
47
+ UpdateParticipatoryProcess.call(@participatory_process, @form) do
48
+ on(:ok) do
49
+ flash[:notice] = I18n.t("participatory_processes.update.success", scope: "decidim.admin")
50
+ redirect_to participatory_processes_path
51
+ end
52
+
53
+ on(:invalid) do
54
+ flash.now[:alert] = I18n.t("participatory_processes.update.error", scope: "decidim.admin")
55
+ render :edit
56
+ end
57
+ end
58
+ end
59
+
60
+ def show
61
+ @participatory_process = collection.find(params[:id])
62
+ authorize @participatory_process
63
+ end
64
+
65
+ def destroy
66
+ @participatory_process = collection.find(params[:id]).destroy!
67
+ authorize @participatory_process
68
+
69
+ flash[:notice] = I18n.t("participatory_processes.destroy.success", scope: "decidim.admin")
70
+
71
+ redirect_to participatory_processes_path
72
+ end
73
+
74
+ private
75
+
76
+ def collection
77
+ current_organization.participatory_processes
78
+ end
79
+
80
+ def policy_class
81
+ Decidim::Admin::ParticipatoryProcessPolicy
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # A form object used to create participatory processes from the admin
5
+ # dashboard.
6
+ #
7
+ class ParticipatoryProcessForm < Rectify::Form
8
+ include TranslatableAttributes
9
+
10
+ translatable_attribute :title, String
11
+ translatable_attribute :subtitle, String
12
+ translatable_attribute :description, String
13
+ translatable_attribute :short_description, String
14
+
15
+ mimic :participatory_process
16
+
17
+ attribute :slug, String
18
+ attribute :hashtag, String
19
+
20
+ validates :slug, presence: true
21
+ translatable_validates :title, :subtitle, :description, :short_description, presence: true
22
+
23
+ validate :slug, :slug_uniqueness
24
+
25
+ private
26
+
27
+ def slug_uniqueness
28
+ return unless ParticipatoryProcess.where(slug: slug).where.not(id: id).any?
29
+
30
+ errors.add(
31
+ :slug,
32
+ I18n.t("models.participatory_process.validations.slug_uniqueness", scope: "decidim.admin")
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
@@ -4,6 +4,8 @@ module Decidim
4
4
  # Custom helpers, scoped to the admin panel.
5
5
  #
6
6
  module ApplicationHelper
7
+ include Decidim::TranslationsHelper
8
+
7
9
  def title
8
10
  current_organization.name
9
11
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # Custom helpers, scoped to the admin panel.
5
+ #
6
+ module AttributesDisplayHelper
7
+ # Displays the given attributes list in a list. This is a simple
8
+ # `show_for` alternative, so there's no way to modify how an attribute is
9
+ # shown and there is no intention on adding this. It is intnded to be
10
+ # used inside a `dl` HTML tag, so you can customize how a specific
11
+ # attribute has to be shown directly:
12
+ #
13
+ # <dl>
14
+ # <%= display_for @post, :title, :body %>
15
+ # <dt>Comments number</dt>
16
+ # <dd>2</dd>
17
+ # </dl>
18
+ #
19
+ # This will render this HTML:
20
+ #
21
+ # <dl>
22
+ # <dt>Title</dt>
23
+ # <dd>Hello, world!</dd>
24
+ # <dt>Body</dt>
25
+ # <dd>Lorem ipsum dolor sit amet...</dd>
26
+ # <dt>Comments number</dt>
27
+ # <dd>2</dd>
28
+ # </dl>
29
+ #
30
+ # record - any Ruby object that needs some attributes rendered
31
+ # attrs - a list of N attributes of the `record`.
32
+ def display_for(record, *attrs)
33
+ attrs.map do |attr|
34
+ if record.column_for_attribute(attr).type == :hstore
35
+ I18n.available_locales.map do |locale|
36
+ content_tag(:dt, record.class.human_attribute_name(attr) + " (#{locale})") +
37
+ display_value(record, attr, locale)
38
+ end.reduce(:+)
39
+ else
40
+ display_label(record, attr) + display_value(record, attr)
41
+ end
42
+ end.reduce(:+)
43
+ end
44
+
45
+ private
46
+
47
+ # Private: Holds the logic to render a label for a given attribute.
48
+ def display_label(record, attr)
49
+ content_tag(:dt, record.class.human_attribute_name(attr))
50
+ end
51
+
52
+ # Private: Holds the logic to render the attribute value.
53
+ def display_value(record, attr, locale = nil)
54
+ return I18n.with_locale(locale) do
55
+ content_tag(:dd, translated_attribute(record.send(attr)).try(:html_safe))
56
+ end if locale
57
+
58
+ content_tag(:dd, record.send(attr).try(:html_safe))
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # A policy to define all the authorizations regarding a
5
+ # ParticipatoryProcess, to be used with Pundit.
6
+ class DashboardPolicy < ApplicationPolicy
7
+ # Checks if the user can see the admin dashboard.
8
+ #
9
+ # Returns a Boolean.
10
+ def show?
11
+ user.roles.include?("admin")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Admin
4
+ # A policy to define all the authorizations regarding a
5
+ # ParticipatoryProcess, to be used with Pundit.
6
+ class ParticipatoryProcessPolicy < ApplicationPolicy
7
+ # Checks if the user can see the form for participatory process creation.
8
+ #
9
+ # Returns a Boolean.
10
+ def new?
11
+ user.roles.include?("admin")
12
+ end
13
+
14
+ # Checks if the user can create a participatory process.
15
+ #
16
+ # Returns a Boolean.
17
+ def create?
18
+ user.roles.include?("admin")
19
+ end
20
+
21
+ # Checks if the user can list a participatory process.
22
+ #
23
+ # Returns a Boolean.
24
+ def index?
25
+ user.roles.include?("admin") && user.organization == record.first.organization
26
+ end
27
+
28
+ # Checks if the user can see a participatory process.
29
+ #
30
+ # Returns a Boolean.
31
+ def show?
32
+ user.roles.include?("admin") && user.organization == record.organization
33
+ end
34
+
35
+ # Checks if the user can edit a participatory process.
36
+ #
37
+ # Returns a Boolean.
38
+ def edit?
39
+ user.roles.include?("admin") && user.organization == record.organization
40
+ end
41
+
42
+ # Checks if the user can update a participatory process.
43
+ #
44
+ # Returns a Boolean.
45
+ def update?
46
+ user.roles.include?("admin") && user.organization == record.organization
47
+ end
48
+
49
+ # Checks if the user can destroy a participatory process.
50
+ #
51
+ # Returns a Boolean.
52
+ def destroy?
53
+ user.roles.include?("admin") && user.organization == record.organization
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,23 @@
1
+ <div class="field">
2
+ <%= form.translated :text_field, :title, autofocus: true %>
3
+ </div>
4
+
5
+ <div class="field">
6
+ <%= form.translated :text_field, :subtitle %>
7
+ </div>
8
+
9
+ <div class="field">
10
+ <%= form.text_field :slug %>
11
+ </div>
12
+
13
+ <div class="field">
14
+ <%= form.text_field :hashtag %>
15
+ </div>
16
+
17
+ <div class="field">
18
+ <%= form.translated :text_area, :short_description %>
19
+ </div>
20
+
21
+ <div class="field">
22
+ <%= form.translated :text_area, :description %>
23
+ </div>
@@ -0,0 +1,11 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t ".title" %></h2>
3
+ <% end %>
4
+
5
+ <%= form_for(@form) do |f| %>
6
+ <%= render partial: 'form', object: f %>
7
+
8
+ <div class="actions">
9
+ <%= f.submit t(".update") %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t "decidim.admin.titles.participatory_processes" %></h2>
3
+ <% end %>
4
+
5
+ <div class="actions title">
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process.name", scope: "decidim.admin")), ['new', 'participatory_process'], class: 'new' %>
7
+ </div>
8
+
9
+ <table class="stack">
10
+ <thead>
11
+ <tr>
12
+ <th><%= t("models.participatory_process.fields.title", scope: "decidim.admin") %></th>
13
+ <th><%= t("models.participatory_process.fields.created_at", scope: "decidim.admin") %></th>
14
+ <th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @participatory_processes.each do |process| %>
19
+ <tr>
20
+ <td>
21
+ <%= link_to translated_attribute(process.title), process %><br />
22
+ </td>
23
+ <td>
24
+ <%= l process.created_at, format: :short %>
25
+ </td>
26
+ <td class="actions">
27
+ <%= link_to_if policy(process).edit?, t("actions.edit", scope: "decidim.admin"), ['edit', process] %>
28
+
29
+ <%= link_to_if policy(process).destroy?, t("actions.destroy", scope: "decidim.admin"), process, method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
30
+ </td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
@@ -0,0 +1,11 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t ".title" %></h2>
3
+ <% end %>
4
+
5
+ <%= form_for(@form) do |f| %>
6
+ <%= render partial: 'form', object: f %>
7
+
8
+ <div class="actions">
9
+ <%= f.submit t(".create") %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% content_for :title do %>
2
+ <h2><%= link_to translated_attribute(@participatory_process.title), @participatory_process %></h2>
3
+ <h3 class="subheader"><%= translated_attribute(@participatory_process.subtitle) %></h3>
4
+ <% end %>
5
+
6
+ <div class="actions">
7
+ <hr />
8
+ <%= link_to_if policy(@participatory_process).edit?, t("decidim.admin.actions.edit"), ['edit', @participatory_process] %>
9
+ <%= link_to_if policy(@participatory_process).destroy?, t("decidim.admin.actions.destroy"), @participatory_process, method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
10
+ </div>
11
+
12
+ <dl>
13
+ <%= display_for @participatory_process,
14
+ :title,
15
+ :subtitle,
16
+ :hashtag,
17
+ :short_description,
18
+ :description
19
+ %>
20
+ </dl>
@@ -8,6 +8,7 @@
8
8
 
9
9
  <nav class="main-menu">
10
10
  <%= active_link_to t("menu.dashboard", scope: "decidim.admin"), root_path, active: :exact %>
11
+ <%= active_link_to t("menu.participatory_processes", scope: "decidim.admin"), participatory_processes_path, active: :inclusive %>
11
12
  </nav>
12
13
 
13
14
  <%= render partial: 'layouts/decidim/admin/login_items' %>
@@ -0,0 +1,40 @@
1
+ ---
2
+ ca:
3
+ decidim:
4
+ admin:
5
+ actions:
6
+ confirm_destroy: Segur que ho vols eliminar?
7
+ destroy: Eliminar
8
+ edit: Editar
9
+ new: Nou %{name}
10
+ title: Accions
11
+ unauthorized: No tens permís per realitzar aquesta acció.
12
+ menu:
13
+ dashboard: Tauler de control
14
+ participatory_processes: Processos participatius
15
+ models:
16
+ participatory_process:
17
+ fields:
18
+ created_at: Data de creació
19
+ title: Títol
20
+ name: Procés participatiu
21
+ validations:
22
+ slug_uniqueness: Ja existeix un altre procés participatiu amb el mateix identificador
23
+ participatory_processes:
24
+ create:
25
+ error: S'ha produït un error en crear un nou procés participatiu.
26
+ success: El procés participatiu s'ha creat correctament.
27
+ destroy:
28
+ success: El procés participatiu s'ha eliminat correctament.
29
+ edit:
30
+ title: Editar procés participatiu
31
+ update: Actualitzar procés participatiu
32
+ new:
33
+ create: Crear procés participatiu
34
+ title: Nou procés participatiu
35
+ update:
36
+ error: S'ha produït un error en l'actualització d'aquest procés participatiu.
37
+ success: El procés participatiu s'ha actualitzat correctament.
38
+ titles:
39
+ dashboard: Tauler de control
40
+ participatory_processes: Processos participatius
@@ -2,7 +2,39 @@
2
2
  en:
3
3
  decidim:
4
4
  admin:
5
+ actions:
6
+ confirm_destroy: Are you sure you want to delete this?
7
+ destroy: Destroy
8
+ edit: Edit
9
+ new: New %{name}
10
+ title: Actions
11
+ unauthorized: You are not authorized to perform this action
5
12
  menu:
6
13
  dashboard: Dashboard
14
+ participatory_processes: Participatory processes
15
+ models:
16
+ participatory_process:
17
+ fields:
18
+ created_at: Created at
19
+ title: Title
20
+ name: Participatory process
21
+ validations:
22
+ slug_uniqueness: Another participatory process with the same slug already exists
23
+ participatory_processes:
24
+ create:
25
+ error: There was an error creating a new participatory process.
26
+ success: Participatory process created successfully
27
+ destroy:
28
+ success: Participatory process successfully destroyed
29
+ edit:
30
+ title: Edit participatory process
31
+ update: Update participatory process
32
+ new:
33
+ create: Create participatory process
34
+ title: New participatory process
35
+ update:
36
+ error: There was an error when updating this participatory process.
37
+ success: Participatory process updated successfully
7
38
  titles:
8
39
  dashboard: Dashboard
40
+ participatory_processes: Participatory processes
@@ -0,0 +1,40 @@
1
+ ---
2
+ es:
3
+ decidim:
4
+ admin:
5
+ actions:
6
+ confirm_destroy: ¿Seguro que lo quieres eliminar?
7
+ destroy: Eliminar
8
+ edit: Editar
9
+ new: Nuevo %{name}
10
+ title: Acciones
11
+ unauthorized: No tienes permiso para realizar esta acción.
12
+ menu:
13
+ dashboard: Panel de control
14
+ participatory_processes: Procesos participativos
15
+ models:
16
+ participatory_process:
17
+ fields:
18
+ created_at: Fecha de creación
19
+ title: Título
20
+ name: Proceso participativo
21
+ validations:
22
+ slug_uniqueness: Ya existe otro proceso participativo con el mismo identificador
23
+ participatory_processes:
24
+ create:
25
+ error: Se ha producido un error al crear un nuevo proceso participativo.
26
+ success: El proceso participativo se ha creado correctamente.
27
+ destroy:
28
+ success: El proceso participativo se ha eliminado correctamente.
29
+ edit:
30
+ title: Editar proceso participativo
31
+ update: Actualizar proceso participativo
32
+ new:
33
+ create: Crear proceso participativo
34
+ title: Nuevo proceso participativo
35
+ update:
36
+ error: Se ha producido un error en la actualización de este proceso participativo.
37
+ success: El proceso participativo se ha actualizado correctamente.
38
+ titles:
39
+ dashboard: Panel de control
40
+ participatory_processes: Procesos participativos
@@ -1,4 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  Decidim::Admin::Engine.routes.draw do
3
- root to: "dashboard#show", constraints: ->(request) { Decidim::Admin::OrganizationDashboardConstraint.new(request).matches? }
3
+ constraints(->(request) { Decidim::Admin::OrganizationDashboardConstraint.new(request).matches? }) do
4
+ resources :participatory_processes
5
+ root to: "dashboard#show"
6
+ end
4
7
  end
@@ -8,11 +8,11 @@ require "decidim/core"
8
8
  require "jquery-rails"
9
9
  require "sass-rails"
10
10
  require "turbolinks"
11
- require "jquery-turbolinks"
12
11
  require "foundation-rails"
13
12
  require "foundation_rails_helper"
14
13
  require "jbuilder"
15
14
  require "rectify"
15
+ require "pundit"
16
16
 
17
17
  module Decidim
18
18
  module Admin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha4
4
+ version: 0.0.1.alpha5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-07 00:00:00.000000000 Z
13
+ date: 2016-10-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.1.alpha4
21
+ version: 0.0.1.alpha5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.0.1.alpha4
28
+ version: 0.0.1.alpha5
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -152,20 +152,6 @@ dependencies:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
154
  version: 5.0.0
155
- - !ruby/object:Gem::Dependency
156
- name: jquery-turbolinks
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: 2.1.0
162
- type: :runtime
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - "~>"
167
- - !ruby/object:Gem::Version
168
- version: 2.1.0
169
155
  - !ruby/object:Gem::Dependency
170
156
  name: jbuilder
171
157
  requirement: !ruby/object:Gem::Requirement
@@ -226,16 +212,16 @@ dependencies:
226
212
  name: decidim-dev
227
213
  requirement: !ruby/object:Gem::Requirement
228
214
  requirements:
229
- - - ">="
215
+ - - '='
230
216
  - !ruby/object:Gem::Version
231
- version: '0'
217
+ version: 0.0.1.alpha5
232
218
  type: :development
233
219
  prerelease: false
234
220
  version_requirements: !ruby/object:Gem::Requirement
235
221
  requirements:
236
- - - ">="
222
+ - - '='
237
223
  - !ruby/object:Gem::Version
238
- version: '0'
224
+ version: 0.0.1.alpha5
239
225
  - !ruby/object:Gem::Dependency
240
226
  name: pundit-matchers
241
227
  requirement: !ruby/object:Gem::Requirement
@@ -271,25 +257,40 @@ files:
271
257
  - app/assets/stylesheets/decidim/admin/_settings.scss
272
258
  - app/assets/stylesheets/decidim/admin/_sidebar.scss
273
259
  - app/assets/stylesheets/decidim/admin/_tables.scss
260
+ - app/commands/decidim/admin/create_participatory_process.rb
261
+ - app/commands/decidim/admin/update_participatory_process.rb
274
262
  - app/constraints/decidim/admin/organization_dashboard_constraint.rb
263
+ - app/controllers/concerns/decidim/needs_authorization.rb
275
264
  - app/controllers/decidim/admin/application_controller.rb
276
265
  - app/controllers/decidim/admin/dashboard_controller.rb
266
+ - app/controllers/decidim/admin/participatory_processes_controller.rb
267
+ - app/forms/decidim/admin/participatory_process_form.rb
277
268
  - app/helpers/decidim/admin/application_helper.rb
269
+ - app/helpers/decidim/admin/attributes_display_helper.rb
278
270
  - app/jobs/decidim/admin/application_job.rb
279
271
  - app/mailers/decidim/admin/application_mailer.rb
280
272
  - app/models/decidim/admin/application_record.rb
281
273
  - app/policies/decidim/admin/application_policy.rb
274
+ - app/policies/decidim/admin/dashboard_policy.rb
282
275
  - app/policies/decidim/admin/organization_policy.rb
276
+ - app/policies/decidim/admin/participatory_process_policy.rb
283
277
  - app/views/decidim/admin/dashboard/show.html.erb
284
278
  - app/views/decidim/admin/devise/mailers/password_change.html.erb
285
279
  - app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb
280
+ - app/views/decidim/admin/participatory_processes/_form.html.erb
281
+ - app/views/decidim/admin/participatory_processes/edit.html.erb
282
+ - app/views/decidim/admin/participatory_processes/index.html.erb
283
+ - app/views/decidim/admin/participatory_processes/new.html.erb
284
+ - app/views/decidim/admin/participatory_processes/show.html.erb
286
285
  - app/views/layouts/decidim/admin/_header.html.erb
287
286
  - app/views/layouts/decidim/admin/_login_items.html.erb
288
287
  - app/views/layouts/decidim/admin/_sidebar.html.erb
289
288
  - app/views/layouts/decidim/admin/application.html.erb
290
289
  - app/views/layouts/decidim/admin/login.html.erb
291
290
  - config/i18n-tasks.yml
291
+ - config/locales/ca.yml
292
292
  - config/locales/en.yml
293
+ - config/locales/es.yml
293
294
  - config/routes.rb
294
295
  - lib/decidim/admin.rb
295
296
  - lib/decidim/admin/engine.rb