diff --git a/decidim-accountability/lib/decidim/accountability/engine.rb b/decidim-accountability/lib/decidim/accountability/engine.rb index cde4b0e83e1f4..923206ef86e6c 100644 --- a/decidim-accountability/lib/decidim/accountability/engine.rb +++ b/decidim-accountability/lib/decidim/accountability/engine.rb @@ -17,6 +17,14 @@ class Engine < ::Rails::Engine root to: "results#home" end + initializer "decidim_accountability.register_icons" do + Decidim.icons.register(name: "Decidim::Accountability::Result", icon: "briefcase-2-line", description: "Result / project (Accountability)", category: "activity", + engine: :accountability) + + Decidim.icons.register(name: "focus-2-line", icon: "focus-2-line", category: "system", description: "", engine: :accountability) + Decidim.icons.register(name: "briefcase-2-line", icon: "briefcase-2-line", category: "system", description: "", engine: :accountability) + end + initializer "decidim_accountability.view_hooks" do Decidim.view_hooks.register(:participatory_space_highlighted_elements, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context| view_context.cell("decidim/accountability/highlighted_results", view_context.current_participatory_space) diff --git a/decidim-admin/app/cells/decidim/admin/content_block/show.erb b/decidim-admin/app/cells/decidim/admin/content_block/show.erb index 544e78be5f972..33489bbad5023 100644 --- a/decidim-admin/app/cells/decidim/admin/content_block/show.erb +++ b/decidim-admin/app/cells/decidim/admin/content_block/show.erb @@ -12,7 +12,7 @@ <%= icon "delete-bin-line", role: "img", "aria-hidden": true %> <% end %> <% end %> - <%= icon "menu", role: "img", "aria-hidden": true %> + <%= icon "menu-line", role: "img", "aria-hidden": true %> diff --git a/decidim-admin/app/helpers/decidim/admin/moderations/reports_helper.rb b/decidim-admin/app/helpers/decidim/admin/moderations/reports_helper.rb index e0268a5f431e2..d4f73420f4cdb 100644 --- a/decidim-admin/app/helpers/decidim/admin/moderations/reports_helper.rb +++ b/decidim-admin/app/helpers/decidim/admin/moderations/reports_helper.rb @@ -19,7 +19,7 @@ def reportable_author_name(reportable) when User content_tag :li do link_to current_or_new_conversation_path_with(author), target: "_blank", rel: "noopener" do - "#{author.name} #{icon "envelope-closed"}".html_safe + "#{author.name} #{icon "mail-send-line"}".html_safe end end when Decidim::Meetings::Meeting diff --git a/decidim-admin/lib/decidim/admin/engine.rb b/decidim-admin/lib/decidim/admin/engine.rb index 0f3a181f59eb9..3c4de7035a1e5 100644 --- a/decidim-admin/lib/decidim/admin/engine.rb +++ b/decidim-admin/lib/decidim/admin/engine.rb @@ -25,6 +25,33 @@ class Engine < ::Rails::Engine end end + initializer "decidim_admin.register_icons" do |_app| + Decidim.icons.register(name: "layout-masonry-line", icon: "layout-masonry-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "service-line", icon: "service-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "fullscreen-line", icon: "fullscreen-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "lock-line", icon: "lock-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "download-line", icon: "download-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "mail-open-line", icon: "mail-open-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "forbid-2-line", icon: "forbid-2-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "key-2-line", icon: "key-2-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "arrow-go-back-line", icon: "arrow-go-back-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "computer-line", icon: "computer-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "arrow-right-s-line", icon: "arrow-right-s-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "arrow-up-line", icon: "arrow-up-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "arrow-down-line", icon: "arrow-down-line", category: "system", description: "", engine: :admin) + + Decidim.icons.register(name: "attachment-2", icon: "attachment-2", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "spy-line", icon: "spy-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "refresh-line", icon: "refresh-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "zoom-in-line", icon: "zoom-in-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "add-line", icon: "add-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "upload-line", icon: "upload-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "settings-4-line", icon: "settings-4-line", category: "system", description: "", engine: :admin) + + Decidim.icons.register(name: "folder-line", icon: "folder-line", category: "system", description: "", engine: :admin) + Decidim.icons.register(name: "attachment-line", icon: "attachment-line", category: "system", description: "", engine: :admin) + end + initializer "decidim_admin.mime_types" do |_app| # Required for importer example downloads Mime::Type.register Decidim::Admin::Import::Readers::XLSX::MIME_TYPE, :xlsx diff --git a/decidim-assemblies/lib/decidim/assemblies/engine.rb b/decidim-assemblies/lib/decidim/assemblies/engine.rb index bdf9bf6d709db..2d018e10bfde1 100644 --- a/decidim-assemblies/lib/decidim/assemblies/engine.rb +++ b/decidim-assemblies/lib/decidim/assemblies/engine.rb @@ -40,6 +40,13 @@ class Engine < ::Rails::Engine end end + initializer "decidim_assemblies.register_icons" do + Decidim.icons.register(name: "Decidim::Assembly", icon: "government-line", description: "Assembly", category: "activity", engine: :assemblies) + Decidim.icons.register(name: "assembly_type", icon: "group-2-line", description: "Type", category: "assemblies", engine: :assemblies) + + Decidim.icons.register(name: "group-2-line", icon: "group-2-line", category: "system", description: "", engine: :assemblies) + end + initializer "decidim_assemblies.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Assemblies::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Assemblies::Engine.root}/app/views") # for partials diff --git a/decidim-blogs/lib/decidim/blogs/engine.rb b/decidim-blogs/lib/decidim/blogs/engine.rb index f9b8474104f56..be44399bc7494 100644 --- a/decidim-blogs/lib/decidim/blogs/engine.rb +++ b/decidim-blogs/lib/decidim/blogs/engine.rb @@ -21,6 +21,11 @@ class Engine < ::Rails::Engine get "/", to: redirect("posts", status: 301) end + initializer "decidim_blogs.register_icons" do + Decidim.icons.register(name: "Decidim::Blogs::Post", icon: "pen-nib-line", description: "Blogs post", category: "activity", engine: :core) + Decidim.icons.register(name: "list-check", icon: "list-check", category: "system", description: "", engine: :blogs) + end + initializer "decidim_blogs.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Blogs::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Blogs::Engine.root}/app/views") # for partials diff --git a/decidim-budgets/app/cells/decidim/budgets/project_voted_hint_cell.rb b/decidim-budgets/app/cells/decidim/budgets/project_voted_hint_cell.rb index 034fed88d1ea2..e5aea5aa48851 100644 --- a/decidim-budgets/app/cells/decidim/budgets/project_voted_hint_cell.rb +++ b/decidim-budgets/app/cells/decidim/budgets/project_voted_hint_cell.rb @@ -18,7 +18,7 @@ def show def hint contents = [] - contents << icon("check", role: "img", "aria-hidden": true) + contents << icon("check-line", role: "img", "aria-hidden": true) contents << " " contents << t("decidim.budgets.projects.project.you_voted") end diff --git a/decidim-budgets/app/views/decidim/budgets/admin/projects/_project-tr.html.erb b/decidim-budgets/app/views/decidim/budgets/admin/projects/_project-tr.html.erb index 7f1b261b19662..c19e1e13a4e6e 100644 --- a/decidim-budgets/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +++ b/decidim-budgets/app/views/decidim/budgets/admin/projects/_project-tr.html.erb @@ -25,7 +25,7 @@ <% if project.selected? %> <%= content_tag :strong, t("projects.index.selected", scope: "decidim.budgets.admin"), class: "text-success" %> <% else %> - <%= content_tag :span, "x", class: "text-muted" %> + <%= content_tag :span, "close-line", class: "text-muted" %> <% end %> diff --git a/decidim-budgets/lib/decidim/budgets/engine.rb b/decidim-budgets/lib/decidim/budgets/engine.rb index cf8afcb47a01e..60b7ab3c2f437 100644 --- a/decidim-budgets/lib/decidim/budgets/engine.rb +++ b/decidim-budgets/lib/decidim/budgets/engine.rb @@ -26,6 +26,15 @@ class Engine < ::Rails::Engine get "/", to: redirect("budgets", status: 301) end + initializer "decidim_budgets.register_icons" do + Decidim.icons.register(name: "Decidim::Budgets::Budget", icon: "coin-line", description: "Budget", category: "activity", engine: :budgets) + Decidim.icons.register(name: "Decidim::Budgets::Project", icon: "coin-line", description: "Project (Budgets)", category: "activity", engine: :budgets) + Decidim.icons.register(name: "Decidim::Budgets::Order", icon: "check-double-fill", description: "Budget voting", category: "activity", engine: :budgets) + + Decidim.icons.register(name: "git-pull-request-line", icon: "git-pull-request-line", category: "system", description: "", engine: :budgets) + Decidim.icons.register(name: "list-check", icon: "list-check", category: "system", description: "", engine: :budgets) + end + initializer "decidim_budgets.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Budgets::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Budgets::Engine.root}/app/views") # for partials diff --git a/decidim-comments/lib/decidim/comments/engine.rb b/decidim-comments/lib/decidim/comments/engine.rb index ab60146e61765..9c21644cdfc1e 100644 --- a/decidim-comments/lib/decidim/comments/engine.rb +++ b/decidim-comments/lib/decidim/comments/engine.rb @@ -37,6 +37,19 @@ class Engine < ::Rails::Engine end end + initializer "decidim_comments.register_icons" do + common_parameters = { category: "action", engine: :comments } + + Decidim.icons.register(name: "Decidim::Comments::Comment", icon: "chat-1-line", description: "Comment", category: "activity", engine: :comments) + Decidim.icons.register(name: "comments_count", icon: "wechat-line", description: "Comments Count", category: "activity", engine: :comments) + + Decidim.icons.register(name: "thumb-up-line", icon: "thumb-up-line", description: "Upvote comment button", **common_parameters) + Decidim.icons.register(name: "thumb-up-fill", icon: "thumb-up-fill", description: "User upvoted comment", **common_parameters) + Decidim.icons.register(name: "thumb-down-line", icon: "thumb-down-line", description: "Downvote comment button", **common_parameters) + Decidim.icons.register(name: "thumb-down-fill", icon: "thumb-down-fill", description: "User downvoted comment", **common_parameters) + Decidim.icons.register(name: "edit-line", icon: "edit-line", description: "Edit comment button", **common_parameters) + end + initializer "decidim_comments.register_metrics" do Decidim.metrics_registry.register(:comments) do |metric_registry| metric_registry.manager_class = "Decidim::Comments::Metrics::CommentsMetricManage" diff --git a/decidim-conferences/lib/decidim/conferences/engine.rb b/decidim-conferences/lib/decidim/conferences/engine.rb index 29eefd088e95c..f5356d35699d3 100644 --- a/decidim-conferences/lib/decidim/conferences/engine.rb +++ b/decidim-conferences/lib/decidim/conferences/engine.rb @@ -51,6 +51,16 @@ class Engine < ::Rails::Engine end end + initializer "decidim_conferences.register_icons" do + Decidim.icons.register(name: "Decidim::Conference", icon: "mic-line", description: "Conference", category: "activity", engine: :conferences) + Decidim.icons.register(name: "conference_speaker", icon: "user-voice-line", description: "Speaker", category: "conferences", engine: :conferences) + + Decidim.icons.register(name: "film-line", icon: "film-line", category: "system", description: "", engine: :conferences) + Decidim.icons.register(name: "ticket-line", icon: "ticket-line", category: "system", description: "", engine: :conferences) + Decidim.icons.register(name: "user-follow-line", icon: "user-follow-line", category: "system", description: "", engine: :conferences) + Decidim.icons.register(name: "link-m", icon: "link-m", category: "system", description: "", engine: :conferences) + end + initializer "decidim_conferences.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Conferences::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Conferences::Engine.root}/app/views") # for partials diff --git a/decidim-core/app/cells/decidim/author/endorsements.erb b/decidim-core/app/cells/decidim/author/endorsements.erb index 51fb023f0916d..6ee8c64217597 100644 --- a/decidim-core/app/cells/decidim/author/endorsements.erb +++ b/decidim-core/app/cells/decidim/author/endorsements.erb @@ -1,4 +1,4 @@ <%= link_to "#{resource_locator(from_context).path}#list-of-endorsements", title: t("decidim.author.endorsements", count: from_context.endorsements_count), class: "author__metadata" do %> - <%= icon "heart-add-line" if show_icons? %> + <%= icon "like" if show_icons? %> <%= from_context.endorsements_count %> <%= t("decidim.author.endorsements", count: from_context.endorsements_count) %> <% end %> diff --git a/decidim-core/app/cells/decidim/author/withdraw.erb b/decidim-core/app/cells/decidim/author/withdraw.erb index 90c1bc3717a0c..19b4a543a6489 100644 --- a/decidim-core/app/cells/decidim/author/withdraw.erb +++ b/decidim-core/app/cells/decidim/author/withdraw.erb @@ -1,4 +1,4 @@ <%= action_authorized_link_to :withdraw, withdraw_path, method: :put, class: "title-action__action button small hollow", title: t("withdraw_btn_hint", scope: resource_i18n_scope ), data: { confirm: t("withdraw_confirmation_html", scope: resource_i18n_scope ) } do %> <%= t("withdraw_#{resource_name}", scope: resource_i18n_scope) %> - <%= icon "x", role: "img", "aria-hidden": true %> + <%= icon "close-line", role: "img", "aria-hidden": true %> <% end %> diff --git a/decidim-core/app/cells/decidim/date_range/show.erb b/decidim-core/app/cells/decidim/date_range/show.erb index 604afeb095f1e..33d6b05c85346 100644 --- a/decidim-core/app/cells/decidim/date_range/show.erb +++ b/decidim-core/app/cells/decidim/date_range/show.erb @@ -17,7 +17,7 @@ <%= l start_time, format: "%H:%M" %> - <%= icon "arrow-thin-right" %> + <%= icon "arrow-right-line" %>
<%= l end_time, format: "%d" %> diff --git a/decidim-core/app/cells/decidim/wizard_step_form/wizard_aside.erb b/decidim-core/app/cells/decidim/wizard_step_form/wizard_aside.erb index 94008c4913280..9a662236afa6b 100644 --- a/decidim-core/app/cells/decidim/wizard_step_form/wizard_aside.erb +++ b/decidim-core/app/cells/decidim/wizard_step_form/wizard_aside.erb @@ -2,7 +2,7 @@ <% if wizard_aside_back_url %>
<%= link_to wizard_aside_back_url do %> - <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %> + <%= icon "arrow-left-s-line", class: "icon--small", role: "img", "aria-hidden": true %> <%= i18n_wizard_aside_back %> <% end %>
diff --git a/decidim-core/app/helpers/concerns/decidim/flash_helper_extensions.rb b/decidim-core/app/helpers/concerns/decidim/flash_helper_extensions.rb index 5d249ca2cbca4..9fc73c2f864a1 100644 --- a/decidim-core/app/helpers/concerns/decidim/flash_helper_extensions.rb +++ b/decidim-core/app/helpers/concerns/decidim/flash_helper_extensions.rb @@ -74,7 +74,11 @@ def flash_icon(alert_class) secondary: "information-line", alert: "alert-line", warning: "alert-line", - success: "checkbox-circle-line" + success: "checkbox-circle-line", + info: "information-line", + notice: "checkbox-circle-line", + primary: "checkbox-circle-line", + error: "alert-line" } content_tag(:div, class: "flash__icon") do diff --git a/decidim-core/app/helpers/decidim/decidim_form_helper.rb b/decidim-core/app/helpers/decidim/decidim_form_helper.rb index 2259643697d42..ea34168226485 100644 --- a/decidim-core/app/helpers/decidim/decidim_form_helper.rb +++ b/decidim-core/app/helpers/decidim/decidim_form_helper.rb @@ -210,7 +210,7 @@ def base_error_messages(record) return unless record.respond_to?(:errors) return unless record.errors[:base].any? - alert_box(record.errors.full_messages_for(:base).join(","), "alert", false) + alert_box(record.errors.full_messages_for(:base).join(","), :alert, false) end # Handle which collection to pass to Decidim::FilterFormBuilder.areas_select diff --git a/decidim-core/app/helpers/decidim/icon_helper.rb b/decidim-core/app/helpers/decidim/icon_helper.rb index 1e6e586023743..99156a77b0787 100644 --- a/decidim-core/app/helpers/decidim/icon_helper.rb +++ b/decidim-core/app/helpers/decidim/icon_helper.rb @@ -5,68 +5,6 @@ module Decidim module IconHelper include Decidim::LayoutHelper - DEFAULT_RESOURCE_TYPE_ICONS = { - "Decidim::Proposals::CollaborativeDraft" => { icon: "draft-line", description: "Collaborative draft", category: "activity" }, - "Decidim::Proposals::Proposal" => { icon: "chat-new-line", description: "Proposal", category: "activity" }, - "Decidim::Amendment" => { icon: "git-branch-line", description: "Amendment", category: "activity" }, - "Decidim::ParticipatoryProcess" => { icon: "treasure-map-line", description: "Participatory Process", category: "activity" }, - "Decidim::Budgets::Budget" => { icon: "coin-line", description: "Budget", category: "activity" }, - "Decidim::Budgets::Project" => { icon: "coin-line", description: "Project (Budgets)", category: "activity" }, - "Decidim::Accountability::Result" => { icon: "briefcase-2-line", description: "Result / project (Accountability)", category: "activity" }, - "Decidim::Initiative" => { icon: "lightbulb-flash-line", description: "Initiative", category: "activity" }, - "Decidim::Blogs::Post" => { icon: "pen-nib-line", description: "Blogs post", category: "activity" }, - "Decidim::Assembly" => { icon: "government-line", description: "Assembly", category: "activity" }, - "Decidim::Budgets::Order" => { icon: "check-double-fill", description: "Budget voting", category: "activity" }, - "Decidim::Debates::Debate" => { icon: "discuss-line", description: "Debate", category: "activity" }, - "Decidim::Meetings::Meeting" => { icon: "map-pin-line", description: "Meeting", category: "activity" }, - "Decidim::Conference" => { icon: "mic-line", description: "Conference", category: "activity" }, - "Decidim::Votings::Voting" => { icon: "check-double-fill", description: "Voting", category: "activity" }, - "Decidim::Elections::Election" => { icon: "chat-poll-line", description: "Election", category: "activity" }, - "Decidim::Comments::Comment" => { icon: "chat-1-line", description: "Comment", category: "activity" }, - "Decidim::Category" => { icon: "price-tag-3-line", description: "Category", category: "activity" }, - "Decidim::Scope" => { icon: "scan-line", description: "Scope", category: "activity" }, - "Decidim::User" => { icon: "user-line", description: "User", category: "activity" }, - "Decidim::UserGroup" => { icon: "group-line", description: "User Group", category: "activity" }, - "comments_count" => { icon: "wechat-line", description: "Comments Count", category: "activity" }, - - "like" => { icon: "heart-add-line", description: "Like", category: "action" }, - "dislike" => { icon: "dislike-line", description: "Dislike", category: "action" }, - "follow" => { icon: "notification-3-line", description: "Follow", category: "action" }, - "unfollow" => { icon: "notification-3-fill", description: "Unfollow", category: "action" }, - "share" => { icon: "share-line", description: "Share", category: "action" }, - - "nickname" => { icon: "account-pin-circle-line", description: "Nickname", category: "profile" }, - "badges" => { icon: "award-line", description: "Badges", category: "profile" }, - "profile" => { icon: "team-line", description: "Groups", category: "profile" }, - "user_group" => { icon: "team-line", description: "Groups", category: "profile" }, - "link" => { icon: "link", description: "web / URL", category: "profile" }, - "following" => { icon: "eye-2-line", description: "Following", category: "profile" }, - "activity" => { icon: "bubble-chart-line", description: "Activity", category: "profile" }, - "followers" => { icon: "group-line", description: "Followers", category: "profile" }, - - "documents" => { icon: "file-text-line", description: "Document", category: "documents" }, - "folder_open" => { icon: "folder-open-line", description: "Folder open", category: "documents" }, - "folder_close" => { icon: "folder-line", description: "Folder close", category: "documents" }, - "document_weight" => { icon: "scales-2-line", description: "Doc. weight (kb/mb)", category: "documents" }, - "document_download" => { icon: "download-line", description: "Download", category: "documents" }, - "images" => { icon: "image-line", description: "Images", category: "documents" }, - - "all" => { icon: "apps-2-line", description: "All", category: "other" }, - "other" => { icon: "question-line", description: "Other", category: "other" }, - - # Modules - - "in_person" => { icon: "community-line", description: "In person", category: "meetings" }, - "online" => { icon: "webcam-line", description: "Online", category: "meetings" }, - "hybrid" => { icon: "home-wifi-line", description: "Hybrid", category: "meetings" }, - - "assembly_type" => { icon: "group-2-line", description: "Type", category: "assemblies" }, - - "conference_speaker" => { icon: "user-voice-line", description: "Speaker", category: "conferences" }, - - "participatory_texts_item" => { icon: "bookmark-line", description: "Index item", category: "participatory_texts" } - }.freeze - # Public: Returns an icon given an instance of a Component. It defaults to # a question mark when no icon is found. # @@ -103,15 +41,15 @@ def manifest_icon(manifest, options = {}) # Returns an HTML tag with the icon. def resource_icon(resource, options = {}) if resource.instance_of?(Decidim::Comments::Comment) - icon "comment-square", options + icon "chat-1-line", options elsif resource.respond_to?(:component) && resource.component.present? component_icon(resource.component, options) elsif resource.respond_to?(:manifest) && resource.manifest.present? manifest_icon(resource.manifest, options) elsif resource.is_a?(Decidim::User) - icon "person", options + icon "user-line", options else - icon "bell", options + icon "notification-3-line", options end end @@ -120,7 +58,9 @@ def resource_type_icon(resource_type, options = {}) end def resource_type_icon_key(resource_type) - DEFAULT_RESOURCE_TYPE_ICONS.dig(resource_type.to_s, :icon) || DEFAULT_RESOURCE_TYPE_ICONS["other"][:icon] + return resource_type.to_s if Decidim.icons.all[resource_type.to_s] + + "other" end def text_with_resource_icon(resource_name, text) diff --git a/decidim-core/app/helpers/decidim/layout_helper.rb b/decidim-core/app/helpers/decidim/layout_helper.rb index 4c517b75d3c78..6d3a5a422abe4 100644 --- a/decidim-core/app/helpers/decidim/layout_helper.rb +++ b/decidim-core/app/helpers/decidim/layout_helper.rb @@ -47,6 +47,8 @@ def legacy_favicon # # Returns a String. def icon(name, options = {}) + name = Decidim.icons.find(name)["icon"] unless options[:ignore_missing] + default_html_properties = { "width" => "1em", "height" => "1em", diff --git a/decidim-core/app/helpers/decidim/messaging/conversation_helper.rb b/decidim-core/app/helpers/decidim/messaging/conversation_helper.rb index 11e6e97fb4717..236adb52451ca 100644 --- a/decidim-core/app/helpers/decidim/messaging/conversation_helper.rb +++ b/decidim-core/app/helpers/decidim/messaging/conversation_helper.rb @@ -49,11 +49,11 @@ def link_to_current_or_new_conversation_with(user, title = t("decidim.contact")) conversation_path = current_or_new_conversation_path_with(user) if conversation_path link_to(conversation_path, title:) do - icon "envelope-closed", aria_label: title, class: "icon--small" + icon "mail-send-line", aria_label: title, class: "icon--small" end else content_tag :span, title: t("decidim.user_contact_disabled"), data: { tooltip: true } do - icon "envelope-closed", aria_label: title, class: "icon--small muted" + icon "mail-send-line", aria_label: title, class: "icon--small muted" end end end diff --git a/decidim-core/app/helpers/decidim/omniauth_helper.rb b/decidim-core/app/helpers/decidim/omniauth_helper.rb index 6b0bc764e3d18..7511c6649c85a 100644 --- a/decidim-core/app/helpers/decidim/omniauth_helper.rb +++ b/decidim-core/app/helpers/decidim/omniauth_helper.rb @@ -15,14 +15,17 @@ def normalize_provider_name(provider) def oauth_icon(provider) info = current_organization.enabled_omniauth_providers[provider.to_sym] + name = normalize_provider_name(provider) + name = "twitter-x" if provider == :twitter + name = "#{name}-fill" + if info icon_path = info[:icon_path] return external_icon(icon_path) if icon_path - name = info[:icon] + name = info[:icon] if info[:icon] end - name ||= normalize_provider_name(provider) icon(name) end diff --git a/decidim-core/app/helpers/decidim/social_share_button_helper.rb b/decidim-core/app/helpers/decidim/social_share_button_helper.rb index 4ce0c47daac57..5d6b1436880de 100644 --- a/decidim-core/app/helpers/decidim/social_share_button_helper.rb +++ b/decidim-core/app/helpers/decidim/social_share_button_helper.rb @@ -21,12 +21,6 @@ def render_social_share_button(service, title, args) uri = service.formatted_share_uri(title, args) return unless uri - social_icon = if service.icon.include? ".svg" - image_tag service.icon_path, alt: t("decidim.shared.share_modal.share_to", service: service.name) - else - icon(service.icon, style: "color: #{service.icon_color};") - end - link_to( uri, rel: "nofollow noopener noreferrer", @@ -38,7 +32,15 @@ def render_social_share_button(service, title, args) }, title: t("decidim.shared.share_modal.share_to", service: service.name) ) do - social_icon + content_tag(:span, service.name) + render_social_share_icon(service) + content_tag(:span, service.name) + end + end + + def render_social_share_icon(service, options = {}) + if service.icon.include? ".svg" + image_tag service.icon_path, options.merge(alt: t("decidim.shared.share_modal.share_to", service: service.name)) + else + icon(service.icon, options.merge(ignore_missing: true, style: "color: #{service.icon_color};")) end end diff --git a/decidim-core/lib/decidim/core.rb b/decidim-core/lib/decidim/core.rb index 5c53226198fef..1cc459eb35ab3 100644 --- a/decidim-core/lib/decidim/core.rb +++ b/decidim-core/lib/decidim/core.rb @@ -121,6 +121,7 @@ module Decidim autoload :ParticipatorySpaceUser, "decidim/participatory_space_user" autoload :ModerationTools, "decidim/moderation_tools" autoload :ContentSecurityPolicy, "decidim/content_security_policy" + autoload :IconRegistry, "decidim/icon_registry" include ActiveSupport::Configurable # Loads seeds from all engines. @@ -746,6 +747,10 @@ def self.menu(name, &) MenuRegistry.register(name.to_sym, &) end + def self.icons + @icons ||= Decidim::IconRegistry.new + end + # Public: Stores an instance of ViewHooks def self.view_hooks @view_hooks ||= ViewHooks.new diff --git a/decidim-core/lib/decidim/core/engine.rb b/decidim-core/lib/decidim/core/engine.rb index fe2147ebb554c..221dcaf3f3037 100644 --- a/decidim-core/lib/decidim/core/engine.rb +++ b/decidim-core/lib/decidim/core/engine.rb @@ -57,6 +57,164 @@ class Engine < ::Rails::Engine isolate_namespace Decidim engine_name "decidim" + initializer "decidim_core.register_icons", after: "decidim_core.add_social_share_services" do + Decidim.icons.register(name: "phone-line", icon: "phone-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "upload-cloud-2-line", icon: "upload-cloud-2-line", category: "system", + description: "Upload cloud 2 line used in attachments form", engine: :core) + Decidim.icons.register(name: "arrow-right-line", icon: "arrow-right-line", category: "system", + description: "Arrow right line icon used in attachments form", engine: :core) + Decidim.icons.register(name: "arrow-left-s-fill", icon: "arrow-left-s-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "flag-line", icon: "flag-line", category: "system", description: "Flag line icon", engine: :core) + Decidim.icons.register(name: "check-line", icon: "check-line", category: "system", description: "Check icon", engine: :core) + Decidim.icons.register(name: "question-line", icon: "question-line", category: "system", description: "Question icon", engine: :core) + Decidim.icons.register(name: "close-line", icon: "close-line", category: "system", description: "Close icon", engine: :core) + Decidim.icons.register(name: "save-line", icon: "save-line", category: "system", description: "Save icon", engine: :core) + Decidim.icons.register(name: "search-line", icon: "search-line", category: "system", description: "Search icon", engine: :core) + Decidim.icons.register(name: "timer-line", icon: "timer-line", category: "system", description: "Timer icon", engine: :core) + Decidim.icons.register(name: "arrow-down-s-line", icon: "arrow-down-s-line", category: "system", description: "Arrow down icon", engine: :core) + Decidim.icons.register(name: "arrow-up-s-line", icon: "arrow-up-s-line", category: "system", description: "Arrow up icon", engine: :core) + Decidim.icons.register(name: "road-map-line", icon: "road-map-line", category: "system", description: "Road map icon", engine: :core) + Decidim.icons.register(name: "bubble-chart-line", icon: "bubble-chart-line", category: "system", description: "Road map icon", engine: :core) + Decidim.icons.register(name: "user-smile-line", icon: "user-smile-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "account-circle-line", icon: "account-circle-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "notification-3-line", icon: "notification-3-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "mail-send-line", icon: "mail-send-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "logout-box-r-line", icon: "logout-box-r-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "menu-line", icon: "menu-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "home-2-line", icon: "home-2-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "global-line", icon: "global-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "creative-commons-line", icon: "creative-commons-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "creative-commons-by-line", icon: "creative-commons-by-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "creative-commons-sa-line", icon: "creative-commons-sa-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "delete-bin-line", icon: "delete-bin-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "loader-3-line", icon: "loader-3-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "share-line", icon: "share-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "file-copy-line", icon: "file-copy-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "check-double-line", icon: "check-double-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "arrow-drop-down-line", icon: "arrow-drop-down-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "login-box-line", icon: "login-box-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "direction-line", icon: "direction-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "newspaper-line", icon: "newspaper-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "alert-line", icon: "alert-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "checkbox-circle-line", icon: "checkbox-circle-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "equalizer-line", icon: "equalizer-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "dashboard-line", icon: "dashboard-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "information-line", icon: "information-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "question-answer-line", icon: "question-answer-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "account-pin-circle-line", icon: "account-pin-circle-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "link", icon: "link", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "award-line", icon: "award-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "eye-2-line", icon: "eye-2-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "group-line", icon: "group-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "team-line", icon: "team-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "apps-2-line", icon: "apps-2-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "chat-1-line", icon: "chat-1-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "discuss-line", icon: "discuss-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "lightbulb-flash-line", icon: "lightbulb-flash-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "map-pin-line", icon: "map-pin-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "pen-nib-line", icon: "pen-nib-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "pencil-line", icon: "pencil-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "close-circle-line", icon: "close-circle-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "contacts-line", icon: "contacts-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "user-settings-line", icon: "user-settings-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "user-star-line", icon: "user-star-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "user-add-line", icon: "user-add-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "share-forward-line", icon: "share-forward-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "star-s-fill", icon: "star-s-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "arrow-left-line", icon: "arrow-left-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "file-3-line", icon: "file-3-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "play-fill", icon: "play-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "fingerprint-line", icon: "fingerprint-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "list-check-2", icon: "list-check-2", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "notification-3-fill", icon: "notification-3-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "pages-line", icon: "pages-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "mail-add-line", icon: "mail-add-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "tools-line", icon: "tools-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "eye-line", icon: "eye-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "government-line", icon: "government-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "mail-line", icon: "mail-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "live-line", icon: "live-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "home-gear-line", icon: "home-gear-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "check-double-fill", icon: "check-double-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "file-list-3-line", icon: "file-list-3-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "price-tag-3-line", icon: "price-tag-3-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "time-line", icon: "time-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "calendar-line", icon: "calendar-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "question-mark", icon: "question-mark", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "arrow-left-s-line", icon: "arrow-left-s-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "user-line", icon: "user-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "mic-line", icon: "mic-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "coin-line", icon: "coin-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "external-link-line", icon: "external-link-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "arrow-down-s-fill", icon: "arrow-down-s-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "arrow-up-s-fill", icon: "arrow-up-s-fill", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "treasure-map-line", icon: "treasure-map-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "chat-new-line", icon: "chat-new-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "draft-line", icon: "draft-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "user-voice-line", icon: "user-voice-line", category: "system", description: "", engine: :core) + + # Attachments + Decidim.icons.register(name: "file-text-line", icon: "file-text-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "scales-2-line", icon: "scales-2-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "image-line", icon: "image-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "error-warning-line", icon: "error-warning-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "folder-open-line", icon: "folder-open-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "dislike-line", icon: "dislike-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "chat-poll-line", icon: "chat-poll-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "git-branch-line", icon: "git-branch-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "calendar-todo-line", icon: "calendar-todo-line", category: "system", description: "", engine: :core) + Decidim.icons.register(name: "home-8-line", icon: "home-8-line", category: "system", description: "", engine: :core) + + Decidim.icons.register(name: "like", icon: "heart-add-line", description: "Like", category: "action", engine: :core) + Decidim.icons.register(name: "dislike", icon: "dislike-line", description: "Dislike", category: "action", engine: :core) + + # Refactor later: Some of the icons here are duplicated, and it would be a greater refactor to remove the duplicates + Decidim.icons.register(name: "Decidim::Amendment", icon: "git-branch-line", category: "activity", description: "Amendment", engine: :core) + Decidim.icons.register(name: "Decidim::Category", icon: "price-tag-3-line", description: "Category", category: "activity", engine: :core) + Decidim.icons.register(name: "Decidim::Scope", icon: "scan-line", description: "Scope", category: "activity", engine: :core) + Decidim.icons.register(name: "Decidim::User", icon: "user-line", description: "User", category: "activity", engine: :core) + Decidim.icons.register(name: "Decidim::UserGroup", icon: "group-line", description: "User Group", category: "activity", engine: :core) + Decidim.icons.register(name: "follow", icon: "notification-3-line", description: "Follow", category: "action", engine: :core) + Decidim.icons.register(name: "unfollow", icon: "notification-3-fill", description: "Unfollow", category: "action", engine: :core) + Decidim.icons.register(name: "share", icon: "share-line", description: "Share", category: "action", engine: :core) + Decidim.icons.register(name: "nickname", icon: "account-pin-circle-line", description: "Nickname", category: "profile", engine: :core) + Decidim.icons.register(name: "badges", icon: "award-line", description: "Badges", category: "profile", engine: :core) + Decidim.icons.register(name: "profile", icon: "team-line", description: "Groups", category: "profile", engine: :core) + Decidim.icons.register(name: "user_group", icon: "team-line", description: "Groups", category: "profile", engine: :core) + Decidim.icons.register(name: "link", icon: "link", description: "web / URL", category: "profile", engine: :core) + Decidim.icons.register(name: "following", icon: "eye-2-line", description: "Following", category: "profile", engine: :core) + Decidim.icons.register(name: "activity", icon: "bubble-chart-line", description: "Activity", category: "profile", engine: :core) + Decidim.icons.register(name: "followers", icon: "group-line", description: "Followers", category: "profile", engine: :core) + Decidim.icons.register(name: "documents", icon: "file-text-line", description: "Document", category: "documents", engine: :core) + Decidim.icons.register(name: "folder_open", icon: "folder-open-line", description: "Folder open", category: "documents", engine: :core) + Decidim.icons.register(name: "folder_close", icon: "folder-line", description: "Folder close", category: "documents", engine: :core) + Decidim.icons.register(name: "document_weight", icon: "scales-2-line", description: "Doc. weight (kb/mb)", category: "documents", engine: :core) + Decidim.icons.register(name: "document_download", icon: "download-line", description: "Download", category: "documents", engine: :core) + Decidim.icons.register(name: "images", icon: "image-line", description: "Images", category: "documents", engine: :core) + Decidim.icons.register(name: "all", icon: "apps-2-line", description: "All", category: "other", engine: :core) + Decidim.icons.register(name: "other", icon: "question-line", description: "Other", category: "other", engine: :core) + + # social icons + Decidim.icons.register(name: "wechat-line", icon: "wechat-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "linkedin-box-fill", icon: "linkedin-box-fill", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "twitter-x-line", icon: "twitter-x-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "whatsapp-line", icon: "whatsapp-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "telegram-line", icon: "telegram-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "twitter-x-fill", icon: "twitter-x-fill", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "google-fill", icon: "google-fill", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "facebook-fill", icon: "facebook-fill", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "instagram-line", icon: "instagram-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "youtube-line", icon: "youtube-line", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "github-fill", icon: "github-fill", category: "social icon", description: "", engine: :core) + Decidim.icons.register(name: "facebook-circle-line", icon: "facebook-circle-line", category: "social icon", description: "", engine: :core) + end + initializer "decidim_core.patch_webpacker", before: "shakapacker.version_checker" do ENV["SHAKAPACKER_CONFIG"] = Decidim::Webpacker.configuration.configuration_file end diff --git a/decidim-core/lib/decidim/icon_registry.rb b/decidim-core/lib/decidim/icon_registry.rb new file mode 100644 index 0000000000000..c0f0781f10d16 --- /dev/null +++ b/decidim-core/lib/decidim/icon_registry.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Decidim + class IconRegistry + def initialize + @icons = ActiveSupport::HashWithIndifferentAccess.new + end + + # It allows detecting with icons are valid remixicons icons, and also for documenting them in the + # `decidim-design` (aka Decidim Design Guide or DDG). + # + # Some of these fields are used to load and work with the icon (`name` and `icon`) and others are + # for documentation purposes in DDG (`category`, `description`, and `engine`). + # + # @param name [String] The name of the icon. It will be used to find the icon later. + # @param icon [String] The id of the icon. It will be used to load the icon from remixicon library. + # @param category [String] The category name. It will be used to group the icons by category. + # @param description [String] The description of the icon. It will be used to show the purpose of the icon in DDG. + # @param engine [String] The engine name. It is used internally to identify the module where the icon is being used. + def register(name:, icon:, description:, category:, engine:) + ActiveSupport::Deprecation.warn("#{name} already registered. #{@icons[name].inspect}") if @icons[name] + + @icons[name] = { name:, icon:, description:, category:, engine: } + end + + def find(name) + if name.blank? + ActiveSupport::Deprecation.warn "The requested icon is blank." + name = "other" + end + + @icons[name] || deprecated(name) + end + + def all + @icons + end + + def categories(field = :category) + all.values.group_by { |d| d[field].try(:to_s) } + end + + private + + def deprecated(name) + message = %{Icon #{name} not found. Register it with \n + Decidim.icons.register(name: "#{name}", icon: "#{name}", category: "system", description: "", engine: :core) + } + + ActiveSupport::Deprecation.warn(message) + raise message if Rails.env.development? || Rails.env.test? + end + end +end diff --git a/decidim-core/spec/cells/decidim/navbar_admin_link_cell_spec.rb b/decidim-core/spec/cells/decidim/navbar_admin_link_cell_spec.rb index 8357c967ab105..3f76bc0110e6a 100644 --- a/decidim-core/spec/cells/decidim/navbar_admin_link_cell_spec.rb +++ b/decidim-core/spec/cells/decidim/navbar_admin_link_cell_spec.rb @@ -34,7 +34,7 @@ let(:link_options) do { name: "Answer", - icon: "comment-square" + icon: "chat-1-line" } end @@ -47,7 +47,7 @@ end it "renders the custom icon: comment" do - expect(subject).to have_css("svg [href*='#ri-comment-square']") + expect(subject).to have_css("svg [href*='#ri-chat-1-line']") end end end diff --git a/decidim-core/spec/helpers/decidim/icon_helper_spec.rb b/decidim-core/spec/helpers/decidim/icon_helper_spec.rb index a30c7edbf3239..c3c49e35d9d95 100644 --- a/decidim-core/spec/helpers/decidim/icon_helper_spec.rb +++ b/decidim-core/spec/helpers/decidim/icon_helper_spec.rb @@ -74,7 +74,7 @@ module Decidim let(:resource) { build(:user) } it "renders a person icon" do - expect(result).to include("svg#ri-person") + expect(result).to include("svg#ri-user-line") end end @@ -86,7 +86,7 @@ module Decidim end it "renders a generic icon" do - expect(result).to include("svg#ri-bell") + expect(result).to include("svg#ri-notification-3-line") end end @@ -106,7 +106,7 @@ module Decidim let(:resource) { "Something" } it "renders a generic icon" do - expect(result).to include("svg#ri-bell") + expect(result).to include("svg#ri-notification-3-line") end end end diff --git a/decidim-core/spec/lib/icon_registry_spec.rb b/decidim-core/spec/lib/icon_registry_spec.rb new file mode 100644 index 0000000000000..2cfaaa9c5d229 --- /dev/null +++ b/decidim-core/spec/lib/icon_registry_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require "spec_helper" + +module Decidim + describe IconRegistry do + subject { described_class.new } + + let(:icon1) { { "name" => "my Icon", "icon" => "foo-bar", "description" => "some description", "category" => "action", "engine" => :core } } + let(:icon2) { { "name" => "my Icon 1", "icon" => "foo-bar", "description" => "some description", "category" => "other_category", "engine" => :core } } + let(:icon3) { { "name" => "my Icon 2", "icon" => "foo-bar", "description" => "some description", "category" => "action", "engine" => :core } } + let(:other) { { "name" => "other", "icon" => "question-line", "description" => "Other", "category" => "other_category", "engine" => :core } } + + before do + subject.register(**icon1.symbolize_keys) + subject.register(**icon2.symbolize_keys) + subject.register(**icon3.symbolize_keys) + subject.register(**other.symbolize_keys) + end + + describe "#register" do + it "registers multiple icons" do + expect(subject.all.size).to eq(4) + expect(subject.find("my Icon")).to eq(icon1) + expect(subject.find("my Icon 1")).to eq(icon2) + expect(subject.find("my Icon 2")).to eq(icon3) + end + + context "when name is the same" do + let(:icon2) { icon1.merge("name" => "my Icon") } + + it "overrides the icon if it already exists" do + expect(subject.all.size).to eq(3) + expect(subject.find("my Icon")).to eq(icon2) + end + end + end + + describe "#find" do + it "raises error when name is blank" do + expect(subject.find("")).to eq(other) + end + end + + describe "#categories" do + it "groups icons by category" do + expect(subject.categories).to eq({ "action" => [icon1, icon3], "other_category" => [icon2, other] }) + end + + it "groups icons by engine" do + expect(subject.categories(:engine)).to eq({ "core" => [icon1, icon2, icon3, other] }) + end + end + + describe "#all" do + it "returns all registered icons" do + expect(subject.all).to eq({ "my Icon" => icon1, "my Icon 1" => icon2, "my Icon 2" => icon3, "other" => other }) + end + end + end +end diff --git a/decidim-debates/lib/decidim/debates/engine.rb b/decidim-debates/lib/decidim/debates/engine.rb index a80b9843b6e8a..20ad01c01fcd6 100644 --- a/decidim-debates/lib/decidim/debates/engine.rb +++ b/decidim-debates/lib/decidim/debates/engine.rb @@ -21,6 +21,11 @@ class Engine < ::Rails::Engine get "/", to: redirect("debates", status: 301) end + initializer "decidim_debates.register_icons" do + Decidim.icons.register(name: "Decidim::Debates::Debate", icon: "discuss-line", description: "Debate", category: "activity", engine: :debates) + Decidim.icons.register(name: "add-fill", icon: "add-fill", category: "system", description: "", engine: :debates) + end + initializer "decidim_debates.settings_changes" do config.to_prepare do Decidim::SettingsChange.subscribe "debates" do |changes| diff --git a/decidim-design/app/helpers/decidim/design/iconography_helper.rb b/decidim-design/app/helpers/decidim/design/iconography_helper.rb index 567222bda316b..559685c45b14e 100644 --- a/decidim-design/app/helpers/decidim/design/iconography_helper.rb +++ b/decidim-design/app/helpers/decidim/design/iconography_helper.rb @@ -4,29 +4,65 @@ module Decidim module Design module IconographyHelper include Decidim::IconHelper + include Decidim::SocialShareButtonHelper def iconography_sections - DEFAULT_RESOURCE_TYPE_ICONS.values.group_by { |d| d[:category] }.map do |category, values| + (remix_icons + social_share_icons).sort_by { |section| section[:id] } + end + + def iconography_table(table_rows) + options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" } + table_rows.map do |table_cell| + row = [] + + row << icon(table_cell[:icon], **options) + row << content_tag(:code, table_cell[:icon]) + row << table_cell[:category] + row << table_cell[:description] + + row + end + end + + def remix_icons + Decidim.icons.categories.map do |category, values| { id: category, contents: [ { type: :table, - options: { headings: %w(Icon Code Description) }, - items: iconography_table(values) + options: { headings: %w(Icon Code Category Description) }, + items: iconography_table(values.sort_by { |v| v[:icon] }) } ] } end end - def iconography_table(table_rows) - table_rows.map do |table_cell| + def social_share_icons + [ + { + id: "social-share", + contents: [ + { + type: :table, + options: { headings: %w(Icon Code Category Description) }, + items: social_share_iconography_table + } + ] + } + ] + end + + def social_share_iconography_table + options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" } + Decidim.social_share_services_registry.manifests.map do |service| row = [] - row << icon(table_cell[:icon], class: "mx-auto w-4 h-4 text-gray fill-current flex-none") - row << content_tag(:code, table_cell[:icon]) - row << table_cell[:description] + row << render_social_share_icon(service, **options) + row << content_tag(:code, service.name) + row << "social-share" + row << t("decidim.shared.share_modal.share_to", service: service.name) row end diff --git a/decidim-design/lib/decidim/design/engine.rb b/decidim-design/lib/decidim/design/engine.rb index f453fd71e4d9e..b5a8f7adb3685 100644 --- a/decidim-design/lib/decidim/design/engine.rb +++ b/decidim-design/lib/decidim/design/engine.rb @@ -16,6 +16,12 @@ class Engine < ::Rails::Engine end end + initializer "decidim_admin.register_icons" do + Decidim.icons.register(name: "home-7-line", icon: "home-7-line", category: "system", description: "", engine: :design) + Decidim.icons.register(name: "ruler-line", icon: "ruler-line", category: "system", description: "", engine: :design) + Decidim.icons.register(name: "focus-line", icon: "focus-line", category: "system", description: "", engine: :design) + end + initializer "decidim_design.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Design::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Design::Engine.root}/app/views") # for partials diff --git a/decidim-elections/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb b/decidim-elections/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb index 836fa1791228b..c0ff6664b4d69 100644 --- a/decidim-elections/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb +++ b/decidim-elections/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb @@ -14,9 +14,9 @@ def trustee_current_participatory_space(trustee) def considered_icon_action_for(trustee) if trustee_current_participatory_space(trustee).considered - "x" + "close-line" else - "check" + "check-line" end end diff --git a/decidim-elections/app/views/decidim/elections/admin/steps/_create_election.html.erb b/decidim-elections/app/views/decidim/elections/admin/steps/_create_election.html.erb index 7d22c5684597f..ca7cc49949b3b 100644 --- a/decidim-elections/app/views/decidim/elections/admin/steps/_create_election.html.erb +++ b/decidim-elections/app/views/decidim/elections/admin/steps/_create_election.html.erb @@ -41,7 +41,7 @@ .sort_by { |_trustee, used| used ? 0 : 1 } .each do |trustee, used| %>
  • > - <%= icon trustee.public_key ? "check" : "x", class: "text-#{trustee.public_key ? "success" : "alert"}", role: "img", "aria-hidden": true %> + <%= icon trustee.public_key ? "check-line" : "close-line", class: "text-#{trustee.public_key ? "success" : "alert"}", role: "img", "aria-hidden": true %> <%= trustee.user.name || trustee.name %> <%= t(".public_key.#{used}").html_safe %> <% if used %> <%= f.hidden_field :trustee_ids, multiple: true, value: trustee.id %> diff --git a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb index 96ef12fa8be4d..14d1abb34fe1e 100644 --- a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb +++ b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb @@ -1,6 +1,6 @@ <% unless elections.one? %> <%= link_to voting_monitoring_committee_election_results_path(current_voting) do %> - <%= icon "caret-left", class: "icon--small", role: "img" %> <%= t(".change_election") %> + <%= icon "arrow-left-s-fill", class: "icon--small", role: "img" %> <%= t(".change_election") %> <% end %> <% end %> diff --git a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb index 1d6162be2b890..cfd082cd2fe06 100644 --- a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb +++ b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb @@ -1,6 +1,6 @@ <% unless elections.one? %> <%= link_to voting_monitoring_committee_polling_station_closures_path(current_voting) do %> - <%= icon "caret-left", class: "icon--small", role: "img" %> <%= t(".change_election") %> + <%= icon "arrow-left-s-fill", class: "icon--small", role: "img" %> <%= t(".change_election") %> <% end %> <% end %> @@ -28,8 +28,8 @@ <% filtered_polling_stations.each do |polling_station| %> <% closure = polling_station.closure_for(election) - sign_icon_name, sign_icon_style = closure&.signed? ? ["check", "polling_station__closure--present"] : ["x", "polling_station__closure--not_present"] - validated_icon_name, validated_icon_style = closure&.validated? ? ["check", "polling_station__closure--validated"] : ["x", "polling_station__closure--not_validated"] + sign_icon_name, sign_icon_style = closure&.signed? ? ["check-line", "polling_station__closure--present"] : ["close-line", "polling_station__closure--not_present"] + validated_icon_name, validated_icon_style = closure&.validated? ? ["check-line", "polling_station__closure--validated"] : ["close-line", "polling_station__closure--not_validated"] %> > diff --git a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb index 591e6900aa17d..d3e3e08c9248e 100644 --- a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb +++ b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb @@ -1,6 +1,6 @@ <% add_decidim_page_title(t(".title", polling_station_title: translated_attribute(closure.polling_station.title), election_title: translated_attribute(closure.election.title))) %> <%= link_to voting_monitoring_committee_polling_station_closures_path(current_voting, election_id: closure.election.id) do %> - <%= icon "caret-left", class: "icon--small", role: "img" %> <%= t(".change_polling_station") %> + <%= icon "arrow-left-s-fill", class: "icon--small", role: "img" %> <%= t(".change_polling_station") %> <% end %>
    diff --git a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb index 8ee9b9761b8f5..6526f5de0b084 100644 --- a/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb +++ b/decidim-elections/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb @@ -1,5 +1,5 @@ <%= link_to voting_monitoring_committee_polling_station_closures_path(current_voting, election_id: closure.election.id) do %> - <%= icon "caret-left", class: "icon--small", role: "img" %> <%= t(".change_polling_station") %> + <%= icon "arrow-left-s-fill", class: "icon--small", role: "img" %> <%= t(".change_polling_station") %> <% end %> <%= render partial: "closure_certificate_results" %> diff --git a/decidim-elections/lib/decidim/elections/engine.rb b/decidim-elections/lib/decidim/elections/engine.rb index 874130bd6c926..cad9f93b017bf 100644 --- a/decidim-elections/lib/decidim/elections/engine.rb +++ b/decidim-elections/lib/decidim/elections/engine.rb @@ -28,6 +28,19 @@ class Engine < ::Rails::Engine get "/", to: redirect("elections", status: 301) end + initializer "decidim_elections.register_icons" do + Decidim.icons.register(name: "Decidim::Elections::Election", icon: "chat-poll-line", description: "Election", category: "activity", engine: :elections) + Decidim.icons.register(name: "list-check", icon: "list-check", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "safe-line", icon: "safe-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "guide-line", icon: "guide-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "loader-4-line", icon: "loader-4-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "checkbox-multiple-line", icon: "checkbox-multiple-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "book-2-line", icon: "book-2-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "shut-down-line", icon: "shut-down-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "article-line", icon: "article-line", category: "system", description: "", engine: :elections) + Decidim.icons.register(name: "bar-chart-box-line", icon: "bar-chart-box-line", category: "system", description: "", engine: :elections) + end + initializer "decidim_elections.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Elections::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Elections::Engine.root}/app/views") # for partials diff --git a/decidim-elections/lib/decidim/votings/engine.rb b/decidim-elections/lib/decidim/votings/engine.rb index f9728a27efad9..4dc2fdece9bc2 100644 --- a/decidim-elections/lib/decidim/votings/engine.rb +++ b/decidim-elections/lib/decidim/votings/engine.rb @@ -43,6 +43,11 @@ class Engine < ::Rails::Engine end end + initializer "decidim_votings.register_icons" do + Decidim.icons.register(name: "Decidim::Votings::Voting", icon: "check-double-fill", description: "Voting", category: "activity", engine: :votings) + Decidim.icons.register(name: "lock-unlock-line", icon: "lock-unlock-line", category: "system", description: "", engine: :votings) + end + initializer "decidim_votings.stats" do Decidim.stats.register :votings_count, priority: StatsRegistry::HIGH_PRIORITY do |organization, _start_at, _end_at| Decidim::Votings::Voting.where(organization:).published.count diff --git a/decidim-forms/lib/decidim/forms/engine.rb b/decidim-forms/lib/decidim/forms/engine.rb index a1fbadc6fb3c4..a9c8014863312 100644 --- a/decidim-forms/lib/decidim/forms/engine.rb +++ b/decidim-forms/lib/decidim/forms/engine.rb @@ -16,6 +16,11 @@ class Engine < ::Rails::Engine Decidim.register_assets_path File.expand_path("app/packs", root) end + initializer "decidim_forms.register_icons" do + Decidim.icons.register(name: "drag-move-2-line", icon: "drag-move-2-line", category: "system", description: "", engine: :forms) + Decidim.icons.register(name: "drag-move-2-fill", icon: "drag-move-2-fill", category: "system", description: "", engine: :forms) + end + initializer "decidim_forms.authorization_transfer" do config.to_prepare do Decidim::AuthorizationTransfer.register(:forms) do |transfer| diff --git a/decidim-generators/lib/decidim/generators/app_templates/secrets.yml.erb b/decidim-generators/lib/decidim/generators/app_templates/secrets.yml.erb index 29e3794724375..692cb69a3fc57 100644 --- a/decidim-generators/lib/decidim/generators/app_templates/secrets.yml.erb +++ b/decidim-generators/lib/decidim/generators/app_templates/secrets.yml.erb @@ -127,15 +127,15 @@ default: &default enabled: <%%= Decidim::Env.new("OMNIAUTH_FACEBOOK_APP_ID").to_boolean_string %> app_id: <%%= ENV["OMNIAUTH_FACEBOOK_APP_ID"] %> app_secret: <%%= ENV["OMNIAUTH_FACEBOOK_APP_SECRET"] %> - icon: facebook-line + icon: facebook-fill twitter: enabled: <%%= Decidim::Env.new("OMNIAUTH_TWITTER_API_KEY").to_boolean_string %> api_key: <%%= ENV["OMNIAUTH_TWITTER_API_KEY"] %> api_secret: <%%= ENV["OMNIAUTH_TWITTER_API_SECRET"] %> - icon: twitter-x-line + icon: twitter-x-fill google_oauth2: enabled: <%%= Decidim::Env.new("OMNIAUTH_GOOGLE_CLIENT_ID").to_boolean_string %> - icon_path: decidim/brands/google.svg + icon: google-fill client_id: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_ID"] %> client_secret: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_SECRET"] %> maps: diff --git a/decidim-initiatives/app/views/decidim/initiatives/create_initiative/finish.html.erb b/decidim-initiatives/app/views/decidim/initiatives/create_initiative/finish.html.erb index e2f0166523997..41e8e0e9ac33f 100644 --- a/decidim-initiatives/app/views/decidim/initiatives/create_initiative/finish.html.erb +++ b/decidim-initiatives/app/views/decidim/initiatives/create_initiative/finish.html.erb @@ -1,7 +1,7 @@ <% add_decidim_page_title(t("new", scope: "decidim.initiatives.create_initiative.select_initiative_type")) %> <% content_for :back_link do %> <%= link_to :back do %> - <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %> + <%= icon "arrow-left-s-line", class: "icon--small", role: "img", "aria-hidden": true %> <%= t(".back") %> <% end %> <% end %> diff --git a/decidim-initiatives/app/views/decidim/initiatives/initiatives/_interactions.html.erb b/decidim-initiatives/app/views/decidim/initiatives/initiatives/_interactions.html.erb index d1123007023d5..821487bb9101a 100644 --- a/decidim-initiatives/app/views/decidim/initiatives/initiatives/_interactions.html.erb +++ b/decidim-initiatives/app/views/decidim/initiatives/initiatives/_interactions.html.erb @@ -1,7 +1,7 @@
    <%= link_to "#comments", class: "button small compact hollow button--nomargin expanded" do %> - <%= icon "comment-square", class: "icon--small", role: "img", "aria-hidden": true %> + <%= icon "chat-1-line", class: "icon--small", role: "img", "aria-hidden": true %> <%= stats.comments_count %> <%= t(".comments_count.count", count: stats.comments_count) %> <% end %> diff --git a/decidim-initiatives/lib/decidim/initiatives/engine.rb b/decidim-initiatives/lib/decidim/initiatives/engine.rb index 62dc66a33a284..dc59ed72508d1 100644 --- a/decidim-initiatives/lib/decidim/initiatives/engine.rb +++ b/decidim-initiatives/lib/decidim/initiatives/engine.rb @@ -86,6 +86,15 @@ class Engine < ::Rails::Engine end end + initializer "decidim_initiatives.register_icons" do + Decidim.icons.register(name: "Decidim::Initiative", icon: "lightbulb-flash-line", description: "Initiative", category: "activity", engine: :initiatives) + Decidim.icons.register(name: "apps-line", icon: "apps-line", category: "system", description: "", engine: :initiatives) + Decidim.icons.register(name: "add-fill", icon: "add-fill", category: "system", description: "", engine: :initiatives) + Decidim.icons.register(name: "printer-line", icon: "printer-line", category: "system", description: "", engine: :initiatives) + Decidim.icons.register(name: "forbid-line", icon: "forbid-line", category: "system", description: "", engine: :initiatives) + Decidim.icons.register(name: "clipboard-line", icon: "clipboard-line", category: "system", description: "", engine: :initiatives) + end + initializer "decidim_initiatives.content_blocks" do Decidim::Initiatives::ContentBlocks::RegistryManager.register! end diff --git a/decidim-meetings/app/views/decidim/meetings/admin/agenda/_form.html.erb b/decidim-meetings/app/views/decidim/meetings/admin/agenda/_form.html.erb index 650d1de175b94..672b7d50ea3b9 100644 --- a/decidim-meetings/app/views/decidim/meetings/admin/agenda/_form.html.erb +++ b/decidim-meetings/app/views/decidim/meetings/admin/agenda/_form.html.erb @@ -4,7 +4,7 @@

    - <%= present(@meeting).title(html_escape: true) %>  <%= icon "arrow-right" %> <%= title %> + <%= present(@meeting).title(html_escape: true) %>  <%= icon "arrow-right-line" %> <%= title %>

    diff --git a/decidim-meetings/lib/decidim/meetings/engine.rb b/decidim-meetings/lib/decidim/meetings/engine.rb index b2231368b46e1..a3402bb5a64f0 100644 --- a/decidim-meetings/lib/decidim/meetings/engine.rb +++ b/decidim-meetings/lib/decidim/meetings/engine.rb @@ -45,6 +45,30 @@ class Engine < ::Rails::Engine end end + initializer "decidim_meetings.register_icons" do + Decidim.icons.register(name: "Decidim::Meetings::Meeting", icon: "map-pin-line", description: "Meeting", category: "activity", engine: :meetings) + Decidim.icons.register(name: "in_person", icon: "community-line", description: "In person", category: "meetings", engine: :meetings) + Decidim.icons.register(name: "online", icon: "webcam-line", description: "Online", category: "meetings", engine: :meetings) + Decidim.icons.register(name: "hybrid", icon: "home-wifi-line", description: "Hybrid", category: "meetings", engine: :meetings) + + Decidim.icons.register(name: "calendar-check-line", icon: "calendar-check-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "community-line", icon: "community-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "webcam-line", icon: "webcam-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "login-circle-line", icon: "login-circle-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "download-cloud-2-line", icon: "download-cloud-2-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "share-forward-2-line", icon: "share-forward-2-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "home-wifi-line", icon: "home-wifi-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "drag-move-2-fill", icon: "drag-move-2-fill", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "coupon-line", icon: "coupon-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "door-open-line", icon: "door-open-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "broadcast-line", icon: "broadcast-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "star-line", icon: "star-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "list-ordered", icon: "list-ordered", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "bill-line", icon: "bill-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "add-box-line", icon: "add-box-line", category: "system", description: "", engine: :meetings) + Decidim.icons.register(name: "calendar-close-line", icon: "calendar-close-line", category: "system", description: "", engine: :meetings) + end + initializer "decidim_meetings.content_processors" do |_app| Decidim.configure do |config| config.content_processors += [:meeting] diff --git a/decidim-participatory_processes/lib/decidim/participatory_processes/engine.rb b/decidim-participatory_processes/lib/decidim/participatory_processes/engine.rb index 05fa1759dc087..fa64537720e5c 100644 --- a/decidim-participatory_processes/lib/decidim/participatory_processes/engine.rb +++ b/decidim-participatory_processes/lib/decidim/participatory_processes/engine.rb @@ -46,6 +46,19 @@ class Engine < ::Rails::Engine end end + initializer "decidim_participatory_processes.register_icons" do + Decidim.icons.register(name: "Decidim::ParticipatoryProcess", icon: "treasure-map-line", description: "Participatory Process", category: "activity", + engine: :participatory_process) + Decidim.icons.register(name: "Decidim::ParticipatoryProcess", icon: "treasure-map-line", category: "activity", + description: "Participatory Process", engine: :participatory_process) + + Decidim.icons.register(name: "drag-move-2-line", icon: "drag-move-2-line", category: "system", description: "", + engine: :participatory_process) + Decidim.icons.register(name: "archive-line", icon: "archive-line", category: "system", description: "", engine: :participatory_process) + Decidim.icons.register(name: "grid-line", icon: "grid-line", category: "system", description: "", engine: :participatory_process) + Decidim.icons.register(name: "globe-line", icon: "globe-line", category: "system", description: "", engine: :participatory_process) + end + initializer "decidim_participatory_processes.query_extensions" do Decidim::Api::QueryType.include Decidim::ParticipatoryProcesses::QueryExtensions end diff --git a/decidim-proposals/app/helpers/decidim/proposals/map_helper.rb b/decidim-proposals/app/helpers/decidim/proposals/map_helper.rb index d3dd108065026..0b165700a07ab 100644 --- a/decidim-proposals/app/helpers/decidim/proposals/map_helper.rb +++ b/decidim-proposals/app/helpers/decidim/proposals/map_helper.rb @@ -32,7 +32,7 @@ def proposal_preview_data_for_map(proposal) :longitude, :address ).merge( - icon: icon("proposals", width: 40, height: 70, remove_icon_class: true) + icon: icon("chat-new-line", width: 40, height: 70, remove_icon_class: true) ) } end diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb index 5890157508c6e..2ae1c8c6d1e50 100644 --- a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb @@ -132,7 +132,7 @@
    <%= t ".endorsements_count" %>
    - <%= icon "heart-add-line", class: "fill-gray" %> + <%= icon "like", class: "fill-gray" %>

    <%= proposal.endorsements_count %>

    @@ -150,7 +150,7 @@
    <%= t ".amendments_count" %>
    - <%= icon "git-branch-line", class: "fill-gray" %> + <%= icon "Decidim::Amendment", class: "fill-gray" %>

    <%= proposal.amendments.count %>

    diff --git a/decidim-proposals/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb b/decidim-proposals/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb index 97af12333b54e..ef7dc6fb093c0 100644 --- a/decidim-proposals/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb @@ -28,7 +28,7 @@ class: "column button light button--sc success", id: "vote_button-#{proposal.id}" ) do %> - <%= icon("check", class: "icon--small", role: "img", "aria-hidden": true) %> + <%= icon("check-line", class: "icon--small", role: "img", "aria-hidden": true) %> <%= t("decidim.proposals.proposals.vote_button.already_voted") %> <%= decidim_html_escape(present(proposal).title) %> <% end %> diff --git a/decidim-proposals/lib/decidim/proposals/engine.rb b/decidim-proposals/lib/decidim/proposals/engine.rb index b57f474cfc9bf..cc09c5301dcf8 100644 --- a/decidim-proposals/lib/decidim/proposals/engine.rb +++ b/decidim-proposals/lib/decidim/proposals/engine.rb @@ -41,6 +41,24 @@ class Engine < ::Rails::Engine get "/", to: redirect("proposals", status: 301) end + initializer "decidim_proposals.register_icons" do + Decidim.icons.register(name: "Decidim::Proposals::CollaborativeDraft", icon: "draft-line", category: "activity", + description: "Collaborative draft", engine: :proposals) + Decidim.icons.register(name: "Decidim::Proposals::Proposal", icon: "chat-new-line", category: "activity", + description: "Proposal", engine: :proposals) + Decidim.icons.register(name: "participatory_texts_item", icon: "bookmark-line", description: "Index item", category: "participatory_texts", + engine: :proposals) + + Decidim.icons.register(name: "scan-line", icon: "scan-line", category: "system", description: "", engine: :proposals) + Decidim.icons.register(name: "edit-2-line", icon: "edit-2-line", + category: "action", description: "Edit icon for Collaborative Drafts", engine: :proposals) + + Decidim.icons.register(name: "bookmark-line", icon: "bookmark-line", category: "system", description: "", engine: :proposals) + Decidim.icons.register(name: "arrow-right-s-fill", icon: "arrow-right-s-fill", category: "system", description: "", engine: :proposals) + Decidim.icons.register(name: "bar-chart-2-line", icon: "bar-chart-2-line", category: "system", description: "", engine: :proposals) + Decidim.icons.register(name: "scales-line", icon: "scales-line", category: "system", description: "", engine: :proposals) + end + initializer "decidim_proposals.content_processors" do |_app| Decidim.configure do |config| config.content_processors += [:proposal] diff --git a/decidim-sortitions/lib/decidim/sortitions/engine.rb b/decidim-sortitions/lib/decidim/sortitions/engine.rb index 98c567330a0f8..fc1d2a5d052ea 100644 --- a/decidim-sortitions/lib/decidim/sortitions/engine.rb +++ b/decidim-sortitions/lib/decidim/sortitions/engine.rb @@ -19,6 +19,10 @@ class Engine < ::Rails::Engine get "/", to: redirect("sortitions", status: 301) end + initializer "decidim_sortitions.register_icons" do + Decidim.icons.register(name: "seedling-line", icon: "seedling-line", category: "system", description: "", engine: :sortitions) + end + initializer "decidim_sortitions.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Sortitions::Engine.root}/app/cells") Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Sortitions::Engine.root}/app/views") # for proposal partials diff --git a/decidim-templates/lib/decidim/templates/engine.rb b/decidim-templates/lib/decidim/templates/engine.rb index 0ea1c044f6632..92cca3090db17 100644 --- a/decidim-templates/lib/decidim/templates/engine.rb +++ b/decidim-templates/lib/decidim/templates/engine.rb @@ -15,6 +15,11 @@ class Engine < ::Rails::Engine # root to: "templates#index" end + initializer "decidim_templates.register_icons" do + Decidim.icons.register(name: "clipboard-line", icon: "clipboard-line", category: "system", description: "", engine: :templates) + Decidim.icons.register(name: "user-forbid-line", icon: "user-forbid-line", category: "system", description: "", engine: :templates) + end + initializer "decidim_templates.webpacker.assets_path" do Decidim.register_assets_path File.expand_path("app/packs", root) end diff --git a/decidim-verifications/lib/decidim/verifications/engine.rb b/decidim-verifications/lib/decidim/verifications/engine.rb index 4b717ab6402a3..e182765882262 100644 --- a/decidim-verifications/lib/decidim/verifications/engine.rb +++ b/decidim-verifications/lib/decidim/verifications/engine.rb @@ -30,6 +30,10 @@ class Engine < ::Rails::Engine end end + initializer "decidim_verifications.register_icons" do + Decidim.icons.register(name: "login-circle-line", icon: "login-circle-line", category: "system", description: "", engine: :verifications) + end + # Initializer to include cells views paths initializer "decidim_verifications.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Verifications::Engine.root}/app/cells")