decidim-core 0.13.1 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/config/decidim_core_manifest.js +1 -1
- data/app/assets/images/decidim/gamification/badges/invitations.svg +117 -0
- data/app/assets/javascripts/decidim.js.es6 +4 -1
- data/app/assets/javascripts/decidim/ajax_modals.js.es6 +17 -0
- data/app/assets/javascripts/decidim/conferences.js.es6 +16 -0
- data/app/assets/javascripts/decidim/input_hashtags.js.es6 +115 -0
- data/app/assets/javascripts/decidim/input_mentions.js.es6 +2 -3
- data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +226 -0
- data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +26 -0
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +701 -0
- data/app/assets/javascripts/decidim/vizzs/renders.js.es6 +11 -0
- data/app/assets/stylesheets/decidim/extras/_proposal_form.scss +3 -1
- data/app/assets/stylesheets/decidim/layouts/_home.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_areachart.scss +74 -0
- data/app/assets/stylesheets/decidim/modules/_badges.scss +116 -0
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +21 -4
- data/app/assets/stylesheets/decidim/modules/_chart-tooltip.scss +42 -0
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +12 -8
- data/app/assets/stylesheets/decidim/modules/_conference-nav.scss +31 -0
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +110 -0
- data/app/assets/stylesheets/decidim/modules/_conference-speaker.scss +86 -0
- data/app/assets/stylesheets/decidim/modules/_conversation.scss +58 -0
- data/app/assets/stylesheets/decidim/modules/_help.scss +38 -0
- data/app/assets/stylesheets/decidim/modules/_hover-section.scss +29 -0
- data/app/assets/stylesheets/decidim/modules/_icons.scss +10 -4
- data/app/assets/stylesheets/decidim/modules/_input-hashtags.scss +124 -0
- data/app/assets/stylesheets/decidim/modules/_loading-spinner.scss +12 -0
- data/app/assets/stylesheets/decidim/modules/_margins.scss +2 -2
- data/app/assets/stylesheets/decidim/modules/_modules.scss +15 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +9 -0
- data/app/assets/stylesheets/decidim/modules/_orgchart.scss +62 -0
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +2 -1
- data/app/assets/stylesheets/decidim/modules/_typography.scss +9 -0
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +28 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +63 -0
- data/app/cells/decidim/author/withdraw.erb +1 -1
- data/app/cells/decidim/author_cell.rb +1 -1
- data/app/cells/decidim/badge/show.erb +36 -0
- data/app/cells/decidim/badge_cell.rb +53 -0
- data/app/cells/decidim/badges/show.erb +6 -0
- data/app/cells/decidim/badges_cell.rb +14 -0
- data/app/cells/decidim/card_m/header.erb +1 -1
- data/app/cells/decidim/card_m/show.erb +1 -2
- data/app/cells/decidim/card_m/top.erb +7 -0
- data/app/cells/decidim/card_m_cell.rb +14 -17
- data/app/cells/decidim/coauthorships_cell.rb +77 -0
- data/app/cells/decidim/collapsible_authors/show.erb +0 -1
- data/app/cells/decidim/collapsible_authors_cell.rb +4 -4
- data/app/cells/decidim/collapsible_list/show.erb +12 -4
- data/app/cells/decidim/collapsible_list_cell.rb +14 -12
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +14 -0
- data/app/cells/decidim/content_blocks/footer_sub_hero_cell.rb +12 -0
- data/app/{views/decidim/pages/home/_hero.html.erb → cells/decidim/content_blocks/hero/show.erb} +4 -4
- data/app/cells/decidim/content_blocks/hero_cell.rb +25 -0
- data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +7 -0
- data/app/cells/decidim/content_blocks/hero_settings_form_cell.rb +13 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +24 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +16 -0
- data/app/{views/decidim/pages/home/_extended.html.erb → cells/decidim/content_blocks/how_to_participate/show.erb} +10 -10
- data/app/cells/decidim/content_blocks/how_to_participate_cell.rb +9 -0
- data/app/{views/decidim/pages/home/_statistics.html.erb → cells/decidim/content_blocks/stats/show.erb} +2 -2
- data/app/cells/decidim/content_blocks/stats_cell.rb +18 -0
- data/app/{views/decidim/pages/home/_sub_hero.html.erb → cells/decidim/content_blocks/sub_hero/show.erb} +2 -2
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +17 -0
- data/app/cells/decidim/conversation/show.erb +18 -0
- data/app/cells/decidim/conversation_cell.rb +23 -0
- data/app/cells/decidim/conversation_header/show.erb +17 -0
- data/app/cells/decidim/conversation_header_cell.rb +16 -0
- data/app/cells/decidim/conversations/show.erb +45 -0
- data/app/cells/decidim/conversations_cell.rb +24 -0
- data/app/cells/decidim/follow_button/show.erb +3 -3
- data/app/cells/decidim/follow_button_cell.rb +1 -5
- data/app/cells/decidim/following_cell.rb +1 -7
- data/app/cells/decidim/message/show.erb +15 -0
- data/app/cells/decidim/message_cell.rb +23 -0
- data/app/cells/decidim/new_conversation/show.erb +19 -0
- data/app/cells/decidim/new_conversation_cell.rb +19 -0
- data/app/cells/decidim/notifications/show.erb +1 -1
- data/app/cells/decidim/profile/show.erb +27 -0
- data/app/cells/decidim/profile_cell.rb +33 -0
- data/app/cells/decidim/profile_sidebar/show.erb +57 -0
- data/app/cells/decidim/profile_sidebar_cell.rb +31 -0
- data/app/cells/decidim/tos_page_cell.rb +0 -4
- data/app/cells/decidim/user_profile/header.erb +1 -1
- data/app/controllers/concerns/decidim/action_authorization.rb +13 -38
- data/app/controllers/concerns/decidim/needs_permission.rb +15 -6
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/authorization_modals_controller.rb +35 -0
- data/app/controllers/decidim/components/base_controller.rb +0 -1
- data/app/controllers/decidim/devise/invitations_controller.rb +2 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +2 -11
- data/app/controllers/decidim/newsletters_controller.rb +4 -6
- data/app/controllers/decidim/notifications_controller.rb +4 -0
- data/app/controllers/decidim/pages_controller.rb +3 -7
- data/app/controllers/decidim/profiles_controller.rb +17 -7
- data/app/forms/decidim/notifications_settings_form.rb +1 -1
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/helpers/decidim/action_authorization_helper.rb +51 -46
- data/app/helpers/decidim/application_helper.rb +18 -0
- data/app/helpers/decidim/card_helper.rb +1 -1
- data/app/helpers/decidim/cells_helper.rb +6 -2
- data/app/helpers/decidim/resource_helper.rb +8 -1
- data/app/helpers/decidim/searches_helper.rb +5 -4
- data/app/helpers/decidim/traceability_helper.rb +5 -1
- data/app/models/decidim/authorization.rb +2 -2
- data/app/models/decidim/content_block.rb +144 -0
- data/app/models/decidim/gamification/badge_score.rb +13 -0
- data/app/models/decidim/messaging/message.rb +1 -1
- data/app/models/decidim/messaging/receipt.rb +1 -1
- data/app/models/decidim/organization.rb +1 -5
- data/app/models/decidim/resource_permission.rb +8 -0
- data/app/models/decidim/searchable_resource.rb +1 -1
- data/app/models/decidim/user.rb +17 -1
- data/app/permissions/decidim/default_permissions.rb +4 -3
- data/app/permissions/decidim/permissions.rb +33 -1
- data/app/presenters/decidim/hashtag_presenter.rb +32 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +13 -0
- data/app/presenters/decidim/user_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/resolvers/decidim/hashtags_resolver.rb +15 -0
- data/app/services/decidim/action_authorizer.rb +9 -8
- data/app/types/decidim/core/date_time_type.rb +1 -1
- data/app/types/decidim/core/hashtag_type.rb +13 -0
- data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
- data/app/uploaders/decidim/image_uploader.rb +1 -0
- data/app/views/decidim/authorization_modals/show.html.erb +32 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/messaging/conversations/index.html.erb +1 -51
- data/app/views/decidim/messaging/conversations/new.html.erb +1 -5
- data/app/views/decidim/messaging/conversations/show.html.erb +1 -9
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
- data/app/views/decidim/notifications/index.html.erb +1 -0
- data/app/views/decidim/pages/decidim_page.html.erb +9 -0
- data/app/views/decidim/pages/home.html.erb +12 -16
- data/app/views/decidim/pages/index.html.erb +8 -0
- data/app/views/decidim/profiles/_user_follow.erb +2 -2
- data/app/views/decidim/profiles/show.html.erb +1 -37
- data/app/views/decidim/searches/_results.html.erb +1 -1
- data/app/views/decidim/shared/_author_reference.html.erb +1 -1
- data/app/views/decidim/shared/_authorization_modal.html.erb +1 -0
- data/app/views/decidim/shared/_tags.html.erb +1 -1
- data/app/views/kaminari/decidim/_page.html.erb +1 -1
- data/app/views/layouts/decidim/_application.html.erb +6 -1
- data/app/views/layouts/decidim/_edit_link.html.erb +8 -0
- data/app/views/layouts/decidim/_impersonation_warning.html.erb +1 -1
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
- data/app/views/layouts/decidim/_wrapper.html.erb +14 -1
- data/config/initializers/carrierwave.rb +15 -0
- data/config/locales/ca.yml +78 -30
- data/config/locales/en.yml +78 -30
- data/config/locales/es-PY.yml +78 -30
- data/config/locales/es.yml +78 -30
- data/config/locales/eu.yml +78 -30
- data/config/locales/fi.yml +262 -214
- data/config/locales/fr.yml +78 -30
- data/config/locales/gl.yml +78 -30
- data/config/locales/hu.yml +781 -0
- data/config/locales/it.yml +78 -30
- data/config/locales/nl.yml +78 -30
- data/config/locales/pl.yml +78 -30
- data/config/locales/pt-BR.yml +106 -58
- data/config/locales/pt.yml +78 -30
- data/config/locales/ru.yml +52 -32
- data/config/locales/sv.yml +183 -135
- data/config/locales/uk.yml +60 -40
- data/config/routes.rb +8 -6
- data/db/migrate/20180705091019_create_decidim_resource_permissions.rb +12 -0
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +14 -0
- data/db/migrate/20180706111847_fix_result_follows.rb +9 -0
- data/db/migrate/20180724103814_add_content_blocks.rb +22 -0
- data/db/migrate/20180726112510_create_decidim_hashtags.rb +17 -0
- data/db/migrate/20180730071851_add_core_content_blocks.rb +28 -0
- data/db/migrate/20180802132147_rename_content_block_options_to_settings.rb +7 -0
- data/db/migrate/20180806095628_add_badge_scores.rb +11 -0
- data/db/migrate/20180808135006_add_images_to_content_blocks.rb +7 -0
- data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +23 -0
- data/db/seeds.rb +10 -2
- data/lib/decidim/api/authorable_interface.rb +1 -1
- data/lib/decidim/coauthorable.rb +1 -0
- data/lib/decidim/content_block_manifest.rb +58 -0
- data/lib/decidim/content_block_registry.rb +87 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_parsers/hashtag_parser.rb +36 -0
- data/lib/decidim/content_processor.rb +11 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/content_renderers/hashtag_renderer.rb +43 -0
- data/lib/decidim/core.rb +28 -6
- data/lib/decidim/core/api.rb +1 -0
- data/lib/decidim/core/engine.rb +52 -1
- data/lib/decidim/core/test.rb +3 -0
- data/lib/decidim/core/test/factories.rb +32 -17
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +10 -0
- data/lib/decidim/core/test/shared_examples/coauthorable.rb +3 -0
- data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +30 -0
- data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/publicable.rb +1 -1
- data/lib/decidim/core/test/shared_examples/railtie_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +2 -1
- data/lib/decidim/form_builder.rb +9 -3
- data/lib/decidim/friendly_dates.rb +1 -1
- data/lib/decidim/gamification.rb +109 -0
- data/lib/decidim/gamification/badge.rb +54 -0
- data/lib/decidim/gamification/badge_earned_event.rb +9 -0
- data/lib/decidim/gamification/badge_registry.rb +63 -0
- data/lib/decidim/gamification/badge_scorer.rb +118 -0
- data/lib/decidim/gamification/badge_status.rb +41 -0
- data/lib/decidim/gamification/base_event.rb +40 -0
- data/lib/decidim/gamification/level_up_event.rb +9 -0
- data/lib/decidim/hashtag.rb +15 -0
- data/lib/decidim/hashtaggable.rb +20 -0
- data/lib/decidim/query_extensions.rb +10 -0
- data/lib/decidim/resource_manifest.rb +10 -0
- data/lib/decidim/resourceable.rb +13 -0
- data/lib/decidim/search_resource_fields_mapper.rb +8 -3
- data/lib/decidim/searchable.rb +8 -0
- data/lib/decidim/translatable_attributes.rb +6 -18
- data/lib/decidim/view_model.rb +6 -0
- data/lib/devise/models/decidim_newsletterable.rb +1 -1
- data/vendor/assets/javascripts/d3.js +17813 -0
- metadata +125 -27
- data/app/cells/decidim/card_m/author.erb +0 -3
- data/app/cells/decidim/card_m/authors.erb +0 -9
- data/app/views/decidim/messaging/conversations/_message.html.erb +0 -14
- data/app/views/decidim/messaging/conversations/_reply.html.erb +0 -11
- data/app/views/decidim/messaging/conversations/_show.html.erb +0 -21
- data/app/views/decidim/messaging/conversations/_start.html.erb +0 -12
- data/app/views/decidim/pages/home/_footer_sub_hero.html.erb +0 -14
- data/app/views/decidim/pages/home/_highlighted_content_banner.html.erb +0 -26
- data/app/views/decidim/pages/home/_highlighted_processes.html.erb +0 -7
- data/app/views/decidim/profiles/_user.html.erb +0 -59
- data/app/views/decidim/shared/_action_authorization_modal.html.erb +0 -39
- data/app/views/layouts/decidim/_component_authorization_modals.html.erb +0 -5
@@ -0,0 +1,62 @@
|
|
1
|
+
.orgchart{
|
2
|
+
// Colors
|
3
|
+
$bg-color: $white;
|
4
|
+
$dot-color: $medium-gray;
|
5
|
+
|
6
|
+
// Dimensions
|
7
|
+
$dot-size: rem-calc(2px);
|
8
|
+
$dot-space: rem-calc(10px);
|
9
|
+
|
10
|
+
background: linear-gradient(90deg, $bg-color ($dot-space - $dot-size), transparent 1%) center, linear-gradient($bg-color ($dot-space - $dot-size), transparent 1%) center, $dot-color;
|
11
|
+
background-size: $dot-space $dot-space;
|
12
|
+
|
13
|
+
// Other vars
|
14
|
+
$stroke-width: 1px;
|
15
|
+
$stroke-color: $medium-gray;
|
16
|
+
|
17
|
+
.as-card{
|
18
|
+
fill: $bg-color;
|
19
|
+
stroke: $stroke-color;
|
20
|
+
stroke-width: $stroke-width;
|
21
|
+
}
|
22
|
+
|
23
|
+
.as-text{
|
24
|
+
font-weight: 600;
|
25
|
+
fill: $secondary;
|
26
|
+
text-anchor: middle;
|
27
|
+
}
|
28
|
+
|
29
|
+
.as-circle{
|
30
|
+
stroke: $stroke-color;
|
31
|
+
stroke-width: $stroke-width;
|
32
|
+
fill: $bg-color;
|
33
|
+
}
|
34
|
+
|
35
|
+
.link{
|
36
|
+
stroke: $stroke-color;
|
37
|
+
stroke-width: $stroke-width;
|
38
|
+
}
|
39
|
+
|
40
|
+
.node{
|
41
|
+
cursor: pointer;
|
42
|
+
}
|
43
|
+
|
44
|
+
.button{
|
45
|
+
$height: ($input-font-size * unitless-calc($input-line-height)) + (get-side($input-padding, 'top') + get-side($input-padding, 'bottom')) - rem-calc(1);
|
46
|
+
|
47
|
+
min-height: $height;
|
48
|
+
color: $body-font-color;
|
49
|
+
outline: none;
|
50
|
+
border: $border;
|
51
|
+
background-color: $input-background;
|
52
|
+
box-shadow: $input-shadow;
|
53
|
+
|
54
|
+
@if has-value($button-transition){
|
55
|
+
transition: $button-transition;
|
56
|
+
}
|
57
|
+
|
58
|
+
&:hover{
|
59
|
+
background-color: $input-background;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
@@ -125,6 +125,15 @@ hr{
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
|
128
|
+
// text status-color
|
129
|
+
$map: map-merge($foundation-palette, (muted: $muted));
|
130
|
+
|
131
|
+
@each $key, $value in $map{
|
132
|
+
.text-#{$key}{
|
133
|
+
color: $value;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
128
137
|
.text-large{
|
129
138
|
font-size: 130%;
|
130
139
|
}
|
@@ -62,6 +62,34 @@
|
|
62
62
|
@include flex-align($x: justify, $y: bottom);
|
63
63
|
}
|
64
64
|
|
65
|
+
// flex--sc:
|
66
|
+
// justify-content: flex-start;
|
67
|
+
// align-items: center;
|
68
|
+
.flex--fsc{
|
69
|
+
@include flex;
|
70
|
+
@include flex-align($x: left, $y: middle);
|
71
|
+
}
|
72
|
+
|
73
|
+
// flex--fsb:
|
74
|
+
// justify-content: flex-start;
|
75
|
+
// align-items: baseline;
|
76
|
+
.flex--fsb{
|
77
|
+
@include flex;
|
78
|
+
@include flex-align($x: left, $y: null);
|
79
|
+
|
80
|
+
align-items: baseline;
|
81
|
+
}
|
82
|
+
|
83
|
+
// flex--fsb:
|
84
|
+
// justify-content: center;
|
85
|
+
// align-items: baseline;
|
86
|
+
.flex--cb{
|
87
|
+
@include flex;
|
88
|
+
@include flex-align($x: center, $y: null);
|
89
|
+
|
90
|
+
align-items: baseline;
|
91
|
+
}
|
92
|
+
|
65
93
|
.scroll{
|
66
94
|
max-height: 50vh;
|
67
95
|
overflow-y: scroll;
|
@@ -88,6 +88,34 @@ $palette: $foundation-palette;
|
|
88
88
|
margin-bottom: 0;
|
89
89
|
}
|
90
90
|
}
|
91
|
+
|
92
|
+
@else if $dir == row-reverse{
|
93
|
+
& > *{
|
94
|
+
margin: 0 $gap/2;
|
95
|
+
}
|
96
|
+
|
97
|
+
& > :last-child{
|
98
|
+
margin-left: 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
& > :first-child{
|
102
|
+
margin-right: 0;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
@else if $dir == column-reverse{
|
107
|
+
& > *{
|
108
|
+
margin: $gap/2 0;
|
109
|
+
}
|
110
|
+
|
111
|
+
& > :last-child{
|
112
|
+
margin-top: 0;
|
113
|
+
}
|
114
|
+
|
115
|
+
& > :first-child{
|
116
|
+
margin-bottom: 0;
|
117
|
+
}
|
118
|
+
}
|
91
119
|
}
|
92
120
|
|
93
121
|
@mixin ellipsis(){
|
@@ -102,3 +130,38 @@ $palette: $foundation-palette;
|
|
102
130
|
content: $char;
|
103
131
|
}
|
104
132
|
}
|
133
|
+
|
134
|
+
@mixin animation($animation){
|
135
|
+
-webkit-animation: $animation;
|
136
|
+
-o-animation: $animation;
|
137
|
+
animation: $animation;
|
138
|
+
}
|
139
|
+
|
140
|
+
@mixin spinner($size, $orbit, $satellite, $time){
|
141
|
+
@include animation( animation-spin $time infinite linear );
|
142
|
+
@include square($size);
|
143
|
+
|
144
|
+
box-sizing: border-box;
|
145
|
+
border-radius: 50%;
|
146
|
+
border: floor(($size / 8)) solid $orbit;
|
147
|
+
border-right-color: $satellite;
|
148
|
+
display: inline-block;
|
149
|
+
position: relative;
|
150
|
+
}
|
151
|
+
|
152
|
+
@mixin size($width, $height){
|
153
|
+
width: $width;
|
154
|
+
height: $height;
|
155
|
+
}
|
156
|
+
|
157
|
+
@mixin square($size){
|
158
|
+
@include size($size, $size);
|
159
|
+
}
|
160
|
+
|
161
|
+
@keyframes animation-spin{
|
162
|
+
to{ transform: rotate(1turn); }
|
163
|
+
}
|
164
|
+
|
165
|
+
@-webkit-keyframes animation-spin{
|
166
|
+
to{ -webkit-transform: rotate(1turn); }
|
167
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if withdrawable? %>
|
2
|
-
<%= action_authorized_link_to :withdraw, withdraw_path, method: :put, class: "title-action__action button small hollow", title: t("withdraw_btn_hint", scope: "decidim.proposals.proposals.show"), data: {confirm: t("withdraw_confirmation", scope: "decidim.proposals.proposals.show")} do %>
|
2
|
+
<%= action_authorized_link_to :withdraw, withdraw_path, method: :put, class: "title-action__action button small hollow", title: t("withdraw_btn_hint", scope: "decidim.proposals.proposals.show"), data: { confirm: t("withdraw_confirmation", scope: "decidim.proposals.proposals.show") } do %>
|
3
3
|
<%= t("withdraw_proposal", scope: "decidim.proposals.proposals.show") %>
|
4
4
|
<%= icon "x" %>
|
5
5
|
<% end %>
|
@@ -52,7 +52,7 @@ module Decidim
|
|
52
52
|
def creation_date?
|
53
53
|
return true if posts_controller?
|
54
54
|
return unless from_context
|
55
|
-
return unless proposals_controller?
|
55
|
+
return unless proposals_controller? || collaborative_drafts_controller?
|
56
56
|
return unless show_action?
|
57
57
|
true
|
58
58
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div class="column">
|
2
|
+
<article class="card card--badge absolutes badge-<%= badge.name %>">
|
3
|
+
<div class="right badge-tip">
|
4
|
+
<div data-tooltip data-position="top" title="<%= tooltip %>" aria-describedby="<%= badge.name %>-tooltip" data-yeti-box="<%= badge.name %>-tooltip" data-toggle="<%= badge.name %>-tooltip" data-resize="<%= badge.name %>-tooltip" class="has-tip" data-t="<%= badge.name %>-t">
|
5
|
+
<%= icon "info" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="card__content">
|
9
|
+
<div class="card__header">
|
10
|
+
<div class="badge-container">
|
11
|
+
<%= image_tag badge.image, class: "badge__logo" %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="card__text text-center">
|
15
|
+
<strong><%= badge_name %></strong>
|
16
|
+
</div>
|
17
|
+
<div class="card__text text-center">
|
18
|
+
<%= description %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<div class="card__footer card__footer--transparent">
|
22
|
+
<div class="p-xs">
|
23
|
+
<div class="flex--sbc">
|
24
|
+
<strong class="text-uppercase muted">
|
25
|
+
<%= t "decidim.gamification.level", level: status.level %>
|
26
|
+
</strong>
|
27
|
+
<div class="badge-level">
|
28
|
+
<% badge.levels.each_with_index do |_threshold, level| %>
|
29
|
+
<div class="<%= "is-achieved" if status.level >= (level + 1) %>"></div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</article>
|
36
|
+
</div>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class BadgeCell < Decidim::ViewModel
|
5
|
+
include Decidim::ApplicationHelper
|
6
|
+
include Decidim::Core::Engine.routes.url_helpers
|
7
|
+
include Decidim::IconHelper
|
8
|
+
|
9
|
+
delegate :current_user, to: :controller
|
10
|
+
|
11
|
+
def badge
|
12
|
+
@options[:badge]
|
13
|
+
end
|
14
|
+
|
15
|
+
def user
|
16
|
+
model
|
17
|
+
end
|
18
|
+
|
19
|
+
def description
|
20
|
+
if user == current_user && status.level.zero?
|
21
|
+
t "decidim.gamification.badges.#{badge.name}.unearned_own"
|
22
|
+
elsif user == current_user && status.level.positive?
|
23
|
+
t "decidim.gamification.badges.#{badge.name}.description_own", score: status.score
|
24
|
+
elsif user != current_user && status.level.zero?
|
25
|
+
t "decidim.gamification.badges.#{badge.name}.unearned_another"
|
26
|
+
elsif user != current_user && status.level.positive?
|
27
|
+
t "decidim.gamification.badges.#{badge.name}.description_another", score: status.score
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def tooltip
|
32
|
+
if user == current_user
|
33
|
+
if status.next_level_in
|
34
|
+
t "decidim.gamification.badges.#{badge.name}.next_level_in", score: status.next_level_in
|
35
|
+
else
|
36
|
+
t "decidim.gamification.reached_top"
|
37
|
+
end
|
38
|
+
else
|
39
|
+
t "decidim.gamification.badges.#{badge.name}.explanation"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def badge_name
|
44
|
+
t "decidim.gamification.badges.#{badge.name}.name"
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def status
|
50
|
+
@status ||= Decidim::Gamification.status_for(user, badge.name)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class BadgesCell < Decidim::ViewModel
|
5
|
+
include Decidim::ApplicationHelper
|
6
|
+
include Decidim::Core::Engine.routes.url_helpers
|
7
|
+
|
8
|
+
delegate :current_user, to: :controller
|
9
|
+
|
10
|
+
def user
|
11
|
+
model
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="card__top">
|
2
|
+
<% if render_space? %>
|
3
|
+
<div class="card__content text-small">
|
4
|
+
<span class="muted"><%= searchable_resource_human_name(model.participatory_space.class) %>:</span> <%= link_to translated_attribute(model.participatory_space.title), Decidim::ResourceLocatorPresenter.new(model.participatory_space).path %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
@@ -10,6 +10,7 @@ module Decidim
|
|
10
10
|
include Decidim::SanitizeHelper
|
11
11
|
include Decidim::CardHelper
|
12
12
|
include Decidim::LayoutHelper
|
13
|
+
include Decidim::SearchesHelper
|
13
14
|
|
14
15
|
def show
|
15
16
|
render
|
@@ -54,24 +55,8 @@ module Decidim
|
|
54
55
|
decidim_sanitize(html_truncate(text, length: 100))
|
55
56
|
end
|
56
57
|
|
57
|
-
def decidim
|
58
|
-
Decidim::Core::Engine.routes.url_helpers
|
59
|
-
end
|
60
|
-
|
61
|
-
def has_author?
|
62
|
-
model.is_a?(Decidim::Authorable)
|
63
|
-
end
|
64
|
-
|
65
|
-
def author
|
66
|
-
present(model).author
|
67
|
-
end
|
68
|
-
|
69
58
|
def has_authors?
|
70
|
-
model.is_a?(Decidim::Coauthorable)
|
71
|
-
end
|
72
|
-
|
73
|
-
def hidden_elements_count_i18n_key
|
74
|
-
"decidim.proposals.#{model.class.name.demodulize}.show.hidden_authors_count"
|
59
|
+
model.is_a?(Decidim::Authorable) || model.is_a?(Decidim::Coauthorable)
|
75
60
|
end
|
76
61
|
|
77
62
|
def has_actions?
|
@@ -140,5 +125,17 @@ module Decidim
|
|
140
125
|
render :comments_counter
|
141
126
|
end
|
142
127
|
end
|
128
|
+
|
129
|
+
def render_authorship
|
130
|
+
cell("decidim/coauthorships", model, extra_small: true, has_actions: has_actions?)
|
131
|
+
end
|
132
|
+
|
133
|
+
def render_space?
|
134
|
+
context[:show_space].presence && model.respond_to?(:participatory_space)
|
135
|
+
end
|
136
|
+
|
137
|
+
def render_top?
|
138
|
+
render_space?
|
139
|
+
end
|
143
140
|
end
|
144
141
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders a collapsible list of a model's coauthors.
|
5
|
+
#
|
6
|
+
# Available sizes:
|
7
|
+
# - any number from 1 to 12
|
8
|
+
# - default value is 1
|
9
|
+
# - it is delegated to the `decidim/collapsible_list` cell
|
10
|
+
#
|
11
|
+
# Extra params:
|
12
|
+
# - `extra_small` => boolean: when this cell is included in small places this
|
13
|
+
# option adds extra css ("author-data--small") to make the box smaller.
|
14
|
+
#
|
15
|
+
# Example:
|
16
|
+
#
|
17
|
+
# cell("decidim/coauthorships", @proposal)
|
18
|
+
class CoauthorshipsCell < Decidim::ViewModel
|
19
|
+
include Decidim::ApplicationHelper
|
20
|
+
|
21
|
+
def show
|
22
|
+
if authorable? || official?
|
23
|
+
cell "decidim/author", presenter_for_author(model), extra_classes.merge(has_actions: has_actions?, from: model)
|
24
|
+
else
|
25
|
+
cell(
|
26
|
+
"decidim/collapsible_authors",
|
27
|
+
presenters_for_identities(model),
|
28
|
+
cell_name: "decidim/author",
|
29
|
+
cell_options: extra_classes,
|
30
|
+
size: size,
|
31
|
+
from: model,
|
32
|
+
has_actions: has_actions?
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def official?
|
40
|
+
model.respond_to?(:official?) && model.official?
|
41
|
+
end
|
42
|
+
|
43
|
+
def presenters_for_identities(coauthorable)
|
44
|
+
coauthorable.identities.map { |identity| present(identity) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def presenter_for_author(authorable)
|
48
|
+
if official?
|
49
|
+
"#{model.class.parent}::OfficialAuthorPresenter".constantize.new
|
50
|
+
elsif authorable.user_group
|
51
|
+
Decidim::UserGroupPresenter.new(authorable.user_group)
|
52
|
+
else
|
53
|
+
Decidim::UserPresenter.new(authorable.author)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def authorable?
|
58
|
+
model.is_a?(Decidim::Authorable)
|
59
|
+
end
|
60
|
+
|
61
|
+
def has_actions?
|
62
|
+
options[:has_actions] == true
|
63
|
+
end
|
64
|
+
|
65
|
+
def extra_classes
|
66
|
+
if options[:extra_small]
|
67
|
+
{ extra_classes: ["author-data--small"] }
|
68
|
+
else
|
69
|
+
{}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def size
|
74
|
+
options[:size] || 1
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|