diff --git a/lib/metrics-api.rb b/lib/metrics-api.rb index 7f8abefe..a4fe5dd6 100644 --- a/lib/metrics-api.rb +++ b/lib/metrics-api.rb @@ -161,8 +161,8 @@ class MetricsApi < Sinatra::Base begin data = JSON.parse request.body.read @meta = MetricMetadata.find_or_create_by(name: params[:metric].parameterize) - @meta.type = data["type"] - @meta.datatype = data["datatype"] + @meta.type = data["type"].presence + @meta.datatype = data["datatype"].presence @meta.title.merge!(data["title"] || {}) @meta.description.merge!(data["description"] || {}) if @meta.save diff --git a/lib/public/css/tooltip.css b/lib/public/css/tooltip.css new file mode 100644 index 00000000..3d1afc1f --- /dev/null +++ b/lib/public/css/tooltip.css @@ -0,0 +1,23 @@ +[data-tip] { + position:relative; + cursor:help; +} + +[data-tip]:after { + display:none; + content:attr(data-tip); + position:absolute; + bottom: 0px; + left: 0px; + right: 0px; + padding:5px 8px; + background:rgba(0,0,0,0.4); + color:#fff; + z-index:9; + font-size: 5vh; +} + +[data-tip]:hover:before, +[data-tip]:hover:after { + display:block; +} diff --git a/lib/public/javascripts/number.js b/lib/public/javascripts/number.js index 5601f47d..db708b57 100644 --- a/lib/public/javascripts/number.js +++ b/lib/public/javascripts/number.js @@ -1,5 +1,5 @@ -function applyNumber(title, date, number, element, datatype) { - var content = '