diff --git a/app/assets/stylesheets/partials/_inline_editing.scss b/app/assets/stylesheets/partials/_inline_editing.scss index f49832ab0..b10a2e8ba 100644 --- a/app/assets/stylesheets/partials/_inline_editing.scss +++ b/app/assets/stylesheets/partials/_inline_editing.scss @@ -69,12 +69,19 @@ cursor: pointer; line-height: 26px; margin-left: -5px; + min-height: 30px; overflow: hidden; padding: 2px 4px; padding-right: 36px; text-overflow: ellipsis; white-space: nowrap; width: calc(100% - 32px); + + &:empty:not(:focus):before{ + color: $color-silver-chalice; + content:attr(data-placeholder); + font-weight: normal; + } } input { @@ -88,6 +95,11 @@ padding-right: 36px; width: calc(100% - 32px); + &::placeholder { + color: $color-silver-chalice; + font-weight: normal; + } + &:focus { outline: 0; } diff --git a/app/views/protocols/_header.html.erb b/app/views/protocols/_header.html.erb index 9853feabc..375eb37b6 100644 --- a/app/views/protocols/_header.html.erb +++ b/app/views/protocols/_header.html.erb @@ -57,6 +57,4 @@ -<%= render partial: "protocols/header/edit_metadata_modal.html.erb" %> - <%= javascript_include_tag "protocols/header" %> diff --git a/app/views/protocols/header/_authors_label.html.erb b/app/views/protocols/header/_authors_label.html.erb index 92ec4b2d1..2006a4606 100644 --- a/app/views/protocols/header/_authors_label.html.erb +++ b/app/views/protocols/header/_authors_label.html.erb @@ -1,18 +1,15 @@ -<% if @protocol.authors.present? %> - <% if can_manage_protocol_in_repository?(@protocol) && editable %> - <%= render partial: "shared/inline_editing.html.erb", - locals: { - initial_value: @protocol.authors, - config: { - field_to_udpate: 'authors', - params_group: 'protocol', - path_to_update: authors_protocol_path(@protocol) - } - } %> - <% else %> - <%= @protocol.authors %> - <% end %> - +<% if can_manage_protocol_in_repository?(@protocol) && editable %> + <%= render partial: "shared/inline_editing.html.erb", + locals: { + initial_value: @protocol.authors, + config: { + field_to_udpate: 'authors', + params_group: 'protocol', + placeholder: t("protocols.header.no_authors"), + path_to_update: authors_protocol_path(@protocol) + } + } + %> <% else %> - <%= t("protocols.header.no_authors") %> -<% end %> \ No newline at end of file + <%= @protocol.authors || t("protocols.header.no_authors") %> +<% end %> diff --git a/app/views/protocols/header/_edit_authors_modal_body.html.erb b/app/views/protocols/header/_edit_authors_modal_body.html.erb deleted file mode 100644 index c6d28e46d..000000000 --- a/app/views/protocols/header/_edit_authors_modal_body.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= bootstrap_form_for @protocol, url: metadata_protocol_path(@protocol, format: :json), remote: :true do |f| %> - <%= f.smart_text_area :authors, label: t("protocols.header.edit_authors_modal.label") %> -<% end %> \ No newline at end of file diff --git a/app/views/protocols/header/_edit_metadata_modal.html.erb b/app/views/protocols/header/_edit_metadata_modal.html.erb deleted file mode 100644 index 73d775d27..000000000 --- a/app/views/protocols/header/_edit_metadata_modal.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/app/views/shared/_inline_editing.html.erb b/app/views/shared/_inline_editing.html.erb index b52890fac..efa914aec 100644 --- a/app/views/shared/_inline_editing.html.erb +++ b/app/views/shared/_inline_editing.html.erb @@ -5,9 +5,10 @@ data-path-to-update="<%= config[:path_to_update] %>" data-original-name="<%= initial_value %>" data-label-after='<%= config[:label_after]&.html_safe %>' + data-placeholder='<%= config[:placeholder] %>' > -
<%= initial_value %>
- +
<%= initial_value %>
+
diff --git a/app/views/shared/_tiny_mce_editor.html.erb b/app/views/shared/_tiny_mce_editor.html.erb index ed55ddebb..ef0e5e232 100644 --- a/app/views/shared/_tiny_mce_editor.html.erb +++ b/app/views/shared/_tiny_mce_editor.html.erb @@ -16,4 +16,4 @@ object_id: object.id, highlightjs_path: asset_path('highlightjs-github-theme.css'), last_updated: object.updated_at.to_i * 1000 } ) %> -<% end %> \ No newline at end of file +<% end %> diff --git a/spec/controllers/protocols_controller_spec.rb b/spec/controllers/protocols_controller_spec.rb index 354d41864..f48fa94c6 100644 --- a/spec/controllers/protocols_controller_spec.rb +++ b/spec/controllers/protocols_controller_spec.rb @@ -106,7 +106,7 @@ describe ProtocolsController, type: :controller do end end - describe 'POST metadata' do + describe 'PUT description' do let(:protocol) do create :protocol, :in_public_repository, team: team, added_by: user end