mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 17:36:13 +08:00
added first half of inputs, working on scroller next, page now refreshes after you cancel out of import window, to update the data, will look for alternate way after im done
This commit is contained in:
parent
d6d1f9d490
commit
5d6cc341ed
3 changed files with 26 additions and 11 deletions
|
@ -606,13 +606,14 @@ def protocolsio_import_new
|
|||
end
|
||||
def protocolsio_import_create
|
||||
|
||||
|
||||
|
||||
json_file_contents=File.read(params[:json_file].path)
|
||||
@json_object=JSON.parse(json_file_contents)
|
||||
|
||||
@protocol=Protocol.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
format.js {}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,32 +12,39 @@
|
|||
<br />
|
||||
</div>
|
||||
<% #puts json_object %>
|
||||
<% #byebug %>
|
||||
|
||||
|
||||
<!-- General protocol info -->
|
||||
<div class="form-group">
|
||||
<%= form_for(protocol, :remote => true) do |f| %>
|
||||
<label for="import_protocol_name"><%= t("protocols.import_export.import_modal.name_label") %></label>
|
||||
<input type="text" class="form-control" id="import_protocol_name">
|
||||
<!-- <input type="text" class="form-control" id="import_protocol_name" value="<%= json_object['protocol_name'] %>"> -->
|
||||
<%= f.text_field :name, :value => json_object['protocol_name'], class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="protocol_authors">
|
||||
<span class="glyphicon glyphicon-user"></span> <%= t("protocols.import_export.import_modal.authors_label") %>
|
||||
</label>
|
||||
<input type="text" class="form-control" id="protocol_authors">
|
||||
<%= f.text_field :authors, :value => json_object['username'], class: "form-control" %>
|
||||
<!-- <input type="text" class="form-control" id="protocol_authors"> -->
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="import_protocol_description"><%= t("protocols.import_export.import_modal.description_label") %></label>
|
||||
<textarea class="form-control" id="import_protocol_description" rows="2"></textarea>
|
||||
<label for="import_protocol_description"><%= t("protocols.import_export.import_modal.description_label") %></label> -->
|
||||
<!-- <textarea class="form-control" id="import_protocol_description" rows="2"></textarea> -->
|
||||
<%= f.text_area :description, :value => json_object['description'], class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label for="protocol_created_at"><%= t("protocols.import_export.import_modal.created_at_label") %></label>
|
||||
<input type="text" class="form-control" id="protocol_created_at" disabled>
|
||||
<!-- <input type="text" class="form-control" id="protocol_created_at" disabled> -->
|
||||
<%= f.text_field :doesnt_exist, :value => json_object['created_on']+" (Protocols.io value)", class: "form-control" %>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="protocol_updated_at"><%= t("protocols.import_export.import_modal.updated_at_label") %></label>
|
||||
<input type="text" class="form-control" id="protocol_updated_at" disabled>
|
||||
<!-- <input type="text" class="form-control" id="protocol_updated_at" disabled> -->
|
||||
<%= f.text_field :doesnt_exist, :value => json_object['last_modified']+" (Protocols.io value)", class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,6 +60,7 @@
|
|||
<div class="import-protocols-modal-preview-container" data-role="preview-container">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
|
@ -66,3 +74,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#modal-import-json-protocol-preview').on('hide.bs.modal',function(){
|
||||
<%= j render inline: "location.reload();" %>
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
$('#modal-import-json-protocol').modal('hide');
|
||||
$('#protocolsio_preview_modal_target').append("<%= j render(:partial => "protocols/import_export/import_json_protocol_preview_modal", :locals => {:json_object => @json_object}) %>")
|
||||
$('#protocolsio_preview_modal_target').append("<%= j render(:partial => "protocols/import_export/import_json_protocol_preview_modal", :locals => {:json_object => @json_object,:protocol => @protocol}) %>")
|
||||
$('#modal-import-json-protocol-preview').modal('show');
|
||||
|
|
Loading…
Reference in a new issue