-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into api/documentation
- Loading branch information
Showing
261 changed files
with
9,291 additions
and
1,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
decidim-accountability/app/types/decidim/accountability/accountability_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Accountability | ||
AccountabilityType = GraphQL::ObjectType.define do | ||
interfaces [-> { Decidim::Core::ComponentInterface }] | ||
|
||
name "Accountability" | ||
description "An accountability component of a participatory space." | ||
|
||
connection :results, ResultType.connection_type do | ||
resolve ->(component, _args, _ctx) { | ||
ResultTypeHelper.base_scope(component).includes(:component) | ||
} | ||
end | ||
|
||
field(:result, ResultType) do | ||
argument :id, !types.ID | ||
|
||
resolve ->(component, args, _ctx) { | ||
ResultTypeHelper.base_scope(component).find_by(id: args[:id]) | ||
} | ||
end | ||
end | ||
|
||
module ResultTypeHelper | ||
def self.base_scope(component) | ||
Result.where(component: component) | ||
end | ||
end | ||
end | ||
end |
35 changes: 35 additions & 0 deletions
35
decidim-accountability/app/types/decidim/accountability/result_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Accountability | ||
ResultType = GraphQL::ObjectType.define do | ||
interfaces [ | ||
-> { Decidim::Core::ComponentInterface }, | ||
-> { Decidim::Core::CategorizableInterface }, | ||
-> { Decidim::Comments::CommentableInterface }, | ||
-> { Decidim::Core::ScopableInterface } | ||
] | ||
|
||
name "Result" | ||
description "A result" | ||
|
||
field :id, !types.ID, "The internal ID for this result" | ||
field :title, Decidim::Core::TranslatedFieldType, "The title for this result" | ||
field :description, Decidim::Core::TranslatedFieldType, "The description for this result" | ||
field :reference, types.String, "The reference for this result" | ||
field :startDate, Decidim::Core::DateType, "The start date for this result", property: :start_date | ||
field :endDate, Decidim::Core::DateType, "The end date for this result", property: :end_date | ||
field :progress, types.Float, "The progress for this result" | ||
field :createdAt, Decidim::Core::DateTimeType, "When this result was created", property: :created_at | ||
field :updatedAt, Decidim::Core::DateTimeType, "When this result was updated", property: :updated_at | ||
field :childrenCount, types.Int, "The number of children results", property: :children_count | ||
field :weight, !types.Int, "The order of this result" | ||
field :externalId, types.String, "The external ID for this result", property: :external_id | ||
|
||
field :children, types[Decidim::Accountability::ResultType], "The childrens results" | ||
field :parent, Decidim::Accountability::ResultType, "The parent result" | ||
field :status, Decidim::Accountability::StatusType, "The status for this result" | ||
field :timelineEntries, types[Decidim::Accountability::TimelineEntryType], "The timeline entries for this result", property: :timeline_entries | ||
end | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
decidim-accountability/app/types/decidim/accountability/status_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Accountability | ||
StatusType = GraphQL::ObjectType.define do | ||
name "Status" | ||
description "A status" | ||
|
||
field :id, !types.ID, "The internal ID for this status" | ||
field :key, types.String, "The key for this status" | ||
field :name, Decidim::Core::TranslatedFieldType, "The name for this status" | ||
field :createdAt, Decidim::Core::DateType, "When this status was created", property: :created_at | ||
field :updatedAt, Decidim::Core::DateType, "When this status was updated", property: :updated_at | ||
field :description, Decidim::Core::TranslatedFieldType, "The description for this status" | ||
field :progress, types.Int, "The progress for this status" | ||
|
||
field :results, types[Decidim::Accountability::ResultType], "The results for this status" | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
decidim-accountability/app/types/decidim/accountability/timeline_entry_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Accountability | ||
TimelineEntryType = GraphQL::ObjectType.define do | ||
name "TimelineEntry" | ||
description "A Timeline Entry" | ||
|
||
field :id, !types.ID, "The internal ID for this timeline entry" | ||
field :entryDate, Decidim::Core::DateType, "The entry date for this timeline entry", property: :entry_date | ||
field :description, Decidim::Core::TranslatedFieldType, "The description for this timeline entry" | ||
field :createdAt, Decidim::Core::DateTimeType, "When this timeline entry was created", property: :created_at | ||
field :updatedAt, Decidim::Core::DateTimeType, "When this timeline entry was updated", property: :updated_at | ||
|
||
field :result, Decidim::Accountability::ResultType, "The result for this timeline entry" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
el: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
is-IS: | ||
activemodel: | ||
attributes: | ||
result: | ||
decidim_accountability_status_id: Staða | ||
decidim_category_id: Flokkur | ||
decidim_scope_id: Umfang | ||
description: Lýsing | ||
end_date: Loka dagsetning | ||
progress: Framfarir | ||
project_ids: Innifalið verkefni | ||
proposals: Innifalið tillögur | ||
start_date: Upphafsdagur | ||
title: Titill | ||
updated_at: Uppfært á | ||
status: | ||
description: Lýsing | ||
key: Lykill | ||
name: Nafn | ||
progress: Framfarir | ||
timeline_entry: | ||
description: Lýsing | ||
entry_date: Dagsetning | ||
decidim: | ||
accountability: | ||
actions: | ||
confirm_destroy: Ertu viss um að þú viljir eyða þessu %{name}? | ||
destroy: Eyða | ||
edit: Breyta | ||
new: Nýtt %{name} | ||
preview: Preview | ||
timeline_entries: Verkefnisþróun | ||
title: Aðgerðir | ||
admin: | ||
exports: | ||
results: Niðurstöður | ||
models: | ||
result: | ||
name: Niðurstaða | ||
status: | ||
name: Staða | ||
timeline_entry: | ||
name: Tímalína færsla | ||
results: | ||
create: | ||
success: Niðurstaða búin til | ||
destroy: | ||
success: Niðurstaða tókst að eyða | ||
edit: | ||
title: Breyta niðurstöðum | ||
update: Uppfæra niðurstöðu | ||
form: | ||
add_proposal: Bæta við tillögu | ||
index: | ||
title: Niðurstöður | ||
new: | ||
create: Búa til niðurstöðu | ||
title: Nýtt niðurstaða | ||
proposals: | ||
close: Loka | ||
current_selection: Núverandi val | ||
select: Veldu | ||
update: | ||
success: Niðurstaða tókst að uppfæra | ||
shared: | ||
subnav: | ||
statuses: Staða | ||
statuses: | ||
create: | ||
success: Staða búin til | ||
destroy: | ||
success: Staða var eytt | ||
edit: | ||
title: Breyta stöðu | ||
update: Uppfæra stöðu | ||
index: | ||
title: Staða | ||
new: | ||
create: Búa til stöðu | ||
title: Ný staða | ||
update: | ||
success: Staða uppfærður með góðum árangri | ||
timeline_entries: | ||
create: | ||
success: Uppfærsla búin til með góðum árangri | ||
destroy: | ||
success: Innslátt tókst eytt | ||
edit: | ||
title: Breyta færslu | ||
update: Uppfæra færslu | ||
index: | ||
title: Verkefni tímalína færslur | ||
new: | ||
create: Búðu til færslu | ||
title: Ný færsla | ||
update: | ||
success: Uppfærsla uppfærð með góðum árangri | ||
admin_log: | ||
result: | ||
create: "%{user_name} búið til afleiðing %{resource_name} í %{space_name}" | ||
delete: "%{user_name} eytt %{resource_name} niðurstöðu í %{space_name}" | ||
update: "%{user_name} uppfært niðurstaða %{resource_name} í %{space_name}" | ||
value_types: | ||
parent_presenter: | ||
not_found: 'Móðirin fannst ekki í gagnagrunninum (ID: %{id})' | ||
models: | ||
result: | ||
fields: | ||
end_date: Loka dagsetning | ||
progress: Framfarir | ||
start_date: Upphafsdagur | ||
status: Staða | ||
title: Titill | ||
status: | ||
fields: | ||
description: Lýsing | ||
key: Lykill | ||
name: Nafn | ||
progress: Framfarir | ||
timeline_entry: | ||
fields: | ||
description: Lýsing | ||
entry_date: Dagsetning | ||
results: | ||
count: | ||
results_count: | ||
one: 1 niðurstaða | ||
other: "%{count} niðurstöður" | ||
filters: | ||
all: Allt | ||
scopes: Scopes | ||
home: | ||
categories_label: Flokkar | ||
subcategories_label: Undirflokka | ||
home_header: | ||
global_status: Global framkvæmdastaða | ||
nav_breadcrumb: | ||
global: Global framkvæmd | ||
search: | ||
search: Leitaðu að aðgerðum | ||
show: | ||
stats: | ||
attendees: Dómarar | ||
back_to_result: Fara aftur til niðurstöðu | ||
comments: Athugasemdir | ||
contributions: Framlög | ||
last_edited_by: Síðast breytt af | ||
last_updated_at: Síðast uppfært á | ||
meetings: Fundir | ||
number_of_versions: Útgáfur | ||
proposals: Tillögur | ||
show_all_versions: Sýna allar útgáfur | ||
version_author: Útgáfa höfundur | ||
version_created_at: Útgáfa búin til á | ||
version_number: Útgáfa númer | ||
version_number_out_of_total: "%{current_version} af %{total_count}" | ||
votes: Styður | ||
timeline: | ||
title: Verkefnisþróun | ||
versions: | ||
index: | ||
changes_at_title: Breytingar á "%{title}" | ||
title: Útgáfur | ||
show: | ||
changes_at_title: Breytingar á "%{title}" | ||
version: | ||
version_index: Útgáfa %{index} | ||
components: | ||
accountability: | ||
name: Ábyrgð | ||
settings: | ||
global: | ||
categories_label: Nafn fyrir "Flokkar" | ||
comments_enabled: Athugasemdir virkt | ||
display_progress_enabled: Sýna framfarir | ||
heading_leaf_level_results: Nafn fyrir "Verkefni" | ||
heading_parent_level_results: Nafn fyrir "Úrslit" | ||
intro: Intro | ||
subcategories_label: Nafn fyrir "undirflokka" | ||
step: | ||
comments_blocked: Athugasemdir læst | ||
events: | ||
accountability: | ||
proposal_linked: | ||
email_intro: 'Tillagan "%{proposal_title}" hefur verið hluti af niðurstöðu. Þú getur séð það frá þessari síðu:' | ||
email_outro: Þú hefur fengið þessa tilkynningu vegna þess að þú fylgist með "%{proposal_title}". Þú getur hætt við að fá tilkynningar eftir fyrri tengilinn. | ||
email_subject: Uppfærsla á %{proposal_title} | ||
notification_title: Tillagan <a href="%{proposal_path}">%{proposal_title}</a> hefur verið innifalinn í <a href="%{resource_path}">%{resource_title}</a> niðurstöðum. | ||
participatory_processes: | ||
participatory_process_groups: | ||
highlighted_results: | ||
results: Niðurstöður | ||
resource_links: | ||
included_projects: | ||
result_project: Verkefni í þessari niðurstöðu | ||
included_proposals: | ||
result_proposal: Tillögur innifalnar í þessari niðurstöðu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
decidim-accountability/spec/types/accountability_type_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
require "decidim/api/test/type_context" | ||
require "decidim/core/test" | ||
|
||
module Decidim | ||
module Accountability | ||
describe AccountabilityType, type: :graphql do | ||
include_context "with a graphql type" | ||
let(:model) { create(:accountability_component) } | ||
|
||
it_behaves_like "a component query type" | ||
|
||
describe "results" do | ||
let!(:component_results) { create_list(:result, 2, component: model) } | ||
let!(:other_results) { create_list(:result, 2) } | ||
|
||
let(:query) { "{ results { edges { node { id } } } }" } | ||
|
||
it "returns the published results" do | ||
ids = response["results"]["edges"].map { |edge| edge["node"]["id"] } | ||
expect(ids).to include(*component_results.map(&:id).map(&:to_s)) | ||
expect(ids).not_to include(*other_results.map(&:id).map(&:to_s)) | ||
end | ||
end | ||
|
||
describe "result" do | ||
let(:query) { "query Result($id: ID!){ result(id: $id) { id } }" } | ||
let(:variables) { { id: result.id.to_s } } | ||
|
||
context "when the result belongs to the component" do | ||
let!(:result) { create(:result, component: model) } | ||
|
||
it "finds the result" do | ||
expect(response["result"]["id"]).to eq(result.id.to_s) | ||
end | ||
end | ||
|
||
context "when the result doesn't belong to the component" do | ||
let!(:result) { create(:result, component: create(:accountability_component)) } | ||
|
||
it "returns null" do | ||
expect(response["result"]).to be_nil | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.