Sha256: d840f7427f8db47aa0582ca74f76a7ca1fdc26c85c3db3fa1cec21472e77f38b

Contents?: true

Size: 1.39 KB

Versions: 12

Compression:

Stored size: 1.39 KB

Contents

rbbt.mview = {}

rbbt.mview.plot = function(content, title, caption){
  var plot 

  if (undefined === title){
    plot = m('figure.ui.segment', m('.header', 'No figure to display'))
  }else{
    if (title == 'loading'){
      plot = m('figure.ui.segment.loading', 'loading figure')
    }else{
      var elems = []
      var img_title = title

      if (! img_title) img_title = 'image'
      else img_title = img_title.replace(': ', ' ')
        
      var img_filename = img_title + '.svg'
      var download_func = function(){
        var blob = new Blob([content], {type: "image/svg+xml;charset=utf-8"});
        return saveAs(blob, img_filename);
      }
      var download = m('.download.ui.labeled.icon.button',{onclick: download_func}, [m('i.icon.download'), "Download"])
      if (title) elems.push(m('.ui.header', title))
      elems.push(m('.content.svg', m.trust(content)))
      if (caption){ 
        elems.push(m('figcaption', m.trust(caption)))
        elems.push(m('hr'))
      }
      if (content) elems.push(download)

      plot = m('figure.ui.segment', elems)
    }

  }

  return plot
}

rbbt.mview.button = function(options,args){
  return m('.ui.button', options, args)
}

rbbt.mview.ibutton = function(options,args){
  return m('.ui.icon.button', options, args)
}

rbbt.mview.dropdown = function(name, options){
 return m('.ui.dropdown.item', [m('i.icon.dropdown'), name, m('.menu', options)])
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rbbt-rest-1.6.21 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.20 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.19 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.18 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.17 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.16 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.15 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.14 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.13 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.12 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.11 share/views/public/js/rbbt.views.js
rbbt-rest-1.6.10 share/views/public/js/rbbt.views.js