From 3322676373c1e612f2b3b301f637872e3474a58d Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Tue, 19 Nov 2019 11:21:03 +0100 Subject: [PATCH 1/2] Replace RTE with simple textarea --- app/assets/stylesheets/settings/teams.scss | 80 +++++++++++++++++++- app/views/users/settings/teams/show.html.erb | 26 +++++-- 2 files changed, 95 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/settings/teams.scss b/app/assets/stylesheets/settings/teams.scss index 609bc0192..3fb9d4550 100644 --- a/app/assets/stylesheets/settings/teams.scss +++ b/app/assets/stylesheets/settings/teams.scss @@ -49,11 +49,85 @@ .team-description { display: inline-block; + margin-top: 20px; position: relative; width: 100%; - .form-group { - margin-bottom: 0; + .view-mode { + border: 1px solid transparent; + border-radius: 3px; + cursor: pointer; + float: left; + min-height: 100px; + padding: 2px 4px; + white-space: pre; + width: 100%; + + &.disable-select { + cursor: default; + margin-bottom: 20px; + min-height: auto; + } + + &:empty:not(:focus)::before { + color: $color-silver-chalice; + content: attr(data-placeholder); + font-weight: normal; + } + } + + .input-field { + border: 1px solid $color-silver; + border-radius: $border-radius-small; + cursor: pointer; + display: block; + float: left; + min-height: 100px; + padding: 2px 4px; + width: 100%; + + &::placeholder { + color: $color-silver-chalice; + font-weight: normal; + } + + &:focus { + outline: 0; + } + + &:disabled { + background: transparent; + border: 1px solid transparent; + cursor: pointer; + pointer-events: none; + user-select: none; + + + .button-container { + display: none; + } + } + } + + .button-container { + position: absolute; + right: 0; + top: -20px; + + .inline-field-button { + color: $color-silver-chalice; + cursor: pointer; + line-height: 20px; + padding-left: 20px; + } + } + + &:hover .input-field, + &:hover .view-mode:not(.disable-select) { + border: 1px solid $color-silver; + + &:disabled { + border: 1px solid $color-gainsboro; + } } } @@ -96,7 +170,7 @@ .dropdown-teams-user { .dropdown-menu li.user-team-role { - & > :first-child { + > :first-child { padding-left: 10px; } diff --git a/app/views/users/settings/teams/show.html.erb b/app/views/users/settings/teams/show.html.erb index 6323568d7..996226b09 100644 --- a/app/views/users/settings/teams/show.html.erb +++ b/app/views/users/settings/teams/show.html.erb @@ -55,14 +55,24 @@
- <%= render partial: "shared/tiny_mce_editor.html.erb", - locals: { - object: @team, - update_url: update_team_path(@team, format: :json), - update_method: :put, - field: :description, - placeholder: t("users.settings.teams.show.enter_description") - } %> + <% if can_update_team?(@team) %> +
+
"><%= sanitize_input(@team.description) %>
+ +
+ <%= t('general.cancel') %> + <%= t('general.save') %> +
+
+ <% else %> + <%= @team.description.empty? ? t('users.settings.teams.edit.header_no_description') : sanitize_input(@team.description) %> + <% end %>
From e161ebc056a4e3feaeb240a36fb230720af593b2 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Wed, 27 Nov 2019 14:52:03 +0100 Subject: [PATCH 2/2] Fix tests --- features/settings_page/team.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/settings_page/team.feature b/features/settings_page/team.feature index 7d3ef37e5..596951605 100644 --- a/features/settings_page/team.feature +++ b/features/settings_page/team.feature @@ -29,8 +29,8 @@ Feature: Team settings Given I'm on "BioSistemika Process" team settings page Then I click on ".team-description" element Then I should not see "I was on Triglav one summer." on ".team-description" element - Then I fill in "I was on Triglav one summer." in "#team_1_textarea" rich text editor field - Then I click "Save" button + Then I fill in "I was on Triglav one summer." in ".team-description textarea" field + Then I click on ".save-button" element And I should see "I was on Triglav one summer." on ".team-description" element @javascript