Commit b78e964f authored by ira.maier's avatar ira.maier
Browse files

changes

parent 3277a2d1
File mode changed from 100644 to 100755
GIT
remote: https://github.com/MiniProfiler/rack-mini-profiler
revision: 39e78748ea0dce5ff767042089b9cfd733aa136e
revision: 4781bce89b0b92949e75daabdd6ea2d05a8a832d
specs:
rack-mini-profiler (1.1.3)
rack-mini-profiler (2.3.0)
rack (>= 1.2.0)
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activesupport (5.0.7.2)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
marcel (~> 0.3.1)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (7.1.4)
autoprefixer-rails (9.7.2)
arel (9.0.0)
autoprefixer-rails (10.1.0.0)
execjs
bcrypt (3.1.13)
bcrypt (3.1.16)
bindex (0.8.1)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap-will_paginate (0.0.11)
will_paginate
builder (3.2.3)
byebug (11.0.1)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.9.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.6.0)
capistrano-bundler (2.0.1)
capistrano (~> 3.1)
capistrano-npm (1.0.3)
capistrano (>= 3.0.0)
capistrano-nvm (0.0.7)
capistrano (~> 3.1)
capistrano-rails (1.4.0)
capistrano-rails (1.6.1)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
cocoon (1.2.14)
cocoon (1.2.15)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
......@@ -84,36 +88,36 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.5)
concurrent-ruby (1.1.7)
crass (1.0.6)
daemons (1.3.1)
delayed_job (4.1.8)
activesupport (>= 3.0, < 6.1)
delayed_job_active_record (4.1.4)
activerecord (>= 3.0, < 6.1)
delayed_job (4.1.9)
activesupport (>= 3.0, < 6.2)
delayed_job_active_record (4.1.5)
activerecord (>= 3.0, < 6.2)
delayed_job (>= 3.0, < 5)
devise (4.7.1)
devise (4.7.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
railties (>= 3.2, < 6.1)
erubis (2.7.0)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
erubi (1.10.0)
execjs (2.7.0)
ffi (1.11.2)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
ffi (1.14.2)
font-awesome-rails (4.7.0.6)
railties (>= 3.2, < 6.2)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.7.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
jquery-rails (4.3.5)
jbuilder (2.10.1)
activesupport (>= 5.0.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
......@@ -122,70 +126,74 @@ GEM
turbolinks
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.2.0)
kgio (2.11.2)
json (2.5.1)
kgio (2.11.3)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.3.1)
loofah (2.8.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.9.2)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
nio4r (2.5.2)
nokogiri (1.10.5)
minitest (5.14.2)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pdf-core (0.7.0)
pg (1.1.4)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
pdf-core (0.9.0)
pg (1.2.3)
prawn (2.4.0)
pdf-core (~> 0.9.0)
ttfunk (~> 1.7)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
rack (2.0.7)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.19.0)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
raindrops (0.19.1)
rake (13.0.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rmagick (4.1.2)
rubyzip (2.0.0)
rubyzip (2.3.0)
sablon (0.3.2)
nokogiri (>= 1.8.5)
rubyzip (>= 1.1.1)
......@@ -194,56 +202,57 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
spring (2.1.0)
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.20.0)
sshkit (1.21.1)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (0.20.3)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
ttfunk (1.5.1)
ttfunk (1.7.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicorn (5.5.1)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
warden (1.2.7)
rack (>= 1.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
websocket-extensions (0.1.5)
will_paginate (3.1.8)
PLATFORMS
ruby
DEPENDENCIES
activestorage
bcrypt (~> 3.1.11)
bootstrap-sass (~> 3.3.6)
bootstrap-will_paginate (~> 0.0.10)
......@@ -272,13 +281,12 @@ DEPENDENCIES
prawn
prawn-table
rack-mini-profiler!
rails (~> 5.0.0)
rails (= 5.2.0)
rmagick (~> 4.1, >= 4.1.2)
sablon
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
unicorn
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
document.addEventListener('DOMContentLoaded', function() {
console.log("test js from assets");
let selectAllCheckbox= document.querySelector('#article_delete_files');
let filenameCheckboxes = document.querySelectorAll('[name="article[delete_file][]"]');
function shiftToSelect() {
let lastChecked;
function handleCheck(event) {
// Check if shift key is down and check if checkbox is checked
let inBetween = false;
if (event.shiftKey && this.checked) {
filenameCheckboxes.forEach(checkbox => {
if (checkbox === this || checkbox === lastChecked) {
inBetween = !inBetween;
}
if (inBetween) {
checkbox.checked = true;
}
});
}
lastChecked = this;
}
filenameCheckboxes.forEach(checkbox => checkbox.addEventListener('click', handleCheck, false));
}
function selectAll(){
function handleSelectAll(event){
if(selectAllCheckbox.checked === true){
filenameCheckboxes.forEach(checkbox => {
checkbox.checked=true;
})
}else{
filenameCheckboxes.forEach(checkbox => {
checkbox.checked=false;
})
}
}
selectAllCheckbox.addEventListener('click', handleSelectAll, false);
}
shiftToSelect();
selectAll();
})
// $(document).ready(function(){
// $('#tb tr.y_n').each(function(i){
// let good = true;
......
......@@ -15,7 +15,7 @@
*= require font-awesome
*/
.sample-submitted {
.sample-submitted {
background-color: #feffea;
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -18,9 +18,9 @@ class SamplesController < ApplicationController
else
flash[:danger] = @sample.errors.full_messages.to_sentence
@samples = current_user.samples[0..-2]
end
redirect_to :back
end
end
redirect_back fallback_location: root_path
end
def index
@sample = if params[:display_sample].present?
......@@ -52,12 +52,13 @@ class SamplesController < ApplicationController
@sample = params[:id] && Sample.find(params[:id]) || nil
redirect_to(root_url) unless operator? || @user == current_user || @sample.status=="in preparation"
if @sample.status == "measured"
redirect_to :back
redirect_back fallback_location: root_path
end
end
def update
sample = Sample.find(params[:id])
unless sample_params.nil?
sample_params['results_attributes'] && sample_params['results_attributes'].each do |key, val|
Sample::PREDEF_ELEMENTS.each do |el|
......@@ -72,6 +73,25 @@ class SamplesController < ApplicationController
else
flash[:danger] = sample.errors.full_messages.to_sentence
end
# files processing:
if params[:sample][:add_files]
logger.debug "add my files"
sample.files.attach(params[:sample][:add_files])
end
if params[:sample][:delete_files] == "1"
logger.debug "purged all at once"
sample.files.purge_later
elsif params[:sample][:delete_files] == "0" and params[:sample][:delete_file]
params[:sample][:delete_file].each{ |id|
unless id && id.to_s.strip.empty?
@file = ActiveStorage::Attachment.find(id)
logger.debug "purged sample by sample"
@file.purge_later
end
}
end
else
flash[:warning] = "no results"
end
......@@ -115,7 +135,7 @@ class SamplesController < ApplicationController
def destroy
@sample.destroy
flash[:success] = "Sample deleted"
redirect_to :back || root_url
redirect_back fallback_location: root_path
end
def Measured
......@@ -159,11 +179,16 @@ class SamplesController < ApplicationController
send_data result.to_blob, filename: png_file_name, type: "image/png" , disposition: "inline"
end
private
# new
def files
@sample = Sample.find(params[:id])
render partial: 'samples/index_files'
end
private
def sample_params
keys=Sample::ELEMENTS.keys
params.require(:sample).permit(:name, :formula, :comment_by_operator, :comment_by_user, results_attributes: [:id, :_destroy, :element_N, :element_C,:element_H, :element_S]) if params[:sample].present?
params.require(:sample).permit(:name, :formula, :comment_by_operator, :comment_by_user, results_attributes: [:id, :_destroy, :element_N, :element_C,:element_H, :element_S], files: []) if params[:sample].present?
end
def correct_user
......@@ -171,8 +196,8 @@ class SamplesController < ApplicationController
redirect_to root_url if @sample.nil?
end
def set_sample
@sample = Sample.find(params[:id])
@result = @sample.results
def set_sample
@sample = Sample.find(params[:id])
@result = @sample.results
end
end
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment