diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd052c81966..76071ff9298 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - lint tests: - image: "ruby:2.6.8" + image: "ruby:2.7.4" stage: test services: - postgres:10.10 @@ -34,7 +34,7 @@ tests: # PRONTO_GITLAB_API_PRIVATE_TOKEN to your repository CI/CD settings # giving it the value of the Personal Access Token linters: - image: "ruby:2.6.8" + image: "ruby:2.7.4" stage: lint cache: key: consul diff --git a/.ruby-version b/.ruby-version index 743af5e1251..a4dd9dba4fb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.8 +2.7.4 diff --git a/Dockerfile b/Dockerfile index 5ec8e146882..6bcdab13c72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.6.8 +FROM ruby:2.7.4-buster ENV DEBIAN_FRONTEND noninteractive diff --git a/Gemfile.lock b/Gemfile.lock index fc8436ab3d6..07b07cc8530 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -795,4 +795,4 @@ DEPENDENCIES wkhtmltopdf-binary (~> 0.12.6) BUNDLED WITH - 1.17.2 + 2.1.4 diff --git a/README.md b/README.md index 06689b68172..101fb333c8d 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ You can access the main website of the project at [http://consulproject.org](htt **NOTE**: For more detailed instructions check the [docs](https://docs.consulproject.org) -Prerequisites: install git, Ruby 2.6.8, CMake, pkg-config, shared-mime-info, Node.js and PostgreSQL (>=9.5). +Prerequisites: install git, Ruby 2.7.4, CMake, pkg-config, shared-mime-info, Node.js and PostgreSQL (>=9.5). ```bash git clone https://github.com/consul/consul.git diff --git a/README_ES.md b/README_ES.md index dbef26e87ac..afbae802da4 100644 --- a/README_ES.md +++ b/README_ES.md @@ -36,7 +36,7 @@ Puedes acceder a la página principal del proyecto en [http://consulproject.org] **NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consulproject.org) -Prerequisitos: tener instalado git, Ruby 2.6.8, CMake, pkg-config, shared-mime-info, Node.js y PostgreSQL (9.5 o superior). +Prerequisitos: tener instalado git, Ruby 2.7.4, CMake, pkg-config, shared-mime-info, Node.js y PostgreSQL (9.5 o superior). ```bash git clone https://github.com/consul/consul.git diff --git a/app/assets/stylesheets/application-rtl.scss b/app/assets/stylesheets/application-rtl.scss new file mode 100644 index 00000000000..99d12603a21 --- /dev/null +++ b/app/assets/stylesheets/application-rtl.scss @@ -0,0 +1,3 @@ +$global-text-direction: rtl; + +@import "application"; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b14baa148ef..e57d065766b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,6 +6,10 @@ def current_path_with_query_params(query_parameters) url_for(request.query_parameters.merge(query_parameters).merge(only_path: true)) end + def rtl? + %i[ar fa he].include?(I18n.locale) + end + def markdown(text) return text if text.blank? diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb index d4c0d4daf0e..abed78d196f 100644 --- a/app/views/layouts/_common_head.html.erb +++ b/app/views/layouts/_common_head.html.erb @@ -2,7 +2,11 @@ <%= content_for?(:title) ? yield(:title) : default_title %> -<%= stylesheet_link_tag "application" %> +<% if rtl? %> + <%= stylesheet_link_tag "application-rtl" %> +<% else %> + <%= stylesheet_link_tag "application" %> +<% end %> <%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %> <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 8c3176b1274..1a78ad60aee 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -1,5 +1,5 @@ - + lang="<%= I18n.locale %>"> <%= render "layouts/common_head", default_title: "Admin" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 68a067c6d54..18bc7f78c87 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,5 +1,5 @@ - + lang="<%= I18n.locale %>" data-current-user-id="<%= current_user&.id %>"> <%= render "layouts/common_head", default_title: setting["org_name"] %> <%= render "layouts/tracking_data" %> diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index cf6753750b3..c781d44038f 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -1,5 +1,5 @@ - + lang="<%= I18n.locale %>"> <%= render "layouts/common_head", default_title: setting["org_name"] %> <%= render "layouts/meta_tags" %> diff --git a/app/views/layouts/management.html.erb b/app/views/layouts/management.html.erb index 1d427044cad..efd92bbdb74 100644 --- a/app/views/layouts/management.html.erb +++ b/app/views/layouts/management.html.erb @@ -1,5 +1,5 @@ - + lang="<%= I18n.locale %>"> <%= render "layouts/common_head", default_title: "Management" %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 1afb578ff84..6630e63f6ca 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -12,6 +12,7 @@ Rails.application.config.assets.precompile += %w[ckeditor/config.js] Rails.application.config.assets.precompile += %w[stat_graphs.js] Rails.application.config.assets.precompile += %w[dashboard_graphs.js] +Rails.application.config.assets.precompile += %w[application-rtl.css] Rails.application.config.assets.precompile += %w[print.css] Rails.application.config.assets.precompile += %w[pdf_fonts.css] Rails.application.config.assets.precompile += %w[sdg/*.png] diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb new file mode 100644 index 00000000000..97a4079d9b8 --- /dev/null +++ b/config/initializers/paperclip.rb @@ -0,0 +1,13 @@ +class Paperclip::UrlGenerator + private + + # Code copied from the paperclip gem, only replacing + # `URI.escape` with `URI::DEFAULT_PARSER.escape` + def escape_url(url) + if url.respond_to?(:escape) + url.escape + else + URI::DEFAULT_PARSER.escape(url).gsub(escape_regex) { |m| "%#{m.ord.to_s(16).upcase}" } + end + end +end diff --git a/spec/system/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb index 2485a457273..1d423c4d359 100644 --- a/spec/system/dashboard/dashboard_spec.rb +++ b/spec/system/dashboard/dashboard_spec.rb @@ -360,13 +360,13 @@ expect(page).to have_link("See previous notifications") end - scenario "Dashboard has a link to send message to proposal supporters" do + scenario "Dashboard has a link to send notification to proposal supporters" do visit messages_proposal_dashboard_path(proposal) click_link("Send notification to proposal followers") fill_in "Title", with: "Thank you for supporting my proposal" fill_in "Message", with: "Please share it with others!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." expect(page).to have_content "Thank you for supporting my proposal" diff --git a/spec/system/direct_messages_spec.rb b/spec/system/direct_messages_spec.rb index d7a2b1ca874..dd008174e64 100644 --- a/spec/system/direct_messages_spec.rb +++ b/spec/system/direct_messages_spec.rb @@ -85,7 +85,7 @@ login_as(author) visit new_proposal_notification_path(proposal_id: proposal.id) - click_button "Send message" + click_button "Send notification" expect(page).to have_content error_message end diff --git a/spec/system/proposal_notifications_spec.rb b/spec/system/proposal_notifications_spec.rb index d3821497821..b26f9606e25 100644 --- a/spec/system/proposal_notifications_spec.rb +++ b/spec/system/proposal_notifications_spec.rb @@ -19,7 +19,7 @@ fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" fill_in "proposal_notification_body", with: "Please share it with "\ "others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." expect(page).to have_content "Thank you for supporting my proposal" @@ -192,7 +192,7 @@ fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" fill_in "proposal_notification_body", with: "Please share it with "\ "others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." @@ -244,7 +244,7 @@ fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" fill_in "proposal_notification_body", with: "Please share it with "\ "others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." @@ -294,7 +294,7 @@ fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" fill_in "proposal_notification_body", with: "Please share it with "\ "others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." @@ -338,7 +338,7 @@ fill_in "Title", with: "Thank you for supporting my proposal" fill_in "Message", with: "Please share it with others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." end @@ -362,7 +362,7 @@ login_as(author) visit new_proposal_notification_path(proposal_id: proposal.id) - click_button "Send message" + click_button "Send notification" expect(page).to have_content error_message end @@ -377,14 +377,14 @@ visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "Title", with: "Thank you for supporting my proposal" fill_in "Message", with: "Please share it with others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "Title", with: "Thank you again for supporting my proposal" fill_in "Message", with: "Please share it again with others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "You have to wait a minimum of 3 days between notifications" expect(page).not_to have_content "Your message has been sent correctly." @@ -399,7 +399,7 @@ visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "Title", with: "Thank you for supporting my proposal" fill_in "Message", with: "Please share it with others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." @@ -407,7 +407,7 @@ visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "Title", with: "Thank you again for supporting my proposal" fill_in "Message", with: "Please share it again with others so we can make it happen!" - click_button "Send message" + click_button "Send notification" expect(page).to have_content "Your message has been sent correctly." expect(page).not_to have_content "You have to wait a minimum of 3 days between notifications"