Browse Source

Some more things working now.

master
Nils Dittberner 9 years ago
parent
commit
efd334e6a3
12 changed files with 39 additions and 67 deletions
  1. +2
    -0
      .gitignore
  2. +19
    -0
      app/assets/stylesheets/application.scss
  3. +6
    -1
      app/controllers/documents_controller.rb
  4. +1
    -1
      app/models/document.rb
  5. +0
    -5
      app/views/documents/_form.html.erb
  6. +2
    -2
      app/views/layouts/application.html.erb
  7. +6
    -0
      db/migrate/20161124142626_add_fingerprint_to_document_doc.rb
  8. +3
    -1
      db/schema.rb
  9. +0
    -57
      public/system/documents/docs/000/000/003/original/mymedicaldevicename.xml
  10. BIN
      public/system/documents/docs/000/000/004/original/02cc55df9b654cefa6c647ecc7a502fa.png
  11. BIN
      public/system/documents/docs/000/000/005/original/MyMedicalDeviceName20161119012242.zip
  12. BIN
      public/system/documents/docs/000/000/006/original/whenType.pdf

+ 2
- 0
.gitignore View File

@@ -19,3 +19,5 @@

# Ignore Byebug command history file.
.byebug_history

/public/system/*

app/assets/stylesheets/application.css → app/assets/stylesheets/application.scss View File

@@ -13,3 +13,22 @@
*= require_tree .
*= require_self
*/

#columns {
display: flex;

#main {
padding: 1em;
flex: 1;
}

#side {
padding: 1em 2em;
}
}

@media all and (max-width: 800px) {
#columns {
flex-direction: column-reverse;
}
}

+ 6
- 1
app/controllers/documents_controller.rb View File

@@ -26,6 +26,11 @@ class DocumentsController < ApplicationController
def create
@document = Document.new(document_params)

@document.name = @document.doc_file_name

if Document.exists?(doc_fingerprint: @document.doc_fingerprint)
end

respond_to do |format|
if @document.save
format.html { redirect_to @document, notice: 'Document was successfully created.' }
@@ -69,6 +74,6 @@ class DocumentsController < ApplicationController

# Never trust parameters from the scary internet, only allow the white list through.
def document_params
params.require(:document).permit(:name, :doc)
params.require(:document).permit(:doc)
end
end

+ 1
- 1
app/models/document.rb View File

@@ -1,4 +1,4 @@
class Document < ApplicationRecord
has_attached_file :doc
has_attached_file :doc, adapter_options: { hash_digest: Digest::SHA256 }
validates_attachment_content_type :doc, content_type: 'application/pdf'
end

+ 0
- 5
app/views/documents/_form.html.erb View File

@@ -12,11 +12,6 @@
<% end %>

<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
</div>

<div class="field">
<%= f.label :doc %>
<%= f.file_field :doc %>
</div>


+ 2
- 2
app/views/layouts/application.html.erb View File

@@ -8,8 +8,8 @@
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
<div id="columsn">
<body class="<%= controller.controller_name %>">
<div id="columns">
<div id="side">
<% if session[:user_id] %>
<%= button_to 'Logout', logout_path, method: :delete %>


+ 6
- 0
db/migrate/20161124142626_add_fingerprint_to_document_doc.rb View File

@@ -0,0 +1,6 @@
class AddFingerprintToDocumentDoc < ActiveRecord::Migration[5.0]
def change
add_column :documents, :doc_fingerprint, :string
add_index :documents, :doc_fingerprint
end
end

+ 3
- 1
db/schema.rb View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20161124131141) do
ActiveRecord::Schema.define(version: 20161124142626) do

create_table "documents", force: :cascade do |t|
t.string "name"
@@ -20,6 +20,8 @@ ActiveRecord::Schema.define(version: 20161124131141) do
t.string "doc_content_type"
t.integer "doc_file_size"
t.datetime "doc_updated_at"
t.string "doc_fingerprint"
t.index ["doc_fingerprint"], name: "index_documents_on_doc_fingerprint"
end

create_table "users", force: :cascade do |t|


+ 0
- 57
public/system/documents/docs/000/000/003/original/mymedicaldevicename.xml View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<p1:MDIBContainer xmlns:p1="http://domain-model-uri/15/04" xmlns:p2="http://extension-point-uri/15/03" xmlns:m="http://message-model-uri/15/04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" p1:MDIBVersion="1">
<p1:MDDescription>
<p1:MDS xsi:type="p1:HydraMDSDescriptor" Handle="my_med_device_handle">
<p1:Type>
<p1:CodeId>CODE_ID</p1:CodeId>
<p1:ConceptDescription>My device description text.</p1:ConceptDescription>
</p1:Type>
<p1:MetaData>
<p1:UDI>uuid-123</p1:UDI>
<p1:Manufacturer>MyManufacturer</p1:Manufacturer>
<p1:ModelName>MyModelname</p1:ModelName>
<p1:ModelNumber>MyModelnumber123</p1:ModelNumber>
<p1:SerialNumber>MySN123</p1:SerialNumber>
</p1:MetaData>
<p1:Context Handle="context"/>
<p1:SCO Handle="sco">
<p1:Operation xsi:type="p1:SetStringOperationDescriptor" Handle="my_set_method_name" OperationTarget="my_metric_handle">
<p1:Type>
<p1:CodeId>CODE_ID_SETM</p1:CodeId>
<p1:ConceptDescription>My set method.</p1:ConceptDescription>
</p1:Type>
</p1:Operation>
</p1:SCO>
<p1:VMD Handle="my_vmd_handle">
<p1:Type>
<p1:CodeId>CODE_ID_VMD</p1:CodeId>
<p1:ConceptDescription>My vmd descrtiption.</p1:ConceptDescription>
</p1:Type>
<p1:Channel Handle="my_channel_handle">
<p1:Type>
<p1:CodeId>CODE_ID_CHAN</p1:CodeId>
<p1:ConceptDescription>My channel description.</p1:ConceptDescription>
</p1:Type>
<p1:Metric xsi:type="p1:StringMetricDescriptor" Handle="my_metric_handle">
<p2:Extension>
<m:Retrievability>
<m:By>Get</m:By>
</m:Retrievability>
</p2:Extension>
<p1:Type>
<p1:CodeId>CODE_ID_METRIC</p1:CodeId>
<p1:ConceptDescription>My metric description.</p1:ConceptDescription>
</p1:Type>
<p1:Unit>
<p1:CodeId>MDC_DIM_DIMLESS</p1:CodeId>
<p1:ConceptDescription>No description for this unit code id.</p1:ConceptDescription>
</p1:Unit>
<p1:MetricCategory>Unspec</p1:MetricCategory>
<p1:Availability>Intr</p1:Availability>
</p1:Metric>
</p1:Channel>
</p1:VMD>
</p1:MDS>
</p1:MDDescription>
<p1:MDState/>
</p1:MDIBContainer>

BIN
public/system/documents/docs/000/000/004/original/02cc55df9b654cefa6c647ecc7a502fa.png View File

Before After
Width: 728  |  Height: 90  |  Size: 53 KiB

BIN
public/system/documents/docs/000/000/005/original/MyMedicalDeviceName20161119012242.zip View File


BIN
public/system/documents/docs/000/000/006/original/whenType.pdf View File


Loading…
Cancel
Save