mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-10 22:06:46 +08:00
Fix placeholder for authors
This commit is contained in:
parent
ca76c0ca0c
commit
b9a34fa809
8 changed files with 31 additions and 41 deletions
|
@ -69,12 +69,19 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
margin-left: -5px;
|
margin-left: -5px;
|
||||||
|
min-height: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
padding-right: 36px;
|
padding-right: 36px;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: calc(100% - 32px);
|
width: calc(100% - 32px);
|
||||||
|
|
||||||
|
&:empty:not(:focus):before{
|
||||||
|
color: $color-silver-chalice;
|
||||||
|
content:attr(data-placeholder);
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
@ -88,6 +95,11 @@
|
||||||
padding-right: 36px;
|
padding-right: 36px;
|
||||||
width: calc(100% - 32px);
|
width: calc(100% - 32px);
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: $color-silver-chalice;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render partial: "protocols/header/edit_metadata_modal.html.erb" %>
|
|
||||||
|
|
||||||
<%= javascript_include_tag "protocols/header" %>
|
<%= javascript_include_tag "protocols/header" %>
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
<% if @protocol.authors.present? %>
|
<% if can_manage_protocol_in_repository?(@protocol) && editable %>
|
||||||
<% if can_manage_protocol_in_repository?(@protocol) && editable %>
|
<%= render partial: "shared/inline_editing.html.erb",
|
||||||
<%= render partial: "shared/inline_editing.html.erb",
|
locals: {
|
||||||
locals: {
|
initial_value: @protocol.authors,
|
||||||
initial_value: @protocol.authors,
|
config: {
|
||||||
config: {
|
field_to_udpate: 'authors',
|
||||||
field_to_udpate: 'authors',
|
params_group: 'protocol',
|
||||||
params_group: 'protocol',
|
placeholder: t("protocols.header.no_authors"),
|
||||||
path_to_update: authors_protocol_path(@protocol)
|
path_to_update: authors_protocol_path(@protocol)
|
||||||
}
|
}
|
||||||
} %>
|
}
|
||||||
<% else %>
|
%>
|
||||||
<span class="view-mode"><%= @protocol.authors %></span>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<em><%= t("protocols.header.no_authors") %></em>
|
<span class="view-mode"><%= @protocol.authors || t("protocols.header.no_authors") %></span>
|
||||||
<% end %>
|
<% end %>
|
|
@ -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 %>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<div class="modal" id="edit-protocol-metadata-modal" tabindex="-1" role="dialog" aria-labelledby="edit-protocol-metadata-modal-label">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
||||||
<h4 class="modal-title" id="edit-protocol-metadata-modal-label"></h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body"></div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
|
|
||||||
<button type="button" class="btn btn-success" data-action="submit"><%=t "general.save" %></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -5,9 +5,10 @@
|
||||||
data-path-to-update="<%= config[:path_to_update] %>"
|
data-path-to-update="<%= config[:path_to_update] %>"
|
||||||
data-original-name="<%= initial_value %>"
|
data-original-name="<%= initial_value %>"
|
||||||
data-label-after='<%= config[:label_after]&.html_safe %>'
|
data-label-after='<%= config[:label_after]&.html_safe %>'
|
||||||
|
data-placeholder='<%= config[:placeholder] %>'
|
||||||
>
|
>
|
||||||
<div class="view-mode"><%= initial_value %></div>
|
<div class="view-mode" data-placeholder="<%= config[:placeholder] %>"><%= initial_value %></div>
|
||||||
<input class="hidden input-field" type="text" value="<%= initial_value %>" disabled/>
|
<input placeholder="<%= config[:placeholder] %>" class="hidden input-field" type="text" value="<%= initial_value %>" disabled/>
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<span class="save-button"><i class="fas fa-check"></i></span>
|
<span class="save-button"><i class="fas fa-check"></i></span>
|
||||||
<span class="cancel-button"><i class="fas fa-times"></i></span>
|
<span class="cancel-button"><i class="fas fa-times"></i></span>
|
||||||
|
|
|
@ -106,7 +106,7 @@ describe ProtocolsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST metadata' do
|
describe 'PUT description' do
|
||||||
let(:protocol) do
|
let(:protocol) do
|
||||||
create :protocol, :in_public_repository, team: team, added_by: user
|
create :protocol, :in_public_repository, team: team, added_by: user
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue