From b4a13dffe313c6d4cb17a9aa19e633fffdc5fd17 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Mon, 11 Sep 2017 13:07:22 +0200 Subject: [PATCH 01/94] init commit, dodav na protocols index gumb z dropdown --- app/assets/javascripts/application.js.erb | 6 +++--- .../import_json_protocols_io/import_records.rb | 0 app/views/protocols/index.html.erb | 10 +++++++++- bin/aws-rb | 17 +++++++++++++++++ bin/aws.rb | 17 +++++++++++++++++ bin/bundler | 17 +++++++++++++++++ bin/byebug | 17 +++++++++++++++++ bin/coderay | 17 +++++++++++++++++ bin/convert_to_should_syntax | 17 +++++++++++++++++ bin/dot2ruby | 17 +++++++++++++++++ bin/erubis | 17 +++++++++++++++++ bin/figaro | 17 +++++++++++++++++ bin/gem2gv | 17 +++++++++++++++++ bin/git2gv | 17 +++++++++++++++++ bin/mongrel_rpm | 17 +++++++++++++++++ bin/newrelic | 17 +++++++++++++++++ bin/newrelic_cmd | 17 +++++++++++++++++ bin/nokogiri | 17 +++++++++++++++++ bin/nrdebug | 17 +++++++++++++++++ bin/puma | 17 +++++++++++++++++ bin/pumactl | 17 +++++++++++++++++ bin/rackup | 17 +++++++++++++++++ bin/rdoc | 17 +++++++++++++++++ bin/ri | 17 +++++++++++++++++ bin/rubocop | 17 +++++++++++++++++ bin/ruby-parse | 17 +++++++++++++++++ bin/ruby-rewrite | 17 +++++++++++++++++ bin/ruby2gv | 17 +++++++++++++++++ bin/sass | 17 +++++++++++++++++ bin/sass-convert | 17 +++++++++++++++++ bin/scss | 17 +++++++++++++++++ bin/scss-lint | 17 +++++++++++++++++ bin/sdoc | 17 +++++++++++++++++ bin/sdoc-merge | 17 +++++++++++++++++ bin/sprockets | 17 +++++++++++++++++ bin/starscope | 17 +++++++++++++++++ bin/thor | 17 +++++++++++++++++ bin/tilt | 17 +++++++++++++++++ bin/wkhtmltopdf-linux-amd64 | 17 +++++++++++++++++ bin/xml2gv | 17 +++++++++++++++++ 40 files changed, 641 insertions(+), 4 deletions(-) create mode 100644 app/services/import_json_protocols_io/import_records.rb create mode 100755 bin/aws-rb create mode 100755 bin/aws.rb create mode 100755 bin/bundler create mode 100755 bin/byebug create mode 100755 bin/coderay create mode 100755 bin/convert_to_should_syntax create mode 100755 bin/dot2ruby create mode 100755 bin/erubis create mode 100755 bin/figaro create mode 100755 bin/gem2gv create mode 100755 bin/git2gv create mode 100755 bin/mongrel_rpm create mode 100755 bin/newrelic create mode 100755 bin/newrelic_cmd create mode 100755 bin/nokogiri create mode 100755 bin/nrdebug create mode 100755 bin/puma create mode 100755 bin/pumactl create mode 100755 bin/rackup create mode 100755 bin/rdoc create mode 100755 bin/ri create mode 100755 bin/rubocop create mode 100755 bin/ruby-parse create mode 100755 bin/ruby-rewrite create mode 100755 bin/ruby2gv create mode 100755 bin/sass create mode 100755 bin/sass-convert create mode 100755 bin/scss create mode 100755 bin/scss-lint create mode 100755 bin/sdoc create mode 100755 bin/sdoc-merge create mode 100755 bin/sprockets create mode 100755 bin/starscope create mode 100755 bin/thor create mode 100755 bin/tilt create mode 100755 bin/wkhtmltopdf-linux-amd64 create mode 100755 bin/xml2gv diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 0a3b2f08b..240899728 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -8,9 +8,9 @@ //= require jquery.scrollTo //= require jquery.autosize //= require jquery-ui/widget -//= require jquery-ui/mouse -//= require jquery-ui/draggable -//= require jquery-ui/droppable +//= require jquery-ui/widgets/mouse +//= require jquery-ui/widgets/draggable +//= require jquery-ui/widgets/droppable //= require jquery.ui.touch-punch.min //= require jquery.caret.min //= require jquery.atwho.min diff --git a/app/services/import_json_protocols_io/import_records.rb b/app/services/import_json_protocols_io/import_records.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index d9a48073d..f14303461 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -63,7 +63,15 @@ - +
+ + +
diff --git a/bin/aws-rb b/bin/aws-rb new file mode 100755 index 000000000..ba93f3013 --- /dev/null +++ b/bin/aws-rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'aws-rb' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("aws-sdk-v1", "aws-rb") diff --git a/bin/aws.rb b/bin/aws.rb new file mode 100755 index 000000000..35700654f --- /dev/null +++ b/bin/aws.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'aws.rb' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("aws-sdk-core", "aws.rb") diff --git a/bin/bundler b/bin/bundler new file mode 100755 index 000000000..d6107f047 --- /dev/null +++ b/bin/bundler @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'bundler' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("bundler", "bundler") diff --git a/bin/byebug b/bin/byebug new file mode 100755 index 000000000..d9bf0f4eb --- /dev/null +++ b/bin/byebug @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'byebug' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("byebug", "byebug") diff --git a/bin/coderay b/bin/coderay new file mode 100755 index 000000000..e248d2436 --- /dev/null +++ b/bin/coderay @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'coderay' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("coderay", "coderay") diff --git a/bin/convert_to_should_syntax b/bin/convert_to_should_syntax new file mode 100755 index 000000000..c083c4683 --- /dev/null +++ b/bin/convert_to_should_syntax @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'convert_to_should_syntax' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("shoulda-context", "convert_to_should_syntax") diff --git a/bin/dot2ruby b/bin/dot2ruby new file mode 100755 index 000000000..585531cf7 --- /dev/null +++ b/bin/dot2ruby @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'dot2ruby' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby-graphviz", "dot2ruby") diff --git a/bin/erubis b/bin/erubis new file mode 100755 index 000000000..9d0f9cb06 --- /dev/null +++ b/bin/erubis @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'erubis' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("erubis", "erubis") diff --git a/bin/figaro b/bin/figaro new file mode 100755 index 000000000..1b9c61dc9 --- /dev/null +++ b/bin/figaro @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'figaro' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("figaro", "figaro") diff --git a/bin/gem2gv b/bin/gem2gv new file mode 100755 index 000000000..31f38af7c --- /dev/null +++ b/bin/gem2gv @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'gem2gv' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby-graphviz", "gem2gv") diff --git a/bin/git2gv b/bin/git2gv new file mode 100755 index 000000000..6e5d0dac4 --- /dev/null +++ b/bin/git2gv @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'git2gv' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby-graphviz", "git2gv") diff --git a/bin/mongrel_rpm b/bin/mongrel_rpm new file mode 100755 index 000000000..20cb86dc8 --- /dev/null +++ b/bin/mongrel_rpm @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'mongrel_rpm' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("newrelic_rpm", "mongrel_rpm") diff --git a/bin/newrelic b/bin/newrelic new file mode 100755 index 000000000..7a2008dda --- /dev/null +++ b/bin/newrelic @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'newrelic' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("newrelic_rpm", "newrelic") diff --git a/bin/newrelic_cmd b/bin/newrelic_cmd new file mode 100755 index 000000000..02d32467c --- /dev/null +++ b/bin/newrelic_cmd @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'newrelic_cmd' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("newrelic_rpm", "newrelic_cmd") diff --git a/bin/nokogiri b/bin/nokogiri new file mode 100755 index 000000000..c1f0ca44f --- /dev/null +++ b/bin/nokogiri @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'nokogiri' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("nokogiri", "nokogiri") diff --git a/bin/nrdebug b/bin/nrdebug new file mode 100755 index 000000000..3878e8590 --- /dev/null +++ b/bin/nrdebug @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'nrdebug' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("newrelic_rpm", "nrdebug") diff --git a/bin/puma b/bin/puma new file mode 100755 index 000000000..13d14022f --- /dev/null +++ b/bin/puma @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'puma' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("puma", "puma") diff --git a/bin/pumactl b/bin/pumactl new file mode 100755 index 000000000..41681ff7f --- /dev/null +++ b/bin/pumactl @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'pumactl' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("puma", "pumactl") diff --git a/bin/rackup b/bin/rackup new file mode 100755 index 000000000..0f074e64e --- /dev/null +++ b/bin/rackup @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rackup' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rack", "rackup") diff --git a/bin/rdoc b/bin/rdoc new file mode 100755 index 000000000..c051912da --- /dev/null +++ b/bin/rdoc @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rdoc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rdoc", "rdoc") diff --git a/bin/ri b/bin/ri new file mode 100755 index 000000000..56db0fc44 --- /dev/null +++ b/bin/ri @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'ri' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rdoc", "ri") diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 000000000..ccb4d5630 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/ruby-parse b/bin/ruby-parse new file mode 100755 index 000000000..20557e7b3 --- /dev/null +++ b/bin/ruby-parse @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'ruby-parse' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("parser", "ruby-parse") diff --git a/bin/ruby-rewrite b/bin/ruby-rewrite new file mode 100755 index 000000000..60032ed17 --- /dev/null +++ b/bin/ruby-rewrite @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'ruby-rewrite' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("parser", "ruby-rewrite") diff --git a/bin/ruby2gv b/bin/ruby2gv new file mode 100755 index 000000000..3b82be141 --- /dev/null +++ b/bin/ruby2gv @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'ruby2gv' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby-graphviz", "ruby2gv") diff --git a/bin/sass b/bin/sass new file mode 100755 index 000000000..ef9f699d8 --- /dev/null +++ b/bin/sass @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'sass' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "sass") diff --git a/bin/sass-convert b/bin/sass-convert new file mode 100755 index 000000000..13936f1df --- /dev/null +++ b/bin/sass-convert @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'sass-convert' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "sass-convert") diff --git a/bin/scss b/bin/scss new file mode 100755 index 000000000..76c0dce5f --- /dev/null +++ b/bin/scss @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'scss' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "scss") diff --git a/bin/scss-lint b/bin/scss-lint new file mode 100755 index 000000000..b300f8e46 --- /dev/null +++ b/bin/scss-lint @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'scss-lint' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("scss_lint", "scss-lint") diff --git a/bin/sdoc b/bin/sdoc new file mode 100755 index 000000000..6d3dbba68 --- /dev/null +++ b/bin/sdoc @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'sdoc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sdoc", "sdoc") diff --git a/bin/sdoc-merge b/bin/sdoc-merge new file mode 100755 index 000000000..7e997760e --- /dev/null +++ b/bin/sdoc-merge @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'sdoc-merge' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sdoc", "sdoc-merge") diff --git a/bin/sprockets b/bin/sprockets new file mode 100755 index 000000000..e8ffa4dd9 --- /dev/null +++ b/bin/sprockets @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'sprockets' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sprockets", "sprockets") diff --git a/bin/starscope b/bin/starscope new file mode 100755 index 000000000..bbaaa6afd --- /dev/null +++ b/bin/starscope @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'starscope' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("starscope", "starscope") diff --git a/bin/thor b/bin/thor new file mode 100755 index 000000000..63f10e55d --- /dev/null +++ b/bin/thor @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'thor' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("thor", "thor") diff --git a/bin/tilt b/bin/tilt new file mode 100755 index 000000000..a606a2ee5 --- /dev/null +++ b/bin/tilt @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'tilt' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("tilt", "tilt") diff --git a/bin/wkhtmltopdf-linux-amd64 b/bin/wkhtmltopdf-linux-amd64 new file mode 100755 index 000000000..55847d918 --- /dev/null +++ b/bin/wkhtmltopdf-linux-amd64 @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'wkhtmltopdf-linux-amd64' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("wkhtmltopdf-heroku", "wkhtmltopdf-linux-amd64") diff --git a/bin/xml2gv b/bin/xml2gv new file mode 100755 index 000000000..33b47ef4a --- /dev/null +++ b/bin/xml2gv @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'xml2gv' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("ruby-graphviz", "xml2gv") From 31e8c107fdbc9f9a21f698bc3b31e6bdd56d663b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Mon, 11 Sep 2017 14:35:00 +0200 Subject: [PATCH 02/94] dodav na pravi branch te file --- app/views/protocols/index.html.erb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index f14303461..df069595f 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -62,16 +62,25 @@ -
-
- + + + +
+
From 2c0a458aafa49cf478ec120b451f9fab0c82b012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Mon, 11 Sep 2017 15:21:35 +0200 Subject: [PATCH 03/94] dodav moj alternativni text za importanje (text na gumbu), za rails translate (t) --- config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 24498ed3c..4b975782b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1443,6 +1443,7 @@ en: edit: "Edit" clone_btn: "Copy" import: "Import" + import_alt: "from SciNote protocol file(.eln)" export: "Export" make_private: "Make private" publish: "Publish" From f668f60237115687c106db974dc7ef0f4ed6013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Mon, 11 Sep 2017 15:22:22 +0200 Subject: [PATCH 04/94] dodav moj stil gumba, ki ga opredeli kot link (padding 0, border 0), za dropdown meni --- app/assets/stylesheets/themes/scinote.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index e5a41a988..026833e74 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1795,6 +1795,14 @@ textarea.textarea-sm { -webkit-padding-before: 0; -webkit-padding-after: 0; } + .btn.btn-default-link { + border:none; + padding:0; + height: 100%; + min-height: 34px; + -webkit-padding-before: 0; + -webkit-padding-after: 0; + } } } From 0f4dadefa99a2d076fa71489ecd28e7d37998645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Mon, 11 Sep 2017 15:23:09 +0200 Subject: [PATCH 05/94] prvi (star gumb) v dropdownu sedaj deluje --- app/views/protocols/index.html.erb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index df069595f..8e850e405 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -68,10 +68,18 @@
- > - - - > - + + + @@ -65,28 +80,7 @@ - -
From 62350d0d420821c27c5b546fa93640ddd92d8e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Mon, 11 Sep 2017 16:03:33 +0200 Subject: [PATCH 07/94] Changed the styling so first option isnt outlined like button, but now mouse cursor wont change to hand when hovering over; will leave this small bug for fixing later --- app/assets/stylesheets/themes/scinote.scss | 6 ++++++ app/views/protocols/index.html.erb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 026833e74..3850029ce 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -2008,6 +2008,12 @@ th.custom-field .modal-tooltiptext { margin-right: 5px; padding: 3px; } + .btn-link { + border-radius: 4px; + margin-right: 5px; + padding: 3px; + cursor:pointer; + } .btn:last-child { margin-right: 20px; diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index af0cdbadf..44adefe47 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -55,9 +55,9 @@ diff --git a/config/locales/en.yml b/config/locales/en.yml index 4b975782b..65936cca5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1444,6 +1444,7 @@ en: clone_btn: "Copy" import: "Import" import_alt: "from SciNote protocol file(.eln)" + import_json: "from protocols.io file(.json)" export: "Export" make_private: "Make private" publish: "Publish" From fdbae19156d31bf1babf8cef3f76524b4f55ffa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Tue, 12 Sep 2017 09:33:18 +0200 Subject: [PATCH 09/94] changed .json to .txt for clarity --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 65936cca5..7ecb93269 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1444,7 +1444,7 @@ en: clone_btn: "Copy" import: "Import" import_alt: "from SciNote protocol file(.eln)" - import_json: "from protocols.io file(.json)" + import_json: "from protocols.io file(.txt)" export: "Export" make_private: "Make private" publish: "Publish" From 706031dacb3ffc8e83ec512ba53bbb541bbdc517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDan=20=C5=BDagar?= Date: Tue, 12 Sep 2017 15:25:22 +0200 Subject: [PATCH 10/94] added model and controler, model should go to services while the controller should go to protocols controller --- app/controllers/temp_jsons_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 app/controllers/temp_jsons_controller.rb diff --git a/app/controllers/temp_jsons_controller.rb b/app/controllers/temp_jsons_controller.rb new file mode 100755 index 000000000..2839fdd85 --- /dev/null +++ b/app/controllers/temp_jsons_controller.rb @@ -0,0 +1,16 @@ +class TempJsonsController < ApplicationController + + def new + @temp_json=JsonTemp.new + end + def create + @temp_json=JsonTemp.new(temp_params) + json_file_contents=@temp_json.json_file.read + json_object=JSON.parse(json_file_contents) + + end + + def temp_params + params.require(:json_file) + end +end From b7432b336a1b7470f39a74c28e0ac3fbcebaf221 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 13 Sep 2017 15:15:08 +0200 Subject: [PATCH 11/94] added file upload popup modal, rails routes and controller functions, deleted old standalone model and controller --- app/assets/javascripts/temp_jsons.js | 2 ++ app/assets/stylesheets/temp_jsons.scss | 3 +++ app/assets/stylesheets/themes/scinote.scss | 21 ++++++++++----- app/controllers/protocols_controller.rb | 16 +++++++++++ app/helpers/temp_jsons_helper.rb | 2 ++ .../_import_json_protocol_modal.html.erb | 23 ++++++++++++++++ app/views/protocols/index.html.erb | 27 ++++++++----------- config/locales/en.yml | 3 +++ config/routes.rb | 10 +++++++ db/schema.rb | 13 +++++---- .../controllers/temp_jsons_controller_test.rb | 7 +++++ 11 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 app/assets/javascripts/temp_jsons.js create mode 100644 app/assets/stylesheets/temp_jsons.scss create mode 100644 app/helpers/temp_jsons_helper.rb create mode 100644 app/views/protocols/import_export/_import_json_protocol_modal.html.erb create mode 100644 test/controllers/temp_jsons_controller_test.rb diff --git a/app/assets/javascripts/temp_jsons.js b/app/assets/javascripts/temp_jsons.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/temp_jsons.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/temp_jsons.scss b/app/assets/stylesheets/temp_jsons.scss new file mode 100644 index 000000000..b12deb7f5 --- /dev/null +++ b/app/assets/stylesheets/temp_jsons.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the temp_jsons controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 3850029ce..73fd098fa 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -337,7 +337,18 @@ a { border-color: darken($color-theme-secondary, 10%); } } - +.btn-link-alt { + border-radius: 4px; + margin-right: 5px; + padding: 3px; + cursor:pointer; +} +.btn-invis-file{ + opacity: 0; + position: absolute; + z-index: -1; + display: none; +} .btn-open-file { position: relative; overflow: hidden; @@ -1803,6 +1814,7 @@ textarea.textarea-sm { -webkit-padding-before: 0; -webkit-padding-after: 0; } + } } @@ -2008,12 +2020,7 @@ th.custom-field .modal-tooltiptext { margin-right: 5px; padding: 3px; } - .btn-link { - border-radius: 4px; - margin-right: 5px; - padding: 3px; - cursor:pointer; - } + .btn:last-child { margin-right: 20px; diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 1cab571da..6a69e9433 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -599,7 +599,23 @@ class ProtocolsController < ApplicationController end end end +# +#tule +def protocolsio_import_new + #@temp_json=JsonTemp.new +end +def protocolsio_import_create + + json_file_contents=File.read(params[:json_file].path) + json_object=JSON.parse(json_file_contents) + byebug +end + +def protocolsio_temp_params + params.require(:json_file) +end +# def export # Make a zip output stream and send it to the client respond_to do |format| diff --git a/app/helpers/temp_jsons_helper.rb b/app/helpers/temp_jsons_helper.rb new file mode 100644 index 000000000..554afcb2d --- /dev/null +++ b/app/helpers/temp_jsons_helper.rb @@ -0,0 +1,2 @@ +module TempJsonsHelper +end diff --git a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb new file mode 100644 index 000000000..a9bfc0a61 --- /dev/null +++ b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb @@ -0,0 +1,23 @@ + diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index 0281d0955..8448b64cd 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -1,3 +1,4 @@ +<%= render partial: "protocols/import_export/import_json_protocol_modal" %> <% provide(:head_title, t("protocols.index.head_title")) %> <% if current_team %> @@ -48,9 +49,8 @@ <% end %>
- -
- +
+ @@ -84,11 +83,7 @@ - - - - -
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 7ecb93269..b2d1e1c2d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1445,6 +1445,9 @@ en: import: "Import" import_alt: "from SciNote protocol file(.eln)" import_json: "from protocols.io file(.txt)" + modal_import_json_title: "Import protocols.io file" + modal_import_json_notice: "Upload your protocols.io .txt json protocol file" + modal_import_json_submit: "Upload file" export: "Export" make_private: "Make private" publish: "Publish" diff --git a/config/routes.rb b/config/routes.rb index 7aed6b3f9..085c7036c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -398,6 +398,10 @@ Rails.application.routes.draw do to: 'protocols#load_from_repository_modal' post 'load_from_repository', to: 'protocols#load_from_repository' post 'load_from_file', to: 'protocols#load_from_file' + ## + ##-tule gre tvoje json_import match 'admin_login' => 'user#admin_login', + post 'protocolsio_import_create', to: 'protocols#protocolsio_import_create' + ## get 'copy_to_repository_modal', to: 'protocols#copy_to_repository_modal' post 'copy_to_repository', to: 'protocols#copy_to_repository' get 'protocol_status_bar', to: 'protocols#protocol_status_bar' @@ -406,6 +410,7 @@ Rails.application.routes.draw do get 'edit_keywords_modal', to: 'protocols#edit_keywords_modal' get 'edit_authors_modal', to: 'protocols#edit_authors_modal' get 'edit_description_modal', to: 'protocols#edit_description_modal' + end collection do get 'create_new_modal', to: 'protocols#create_new_modal' @@ -415,6 +420,10 @@ Rails.application.routes.draw do post 'archive', to: 'protocols#archive' post 'restore', to: 'protocols#restore' post 'import', to: 'protocols#import' + ## + ##-tule gre tvoje json_import match 'admin_login' => 'user#admin_login', + post 'protocolsio_import_create', to: 'protocols#protocolsio_import_create' + ## get 'export', to: 'protocols#export' end end @@ -481,4 +490,5 @@ Rails.application.routes.draw do get 'wopi/files/:id', to: 'wopi#file_get_endpoint', as: 'wopi_rest_endpoint' post 'wopi/files/:id', to: 'wopi#post_file_endpoint' end + end diff --git a/db/schema.rb b/db/schema.rb index 6046e0877..c34571109 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170515141252) do +ActiveRecord::Schema.define(version: 20170619125051) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -413,7 +413,6 @@ ActiveRecord::Schema.define(version: 20170515141252) do t.datetime "updated_at" end - add_index "repository_rows", ["name"], name: "index_repository_rows_on_name", using: :btree add_index "repository_rows", ["repository_id"], name: "index_repository_rows_on_repository_id", using: :btree create_table "repository_table_states", force: :cascade do |t| @@ -544,11 +543,11 @@ ActiveRecord::Schema.define(version: 20170515141252) do add_index "samples", ["user_id"], name: "index_samples_on_user_id", using: :btree create_table "samples_tables", force: :cascade do |t| - t.jsonb "status", default: {"time"=>0, "order"=>[[2, "desc"]], "start"=>0, "length"=>10, "search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "columns"=>[{"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}], "ColReorder"=>[0, 1, 2, 3, 4, 5, 6]}, null: false - t.integer "user_id", null: false - t.integer "team_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.jsonb "status", default: {"time"=>0, "order"=>[[2, "desc"]], "start"=>0, "length"=>10, "search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "columns"=>[{"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}], "assigned"=>"all", "ColReorder"=>[0, 1, 2, 3, 4, 5, 6]}, null: false + t.integer "user_id", null: false + t.integer "team_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "samples_tables", ["team_id"], name: "index_samples_tables_on_team_id", using: :btree diff --git a/test/controllers/temp_jsons_controller_test.rb b/test/controllers/temp_jsons_controller_test.rb new file mode 100644 index 000000000..4fe936641 --- /dev/null +++ b/test/controllers/temp_jsons_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TempJsonsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 9fc91aac3272f0a537e6e1660eb230bbf5eaa773 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 13 Sep 2017 16:04:16 +0200 Subject: [PATCH 12/94] added protocols io upload preview modal --- app/controllers/protocols_controller.rb | 4 +- ...mport_json_protocol_preview_modal.html.erb | 84 +++++++++++++++++++ app/views/protocols/index.html.erb | 2 + 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 6a69e9433..005f609dd 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -608,8 +608,8 @@ def protocolsio_import_create json_file_contents=File.read(params[:json_file].path) - json_object=JSON.parse(json_file_contents) - byebug + @json_object=JSON.parse(json_file_contents) + render :partial => "/protocols/import_json_protocol_preview_modal" end def protocolsio_temp_params diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb new file mode 100644 index 000000000..07510de19 --- /dev/null +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -0,0 +1,84 @@ + diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index 8448b64cd..8f50b9c33 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -1,4 +1,6 @@ <%= render partial: "protocols/import_export/import_json_protocol_modal" %> +<%= render partial: "protocols/import_export/import_json_protocol_preview_modal" %> + <% provide(:head_title, t("protocols.index.head_title")) %> <% if current_team %> From 29b9d503632a656f68289eb7203ec731f174b02b Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 14 Sep 2017 11:30:53 +0200 Subject: [PATCH 13/94] Modals now popup correctly trough ajax, added js file for this functionality, and two partials which are reused from existing importer --- app/controllers/protocols_controller.rb | 7 ++++++- .../import_export/_import_json_protocol_modal.html.erb | 1 + .../_import_json_protocol_preview_modal.html.erb | 4 +++- app/views/protocols/index.html.erb | 5 ++--- app/views/protocols/protocolsio_import_create.js.erb | 3 +++ 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 app/views/protocols/protocolsio_import_create.js.erb diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 005f609dd..760a96a9f 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -609,7 +609,12 @@ def protocolsio_import_create json_file_contents=File.read(params[:json_file].path) @json_object=JSON.parse(json_file_contents) - render :partial => "/protocols/import_json_protocol_preview_modal" + + respond_to do |format| + format.html + format.js + end + end def protocolsio_temp_params diff --git a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb index a9bfc0a61..5d35ba8c7 100644 --- a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb @@ -18,6 +18,7 @@ <%= submit_tag t("protocols.index.modal_import_json_submit"), class: "btn btn-default" %>
<% end %> + diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 07510de19..771b74ea3 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -1,4 +1,4 @@ - - <% #puts json_object %> @@ -25,12 +24,12 @@ - <%= f.text_field :authors, :value => json_object['username'], class: "form-control" %> + <%= f.text_field :authors, :value => json_object['full_name'], class: "form-control" %>
- --> + <%= f.text_area :description, :value => json_object['description'], class: "form-control" %>
@@ -39,12 +38,14 @@
- <%= f.text_field :doesnt_exist, :value => json_object['created_on']+" (Protocols.io value)", class: "form-control" %> + <% display_created_at=Time.at(json_object['created_on'].to_i) %> + <%= f.text_field :doesnt_exist, :value => display_created_at.to_s+" (Protocols.io value)", class: "form-control" %>
- <%= f.text_field :doesnt_exist, :value => json_object['last_modified']+" (Protocols.io value)", class: "form-control" %> + <% display_last_modified=Time.at(json_object['last_modified'].to_i) %> + <%= f.text_field :doesnt_exist, :value => display_last_modified.to_s+" (Protocols.io value)", class: "form-control" %>
@@ -57,21 +58,55 @@
-
+
+ -
+ <% if json_object["before_start"]&&json_object["before_start"]!="" %> + + + + + <% end %> + <% if json_object["warning"]&&json_object["warning"]!="" %> + + + + + + + <% end %> + + + <% if json_object["guidelines"]&&json_object["guidelines"]!="" %> + + + + + + <% end %> <% counter=0 whitelist_simple=["1","6","17"] whitelist_complex=["8","9","15","18","19","20"]%> - <% #byebug %> <% json_object["steps"].each do |step| %> - - - + <% end #posamezni koraki%> + + <% if json_object["manuscript_citation"]&&json_object["manuscript_citation"]!="" %> + + + + + + <% end %> + + <% if json_object["publish_date"]&&json_object["publish_date"]!="" %> + + + + + + <% end %> + + <% if json_object["vendor_name"]&&json_object["vendor_name"]!="" %> + + + + + + <% end %> + <% if json_object["vendor_link"]&&json_object["vendor_link"]!="" %> + + + + + + <% end %> + <% if json_object["keywords"]&&json_object["keywords"]!="" %> + + + + + + <% end %> + <% if json_object["tags"]&&json_object["tags"]!="" %> + + + + + + <% end %>
+

Before starting protocol information

+ <%= strip_tags(json_object["before_start"].remove("\"")) %> + +
+

Protocol warning

+ <%= strip_tags(json_object["warning"].remove("\"")) %> + +
+

Guidelines

+ <%= strip_tags(json_object["guidelines"].remove("\"")) %> + +
Step <%= (counter+=1).to_s %> Step guid (Protocols.io) :<%= step["guid"] %> +

Step <%= (counter+=1).to_s %>


+ Step guid (Protocols.io) :<%= step["guid"] %> <% #byebug %> <% if counter>1 %>
Guid of previous step (Protocols.io) :<%= step["previous_guid"] %> @@ -79,59 +114,66 @@ <% step["components"].each do |key,value| %> <% #byebug %> - <% if counter>1 #nevem zaka ampak v vseh njihovih izvoženih jsonih ima prvi korak čudno strukturo - #elementov, v kateri so shranjeni kot hash, katerega ključ je "0", vrednost pa komponenta, to zruši iteriranje v enem stavku - #trenutno sem porabil {5} ur da bi našel rešitev, tako da bi ena zanka naredila oboje. - # to je samo v prvem koraku, naprej so vsi shranjeni brez tega arraya, in se po njih da normalno iterirat + <% if counter>1 #here i made an if to distinguish the first step from the others, because the first step + #sometimes has weird nesting that makes the below outputs not work %> - <% #byebug %> + <% #if false %> + <% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["name"] && key["data"]%>
- <%= key["name"]+" : "+key["data"] %> + <%= strip_tags(key["name"].remove("\""))+" : "+ strip_tags(key["data"].remove("\"")) %> <% #byebug #debug #comp[counter];counter;@json.file_contents["steps"][3]["components"][0]["name"] #@json.file_contents["steps"][0]["components"] %> + <% #end %> <% elsif key && whitelist_complex.include?(key["component_type_id"]) %> <% case key["component_type_id"]%> <% when "8"%>
- <%= "-"+key["name"]+" : "+key["source_data"]["name"] %> + <%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
- Developer : <%= key["source_data"]["developer"] %> + Developer : <%= strip_tags(key["source_data"]["developer"].remove("\"")) %>
- Version : <%= key["source_data"]["version"] %> + Version : <%= strip_tags(key["source_data"]["version"].remove("\"")) %>
- Link : <%= key["source_data"]["link"] %> + Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %>
- Repository : <%= key["source_data"]["repository"] %> + Repository : <%= strip_tags(key["source_data"]["repository"].remove("\"")) %>
- OS name , OS version : <%= key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] %> + OS name , OS version : <%= strip_tags(key["source_data"]["os_name"].remove("\""))+" , "+strip_tags(key["source_data"]["os_version"].remove("\"")) %> <% when "9"%>
- <%= "-"+key["name"]+" : "+key["source_data"]["name"] %> + <%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
- Link : <%= key["source_data"]["link"] %> + Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %> <% when "15"%>
- <%= "-"+key["name"]+" : "+key["source_data"]["name"] %> + <%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
- Description : <%= key["source_data"]["description"] %> + Description : <%= strip_tags(key["source_data"]["description"].remove("\"")) %>
- OS name , OS version : <%= key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] %> + OS name , OS version : <%= strip_tags(key["source_data"]["os_name"].remove("\""))+" , "+strip_tags(key["source_data"]["os_version"].remove("\"")) %> <% when "18"%> - +
+ -This protocol also contains an attached sub-protocol: <%= strip_tags(key["source_data"]["protocol_name"].remove("\"")) %> +
+ Author: <%= strip_tags(key["source_data"]["full_name"].remove("\"")) %> +
+ <% if key["source_data"]["link"]&&key["source_data"]["link"]!="" %> + Link: <%= strip_tags(key["source_data"]["link"].remove("\"")) %> + <% end %> <% when "19"%>
- <%= "-"+key["name"]+" : "+key["source_data"]["body"] %> + <%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["body"].remove("\"")) %>
- Link : <%= key["source_data"]["link"] %> + Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %> <% when "20"%> @@ -141,6 +183,7 @@ <% end %> + <% end #notranji if št 1%> @@ -149,11 +192,11 @@ <% unless value %> <% value=key #json format ima random arraye namest hashov, ta problem je opisan pri if counter > 1 stavku %> <% end %> - <% #byebug %> + <% if whitelist_simple.include?(value["component_type_id"])&& value["data"]!="" && value["name"] && value["data"] %>
- <%= value["name"]+" : "+value["data"] %> - <% #byebug + <%= strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["data"].remove("\"")) %> + <% #debug #comp[counter];counter;@json.file_contents["steps"][3]["components"][0]["name"] #@json.file_contents["steps"][0]["components"] @@ -163,40 +206,48 @@ <% case value["component_type_id"]%> <% when "8"%>
- <%= "-"+value["name"]+" : "+value["source_data"]["name"] %> + <%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
- Developer : <%= value["source_data"]["developer"] %> + Developer : <%= strip_tags(value["source_data"]["developer"].remove("\"")) %>
- Version : <%= value["source_data"]["version"] %> + Version : <%= strip_tags(value["source_data"]["version"].remove("\"")) %>
- Link : <%= value["source_data"]["link"] %> + Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %>
- Repository : <%= value["source_data"]["repository"] %> + Repository : <%= strip_tags(value["source_data"]["repository"].remove("\"")) %>
- OS name , OS version : <%= value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] %> + OS name , OS version : <%= strip_tags(value["source_data"]["os_name"].remove("\""))+" , "+strip_tags(value["source_data"]["os_version"].remove("\"")) %> <% when "9"%>
- <%= "-"+value["name"]+" : "+value["source_data"]["name"] %> + <%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
- Link : <%= value["source_data"]["link"] %> + Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %> <% when "15"%>
- <%= "-"+value["name"]+" : "+value["source_data"]["name"] %> + <%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
- Description : <%= value["source_data"]["description"] %> + Description : <%= strip_tags(value["source_data"]["description"].remove("\"")) %>
- OS name , OS version : <%= value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] %> + OS name , OS version : <%= strip_tags(value["source_data"]["os_name"].remove("\""))+" , "+strip_tags(value["source_data"]["os_version"].remove("\"")) %> <% when "18"%> +
+ -This protocol also contains an attached sub-protocol: <%= strip_tags(value["source_data"]["protocol_name"].remove("\"")) %> +
+ Author: <%= strip_tags(value["source_data"]["full_name"].remove("\"")) %> + <% if value["source_data"]["link"]&&value["source_data"]["link"]!="" %> +
+ Link: <%= strip_tags(value["source_data"]["link"].remove("\"")) %> + <% end %> <% when "19"%>
- <%= "-"+value["name"]+" : "+value["source_data"]["body"] %> + <%= "-"+strip_tags(value["name"])+" : "+strip_tags(value["source_data"]["body"].remove("\"")) %>
- Link : <%= value["source_data"]["link"] %> + Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %> <% when "20"%> @@ -211,12 +262,83 @@ <% end #komponente koraka %> +
WIP
+

Manuscript citation

+ <%= strip_tags(json_object["manuscript_citation"].remove("\"")) %> + +
+

Publish date

+ <%= strip_tags(json_object["publish_date"].remove("\"")) %> + +
+

Vendor name

+ <%= strip_tags(json_object["vendor_name"].remove("\"")) %> + +
+

Vendor link

+ <%= strip_tags(json_object["vendor_link"].remove("\"")) %> + +
+

Keywords

+ <%= strip_tags(json_object["keywords"].remove("\"")) %> + +
+

Tags

+ <% json_object["tags"].each do |tag| %> + <%= strip_tags(tag["tag_name"].remove("\""))+" , " %> + <% end %> +
From f861b1fc52ae7bac926019fc8d851698f90b59d9 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 15 Sep 2017 15:52:55 +0200 Subject: [PATCH 18/94] Configured the controller,the main task ahead is to figure out how to import all of the data i have available --- app/controllers/protocols_controller.rb | 16 ++++++---- ...mport_json_protocol_preview_modal.html.erb | 30 +++++++++++-------- config/routes.rb | 8 ++--- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 0a3d85203..ff989cf00 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -601,23 +601,29 @@ class ProtocolsController < ApplicationController end # #tule -def protocolsio_import_new - #@temp_json=JsonTemp.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.html {} format.js {} end end +def protocolsio_import_save + #@temp_json=JsonTemp.new + respond_to do |format| + format.html {render protocols} + format.js {render nothing} + + end +end + def protocolsio_temp_params params.require(:json_file) end diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 21acd0b8d..66f6ebfc3 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -1,3 +1,4 @@ +<%= form_for(protocol, :url => "protocols/protocolsio_import_save",method: :post) do |f| %> @@ -65,26 +65,26 @@
- +
<% if @json_object["before_start"]&&@json_object["before_start"]!="" %> -
Before starting protocol information:
- <%= (@json_object["before_start"]) %> + Before starting protocol information:
+ <%= (@json_object["before_start"]) %>
<% end %> <% if @json_object["warning"]&&@json_object["warning"]!="" %> -
Protocol warning:
- <%= (@json_object["warning"]) %> + Protocol warning:
+ <%= (@json_object["warning"]) %>
<% end %> <% if @json_object["guidelines"]&&@json_object["guidelines"]!="" %> -
Guidelines:
- <%= (@json_object["guidelines"]) %> + Guidelines:
+ <%= (@json_object["guidelines"]) %>
<% end %> @@ -150,7 +150,6 @@ <% if counter>1 #here i made an if to distinguish the first step from the others, because the first step #sometimes has weird nesting that makes the below outputs not work %> - <% #byebug %> <% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["data"] %>
<% case key["component_type_id"]%> @@ -169,15 +168,15 @@
<%= key["name"]+": " %> <%= (key["source_data"]["name"]) %>
- Developer : <%= (key["source_data"]["developer"]) %> + Developer: <%= (key["source_data"]["developer"]) %>
- Version : <%= (key["source_data"]["version"]) %> + Version: <%= (key["source_data"]["version"]) %>
- Link : <%= (key["source_data"]["link"]) %> + Link: <%= (key["source_data"]["link"]) %>
- Repository : <%= (key["source_data"]["repository"]) %> + Repository: <%= (key["source_data"]["repository"]) %>
- OS name , OS version : <%= (key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) %> + OS name , OS version: <%= (key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) %> <% when "9"%>
@@ -190,9 +189,9 @@
<%= key["name"]+": " %> <%= key["source_data"]["name"] %>
- Description : <%= (key["source_data"]["description"]) %> + Description: <%= (key["source_data"]["description"]) %>
- OS name , OS version : <%= (key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) %> + OS name , OS version: <%= (key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) %> <% when "18"%>
@@ -207,7 +206,7 @@
<%= key["name"]+": " %> <%= key["source_data"]["body"] %>
- Link : <%= (key["source_data"]["link"]) %> + Link: <%= (key["source_data"]["link"]) %> <% when "20"%> @@ -354,7 +353,7 @@ <% end %> <% end %> - +
From deef790951309b50ebcc77f0e8f6a810e9c6cc5a Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 11:56:50 +0200 Subject: [PATCH 30/94] added validations to controllers (file too big, names too big), some javascript error messagges, and fixed some nil exceptions in controllers appending nil strings to descriptions --- app/controllers/protocols_controller.rb | 101 ++++++++++++------ ...mport_json_protocol_preview_modal.html.erb | 19 ++-- .../protocolsio_import_create.js.erb | 19 ++-- .../protocols/protocolsio_import_save.js.erb | 5 + config/locales/en.yml | 1 + 5 files changed, 102 insertions(+), 43 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index e9169db40..442cd23fc 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -606,9 +606,20 @@ class ProtocolsController < ApplicationController # #tule def protocolsio_import_create - + @protocolsio_too_big=false + file_size=(File.size(params[:json_file].path)) + + if(file_size/1000>Constants::FILE_MAX_SIZE_MB) + @protocolsio_too_big=true + respond_to do |format| + format.js {} + end + else + @protocolsio_too_big=false + end json_file_contents=File.read(params[:json_file].path) + json_file_contents.gsub! '\"', "'" @@ -632,7 +643,7 @@ def protocolsio_import_save # will have to fit various things in here (guidelines, manuscript citations etc etc) #"before_start","warning","guidelines","manuscript_citation","publish_date","created_on" #"vendor_name","vendor_link","keywords","tags" - description_array = [ "before_start","warning","guidelines","manuscript_citation","publish_date","created_on","vendor_name","vendor_link","keywords","tags" ] + description_array = [ "before_start","warning","guidelines","manuscript_citation","publish_date","created_on","vendor_name","vendor_link","keywords","tags","link" ] description_string=params["protocol"]["description"] #@import_object["description"]=params["protocol"]["description"] description_array.each do |element| @@ -640,16 +651,16 @@ def protocolsio_import_save if(@json_object[element]&&@json_object[element]!="") new_element = element.slice(0,1).capitalize + element.slice(1..-1) new_element= new_element.gsub("_"," ") - description_string=description_string+new_element.to_s+": "+params["protocol"]["created_at"].to_s+"\n" + description_string=description_string+new_element.to_s+": "+Sanitize.clean(params["protocol"]["created_at"].to_s)+"\n" end else if(element=="tags") - if(@json_object[element]&&@json_object[element]!="") + if(@json_object[element].any?&&@json_object[element]!="") new_element = element.slice(0,1).capitalize + element.slice(1..-1) new_element= new_element.gsub("_"," ") description_string=description_string+new_element.to_s+": " @json_object[element].each do |tag| - description_string=description_string+tag["tag_name"]+" , " + description_string=description_string+Sanitize.clean(tag["tag_name"])+" , " end description_string=description_string+"\n" end @@ -658,7 +669,7 @@ def protocolsio_import_save if(@json_object[element]&&@json_object[element]!="") new_element = element.slice(0,1).capitalize + element.slice(1..-1) new_element= new_element.gsub("_"," ") - description_string=description_string+new_element.to_s+": "+@json_object[element].to_s+"\n" + description_string=description_string+new_element.to_s+": "+Sanitize.clean(@json_object[element].to_s)+"\n" end end end @@ -696,7 +707,7 @@ def protocolsio_import_save when "1" if !key["data"].nil? && key["data"]!="" - element_string="
"+key["data"]+"
" + element_string="
"+(key["data"])+"
" if(@import_object["steps"][step_pos.to_s]["description"]) @import_object["steps"][step_pos.to_s]["description"]<" + element_string="
Expected result: "+(key["data"])+"
" @import_object["steps"][step_pos.to_s]["description"]<Developer: "+key["source_data"]["developer"]+"
Version: "+key["source_data"]["version"]+"
Link: "+key["source_data"]["link"]+"
Repository: "+key["source_data"]["repository"]+"
OS name , OS version: "+key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] + if(key["source_data"]["name"]&&key["source_data"]["developer"]&&key["source_data"]["version"]&&key["source_data"]["link"]&&key["source_data"]["repository"]&&key["source_data"]["os_name"]&&key["source_data"]["os_version"]) + element_string="
Software package: "+(key["source_data"]["name"])+"
Developer: "+(key["source_data"]["developer"])+"
Version: "+(key["source_data"]["version"])+"
Link: "+(key["source_data"]["link"])+"
Repository: "+(key["source_data"]["repository"])+"
OS name , OS version: "+(key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) @import_object["steps"][step_pos.to_s]["description"]<Link: "+key["source_data"]["link"] + if(key["source_data"]["name"]&&key["source_data"]["link"]) + element_string="
Dataset: "+(key["source_data"]["name"])+"
Link: "+(key["source_data"]["link"]) @import_object["steps"][step_pos.to_s]["description"]<Description: "+key["source_data"]["description"]+"
OS name , OS version: "+key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] + if(key["source_data"]["name"]&&key["source_data"]["description"]&&key["source_data"]["os_name"]&&key["source_data"]["os_version"]) + element_string="
Command: "+(key["source_data"]["name"])+"
Description: "+(key["source_data"]["description"])+"
OS name , OS version: "+(key["source_data"]["os_name"])+" , "+(key["source_data"]["os_version"]) @import_object["steps"][step_pos.to_s]["description"]<Author: "+key["source_data"]["full_name"]+"
Link: "+key["source_data"]["link"] + if(key["source_data"]["protocol_name"]&&key["source_data"]["full_name"]&&key["source_data"]["link"]) + element_string="
This protocol also contains an attached sub-protocol: "+(key["source_data"]["protocol_name"])+"
Author: "+(key["source_data"]["full_name"])+"
Link: "+(key["source_data"]["link"]) + @import_object["steps"][step_pos.to_s]["description"]<Link: "+key["source_data"]["link"] + if(key["source_data"]["body"]&&key["source_data"]["link"]) + element_string="
Safety information: "+(key["source_data"]["body"])+"
Link: "+(key["source_data"]["link"]) @import_object["steps"][step_pos.to_s]["description"]<" + element_string="
"+(value["data"].to_s)+"
" if(@import_object["steps"][step_pos.to_s]["description"]) @import_object["steps"][step_pos.to_s]["description"]<" + element_string="
Expected result: "+(value["data"])+"
" @import_object["steps"][step_pos.to_s]["description"]<Developer: "+value["source_data"]["developer"]+"
Version: "+value["source_data"]["version"]+"
Link: "+value["source_data"]["link"]+"
Repository: "+value["source_data"]["repository"]+"
OS name , OS version: "+value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] - @import_object["steps"][step_pos.to_s]["description"]<Link: "+value["source_data"]["link"] - @import_object["steps"][step_pos.to_s]["description"]<Description: "+value["source_data"]["description"]+"
OS name , OS version: "+value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] - @import_object["steps"][step_pos.to_s]["description"]<Author: "+value["source_data"]["full_name"]+"
Link: "+value["source_data"]["link"] + if(value["source_data"]["name"]&&value["source_data"]["developer"]&&value["source_data"]["version"]&&value["source_data"]["link"]&&value["source_data"]["repository"]&&value["source_data"]["os_name"]&&value["source_data"]["os_version"]) + element_string="
Software package: "+(value["source_data"]["name"])+"
Developer: "+(value["source_data"]["developer"])+"
Version: "+(value["source_data"]["version"])+"
Link: "+(value["source_data"]["link"])+"
Repository: "+(value["source_data"]["repository"])+"
OS name , OS version: "+(value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) + @import_object["steps"][step_pos.to_s]["description"]<Link: "+(value["source_data"]["link"]) + @import_object["steps"][step_pos.to_s]["description"]<Description: "+(value["source_data"]["description"])+"
OS name , OS version: "+(value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) + @import_object["steps"][step_pos.to_s]["description"]<Author: "+(value["source_data"]["full_name"])+"
Link: "+(value["source_data"]["link"]) + @import_object["steps"][step_pos.to_s]["description"]<Link: "+value["source_data"]["link"] + if(value["source_data"]["body"]&&value["source_data"]["link"]) + + element_string="
Safety information: "+(value["source_data"]["body"])+"
Link: "+(value["source_data"]["link"]) @import_object["steps"][step_pos.to_s]["description"]< root_url # protocolsDatatable.ajax.reload(); # $('#modal-import-json-protocol-preview').modal('hide'); else + @protocolsio_general_error=false format.json { render json: { name: p_name, new_name: protocol.name, status: :ok diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 0bdca490e..703b8eb64 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -86,6 +86,13 @@ Guidelines:
<%= (@json_object["guidelines"]) %>
+ <% end %> + + <% if @json_object["link"]&&@json_object["link"]!="" %> + +
Supplied link:
+ <%= (@json_object["link"]) %> + <% end %> <% counter=0 %> @@ -317,37 +324,37 @@ <% if @json_object["manuscript_citation"]&&@json_object["manuscript_citation"]!="" %> -
Manuscript citation
+
Manuscript citation:
<%= (@json_object["manuscript_citation"]) %> <% end %> <% if @json_object["publish_date"]&&@json_object["publish_date"]!="" %> -
Publish date
+
Publish date:
<%= (@json_object["publish_date"]) %> <% end %> <% if @json_object["vendor_name"]&&@json_object["vendor_name"]!="" %> -
Vendor name
+
Vendor name:
<%= (@json_object["vendor_name"]) %> <% end %> <% if @json_object["vendor_link"]&&@json_object["vendor_link"]!="" %> -
Vendor link
+
Vendor link:
<%= (@json_object["vendor_link"]) %> <% end %> <% if @json_object["keywords"]&&@json_object["keywords"]!="" %> -
Keywords
+
Keywords:
<%= (@json_object["keywords"]) %> <% end %> <% if @json_object["tags"]&&@json_object["tags"]!="" %> -
Tags
+
Tags:
<% @json_object["tags"].each do |tag| %> <%= (tag["tag_name"])+" , " %> <% end %> diff --git a/app/views/protocols/protocolsio_import_create.js.erb b/app/views/protocols/protocolsio_import_create.js.erb index 8d8b03acf..f37528b00 100644 --- a/app/views/protocols/protocolsio_import_create.js.erb +++ b/app/views/protocols/protocolsio_import_create.js.erb @@ -1,9 +1,16 @@ -$('#modal-import-json-protocol').modal('hide'); -<% if remotipart_submitted? %> - $('#protocolsio-preview-modal-target').html("<%= j "#{render(:partial => 'protocols/import_export/import_json_protocol_preview_modal')}" %>"); +<% if @protocolsio_too_big %> +alert('<%= I18n.t('my_modules.protocols.load_from_file_size_error', + size: Constants::FILE_MAX_SIZE_MB ) %>'); + + <% else %> - $('#protocolsio-preview-modal-target').html("<%= j render(:partial => 'protocols/import_export/import_json_protocol_preview_modal') %>"); -<% end %> -$('#modal-import-json-protocol-preview').modal('show'); + $('#modal-import-json-protocol').modal('hide'); + <% if remotipart_submitted? %> + $('#protocolsio-preview-modal-target').html("<%= j "#{render(:partial => 'protocols/import_export/import_json_protocol_preview_modal')}" %>"); + <% else %> + $('#protocolsio-preview-modal-target').html("<%= j render(:partial => 'protocols/import_export/import_json_protocol_preview_modal') %>"); + <% end %> + $('#modal-import-json-protocol-preview').modal('show'); +<% end %> diff --git a/app/views/protocols/protocolsio_import_save.js.erb b/app/views/protocols/protocolsio_import_save.js.erb index e3e10e8fc..3741c0eb3 100644 --- a/app/views/protocols/protocolsio_import_save.js.erb +++ b/app/views/protocols/protocolsio_import_save.js.erb @@ -1,2 +1,7 @@ +<% if @protocolsio_general_error %> +alert('<%= I18n.t('my_modules.protocols.load_from_file_protocol_general_error', max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>'); +<% else %> + $('#modal-import-json-protocol-preview').modal('hide'); protocolsDatatable.ajax.reload(); +<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c0f362732..b17d01075 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -603,6 +603,7 @@ en: load_from_file_error: "Failed to load the protocol from file." load_from_file_error_locked: "Failed to load the protocol from file. One or more files are currently being edited." load_from_file_size_error: "Failed to load the protocol from file. Limit is %{size}Mb." + load_from_file_protocol_general_error: "Failed to load the protocol from file. It is likely that certain fields (protocol and individual step titles and names) contain too many or too few characters.(max is %{max} and min is %{min})" results: head_title: "%{project} | %{module} | Results" add_label: "Add new result:" From 6a07aa28e4338ae7bcd341aaca1f6192ff30ca83 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 13:11:49 +0200 Subject: [PATCH 31/94] Accidentally removed this line after reviewing git changes, adding it back --- app/assets/javascripts/protocols/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index 031731988..b53a00c23 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -335,7 +335,7 @@ function initModals() { modal.find(".modal-body").html(""); // Simply re-render table - + protocolsDatatable.ajax.reload(); } From 4051c0b06baf6ca8bb67763232f8dea8273492d4 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 13:28:38 +0200 Subject: [PATCH 32/94] Deleted old unused files i spotted on github --- app/assets/javascripts/temp_jsons.js | 2 -- app/assets/stylesheets/temp_jsons.scss | 3 --- app/controllers/temp_jsons_controller.rb | 16 ---------------- app/helpers/temp_jsons_helper.rb | 2 -- test/controllers/temp_jsons_controller_test.rb | 7 ------- 5 files changed, 30 deletions(-) delete mode 100644 app/assets/javascripts/temp_jsons.js delete mode 100644 app/assets/stylesheets/temp_jsons.scss delete mode 100755 app/controllers/temp_jsons_controller.rb delete mode 100644 app/helpers/temp_jsons_helper.rb delete mode 100644 test/controllers/temp_jsons_controller_test.rb diff --git a/app/assets/javascripts/temp_jsons.js b/app/assets/javascripts/temp_jsons.js deleted file mode 100644 index dee720fac..000000000 --- a/app/assets/javascripts/temp_jsons.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place all the behaviors and hooks related to the matching controller here. -// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/temp_jsons.scss b/app/assets/stylesheets/temp_jsons.scss deleted file mode 100644 index b12deb7f5..000000000 --- a/app/assets/stylesheets/temp_jsons.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the temp_jsons controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/temp_jsons_controller.rb b/app/controllers/temp_jsons_controller.rb deleted file mode 100755 index 2839fdd85..000000000 --- a/app/controllers/temp_jsons_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class TempJsonsController < ApplicationController - - def new - @temp_json=JsonTemp.new - end - def create - @temp_json=JsonTemp.new(temp_params) - json_file_contents=@temp_json.json_file.read - json_object=JSON.parse(json_file_contents) - - end - - def temp_params - params.require(:json_file) - end -end diff --git a/app/helpers/temp_jsons_helper.rb b/app/helpers/temp_jsons_helper.rb deleted file mode 100644 index 554afcb2d..000000000 --- a/app/helpers/temp_jsons_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module TempJsonsHelper -end diff --git a/test/controllers/temp_jsons_controller_test.rb b/test/controllers/temp_jsons_controller_test.rb deleted file mode 100644 index 4fe936641..000000000 --- a/test/controllers/temp_jsons_controller_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class TempJsonsControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end -end From 6ebdea5dcef569f23a83ad95f31e5cac5cf54b60 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 15:12:29 +0200 Subject: [PATCH 33/94] Fixed old workaround with inconsistent protocols.io json formatting and made the workaround nicer (now its only one if statement, instead of one whole block of duplicated code) --- app/controllers/protocols_controller.rb | 88 ++------------ ...mport_json_protocol_preview_modal.html.erb | 111 +++--------------- 2 files changed, 25 insertions(+), 174 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 442cd23fc..d4452e5cc 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -608,7 +608,7 @@ class ProtocolsController < ApplicationController def protocolsio_import_create @protocolsio_too_big=false file_size=(File.size(params[:json_file].path)) - + if(file_size/1000>Constants::FILE_MAX_SIZE_MB) @protocolsio_too_big=true respond_to do |format| @@ -699,8 +699,12 @@ def protocolsio_import_save step["components"].each do |key,value| element_string=nil - if counter>1 #here i made an if to distinguish the first step from the others, because the first step - #sometimes has weird nesting that requires different handling + if counter<=1 #here i made an if to distinguish the first step from the others, because the first step + #sometimes has index values as keys instead of hashes + if value.class==Hash + key=value + end + end if whitelist_simple.include?(key["component_type_id"]) case key["component_type_id"] @@ -770,85 +774,7 @@ def protocolsio_import_save end end #finished step component iteration - else #it is first step - unless value - value=key #some json files have random empty arrays in beggining of step components - end - if whitelist_simple.include?(value["component_type_id"]) - - case value["component_type_id"] - when "1" - if !value["data"].nil? && value["data"]!="" - - element_string="
"+(value["data"].to_s)+"
" - if(@import_object["steps"][step_pos.to_s]["description"]) - @import_object["steps"][step_pos.to_s]["description"]<" - @import_object["steps"][step_pos.to_s]["description"]<Developer: "+(value["source_data"]["developer"])+"
Version: "+(value["source_data"]["version"])+"
Link: "+(value["source_data"]["link"])+"
Repository: "+(value["source_data"]["repository"])+"
OS name , OS version: "+(value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) - @import_object["steps"][step_pos.to_s]["description"]<Link: "+(value["source_data"]["link"]) - @import_object["steps"][step_pos.to_s]["description"]<Description: "+(value["source_data"]["description"])+"
OS name , OS version: "+(value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) - @import_object["steps"][step_pos.to_s]["description"]<Author: "+(value["source_data"]["full_name"])+"
Link: "+(value["source_data"]["link"]) - @import_object["steps"][step_pos.to_s]["description"]<Link: "+(value["source_data"]["link"]) - @import_object["steps"][step_pos.to_s]["description"]< <% step["components"].each do |key1,value1| #finding section (title of step) %> - <% if counter >1 %> + <% if counter <=1 %> + <% if value1.class==Hash %> + <% key1=value1 %> + <% end %> + <% end %> <% if(key1["component_type_id"]=="6") %> <% if(!key1["data"].nil? && key1["data"]!="") %> <%# byebug %> <% title ||=key1["data"] %> <% end %> <% end %> - <% else %> - <% unless value1 %> - <% value1=key1 %> - <% end %> - <% if(value1["component_type_id"]=="6") %> - <% if(!value1["data"].nil? && value1["data"]!="") %> - <% #byebug %> - <% title ||=value1["data"] %> + <% end %> - <% end %> - <% end %> - <% end %> <% if title.nil? %> <%# byebug %> <% title ="Protocols.io" %> @@ -153,16 +147,19 @@ <% step["components"].each do |key,value| %> - - <% if counter>1 #here i made an if to distinguish the first step from the others, because the first step - #sometimes has weird nesting that makes the below outputs not work + <% if counter<=1 #here i made an if to distinguish the first step from the others, because the first step + #sometimes has index values as keys instead of hashes %> + <% if value.class==Hash %> + <% key=value %> + <% end %> + <% end %> + + <% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["data"] %>
<% case key["component_type_id"]%> - <% when "6" %> - - <% when "1" %> + <% when "1" %>
Description: <%=key["data"]%>
<% when "17" %>
Expected result: <%=key["data"]%>
@@ -220,83 +217,11 @@ <% else %> - <% end %> + <% end #case if%> - <% end #notranji if št 1%> - - <% else #if first step %> - - <% unless value %> - <% value=key #protocols io first step json formating is sometimes broken, this is a workaround%> - <% end %> - <% #byebug %> - <% if whitelist_simple.include?(value["component_type_id"]) && value["data"] && value["data"]!="" %> -
- <% case value["component_type_id"]%> - <% when "6" %> - - <% when "1" %> -
Description: <%=value["data"]%>
- <% when "17" %> -
Expected result: <%=value["data"]%>
- <% else %> - <% end %> - - <% elsif value && whitelist_complex.include?(value["component_type_id"]) %> - <% case value["component_type_id"]%> - <% when "8"%> -
- <%= value["name"]+": " %> <%= (value["source_data"]["name"]) %> -
- Developer : <%= (value["source_data"]["developer"]) %> -
- Version : <%= (value["source_data"]["version"]) %> -
- Link : <%= (value["source_data"]["link"]) %> -
- Repository : <%= (value["source_data"]["repository"]) %> -
- OS name , OS version : <%= (value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) %> - - <% when "9"%> -
- <%= value["name"]+": " %> <%= value["source_data"]["name"] %> -
- Link : <%= (value["source_data"]["link"]) %> + <% end #inner if%> - <% when "15"%> -
- <%= value["name"]+": " %> <%= value["source_data"]["name"] %> -
- Description : <%= (value["source_data"]["description"]) %> -
- OS name , OS version : <%= (value["source_data"]["os_name"])+" , "+(value["source_data"]["os_version"]) %> - - <% when "18"%> -
- This protocol also contains an attached sub-protocol: <%= (value["source_data"]["protocol_name"]) %> -
- Author: <%= (value["source_data"]["full_name"]) %> -
- <% if value["source_data"]["link"]&&value["source_data"]["link"]!="" %> - Link: <%= (value["source_data"]["link"]) %> - <% end %> - <% when "19"%> -
- <%= value["name"]+": " %> <%= value["source_data"]["body"] %> -
- Link : <%= (value["source_data"]["link"]) %> - - - <% when "20"%> - - <% else %> - - <% end %> - - <% end #inner whitelist if%> - <% end #first step if %> <% end #step component loop %>
@@ -317,7 +242,7 @@
- <%# div od blocka %> + <%# block div%> <% end #step loop%> From dd4d4072e875c72be3945fc6d2d5d2ff69f9ab67 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 16:02:56 +0200 Subject: [PATCH 34/94] Made code more aesthetic --- app/assets/javascripts/protocols/index.js | 2 - app/controllers/protocols_controller.rb | 50 ++++++------------- ...mport_json_protocol_preview_modal.html.erb | 2 +- .../protocolsio_import_create.js.erb | 2 +- 4 files changed, 17 insertions(+), 39 deletions(-) diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index b53a00c23..13960bbec 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -338,8 +338,6 @@ function initModals() { protocolsDatatable.ajax.reload(); } - - // Make private modal hidden action $("#make-private-results-modal").on("hidden.bs.modal", function(e) { refresh($(this)); diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index d4452e5cc..62ec530e0 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -66,7 +66,6 @@ class ProtocolsController < ApplicationController before_action :check_import_permissions, only: [ :import ] before_action :check_export_permissions, only: [ :export ] - def index end @@ -469,7 +468,6 @@ class ProtocolsController < ApplicationController end def load_from_repository - respond_to do |format| if @protocol.can_destroy? transaction_error = false @@ -520,7 +518,6 @@ class ProtocolsController < ApplicationController def load_from_file # This is actually very similar to import - respond_to do |format| if @protocol.can_destroy? transaction_error = false @@ -569,8 +566,7 @@ class ProtocolsController < ApplicationController end end - def import #tega uporabi .eln import - + def import protocol = nil respond_to do |format| transaction_error = false @@ -603,8 +599,7 @@ class ProtocolsController < ApplicationController end end end -# -#tule + def protocolsio_import_create @protocolsio_too_big=false file_size=(File.size(params[:json_file].path)) @@ -612,40 +607,30 @@ def protocolsio_import_create if(file_size/1000>Constants::FILE_MAX_SIZE_MB) @protocolsio_too_big=true respond_to do |format| - format.js {} + format.js {} #if file is too big, default to the js.erb file named the same as this controller + # where a javascript alert is called end - else - @protocolsio_too_big=false end - json_file_contents=File.read(params[:json_file].path) - - json_file_contents.gsub! '\"', "'" - - + json_file_contents.gsub! '\"', "'" #escaped double quotes too stressfull, html works with single quotes too + #json double quotes dont get escaped since they dont match \", they are just " @json_object=JSON.parse(json_file_contents) @protocol=Protocol.new - respond_to do |format| - #format.html {} - format.js {} + format.js {} # go to the js.erb file named the same as this controller, where a preview modal is rendered, and + # some modals get closed and opened end - end def protocolsio_import_save - #@temp_json=JsonTemp.new @json_object=JSON.parse(params["json_object"]) @import_object=Hash.new @import_object["name"]=params["protocol"]["name"] - - # will have to fit various things in here (guidelines, manuscript citations etc etc) - #"before_start","warning","guidelines","manuscript_citation","publish_date","created_on" - #"vendor_name","vendor_link","keywords","tags" + # since scinote only has description field, while protocols.io has many many others, here i am basically + #putting everything important from protocols.io into description description_array = [ "before_start","warning","guidelines","manuscript_citation","publish_date","created_on","vendor_name","vendor_link","keywords","tags","link" ] description_string=params["protocol"]["description"] - #@import_object["description"]=params["protocol"]["description"] description_array.each do |element| if(element=="created_on") if(@json_object[element]&&@json_object[element]!="") @@ -664,7 +649,8 @@ def protocolsio_import_save end description_string=description_string+"\n" end - + #Since protocols description field doesnt show html, i just remove it here because its even messier Otherwise + #what this does is basically appends "FIELD NAME: "+" FIELD VALUE" to description for various fields else if(@json_object[element]&&@json_object[element]!="") new_element = element.slice(0,1).capitalize + element.slice(1..-1) @@ -674,33 +660,27 @@ def protocolsio_import_save end end end - @import_object["authors"]=params["protocol"]["authors"] @import_object["created_at"]=params["protocol"]["created_at"] @import_object["updated_at"]=params["protocol"]["last_modified"] @import_object["description"]=description_string - #@import_object["steps"] - - @import_object["steps"]=Hash.new counter=0 step_pos=-1 - #these whitelists are there to not let some useless step components true, that always have data set to null (data doesnt get imported over to json) + #these whitelists are there to not let some useless step components trough, that always have data set to null (data doesnt get imported over to json) whitelist_simple=["1","6","17"] #(simple to map) id 1= step description, id 6= section (title), id 17= expected result whitelist_complex=["8","9","15","18","19","20"] #(complex mapping with nested hashes) id 8 = software package, id 9 = dataset, id 15 = command, id 18 = attached sub protocol # id 19= safety information ,id 20= regents (materials, like scinote samples kind of) @json_object["steps"].each do |step| - #@import_object["steps"][step_pos.to_s]=step step_pos+=1 counter+=1 - @import_object["steps"][step_pos.to_s]=Hash.new @import_object["steps"][step_pos.to_s]["position"]=step_pos step["components"].each do |key,value| element_string=nil if counter<=1 #here i made an if to distinguish the first step from the others, because the first step - #sometimes has index values as keys instead of hashes + #sometimes has index values as keys instead of hashes, for no good reason if value.class==Hash key=value end @@ -724,7 +704,7 @@ def protocolsio_import_save if !key["data"].nil? && key["data"]!="" @import_object["steps"][step_pos.to_s]["name"]=key["data"] else - @import_object["steps"][step_pos.to_s]["name"]="Protocols.io" + @import_object["steps"][step_pos.to_s]["name"]="Step" end when "17" if !key["data"].nil? && key["data"]!="" diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 50417e9e7..5f1bd5842 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -134,7 +134,7 @@ <% end %> <% if title.nil? %> <%# byebug %> - <% title ="Protocols.io" %> + <% title ="Step" %> <% end %> <%= title %> diff --git a/app/views/protocols/protocolsio_import_create.js.erb b/app/views/protocols/protocolsio_import_create.js.erb index f37528b00..50d95301f 100644 --- a/app/views/protocols/protocolsio_import_create.js.erb +++ b/app/views/protocols/protocolsio_import_create.js.erb @@ -7,7 +7,7 @@ alert('<%= I18n.t('my_modules.protocols.load_from_file_size_error', <% else %> $('#modal-import-json-protocol').modal('hide'); - <% if remotipart_submitted? %> + <% if remotipart_submitted? %> <%# a workaround to a bug with remotipart, that caused alot of headache, courtesy of github.com/dhampik %> $('#protocolsio-preview-modal-target').html("<%= j "#{render(:partial => 'protocols/import_export/import_json_protocol_preview_modal')}" %>"); <% else %> $('#protocolsio-preview-modal-target').html("<%= j render(:partial => 'protocols/import_export/import_json_protocol_preview_modal') %>"); From 549346bb0a8ec35190d270bd4d431556db748516 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 22 Sep 2017 16:13:06 +0200 Subject: [PATCH 35/94] Deleted a warning that was out of place --- .../_import_json_protocol_preview_modal.html.erb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 5f1bd5842..6bf7ffa68 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -11,11 +11,7 @@ From ac26b17ddf29a1115b59007480a4145155b03c12 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 3 Nov 2017 16:45:15 +0100 Subject: [PATCH 81/94] Rubocop refactor --- app/assets/stylesheets/themes/scinote.scss | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index e0da5c7ba..89e7781b0 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -339,16 +339,18 @@ a { } .btn-link-alt { border-radius: 4px; + cursor: pointer; margin-right: 5px; padding: 3px; - cursor:pointer; } -.btn-invis-file{ + +.btn-invis-file { + display: none; opacity: 0; position: absolute; z-index: -1; - display: none; } + .btn-open-file { position: relative; overflow: hidden; @@ -1272,20 +1274,20 @@ ul.content-module-activities { } } -/* Import json protocols.io protocol modal */ +// Import json protocols.io protocol modal #modal-import-json-protocol-preview .modal-dialog { width: 70%; } .import-protocols-modal-preview-container-json { height: 300px; - overflow-y: scroll; overflow-x: scroll; + overflow-y: scroll; width: 100%; .eln-table { - text-align: center; height: 21px; + text-align: center; } .badge-preview { @@ -1834,8 +1836,8 @@ textarea.textarea-sm { -webkit-padding-after: 0; } .btn.btn-default-link { - border:none; - padding:0; + border: 0; + padding: 0; height: 100%; min-height: 34px; -webkit-padding-before: 0; From 4354363215c27b101161d22d16e373a8799e093f Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 3 Nov 2017 16:46:03 +0100 Subject: [PATCH 82/94] rubocop refactor css --- app/assets/stylesheets/themes/scinote.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 89e7781b0..96be2928b 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1837,11 +1837,11 @@ textarea.textarea-sm { } .btn.btn-default-link { border: 0; - padding: 0; height: 100%; min-height: 34px; - -webkit-padding-before: 0; + padding: 0; -webkit-padding-after: 0; + -webkit-padding-before: 0; } } From 0dc0109d91d1f9cfcd56acac6defced00b4936be Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 3 Nov 2017 21:47:52 +0100 Subject: [PATCH 83/94] reverted schema --- db/schema.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index e0fcd75d2..337d4ca50 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -544,12 +544,12 @@ ActiveRecord::Schema.define(version: 20170619125051) do add_index "samples", ["user_id"], name: "index_samples_on_user_id", using: :btree create_table "samples_tables", force: :cascade do |t| - t.jsonb "status", default: {"time"=>0, "order"=>[[2, "desc"]], "start"=>0, "length"=>10, "search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "columns"=>[{"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}], "assigned"=>"all", "ColReorder"=>[0, 1, 2, 3, 4, 5, 6]}, null: false - t.integer "user_id", null: false - t.integer "team_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end + t.jsonb "status", default: {"time"=>0, "order"=>[[2, "desc"]], "start"=>0, "length"=>10, "search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "columns"=>[{"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}, {"search"=>{"regex"=>false, "smart"=>true, "search"=>"", "caseInsensitive"=>true}, "visible"=>true}], "ColReorder"=>[0, 1, 2, 3, 4, 5, 6]}, null: false + t.integer "user_id", null: false + t.integer "team_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false +end add_index "samples_tables", ["team_id"], name: "index_samples_tables_on_team_id", using: :btree add_index "samples_tables", ["user_id"], name: "index_samples_tables_on_user_id", using: :btree From 04c6f0c20df1227c9695b6a3822a495536858a23 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 3 Nov 2017 21:50:06 +0100 Subject: [PATCH 84/94] schema missing space --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 337d4ca50..26902db7c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -549,7 +549,7 @@ ActiveRecord::Schema.define(version: 20170619125051) do t.integer "team_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false -end + end add_index "samples_tables", ["team_id"], name: "index_samples_tables_on_team_id", using: :btree add_index "samples_tables", ["user_id"], name: "index_samples_tables_on_user_id", using: :btree From 9086cd8b6b79a53ec474bb26ec8e917ef0bb023b Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 25 Oct 2017 22:08:33 +0200 Subject: [PATCH 85/94] Jira branch code --- .../import_export/_import_json_protocol_p_desc.html.erb | 8 ++++---- config/locales/en.yml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb index b1a62200f..365fc8dd2 100644 --- a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb @@ -28,10 +28,6 @@ <%= t('protocols.protocols_io_import.preview.guideln') %> <%= sanitize_input(json_object['guidelines'].html_safe) %>
<% end %> - <% if json_object['link'].present? %> - <%= t('protocols.protocols_io_import.preview.p_link') %> - <%= sanitize_input(json_object['link'].html_safe) %>
- <% end %> <% if json_object['manuscript_citation'].present? %> <%= t('protocols.protocols_io_import.preview.manu_cit') %> <%= sanitize_input(json_object['manuscript_citation'].html_safe) %>
@@ -58,6 +54,10 @@ <%= sanitize_input(tag['tag_name'])+' , ' %>
<% end %> <% end %> + <% if json_object['link'].present? %> + <%= t('protocols.protocols_io_import.preview.p_link') %> + <%= sanitize_input(json_object['link'].html_safe) %>
+ <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index d77f7546c..3331e45cd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1385,7 +1385,7 @@ en: b_s_p: "Before starting protocol information:" warn: "Protocol warning:" guideln: "Guidelines:" - p_link: "Supplied link:" + p_link: "Link:" s_nobr_link: "Link:" s_link: "Link:" s_desc: "Description:" @@ -1555,6 +1555,7 @@ en: title: "Import results" message_failed: "Failed to import %{nr} protocol/s." message_ok: "Successfully imported %{nr} protocol/s." + message_ok_pio: "Successfully imported protocol from protocols.io file." row_success: "Imported" row_renamed: "Imported & renamed" row_failed: "Failed" From 8b247770efa065870bb7b4285957512f9ac56e05 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 25 Oct 2017 23:04:19 +0200 Subject: [PATCH 86/94] Added the success flash alert --- app/views/protocols/protocolsio_import_save.js.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/protocols/protocolsio_import_save.js.erb b/app/views/protocols/protocolsio_import_save.js.erb index 16ad30454..830ebafbf 100644 --- a/app/views/protocols/protocolsio_import_save.js.erb +++ b/app/views/protocols/protocolsio_import_save.js.erb @@ -1,8 +1,9 @@ <% if @protocolsio_general_error %> - alert('<%= I18n.t('my_modules.protocols.load_from_file_protocol_general_error', + alert('<%= t('my_modules.protocols.load_from_file_protocol_general_error', max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>'); <% else %> $('#modal-import-json-protocol-preview').modal('hide'); $('#protocols_io_form').trigger("reset"); protocolsDatatable.ajax.reload(); + HelperModule.flashAlertMsg('<%= t('protocols.index.import_results.message_ok_pio')%>', 'success'); <% end %> From feb686b4ac604583d50326f63d392e3babc01d23 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 25 Oct 2017 23:17:20 +0200 Subject: [PATCH 87/94] Fixed alignement --- app/views/protocols/protocolsio_import_save.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/protocols/protocolsio_import_save.js.erb b/app/views/protocols/protocolsio_import_save.js.erb index 830ebafbf..6fa532567 100644 --- a/app/views/protocols/protocolsio_import_save.js.erb +++ b/app/views/protocols/protocolsio_import_save.js.erb @@ -5,5 +5,5 @@ $('#modal-import-json-protocol-preview').modal('hide'); $('#protocols_io_form').trigger("reset"); protocolsDatatable.ajax.reload(); - HelperModule.flashAlertMsg('<%= t('protocols.index.import_results.message_ok_pio')%>', 'success'); + HelperModule.flashAlertMsg(' <%= t('protocols.index.import_results.message_ok_pio')%>', 'success'); <% end %> From 4b837dbe9dbc6ea8da60ef59738a31702e7bf2e2 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 27 Oct 2017 00:17:42 +0200 Subject: [PATCH 88/94] Forgot flash fail messagges, now added them for file too big and general error --- app/views/protocols/protocolsio_import_create.js.erb | 5 +++-- app/views/protocols/protocolsio_import_save.js.erb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/protocols/protocolsio_import_create.js.erb b/app/views/protocols/protocolsio_import_create.js.erb index ba20d05c3..b9dbd0cd5 100644 --- a/app/views/protocols/protocolsio_import_create.js.erb +++ b/app/views/protocols/protocolsio_import_create.js.erb @@ -1,7 +1,8 @@ <% if @protocolsio_too_big %> -alert('<%= I18n.t('my_modules.protocols.load_from_file_size_error', - size: Constants::FILE_MAX_SIZE_MB ) %>'); +$('#modal-import-json-protocol').modal('hide'); +HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_size_error', + size: Constants::FILE_MAX_SIZE_MB ) %>','danger'); <% else %> $('#modal-import-json-protocol').modal('hide'); <% if remotipart_submitted? %> <%# a workaround to a bug with remotipart, that caused alot of headache, courtesy of github.com/dhampik %> diff --git a/app/views/protocols/protocolsio_import_save.js.erb b/app/views/protocols/protocolsio_import_save.js.erb index 6fa532567..5566d0f54 100644 --- a/app/views/protocols/protocolsio_import_save.js.erb +++ b/app/views/protocols/protocolsio_import_save.js.erb @@ -1,6 +1,7 @@ <% if @protocolsio_general_error %> - alert('<%= t('my_modules.protocols.load_from_file_protocol_general_error', - max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>'); +$('#modal-import-json-protocol-preview').modal('hide'); + HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_protocol_general_error', + max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>', 'danger'); <% else %> $('#modal-import-json-protocol-preview').modal('hide'); $('#protocols_io_form').trigger("reset"); From 518eb09110767903cb907f0dd6de6d6588fe84b8 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 2 Nov 2017 16:48:09 +0100 Subject: [PATCH 89/94] Deleted un needed error flash --- app/views/protocols/protocolsio_import_save.js.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/protocols/protocolsio_import_save.js.erb b/app/views/protocols/protocolsio_import_save.js.erb index 5566d0f54..1250b7816 100644 --- a/app/views/protocols/protocolsio_import_save.js.erb +++ b/app/views/protocols/protocolsio_import_save.js.erb @@ -1,7 +1,7 @@ <% if @protocolsio_general_error %> $('#modal-import-json-protocol-preview').modal('hide'); - HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_protocol_general_error', - max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>', 'danger'); + alert(' <%= t('my_modules.protocols.load_from_file_protocol_general_error', + max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>'); <% else %> $('#modal-import-json-protocol-preview').modal('hide'); $('#protocols_io_form').trigger("reset"); From a40a63ae50a33174275f856186d808194fe4c7ae Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 9 Nov 2017 15:38:06 +0100 Subject: [PATCH 90/94] Made code more aesthetic --- .../_import_json_protocol_p_desc.html.erb | 139 +++++++++--------- .../_import_json_protocol_s_desc.html.erb | 23 ++- 2 files changed, 76 insertions(+), 86 deletions(-) diff --git a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb index ee294c054..266a9ed07 100644 --- a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb @@ -12,78 +12,73 @@
-
-
-
-
- <% prot_info_string = '' %> - <% protocol_table_elements_array = [] %> - <% if json_object['before_start'].present? %> - <% prot_info_string += (json_object['before_start']) %> - <%= t('protocols.protocols_io_import.preview.b_s_p') %> - <%= sanitize_input(string_html_table_remove(json_object['before_start']).html_safe) %>
- <% end %> - <% if json_object['warning'].present? %> - <% prot_info_string += (json_object['warning']) %> - <%= t('protocols.protocols_io_import.preview.warn') %> - <%= sanitize_input(string_html_table_remove(json_object['warning']).html_safe) %>
- <% end %> - <% if json_object['guidelines'].present? %> - <% prot_info_string += (json_object['guidelines']) %> - <%= t('protocols.protocols_io_import.preview.guideln') %> - <%= sanitize_input(string_html_table_remove(json_object['guidelines']).html_safe) %>
- <% end %> - <% if json_object['manuscript_citation'].present? %> - <% prot_info_string += (json_object['manuscript_citation']) %> - <%= t('protocols.protocols_io_import.preview.manu_cit') %> - <%= sanitize_input(string_html_table_remove(json_object['manuscript_citation']).html_safe) %>
- <% end %> - <% if json_object['publish_date'].present? %> - <%= t('protocols.protocols_io_import.preview.pbl_date') %> - <%= sanitize_input(json_object['publish_date']) %>
- <% end %> - <% if json_object['vendor_name'].present? %> - <%= t('protocols.protocols_io_import.preview.vnd_name') %> - <%= sanitize_input(json_object['vendor_name']) %>
- <% end %> - <% if json_object['vendor_link'].present? %> - <%= t('protocols.protocols_io_import.preview.vnd_link') %> - <%= sanitize_input(json_object['vendor_link'].html_safe) %>
- <% end %> - <% if json_object['keywords'].present? %> - <%= t('protocols.protocols_io_import.preview.key_wrd') %> - <%= sanitize_input(json_object['keywords']) %>
- <% end %> - <% if json_object['tags'].present? %> - <%= t('protocols.protocols_io_import.preview.tags') %> - <% json_object['tags'].each do |tag| %> - <%= sanitize_input(tag['tag_name'])+' , ' %>
- <% end %> - <% end %> - <% if json_object['link'].present? %> - <%= t('protocols.protocols_io_import.preview.p_link') %> - <%= sanitize_input(json_object['link'].html_safe) %>
- <% end %> - <% tables, garbage = protocolsio_string_to_table_element(prot_info_string) %> - <% if tables.present? %> -


- <% end %> - <% table_count = 0 %> - <% tables.each do |index, table| %> - <% table_hash = JSON.parse((Base64.decode64(table['contents']))) %> - <% pio_table_id = "pio_table_prot_info_"+table_count.to_s %> - <% protocol_table_elements_array.push([pio_table_id,table_hash['data']]) %> - - -
- - - <% table_count += 1 %> - <% end %> - -
-
-
+
+
+
+
+ <% prot_info_string = '' %> + <% protocol_table_elements_array = [] %> + <% if json_object['before_start'].present? %> + <% prot_info_string += (json_object['before_start']) %> + <%= t('protocols.protocols_io_import.preview.b_s_p') %> + <%= sanitize_input(string_html_table_remove(json_object['before_start']).html_safe) %>
+ <% end %> + <% if json_object['warning'].present? %> + <% prot_info_string += (json_object['warning']) %> + <%= t('protocols.protocols_io_import.preview.warn') %> + <%= sanitize_input(string_html_table_remove(json_object['warning']).html_safe) %>
+ <% end %> + <% if json_object['guidelines'].present? %> + <% prot_info_string += (json_object['guidelines']) %> + <%= t('protocols.protocols_io_import.preview.guideln') %> + <%= sanitize_input(string_html_table_remove(json_object['guidelines']).html_safe) %>
+ <% end %> + <% if json_object['manuscript_citation'].present? %> + <% prot_info_string += (json_object['manuscript_citation']) %> + <%= t('protocols.protocols_io_import.preview.manu_cit') %> + <%= sanitize_input(string_html_table_remove(json_object['manuscript_citation']).html_safe) %>
+ <% end %> + <% if json_object['publish_date'].present? %> + <%= t('protocols.protocols_io_import.preview.pbl_date') %> + <%= sanitize_input(json_object['publish_date']) %>
+ <% end %> + <% if json_object['vendor_name'].present? %> + <%= t('protocols.protocols_io_import.preview.vnd_name') %> + <%= sanitize_input(json_object['vendor_name']) %>
+ <% end %> + <% if json_object['vendor_link'].present? %> + <%= t('protocols.protocols_io_import.preview.vnd_link') %> + <%= sanitize_input(json_object['vendor_link'].html_safe) %>
+ <% end %> + <% if json_object['keywords'].present? %> + <%= t('protocols.protocols_io_import.preview.key_wrd') %> + <%= sanitize_input(json_object['keywords']) %>
+ <% end %> + <% if json_object['tags'].present? %> + <%= t('protocols.protocols_io_import.preview.tags') %> + <% json_object['tags'].each do |tag| %> + <%= sanitize_input(tag['tag_name'])+' , ' %>
+ <% end %> + <% end %> + <% if json_object['link'].present? %> + <%= t('protocols.protocols_io_import.preview.p_link') %> + <%= sanitize_input(json_object['link'].html_safe) %>
+ <% end %> + <% tables, garbage = protocolsio_string_to_table_element(prot_info_string) %> + <% if tables.present? %> +


+ <% end %> + <% table_count = 0 %> + <% tables.each do |index, table| %> + <% table_hash = JSON.parse((Base64.decode64(table['contents']))) %> + <% pio_table_id = "pio_table_prot_info_"+table_count.to_s %> + <% protocol_table_elements_array.push([pio_table_id,table_hash['data']]) %> +
+ <% table_count += 1 %> + <% end %> +
+
+