diff --git a/.gitignore b/.gitignore index 85e8290..24802fc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ vendor/cache/ vendor/ruby public/assets config/deployvendor/ruby +*.sublime* diff --git a/Gemfile b/Gemfile index c754d00..d13d664 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,6 @@ gem 'jquery-ui-themes' gem 'jbuilder', '~> 2.0' gem 'highcharts-rails' gem 'jquery-tablesorter' -gem 'yui-rails' gem 'jquery-cookie-rails' gem 'country-select' gem 'devise' diff --git a/Gemfile.lock b/Gemfile.lock index 2b56005..9a27350 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -250,8 +250,6 @@ GEM railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) will_paginate (3.1.5) - yui-rails (3.13.0.0.3.0) - rails (>= 3.1) PLATFORMS ruby @@ -296,7 +294,6 @@ DEPENDENCIES uglifier (>= 1.3.0) web-console (~> 2.0) will_paginate - yui-rails RUBY VERSION ruby 2.3.0p0 diff --git a/app/assets/images/einstein/logo.png b/app/assets/images/einstein/logo.png deleted file mode 100644 index e2c415d..0000000 Binary files a/app/assets/images/einstein/logo.png and /dev/null differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 3c12dd9..476b225 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,5 +11,4 @@ //= require jstree //= require tether //= require bootstrap -//= require yui-min //= require_tree . diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/public.scss similarity index 100% rename from app/assets/stylesheets/application.scss rename to app/assets/stylesheets/public.scss diff --git a/app/controllers/administrators_controller.rb b/app/controllers/administrators_controller.rb deleted file mode 100644 index 45d46fd..0000000 --- a/app/controllers/administrators_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AdministratorsController < ApplicationController - before_action :authorize - - def index - end - - def authorize - if current_user.blank? || (current_user.rank != 'Superuser' && current_user.rank != 'Administrator') - redirect_to root_path - end - end -end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 78d42b1..72c099e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,10 +8,12 @@ class ApplicationController < ActionController::Base before_action :authenticate_user! def layout_by_resource - if devise_controller? && resource_name == :client - 'public' - else + if user_signed_in? 'lims' + elsif client_signed_in? + 'client' + else + 'public' end end diff --git a/app/helpers/administrators_helper.rb b/app/helpers/administrators_helper.rb deleted file mode 100644 index 5b0f3c3..0000000 --- a/app/helpers/administrators_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module AdministratorsHelper -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 56701d1..d2689f1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -72,25 +72,24 @@ def nah(value=nil, message="Not Available") end end - - def destroy_link(params, title='delete') + def link_to_destroy(params, title='delete') link_to "#{icon(:remove)} #{title}".html_safe, params, data: { confirm: 'Are you sure you want to delete this entry?' }, method: :delete, class: 'btn btn-outline-danger btn-sm', title: 'Delete Entry' end - def edit_link(params, title='edit') + def link_to_edit(params, title='edit') link_to "#{icon(:edit)} #{title}".html_safe, params, class: 'btn btn-sm btn-outline-primary', title: 'Edit Entry' end - def show_link(params, title='view') + def link_to_show(params, title='view') link_to "#{icon(:eye)} #{title}".html_safe, params, class: 'btn btn-sm btn-outline-primary', title: 'Show Entry' end - def new_link(title, params) + def link_to_new(title, params) title ||= 'new' link_to "#{icon(:'plus-square')} add #{title}".html_safe, params, class: 'btn btn-sm btn-outline-success' end diff --git a/app/views/administrators/index.html.erb b/app/views/administrators/index.html.erb deleted file mode 100644 index b498b8d..0000000 --- a/app/views/administrators/index.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Administrative Tasks

- - diff --git a/app/views/batches/batches/unprepped.html.erb b/app/views/batches/batches/unprepped.html.erb index c95f863..67accd4 100644 --- a/app/views/batches/batches/unprepped.html.erb +++ b/app/views/batches/batches/unprepped.html.erb @@ -14,7 +14,7 @@ <%= check_box_tag 'samples[]', s.id %> <%= s.barcode %> <%= s.collected_on %> - <%# show_link s.sample ? sample_sample_path(s.sample, s) : test_subject_sample_path(s.test_subject, s) %> + <%# link_to_show s.sample ? sample_sample_path(s.sample, s) : test_subject_sample_path(s.test_subject, s) %> <% end %> diff --git a/app/views/bovine/index.html.erb b/app/views/bovine/index.html.erb index 7e5779d..031b79f 100644 --- a/app/views/bovine/index.html.erb +++ b/app/views/bovine/index.html.erb @@ -1,10 +1,10 @@ <% title 'Home' %>

Welcome to Metaboflo

- Welcome to the Metaboflo Laboratory Information Management System (LIMS). + Welcome to the Metaboflo Laboratory Information Management System (LIMS). Metaboflo is a central repository for study management and metabolomics scientific information.

- + @@ -37,9 +37,9 @@ - - - + + + <% end %>
General Statistics
<%= experiment.name %> <%= experiment.perform_on %><%= show_link [experiment.sample, experiment] %><%= edit_link edit_sample_experiment_path(experiment.sample, experiment) %><%= destroy_link [experiment.sample, experiment] %><%= link_to_show [experiment.sample, experiment] %><%= link_to_edit edit_sample_experiment_path(experiment.sample, experiment) %><%= link_to_destroy [experiment.sample, experiment] %>
diff --git a/app/views/data_file_types/edit.html.erb b/app/views/data_file_types/edit.html.erb index 5b1f23a..a34d757 100644 --- a/app/views/data_file_types/edit.html.erb +++ b/app/views/data_file_types/edit.html.erb @@ -2,4 +2,4 @@ <%= render 'form' %> -<%= show_link @data_file_type %> +<%= link_to_show @data_file_type %> diff --git a/app/views/data_file_types/index.html.erb b/app/views/data_file_types/index.html.erb index d7f8809..e1029bf 100644 --- a/app/views/data_file_types/index.html.erb +++ b/app/views/data_file_types/index.html.erb @@ -11,13 +11,13 @@ <%= data_file_type.name %> <%= data_file_type.description %> - <%= show_link data_file_type %> - <%= edit_link edit_data_file_type_path(data_file_type) %> - <%= destroy_link(data_file_type) %> + <%= link_to_show data_file_type %> + <%= link_to_edit edit_data_file_type_path(data_file_type) %> + <%= link_to_destroy(data_file_type) %> <% end %>
-<%= new_link 'data file type', new_data_file_type_path %> +<%= link_to_new 'data file type', new_data_file_type_path %> diff --git a/app/views/data_file_types/show.html.erb b/app/views/data_file_types/show.html.erb index 3ca80ae..71df8a9 100644 --- a/app/views/data_file_types/show.html.erb +++ b/app/views/data_file_types/show.html.erb @@ -9,4 +9,4 @@

-<%= edit_link edit_data_file_type_path(@data_file_type) %> \ No newline at end of file +<%= link_to_edit edit_data_file_type_path(@data_file_type) %> diff --git a/app/views/data_files/index.html.erb b/app/views/data_files/index.html.erb index a0a399f..a69182d 100644 --- a/app/views/data_files/index.html.erb +++ b/app/views/data_files/index.html.erb @@ -17,8 +17,8 @@ <%= link_to h(data_file.data_file_name), data_file.data.url %> <%= number_to_human_size(data_file.data_file_size) %> <%= link_to h(data_file.data_file_type.name), data_file_type_path(data_file.data_file_type) %> - <%= show_link experiment_data_file_path(data_file.experiment, data_file) %> - <%= destroy_link experiment_data_file_path(data_file.experiment, data_file) %> + <%= link_to_show experiment_data_file_path(data_file.experiment, data_file) %> + <%= link_to_destroy experiment_data_file_path(data_file.experiment, data_file) %> <% end %> @@ -26,5 +26,5 @@
<% if @experiment %> - <%= new_link 'data file for this experiment', new_experiment_data_file_path(@experiment) %> + <%= link_to_new 'data file for this experiment', new_experiment_data_file_path(@experiment) %> <% end %> diff --git a/app/views/diets/edit.html.erb b/app/views/diets/edit.html.erb index 42c0149..5999146 100644 --- a/app/views/diets/edit.html.erb +++ b/app/views/diets/edit.html.erb @@ -1,5 +1,5 @@

Editing diet

<%= render :partial => 'form' %> - -<%= show_link @diet %> + +<%= link_to_show @diet %> diff --git a/app/views/diets/index.html.erb b/app/views/diets/index.html.erb index 5f6c509..6befb9d 100644 --- a/app/views/diets/index.html.erb +++ b/app/views/diets/index.html.erb @@ -9,13 +9,13 @@ <% @diets.each do |diet| %> <%= diet.name %> - <%= show_link diet %> - <%= edit_link edit_diet_path(diet) %> - <%= destroy_link diet %> + <%= link_to_show diet %> + <%= link_to_edit edit_diet_path(diet) %> + <%= link_to_destroy diet %> <% end %>
-<%= new_link 'diet', new_diet_path %> +<%= link_to_new 'diet', new_diet_path %> diff --git a/app/views/diets/show.html.erb b/app/views/diets/show.html.erb index 9e6b6ed..d47083e 100644 --- a/app/views/diets/show.html.erb +++ b/app/views/diets/show.html.erb @@ -10,7 +10,7 @@ Name Amount (%) - + <% @diet.diet_ingredients.each do |diet_ingredient| -%> <%= diet_ingredient.ingredient.name %> @@ -29,7 +29,7 @@ Name Amount - + <% @diet.compositions.each do |composition| -%> <%= composition.nutrient.name %> @@ -41,4 +41,4 @@
-<%= edit_link edit_diet_path(@diet) %> +<%= link_to_edit edit_diet_path(@diet) %> diff --git a/app/views/experiments/edit.html.erb b/app/views/experiments/edit.html.erb index e0e4d90..8825211 100644 --- a/app/views/experiments/edit.html.erb +++ b/app/views/experiments/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link [@sample, @experiment] %> \ No newline at end of file +<%= link_to_show [@sample, @experiment] %> diff --git a/app/views/experiments/index.html.erb b/app/views/experiments/index.html.erb deleted file mode 100644 index 8f9187e..0000000 --- a/app/views/experiments/index.html.erb +++ /dev/null @@ -1,51 +0,0 @@ -

<%= @sample.blank? ? 'Experiments' : "Experiments for sample #{@sample}" %>

- - - - - - - - - - - - - - - - - <% @experiments.each do |experiment| %> - - - - - - - - - - - - - - - - <% end %> -
<%= TestSubject.title %>SampleTitleTypeDescriptionTo be analyzed byTo be analyzed onAnalyzed byAnalyzed onData FilesActions
<%= link_to(experiment.sample.root, experiment.sample.root) %><%= link_to(experiment.sample, experiment.sample) %><%= experiment.name %><%= experiment.experiment_type.name unless experiment.experiment_type.nil? %><%= truncate(experiment.description, :length => 50) %><%= link_to(experiment.assigned_to.name, experiment.assigned_to) if experiment.assigned_to.present? %><%= experiment.perform_on %><% if experiment.performed_by %><%= link_to(experiment.performed_by.name, experiment.performed_by) %><% else %> <% end %><% if experiment.performed_on %><%= experiment.performed_on %><% else %> <% end %> - <% if experiment.data_files.length > 0 %> -
    - <% experiment.data_files.each do |data_file| %> -
  • <%= link_to data_file.data_file_name, data_file.data.url %>
  • - <% end %> -
- <% else %> - - - <% end %> -
<%= show_link [experiment.sample, experiment] %><%= edit_link edit_sample_experiment_path(experiment.sample, experiment) %><%= destroy_link [experiment.sample, experiment] %>
- -
- -<% if !@sample.blank? %> - <%= new_link 'experiment for this sample', new_sample_experiment_path(@sample) %> -<% end %> diff --git a/app/views/experiments/index.html.slim b/app/views/experiments/index.html.slim new file mode 100644 index 0000000..e5d3ef0 --- /dev/null +++ b/app/views/experiments/index.html.slim @@ -0,0 +1,46 @@ +h1= @sample.blank? ? 'Experiments' : "Experiments for sample # @sample " + +table.list + thead + tr + th= TestSubject.title + th Sample + th Title + th Type + th Description + th To be analyzed by + th To be analyzed on + th Analyzed by + th Analyzed on + th Data Files + th colspan="3" + tbody + - @experiments.each do |experiment| + tr + td= link_to(experiment.sample.root, experiment.sample.root) + td= link_to(experiment.sample, experiment.sample) + td= experiment.name + td= experiment.experiment_type.name unless experiment.experiment_type.nil? + td= truncate(experiment.description, :length => 50) + td= link_to(experiment.assigned_to.name, experiment.assigned_to) if experiment.assigned_to.present? + td= experiment.perform_on + td + - if experiment.performed_by + = link_to(experiment.performed_by.name, experiment.performed_by) + - else + = nah nil + td = nah experiment.performed_on + td + - if experiment.data_files.length > 0 + ul + - experiment.data_files.each do |data_file| + li= link_to data_file.data_file_name, data_file.data.url + - else + = nah + td= link_to_show [experiment.sample, experiment] + td= link_to_edit edit_sample_experiment_path(experiment.sample, experiment) + td= link_to_destroy [experiment.sample, experiment] + +- if @sample.present? + = link_to_new 'experiment for this sample', new_sample_experiment_path(@sample) + diff --git a/app/views/experiments/show.html.erb b/app/views/experiments/show.html.erb index ebc7d62..df1945e 100644 --- a/app/views/experiments/show.html.erb +++ b/app/views/experiments/show.html.erb @@ -7,22 +7,22 @@

Sample type
<%= @experiment.sample.sample_type %> -

+

<% if @experiment.sample.barcode.present? %>

Sample barcode
<%= @experiment.sample.barcode %> -

+

<% end -%> <% if @experiment.sample.original_amount.present? %>

Original Amount
<%= @experiment.sample.original_amount %> <%= @experiment.sample.original_unit %> -

+

<% end -%> - + <% if @experiment.sample.location_information? %> <% if @experiment.sample.site.present? %>

@@ -104,7 +104,7 @@ <% end -%>

-<%= edit_link edit_sample_experiment_path(@sample, @experiment) %> +<%= link_to_edit edit_sample_experiment_path(@sample, @experiment) %>

@@ -127,15 +127,15 @@ There are no data file associated with this experiment.
<%= link_to data_file.data_file_name, data_file.data.url %> <%= number_to_human_size(data_file.data_file_size) %> <%= link_to data_file.data_file_type.name, data_file_type_path(data_file.data_file_type) %> - <%= show_link experiment_data_file_path(@experiment, data_file) %> - <%= destroy_link experiment_data_file_path(@experiment, data_file) %> + <%= link_to_show experiment_data_file_path(@experiment, data_file) %> + <%= link_to_destroy experiment_data_file_path(@experiment, data_file) %> <% end %> <% end %>

-<%= new_link 'Upload new data file', new_experiment_data_file_path(@experiment) %> +<%= link_to_new 'Upload new data file', new_experiment_data_file_path(@experiment) %>

diff --git a/app/views/groupings/edit.html.erb b/app/views/groupings/edit.html.erb index 4840297..5ccac9e 100644 --- a/app/views/groupings/edit.html.erb +++ b/app/views/groupings/edit.html.erb @@ -10,4 +10,4 @@ <% end %> -<%= show_link({id: @grouping, type: @type}) %> +<%= link_to_show({id: @grouping, type: @type}) %> diff --git a/app/views/groupings/index.html.erb b/app/views/groupings/index.html.erb index 29be3ea..b3d3134 100644 --- a/app/views/groupings/index.html.erb +++ b/app/views/groupings/index.html.erb @@ -5,7 +5,7 @@ Groups allow you to make arbitrary collections of <%= TestSubject.title.pluralize.downcase %>, samples and experiments. You can organize your data into groups that can later be exported, watched for changes, or used in cohort studies.

- + -<%= edit_link({:action => 'edit', :type => @type}) %> \ No newline at end of file +<%= link_to_edit({:action => 'edit', :type => @type}) %> diff --git a/app/views/ingredients/edit.html.erb b/app/views/ingredients/edit.html.erb index 6412040..88373d7 100644 --- a/app/views/ingredients/edit.html.erb +++ b/app/views/ingredients/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link @ingredient %> +<%= link_to_show @ingredient %> diff --git a/app/views/ingredients/index.html.erb b/app/views/ingredients/index.html.erb index 26c0269..4a11cb4 100644 --- a/app/views/ingredients/index.html.erb +++ b/app/views/ingredients/index.html.erb @@ -9,13 +9,13 @@ <% @ingredients.each do |ingredient| %> <%= ingredient.name %> - <%= show_link ingredient %> - <%= edit_link edit_ingredient_path(ingredient) %> - <%= destroy_link ingredient %> + <%= link_to_show ingredient %> + <%= link_to_edit edit_ingredient_path(ingredient) %> + <%= link_to_destroy ingredient %> <% end %>
-<%= new_link 'ingredient', new_ingredient_path %> +<%= link_to_new 'ingredient', new_ingredient_path %> diff --git a/app/views/ingredients/show.html.erb b/app/views/ingredients/show.html.erb index 3608670..bfd2496 100644 --- a/app/views/ingredients/show.html.erb +++ b/app/views/ingredients/show.html.erb @@ -3,4 +3,4 @@ <%= @ingredient.name %>

-<%= edit_link edit_ingredient_path(@ingredient) %> +<%= link_to_edit edit_ingredient_path(@ingredient) %> diff --git a/app/views/lab_tests/edit.html.erb b/app/views/lab_tests/edit.html.erb index 2123773..8bf24cc 100644 --- a/app/views/lab_tests/edit.html.erb +++ b/app/views/lab_tests/edit.html.erb @@ -9,4 +9,4 @@

<% end %> -<%= show_link test_subject_lab_test_path(@test_subject, @lab_test) %> \ No newline at end of file +<%= link_to_show test_subject_lab_test_path(@test_subject, @lab_test) %> diff --git a/app/views/lab_tests/index.html.erb b/app/views/lab_tests/index.html.erb index cc787c9..7094c08 100644 --- a/app/views/lab_tests/index.html.erb +++ b/app/views/lab_tests/index.html.erb @@ -22,12 +22,12 @@ <% end %> <%= lab_test.collected_at %> - <%= show_link test_subject_lab_test_path(@test_subject, lab_test) %> - <%= edit_link edit_test_subject_lab_test_path(@test_subject, lab_test) %> - <%= destroy_link test_subject_lab_test_path(@test_subject, lab_test) %> + <%= link_to_show test_subject_lab_test_path(@test_subject, lab_test) %> + <%= link_to_edit edit_test_subject_lab_test_path(@test_subject, lab_test) %> + <%= link_to_destroy test_subject_lab_test_path(@test_subject, lab_test) %> <% end %>
-<%= new_link 'lab test', new_test_subject_lab_test_path(@test_subject) %> +<%= link_to_new 'lab test', new_test_subject_lab_test_path(@test_subject) %> diff --git a/app/views/lab_tests/show.html.erb b/app/views/lab_tests/show.html.erb index a61c809..0e8aa1b 100644 --- a/app/views/lab_tests/show.html.erb +++ b/app/views/lab_tests/show.html.erb @@ -12,7 +12,7 @@
<% for test in tests(@lab_test, true) %> - + <% name = test.gsub('_', ' ').capitalize() %> <% if not @lab_test.send("#{test}_value").nil? %>

@@ -24,4 +24,4 @@ <% end %> -<%= edit_link edit_test_subject_lab_test_path(@test_subject, @lab_test) %> \ No newline at end of file +<%= link_to_edit edit_test_subject_lab_test_path(@test_subject, @lab_test) %> diff --git a/app/views/layouts/_client_menu.html.erb b/app/views/layouts/_client_menu.html.erb deleted file mode 100644 index 767b051..0000000 --- a/app/views/layouts/_client_menu.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

\ No newline at end of file diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb deleted file mode 100644 index 3aefd54..0000000 --- a/app/views/layouts/_flash.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if notice.present? || alert.present? %> -
- <% if notice.present? %>
<%= notice %>
<% end %> - <% if alert.present? %>
<%= alert %>
<% end %> -
-<% end -%> \ No newline at end of file diff --git a/app/views/layouts/lims/_messages.html.slim b/app/views/layouts/_flash.html.slim similarity index 100% rename from app/views/layouts/lims/_messages.html.slim rename to app/views/layouts/_flash.html.slim diff --git a/app/views/layouts/_public_menu.html.erb b/app/views/layouts/_public_menu.html.erb deleted file mode 100644 index 2dc75cf..0000000 --- a/app/views/layouts/_public_menu.html.erb +++ /dev/null @@ -1,18 +0,0 @@ - \ No newline at end of file diff --git a/app/views/layouts/client.html.erb b/app/views/layouts/client.html.erb deleted file mode 100644 index 83e1d20..0000000 --- a/app/views/layouts/client.html.erb +++ /dev/null @@ -1,63 +0,0 @@ - - - - - <% title = yield(:title) %> - <%= title.present? ? "Metaboflo: #{title}" : 'Metaboflo' %> - - <%= stylesheet_link_tag "application", 'clients' %> - <%= javascript_include_tag "application" %> - - <%= yield :css %> - <%= yield :javascript %> - - - - <%= csrf_meta_tag %> - - - -
-
- <%= image_tag "banner_left.jpg", :class => 'left' %> - <%= image_tag "banner_right.png", :class => 'right' %> - - <% if client_signed_in? %> -
- Logged in as <%= current_client.to_s %> | - <%= link_to 'Logout', destroy_client_session_path, :method => :delete %> -
- <% end -%> -
- - <%= render :partial => "layouts/client_menu" if client_signed_in? %> -
- -
- - - <% if content_for?(:sidebar) %> - - <% end -%> - - -
-
- <%= render :partial => "layouts/flash" %> - <%= yield %> -
-
-
- - - \ No newline at end of file diff --git a/app/views/layouts/client.html.slim b/app/views/layouts/client.html.slim new file mode 100644 index 0000000..e55cfea --- /dev/null +++ b/app/views/layouts/client.html.slim @@ -0,0 +1,25 @@ +doctype html +html + head + meta name="viewport" content="width=device-width, initial-scale=1.0" + meta content="text/html; charset=UTF-8" http-equiv="Content-Type" + == content_for(:meta_tags) + title = content_for?(:title) ? yield(:title) : 'Metaboflo' + == stylesheet_link_tag 'client', media: 'all', + "data-turbolinks-track" => true + == javascript_include_tag 'application', media: 'all', + "data-turbolinks-track" => true + == yield :css + == yield :javascript + + == csrf_meta_tags + + body[class="#{params[:controller].parameterize.dasherize}-c + #{params[:action].parameterize}-a"] + header == render 'layouts/client/navigation' + main role="main" + .row + #main-content + == render '/layouts/flash' + == yield + footer diff --git a/app/views/layouts/client/_navigation.html.slim b/app/views/layouts/client/_navigation.html.slim new file mode 100644 index 0000000..90d1544 --- /dev/null +++ b/app/views/layouts/client/_navigation.html.slim @@ -0,0 +1,4 @@ +nav.navbar.navbar-dark.navbar-fixed-top.bg-inverse + a.navbar-brand href=client_root_path Metaboflo + ul.nav.navbar-nav + = render 'layouts/client/navigation_links' diff --git a/app/views/layouts/client/_navigation_links.html.slim b/app/views/layouts/client/_navigation_links.html.slim new file mode 100644 index 0000000..8422576 --- /dev/null +++ b/app/views/layouts/client/_navigation_links.html.slim @@ -0,0 +1,7 @@ +li.nav-item = link_to 'Submit New Sample', new_clients_sample_manifest_path, class: 'nav-link' +li.nav-item = link_to 'My Manifests', clients_sample_manifests_path, class: 'nav-link' +li.nav-item = link_to 'Order Tracking', clients_samples_path, class: 'nav-link' +li.nav-item.dropdown + a.nav-link.dropdown-toggle href="#" data-toggle="dropdown" Account + div.dropdown-menu + = link_to 'Logout', destroy_client_session_path, method: 'delete', class: 'dropdown-item' diff --git a/app/views/layouts/lims.html.slim b/app/views/layouts/lims.html.slim index 2b187ef..743d9ab 100644 --- a/app/views/layouts/lims.html.slim +++ b/app/views/layouts/lims.html.slim @@ -24,17 +24,16 @@ html = content_for :sidebar do h2 #{TestSubject.title} Summary #subject-tree data-source="#{tree_test_subject_path(@test_subject)}" - .row - if content_for?(:sidebar) #sidebar-content #sidebar == yield :sidebar #main-content.with-sidebar - == render '/layouts/lims/messages' + == render '/layouts/flash' == yield - else #main-content.without-sidebar - == render '/layouts/lims/messages' + == render '/layouts/flash' == yield footer diff --git a/app/views/layouts/lims.old.erb b/app/views/layouts/lims.old.erb deleted file mode 100644 index e6f6929..0000000 --- a/app/views/layouts/lims.old.erb +++ /dev/null @@ -1,70 +0,0 @@ - - - - - <% title = yield(:title) %> - <%= title.present? ? "Metaboflo: #{title}" : 'Metaboflo' %> - - <%= stylesheet_link_tag "application", 'lims' %> - <%= javascript_include_tag "application" %> - - <%= yield :css %> - <%= yield :javascript %> - - - - <%= csrf_meta_tag %> - - - -
-
- <%= image_tag "banner_left.jpg", :class => 'left' %> - <%= image_tag "banner_right.png", :class => 'right' %> - - <% if user_signed_in? %> -
- Logged in as <%= current_user.to_s %> | - <%= link_to 'Logout', destroy_user_session_path, :method => :delete %> -
- <% end -%> -
- - <%= render :partial => "layouts/lims_menu" if user_signed_in? %> -
- -
- - - <% if defined?(@test_subject) && @test_subject.present? && !@test_subject.new_record? %> - <%= content_for :sidebar do %> -

<%= TestSubject.title %> Summary

-
- <% end -%> - <% end -%> - - <% if content_for?(:sidebar) %> - - <% end -%> - - -
-
- <%= render :partial => "layouts/flash" %> - <%= yield %> -
-
-
- - - diff --git a/app/views/layouts/main.html.erb b/app/views/layouts/main.html.erb deleted file mode 100644 index 6d68335..0000000 --- a/app/views/layouts/main.html.erb +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - Metaboflo: <%= yield(:title) %> - - <%= stylesheet_link_tag 'yui', 'menu', 'application', 'tree', 'jquery-ui-1.8.13.custom' %> - <%= yield :css %> - - <%= javascript_include_tag :defaults %> - <%= javascript_include_tag 'yahoo-dom-event', 'container_core', 'menu', 'tree', 'jquery-ui-1.8.13.custom.min' %> - - - <%= javascript_include_tag 'overlay_patch', 'menu_patch' %> - - <%= yield :javascript %> - - - <%= csrf_meta_tag %> - - - <% sidebar = !@test_subject.nil? && !@test_subject.new_record? %> - -
> -
-
- <%= image_tag "banner_left.jpg", :style => 'float: left' %> - <%= image_tag "banner_right.png", :style => 'float: right' %> -
- - <% if current_user %> - - <% end %> -
- -
- <% if current_user %> -
- Logged in as <%= current_user.to_s %> | <%= link_to 'Logout', destroy_user_session_path %> -
- <% elsif current_client %> -
- Logged in as <%= current_client.to_s %> | <%= link_to 'Logout', destroy_client_session_path %> -
- <% end -%> - -
- - <% if sidebar -%> - - <% end %> -
- -
-
-
-
- <% if flash[:notice] %>

<%= flash[:notice] %>

<% end %> - <% if flash[:error] %>

<%= flash[:error] %>

<% end %> - <% if flash[:alert] %>

<%= flash[:alert] %>

<% end %> -
- <%= yield %> -
- -
-
-
- -
- - -
-
- - - diff --git a/app/views/layouts/public.html.erb b/app/views/layouts/public.html.erb deleted file mode 100644 index 8581123..0000000 --- a/app/views/layouts/public.html.erb +++ /dev/null @@ -1,50 +0,0 @@ - - - - - <% title = yield(:title) %> - <%= title.present? ? "Metaboflo: #{title}" : 'Metaboflo' %> - - <%= stylesheet_link_tag "application", 'clients' %> - <%= javascript_include_tag "application" %> - - <%= yield :css %> - <%= yield :javascript %> - - - - <%= csrf_meta_tag %> - - - -
-
- <%= image_tag "einstein/logo.png", :class => 'left' %> - <%# image_tag "banner_right.png", :class => 'right' %> - -
- <%= link_to 'Client Login', new_client_session_path %> -
-
- - <%= render :partial => "layouts/public_menu" %> -
- -
- -
-
- <%= render :partial => "layouts/flash" %> - <%= yield %> -
-
-
- - - \ No newline at end of file diff --git a/app/views/layouts/public.html.slim b/app/views/layouts/public.html.slim new file mode 100644 index 0000000..4dc0469 --- /dev/null +++ b/app/views/layouts/public.html.slim @@ -0,0 +1,25 @@ +doctype html +html + head + meta name="viewport" content="width=device-width, initial-scale=1.0" + meta content="text/html; charset=UTF-8" http-equiv="Content-Type" + == content_for(:meta_tags) + title = content_for?(:title) ? yield(:title) : 'Metaboflo' + == stylesheet_link_tag 'public', media: 'all', + "data-turbolinks-track" => true + == javascript_include_tag "application", media: 'all', + "data-turbolinks-track" => true + == yield :css + == yield :javascript + + == csrf_meta_tags + + body[class="#{params[:controller].parameterize.dasherize}-c + #{params[:action].parameterize}-a"] + header == render 'layouts/public/navigation' + main role="main" + .row + #main-content + == render '/layouts/flash' + == yield + footer diff --git a/app/views/layouts/public/_navigation.html.slim b/app/views/layouts/public/_navigation.html.slim new file mode 100644 index 0000000..b31832d --- /dev/null +++ b/app/views/layouts/public/_navigation.html.slim @@ -0,0 +1,4 @@ +nav.navbar.navbar-dark.navbar-fixed-top.bg-inverse + a.navbar-brand href=main_app.root_path Metaboflo + ul.nav.navbar-nav + = render 'layouts/public/navigation_links' diff --git a/app/views/layouts/public/_navigation_links.html.slim b/app/views/layouts/public/_navigation_links.html.slim new file mode 100644 index 0000000..9154b29 --- /dev/null +++ b/app/views/layouts/public/_navigation_links.html.slim @@ -0,0 +1,4 @@ +li.nav-item = link_to 'About', about_path, class: 'nav-link' +li.nav-item = link_to 'Contact', contact_path, class: 'nav-link' +li.nav-item = link_to 'Client Login', new_client_session_path, class: 'nav-link' +li.nav-item = link_to 'LIMS Login', new_user_session_path, class: 'nav-link' diff --git a/app/views/meals/edit.html.erb b/app/views/meals/edit.html.erb index 7e75a70..63f889f 100644 --- a/app/views/meals/edit.html.erb +++ b/app/views/meals/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link test_subject_meal_path(@test_subject, @meal) %> \ No newline at end of file +<%= link_to_show test_subject_meal_path(@test_subject, @meal) %> diff --git a/app/views/meals/index.html.erb b/app/views/meals/index.html.erb index bfe5a5b..dd6bc84 100644 --- a/app/views/meals/index.html.erb +++ b/app/views/meals/index.html.erb @@ -16,9 +16,9 @@ <%= meal.amount %> <%= meal.consumed_during_period %> <%= meal.consumed_on_day %> - <%= show_link test_subject_meal_path(@test_subject, meal) %> - <%= edit_link edit_test_subject_meal_path(@test_subject, meal) %> - <%= destroy_link test_subject_meal_path(@test_subject, meal) %> + <%= link_to_show test_subject_meal_path(@test_subject, meal) %> + <%= link_to_edit edit_test_subject_meal_path(@test_subject, meal) %> + <%= link_to_destroy test_subject_meal_path(@test_subject, meal) %> <% end %> @@ -26,4 +26,4 @@
-<%= new_link "meal for #{TestSubject.title} #{@test_subject.code}", new_test_subject_meal_path(@test_subject) %> \ No newline at end of file +<%= link_to_new "meal for #{TestSubject.title} #{@test_subject.code}", new_test_subject_meal_path(@test_subject) %> diff --git a/app/views/meals/show.html.erb b/app/views/meals/show.html.erb index 0451a29..14e9acf 100644 --- a/app/views/meals/show.html.erb +++ b/app/views/meals/show.html.erb @@ -26,4 +26,4 @@

-<%= edit_link edit_test_subject_meal_path(@test_subject, @meal) %> \ No newline at end of file +<%= link_to_edit edit_test_subject_meal_path(@test_subject, @meal) %> diff --git a/app/views/medications/edit.html.erb b/app/views/medications/edit.html.erb index 8786f36..078d0ac 100644 --- a/app/views/medications/edit.html.erb +++ b/app/views/medications/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link test_subject_medication_path(@test_subject, @medication) %> \ No newline at end of file +<%= link_to_show test_subject_medication_path(@test_subject, @medication) %> diff --git a/app/views/medications/index.html.erb b/app/views/medications/index.html.erb index 28b4c12..da3b60b 100644 --- a/app/views/medications/index.html.erb +++ b/app/views/medications/index.html.erb @@ -17,13 +17,13 @@ <%= medication.stopped_on %> <%= boolean_to_english(medication.currently_taking) %> <%= medication.drugbank_reference %> - <%= show_link test_subject_medication_path(@test_subject, medication) %> - <%= edit_link edit_test_subject_medication_path(@test_subject, medication) %> - <%= destroy_link test_subject_medication_path(@test_subject, medication) %> + <%= link_to_show test_subject_medication_path(@test_subject, medication) %> + <%= link_to_edit edit_test_subject_medication_path(@test_subject, medication) %> + <%= link_to_destroy test_subject_medication_path(@test_subject, medication) %> <% end %>
-<%= new_link 'medication', new_test_subject_medication_path(@test_subject) %> +<%= link_to_new 'medication', new_test_subject_medication_path(@test_subject) %> diff --git a/app/views/medications/show.html.erb b/app/views/medications/show.html.erb index aa773ea..5a1daf3 100644 --- a/app/views/medications/show.html.erb +++ b/app/views/medications/show.html.erb @@ -29,4 +29,4 @@

-<%= edit_link edit_test_subject_medication_path(@test_subject, @medication) %> \ No newline at end of file +<%= link_to_edit edit_test_subject_medication_path(@test_subject, @medication) %> diff --git a/app/views/metabolites/edit.html.erb b/app/views/metabolites/edit.html.erb index d265d7d..f9c2785 100644 --- a/app/views/metabolites/edit.html.erb +++ b/app/views/metabolites/edit.html.erb @@ -2,5 +2,5 @@ <%= render :partial => 'form' %> -<%= show_link @metabolite %> | -<%= link_to 'Back', :back %> \ No newline at end of file +<%= link_to_show @metabolite %> | +<%= link_to 'Back', :back %> diff --git a/app/views/metabolites/index.html.erb b/app/views/metabolites/index.html.erb index 9d5e933..48c5752 100644 --- a/app/views/metabolites/index.html.erb +++ b/app/views/metabolites/index.html.erb @@ -65,4 +65,4 @@ <%= render(:partial => "shared/paginate", :locals => { :collection => @metabolites }) if params[:query].nil? %>
-<%= new_link 'metabolite', new_metabolite_path %> \ No newline at end of file +<%= link_to_new 'metabolite', new_metabolite_path %> diff --git a/app/views/nutrients/edit.html.erb b/app/views/nutrients/edit.html.erb index c03c044..5b31fbb 100644 --- a/app/views/nutrients/edit.html.erb +++ b/app/views/nutrients/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link @nutrient %> +<%= link_to_show @nutrient %> diff --git a/app/views/nutrients/index.html.erb b/app/views/nutrients/index.html.erb index 26ec9b9..bc2a12a 100644 --- a/app/views/nutrients/index.html.erb +++ b/app/views/nutrients/index.html.erb @@ -9,13 +9,13 @@ <% @nutrients.each do |nutrient| %> <%= nutrient.name %> - <%= show_link nutrient %> - <%= edit_link edit_nutrient_path(nutrient) %> - <%= destroy_link nutrient %> + <%= link_to_show nutrient %> + <%= link_to_edit edit_nutrient_path(nutrient) %> + <%= link_to_destroy nutrient %> <% end %>
-<%= new_link 'nutrient', new_nutrient_path %> \ No newline at end of file +<%= link_to_new 'nutrient', new_nutrient_path %> diff --git a/app/views/nutrients/show.html.erb b/app/views/nutrients/show.html.erb index 5191410..a2c5881 100644 --- a/app/views/nutrients/show.html.erb +++ b/app/views/nutrients/show.html.erb @@ -3,4 +3,4 @@ <%= @nutrient.name %>

-<%= edit_link edit_nutrient_path(@nutrient) %> +<%= link_to_edit edit_nutrient_path(@nutrient) %> diff --git a/app/views/protocols/edit.html.erb b/app/views/protocols/edit.html.erb index b8b6e0f..a800c87 100644 --- a/app/views/protocols/edit.html.erb +++ b/app/views/protocols/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link @protocol %> +<%= link_to_show @protocol %> diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index 0a495d0..be9631c 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -11,13 +11,13 @@ <%= protocol.name %> <%= protocol.version %> - <%= show_link protocol %> - <%= edit_link edit_protocol_path(protocol) %> - <%= destroy_link protocol %> + <%= link_to_show protocol %> + <%= link_to_edit edit_protocol_path(protocol) %> + <%= link_to_destroy protocol %> <% end %>
-<%= new_link 'protocol', new_protocol_path %> +<%= link_to_new 'protocol', new_protocol_path %> diff --git a/app/views/protocols/show.html.erb b/app/views/protocols/show.html.erb index 02ab4da..f7786da 100644 --- a/app/views/protocols/show.html.erb +++ b/app/views/protocols/show.html.erb @@ -19,4 +19,4 @@

-<%= edit_link edit_protocol_path(@protocol) %> +<%= link_to_edit edit_protocol_path(@protocol) %> diff --git a/app/views/samples/edit.html.erb b/app/views/samples/edit.html.erb index a827a8d..fce846f 100644 --- a/app/views/samples/edit.html.erb +++ b/app/views/samples/edit.html.erb @@ -7,4 +7,4 @@ <%= render :partial => 'form', :locals => { :f => form } %> <% end %> -<%= show_link [@parent, @sample] %> +<%= link_to_show [@parent, @sample] %> diff --git a/app/views/samples/index.html.slim b/app/views/samples/index.html.slim index ba4b4a8..336365d 100644 --- a/app/views/samples/index.html.slim +++ b/app/views/samples/index.html.slim @@ -51,24 +51,24 @@ h1 br td - if sample.aliquot? - = show_link sample_sample_path(sample.sample, sample) + = link_to_show sample_sample_path(sample.sample, sample) - else - = show_link test_subject_sample_path(sample.test_subject, sample) + = link_to_show test_subject_sample_path(sample.test_subject, sample) td - if sample.aliquot? - = edit_link edit_sample_sample_path(sample.sample, sample) + = link_to_edit edit_sample_sample_path(sample.sample, sample) - else - = edit_link edit_test_subject_sample_path(sample.test_subject, sample) + = link_to_edit edit_test_subject_sample_path(sample.test_subject, sample) td - if sample.aliquot? - = destroy_link sample_sample_path(sample.sample, sample) + = link_to_destroy sample_sample_path(sample.sample, sample) - else - = destroy_link test_subject_sample_path(sample.test_subject, sample) + = link_to_destroy test_subject_sample_path(sample.test_subject, sample) br - if defined? @parent - if @parent.kind_of?(Sample) - = new_link "aliquot of sample #{@parent.id}", new_sample_sample_path(@parent) + = link_to_new "aliquot of sample #{@parent.id}", new_sample_sample_path(@parent) - elsif @parent.kind_of?(TestSubject) - = new_link "sample for #{TestSubject.title.downcase} #{@parent.code}", + = link_to_new "sample for #{TestSubject.title.downcase} #{@parent.code}", new_test_subject_sample_path(@parent) diff --git a/app/views/samples/show.html.slim b/app/views/samples/show.html.slim index 0ccf8e7..a626f8c 100644 --- a/app/views/samples/show.html.slim +++ b/app/views/samples/show.html.slim @@ -13,8 +13,8 @@ h1 Showing #{@sample.aliquot? ? 'aliquot' : 'sample'} #{@sample.barcode} from #{ dd = link_to(@sample.root.to_s, test_subject_path(@sample.root)) .card-footer .btn-group - = new_link 'aliquot', new_sample_sample_path(@sample) - = new_link 'experiment', new_sample_experiment_path(@sample) + = link_to_new 'aliquot', new_sample_sample_path(@sample) + = link_to_new 'experiment', new_sample_experiment_path(@sample) .card .card-header Client-related Information @@ -81,5 +81,5 @@ h1 Showing #{@sample.aliquot? ? 'aliquot' : 'sample'} #{@sample.barcode} from #{ br -= edit_link @sample.aliquot? ? edit_sample_sample_path(@sample.sample, @sample) : edit_test_subject_sample_path(@test_subject, @sample) += link_to_edit @sample.aliquot? ? edit_sample_sample_path(@sample.sample, @sample) : edit_test_subject_sample_path(@test_subject, @sample) diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb index 4aac7be..1e43de9 100644 --- a/app/views/sites/edit.html.erb +++ b/app/views/sites/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link @site %> +<%= link_to_show @site %> diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index c65dc9b..1668ebb 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -15,13 +15,13 @@ <% else %> 0 <% end %> - <%= show_link site %> - <%= edit_link edit_site_path(site) %> - <%= destroy_link site %> + <%= link_to_show site %> + <%= link_to_edit edit_site_path(site) %> + <%= link_to_destroy site %> <% end %>
-<%= new_link 'site', new_site_path %> +<%= link_to_new 'site', new_site_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index c739306..d73fc55 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -14,4 +14,4 @@

-<%= edit_link edit_site_path(@site) %> \ No newline at end of file +<%= link_to_edit edit_site_path(@site) %> diff --git a/app/views/studies/edit.html.erb b/app/views/studies/edit.html.erb index 7a64de4..4366d1b 100644 --- a/app/views/studies/edit.html.erb +++ b/app/views/studies/edit.html.erb @@ -9,4 +9,4 @@ <% end %> -<%= show_link({id: @study}) %> +<%= link_to_show({id: @study}) %> diff --git a/app/views/studies/index.html.erb b/app/views/studies/index.html.erb index 733cda6..001a245 100644 --- a/app/views/studies/index.html.erb +++ b/app/views/studies/index.html.erb @@ -17,13 +17,13 @@ <%= study.name %> <%= truncate(study.description, :length => 50) %> <%= study.cohorts.count %> - <%= show_link({:action => 'show', :id => study}, 'show/analyze') %> - <%= edit_link({:action => 'edit', :id => study}) %> - <%= destroy_link({:action => 'destroy', :id => study}) %> + <%= link_to_show({:action => 'show', :id => study}, 'show/analyze') %> + <%= link_to_edit({:action => 'edit', :id => study}) %> + <%= link_to_destroy({:action => 'destroy', :id => study}) %> <% end %>
-<%= new_link("Study", {:action => 'new'}) %> \ No newline at end of file +<%= link_to_new("Study", {:action => 'new'}) %> diff --git a/app/views/studies/show.html.erb b/app/views/studies/show.html.erb index fd1e4d7..4aff155 100644 --- a/app/views/studies/show.html.erb +++ b/app/views/studies/show.html.erb @@ -13,7 +13,7 @@ <%= link_to 'Run Analysis', analysis_study_path(@study), :style => "display: #{ @study.cohorts.length > 1 ? 'inline' : 'none'}", :id => 'run-analysis' %>
- <%= link_to 'Export to MetaboAnalyst', study_path(@study, :format => :metaboanalyst) %> | + <%= link_to 'Export to MetaboAnalyst', study_path(@study, :format => :metaboanalyst) %> | <%= link_to 'Export to Umetrics', study_path(@study, :format => :umetrics) %>
@@ -42,4 +42,4 @@

-<%= edit_link({:action => 'edit'}) %> \ No newline at end of file +<%= link_to_edit({:action => 'edit'}) %> diff --git a/app/views/task_categories/edit.html.erb b/app/views/task_categories/edit.html.erb index 49d211a..b09b0c6 100644 --- a/app/views/task_categories/edit.html.erb +++ b/app/views/task_categories/edit.html.erb @@ -15,4 +15,4 @@

<% end %> -<%= show_link @task_category %> +<%= link_to_show @task_category %> diff --git a/app/views/task_categories/index.html.erb b/app/views/task_categories/index.html.erb index 8d9f375..3d2c915 100644 --- a/app/views/task_categories/index.html.erb +++ b/app/views/task_categories/index.html.erb @@ -10,13 +10,13 @@ <%= task_category.name %> <%= task_category.description %> - <%= show_link task_category %> - <%= edit_link edit_task_category_path(task_category) %> - <%= destroy_link task_category %> + <%= link_to_show task_category %> + <%= link_to_edit edit_task_category_path(task_category) %> + <%= link_to_destroy task_category %> <% end %>
-<%= new_link 'task category', new_task_category_path %> +<%= link_to_new 'task category', new_task_category_path %> diff --git a/app/views/task_categories/show.html.erb b/app/views/task_categories/show.html.erb index 49edef0..dfea834 100644 --- a/app/views/task_categories/show.html.erb +++ b/app/views/task_categories/show.html.erb @@ -9,4 +9,4 @@

-<%= edit_link edit_task_category_path(@task_category) %> \ No newline at end of file +<%= link_to_edit edit_task_category_path(@task_category) %> diff --git a/app/views/task_priorities/edit.html.erb b/app/views/task_priorities/edit.html.erb index b581576..41a5c33 100644 --- a/app/views/task_priorities/edit.html.erb +++ b/app/views/task_priorities/edit.html.erb @@ -15,4 +15,4 @@

<% end %> -<%= show_link @task_priority %> \ No newline at end of file +<%= link_to_show @task_priority %> diff --git a/app/views/task_priorities/index.html.erb b/app/views/task_priorities/index.html.erb index 07c5cad..746ecd2 100644 --- a/app/views/task_priorities/index.html.erb +++ b/app/views/task_priorities/index.html.erb @@ -10,13 +10,13 @@ <%= task_priority.name %> <%= task_priority.description %> - <%= show_link task_priority %> - <%= edit_link edit_task_priority_path(task_priority) %> - <%= destroy_link task_priority %> + <%= link_to_show task_priority %> + <%= link_to_edit edit_task_priority_path(task_priority) %> + <%= link_to_destroy task_priority %> <% end %>
-<%= new_link 'task priority', new_task_priority_path %> +<%= link_to_new 'task priority', new_task_priority_path %> diff --git a/app/views/task_priorities/show.html.erb b/app/views/task_priorities/show.html.erb index e88a981..4a971f3 100644 --- a/app/views/task_priorities/show.html.erb +++ b/app/views/task_priorities/show.html.erb @@ -9,4 +9,4 @@

-<%= edit_link edit_task_priority_path(@task_priority) %> \ No newline at end of file +<%= link_to_edit edit_task_priority_path(@task_priority) %> diff --git a/app/views/tasks/calendar.html.erb b/app/views/tasks/calendar.html.erb index 54acab4..11cb7ae 100644 --- a/app/views/tasks/calendar.html.erb +++ b/app/views/tasks/calendar.html.erb @@ -9,15 +9,15 @@

- <%= link_to ('« ' + (@month==1 ? "#{Date::MONTHNAMES[12]} #{@year-1}" : "#{Date::MONTHNAMES[@month-1]}")).html_safe, + <%= link_to ('« ' + (@month==1 ? "#{Date::MONTHNAMES[12]} #{@year-1}" : "#{Date::MONTHNAMES[@month-1]}")).html_safe, { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }, :method => :get %> | - <%= link_to ((@month==12 ? "#{Date::MONTHNAMES[1]} #{@year+1}" : "#{Date::MONTHNAMES[@month+1]}") + ' »').html_safe, + <%= link_to ((@month==12 ? "#{Date::MONTHNAMES[1]} #{@year+1}" : "#{Date::MONTHNAMES[@month+1]}") + ' »').html_safe, { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }, :method => :get %>

<%= link_to 'Today', { :month => nil, :year => nil }, :method => :get, :class => 'icon icon-home' %>

- + <% 7.times do |i| %><% end %> @@ -28,16 +28,16 @@ <% while day <= @calendar.enddt %> <%= "".html_safe if day.cwday == @calendar.first_wday %>
<%= Date::DAYNAMES[(@calendar.first_wday+i)%7] %>
#{day.cweek} -

<%= day.day %>

+

<%= day.day %>

<% @calendar.events_on(day).each do |i| %> <% if i.is_a? Task %>
<%= if day == i.start_date && day == i.due_date image_tag('icons/arrow_bw.png') elsif day == i.start_date - image_tag('icons/arrow_from.png') + image_tag('icons/arrow_from.png') elsif day == i.due_date - image_tag('icons/arrow_to.png') + image_tag('icons/arrow_to.png') end %> <%= link_to i.subject, task_path(i) %> <%= render_task_tooltip i %> @@ -58,6 +58,6 @@
-<%= new_link 'task', new_task_path %> | -<%= link_to 'Tasks', tasks_path %> | +<%= link_to_new 'task', new_task_path %> | +<%= link_to 'Tasks', tasks_path %> | <%= link_to 'Gantt', gantt_tasks_path, :class => 'icon icon-report' %> diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb index 1164929..fcf0957 100644 --- a/app/views/tasks/edit.html.erb +++ b/app/views/tasks/edit.html.erb @@ -1,5 +1,5 @@

Editing task

<%= render :partial => 'form' %> - -<%= show_link @task %> \ No newline at end of file + +<%= link_to_show @task %> diff --git a/app/views/tasks/gantt.html.erb b/app/views/tasks/gantt.html.erb index f53f41e..0bcd2e8 100644 --- a/app/views/tasks/gantt.html.erb +++ b/app/views/tasks/gantt.html.erb @@ -26,7 +26,7 @@ <%= link_to 'Today', @gantt.params.merge(:month => nil, :year => nil), :method => :get, :class => 'icon icon-home' %> <% end %> - + <% zoom = 1 @gantt.zoom.times { zoom = zoom * 2 } @@ -75,25 +75,25 @@
 
- <% + <% # # Months headers # month_f = @gantt.date_from left = 0 height = (show_weeks ? header_height : header_height + g_height) - @gantt.months.times do + @gantt.months.times do width = ((month_f >> 1) - month_f) * zoom - 1 %>
<%= link_to "#{month_f.year}-#{month_f.month}", @gantt.params.merge(:year => month_f.year, :month => month_f.month), :title => "#{month_f.month} #{month_f.year}"%>
- <% + <% left = left + width + 1 month_f = month_f >> 1 end %> - <% + <% # # Weeks headers # @@ -109,7 +109,7 @@ width = (7 - @gantt.date_from.cwday + 1) * zoom-1 %>
 
- <% + <% left = left + width+1 end %> <% @@ -119,13 +119,13 @@
<%= week_f.cweek if width >= 16 %>
- <% + <% left = left + width+1 week_f = week_f+7 end end %> - <% + <% # # Days headers # @@ -133,13 +133,13 @@ left = 0 height = g_height + header_height - 1 wday = @gantt.date_from.cwday - (@gantt.date_to - @gantt.date_from + 1).to_i.times do + (@gantt.date_to - @gantt.date_from + 1).to_i.times do width = zoom - 1 %>
5 %>" class="gantt_hdr"> <%= Date::DAYNAMES[wday % 7].first %>
- <% + <% left = left + width+1 wday = wday + 1 wday = 1 if wday > 7 @@ -151,7 +151,7 @@ # Tasks # top = headers_height + 10 - @gantt.events.each do |i| + @gantt.events.each do |i| i_start_date = (i.start_date >= @gantt.date_from ? i.start_date : @gantt.date_from ) i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to ) @@ -161,7 +161,7 @@ i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today - i_left = ((i_start_date - @gantt.date_from)*zoom).floor + i_left = ((i_start_date - @gantt.date_from)*zoom).floor i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders) d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width @@ -207,6 +207,6 @@
-<%= new_link 'task', new_task_path %> | -<%= link_to 'Tasks', tasks_path %> | +<%= link_to_new 'task', new_task_path %> | +<%= link_to 'Tasks', tasks_path %> | <%= link_to 'Calendar', calendar_tasks_path, :class => 'icon icon-calendar' %> diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index d3a6890..804d973 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -31,16 +31,16 @@ <%= task.due_date %> <%= task.estimated_hours %> <%= task.done_ratio %> - <%= show_link task %> - <%= edit_link edit_task_path(task) %> - <%= destroy_link task %> + <%= link_to_show task %> + <%= link_to_edit edit_task_path(task) %> + <%= link_to_destroy task %> <% end %>
-<%= new_link("task", new_task_path) %> | +<%= link_to_new("task", new_task_path) %> | <%= link_to 'My tasks', user_tasks_path(current_user) %> | <%= link_to 'Gantt', gantt_tasks_path, :class => 'icon icon-report' %> | <%= link_to 'Calendar', calendar_tasks_path, :class => 'icon icon-calendar' %> diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index da9fe47..b001157 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -49,4 +49,4 @@

-<%= edit_link edit_task_path(@task) %> \ No newline at end of file +<%= link_to_edit edit_task_path(@task) %> diff --git a/app/views/test_subject_evaluations/edit.html.erb b/app/views/test_subject_evaluations/edit.html.erb index 183c3c1..e1c6a1a 100644 --- a/app/views/test_subject_evaluations/edit.html.erb +++ b/app/views/test_subject_evaluations/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => 'form' %> -<%= show_link test_subject_test_subject_evaluation_path(@test_subject, @test_subject_evaluation) %> \ No newline at end of file +<%= link_to_show test_subject_test_subject_evaluation_path(@test_subject, @test_subject_evaluation) %> diff --git a/app/views/test_subject_evaluations/index.html.erb b/app/views/test_subject_evaluations/index.html.erb index f589da9..d16d839 100644 --- a/app/views/test_subject_evaluations/index.html.erb +++ b/app/views/test_subject_evaluations/index.html.erb @@ -3,18 +3,18 @@ <% for test_subject_evaluation in @test_subject_evaluations %> - + - + - + - +
<%= h test_subject_evaluation.evaluated_on %><%= show_link test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %> | <%= edit_link edit_test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %> | <%= destroy_link test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %>
<%= h test_subject_evaluation.evaluated_on %><%= link_to_show test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %> | <%= link_to_edit edit_test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %> | <%= link_to_destroy test_subject_test_subject_evaluation_path(@test_subject, test_subject_evaluation) %>
Diagnosis:<%= test_subject_evaluation.diagnosis %>
BMI:<%= BMI(test_subject_evaluation.height, test_subject_evaluation.weight) %>
Symptoms:<%= test_subject_evaluation.symptoms.join(', ') %>

<% end %>
-<%= new_link "#{TestSubject.title.downcase} evaluation", new_test_subject_test_subject_evaluation_path(@test_subject) %> +<%= link_to_new "#{TestSubject.title.downcase} evaluation", new_test_subject_test_subject_evaluation_path(@test_subject) %> diff --git a/app/views/test_subject_evaluations/show.html.erb b/app/views/test_subject_evaluations/show.html.erb index 7df43fd..2ec67ff 100644 --- a/app/views/test_subject_evaluations/show.html.erb +++ b/app/views/test_subject_evaluations/show.html.erb @@ -176,4 +176,4 @@ TODO: Past medical history
-<%= edit_link edit_test_subject_test_subject_evaluation_path(@test_subject, @test_subject_evaluation) %> \ No newline at end of file +<%= link_to_edit edit_test_subject_test_subject_evaluation_path(@test_subject, @test_subject_evaluation) %> diff --git a/app/views/test_subjects/edit.html.erb b/app/views/test_subjects/edit.html.erb index 43986aa..5162c5d 100644 --- a/app/views/test_subjects/edit.html.erb +++ b/app/views/test_subjects/edit.html.erb @@ -2,4 +2,4 @@ <%= render :partial => "#{TestSubjectsController::VIEW_PATH}/form" %> -<%= show_link @test_subject %> \ No newline at end of file +<%= link_to_show @test_subject %> diff --git a/app/views/test_subjects/subjects/cow/index.html.erb b/app/views/test_subjects/subjects/cow/index.html.erb index 29414aa..8bacabb 100644 --- a/app/views/test_subjects/subjects/cow/index.html.erb +++ b/app/views/test_subjects/subjects/cow/index.html.erb @@ -13,12 +13,12 @@ <%= test_subject.code %> <%= test_subject.birthdate %> <%= test_subject.samples.length %> (<%= link_to 'display', test_subject_samples_path(test_subject) %>) - <%= show_link test_subject %> - <%= edit_link edit_test_subject_path(test_subject) %> - <%= destroy_link test_subject %> + <%= link_to_show test_subject %> + <%= link_to_edit edit_test_subject_path(test_subject) %> + <%= link_to_destroy test_subject %> <% end %>
-<%= new_link TestSubject.title.downcase, new_test_subject_path %> +<%= link_to_new TestSubject.title.downcase, new_test_subject_path %> diff --git a/app/views/test_subjects/subjects/cow/show.html.erb b/app/views/test_subjects/subjects/cow/show.html.erb index 8683802..36bddac 100644 --- a/app/views/test_subjects/subjects/cow/show.html.erb +++ b/app/views/test_subjects/subjects/cow/show.html.erb @@ -52,14 +52,14 @@
-<%= edit_link edit_test_subject_path(@test_subject) %> +<%= link_to_edit edit_test_subject_path(@test_subject) %>

Diet Information - + <% if @meals.length > 0 %> @@ -75,18 +75,18 @@ - - - + + + <% end %>
<%= meal.amount %> <%= meal.consumed_during_period %> <%= meal.consumed_on_day %><%= show_link test_subject_meal_path(@test_subject, meal) %><%= edit_link edit_test_subject_meal_path(@test_subject, meal) %><%= destroy_link test_subject_meal_path(@test_subject, meal) %><%= link_to_show test_subject_meal_path(@test_subject, meal) %><%= link_to_edit edit_test_subject_meal_path(@test_subject, meal) %><%= link_to_destroy test_subject_meal_path(@test_subject, meal) %>
- +
- - <%= new_link "meal for #{TestSubject.title.downcase} #{@test_subject.code}", new_test_subject_meal_path(@test_subject) %> + + <%= link_to_new "meal for #{TestSubject.title.downcase} #{@test_subject.code}", new_test_subject_meal_path(@test_subject) %> <% else %> No current diet information. <% end %>
- + diff --git a/app/views/test_subjects/subjects/patient/index.html.slim b/app/views/test_subjects/subjects/patient/index.html.slim index 7de4f39..569e78d 100644 --- a/app/views/test_subjects/subjects/patient/index.html.slim +++ b/app/views/test_subjects/subjects/patient/index.html.slim @@ -25,9 +25,9 @@ h1= title 'Patients' td #{patient.samples.length} (#{link_to 'display', test_subject_samples_path(patient)}) td= patient.practitioner td= truncate(patient.notes) - td= show_link patient - td= edit_link edit_test_subject_path(patient) - td= destroy_link patient + td= link_to_show patient + td= link_to_edit edit_test_subject_path(patient) + td= link_to_destroy patient -= new_link 'patient', new_test_subject_path += link_to_new 'patient', new_test_subject_path diff --git a/app/views/test_subjects/subjects/patient/show.html.slim b/app/views/test_subjects/subjects/patient/show.html.slim index e784313..55de9f2 100644 --- a/app/views/test_subjects/subjects/patient/show.html.slim +++ b/app/views/test_subjects/subjects/patient/show.html.slim @@ -26,5 +26,5 @@ b Notes: = @test_subject.notes br/ - = edit_link edit_test_subject_path(@test_subject) + = link_to_edit edit_test_subject_path(@test_subject) diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index a1b39d2..fe301f4 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -29,9 +29,9 @@ - <% end %> <%= user.email %> - <%= show_link user %> - <%= edit_link edit_user_path(user) %> - <%= destroy_link user %> + <%= link_to_show user %> + <%= link_to_edit edit_user_path(user) %> + <%= link_to_destroy user %> <% end %> @@ -39,4 +39,4 @@
-<%= new_link 'user', new_user_path %> \ No newline at end of file +<%= link_to_new 'user', new_user_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 4dd901a..e954abf 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -24,4 +24,4 @@ <%= @user.email %>

-<%= edit_link edit_user_path(@user) %> \ No newline at end of file +<%= link_to_edit edit_user_path(@user) %> diff --git a/app/views/workflows/patients/_show.html.erb b/app/views/workflows/patients/_show.html.erb index e1055bf..df56df3 100644 --- a/app/views/workflows/patients/_show.html.erb +++ b/app/views/workflows/patients/_show.html.erb @@ -43,4 +43,4 @@
-<%= edit_link edit_test_subject_path(@test_subject) %> +<%= link_to_edit edit_test_subject_path(@test_subject) %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 4f3f07a..52257d5 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -8,4 +8,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( clients.css lims.css ) +Rails.application.config.assets.precompile += %w( clients.css lims.css public.css ) diff --git a/config/routes.rb b/config/routes.rb index c9b4b71..8a7e976 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,29 +5,20 @@ get 'contact' => 'public/pages#contact' get 'services' => 'public/pages#services' - ## User routes - devise_for :users do - get 'landing' => 'bovine#index', as: :user_root - end - - resources :users do - resources :user_pictures - resources :tasks - end - ## Client routes - devise_for :clients do - get 'clients/home' => 'clients/home#index', as: :client_root - end + devise_for :clients namespace :clients do - resources :samples, only: [ :index, :show ] + resources :samples, only: [:index, :show] resources :sample_manifests do - get 'print', on: :member + get :print, on: :member end - resources :home, only: [ :index ] + resources :home, only: [:index] + root 'home#index' end - resources :clients + + ## User routes + devise_for :users namespace :workflows do resources :experiments @@ -44,35 +35,32 @@ end end + resources :clients + + resources :users do + resources :user_pictures + resources :tasks + end + namespace :batches do resources :batches, only: [:new, :create] do - collection do - get :unprepped - end + get :unprepped, on: :collection end resources :preparations, only: [:new, :create] do - collection do - get :non_ph - end + get :non_ph, on: :collection end resources :phs, only: [:edit, :update] do - collection do - get :no_experiment - end + get :no_experiment, on: :collection end end resources :nutrients resources :metabolites do - collection do - post :search - end + post :search, on: :collection end - ## Resources - # Diets/etc. resources :nutrients resources :ingredients @@ -97,15 +85,11 @@ # Studies resources :studies do - member do - get :analysis - end + get :analysis, on: :member end resources :metabolites do - collection do - post :search - end + post :search, on: :collection end resources :experiments do @@ -130,26 +114,18 @@ # Sample/test subject tracking resources :samples do resources :samples do - member do - post :finish - end + post :finish, on: :member end resources :experiments resources :grouping_assignments - member do - post :finish - end + post :finish, on: :member end resources :test_subjects do - member do - get :tree - end + get :tree, on: :member resources :meals resources :samples do - member do - post :finish - end + post :finish, on: :member end resources :grouping_assignments resources :lab_tests @@ -177,9 +153,5 @@ controller: 'groupings', defaults: { type: grouping_type } end - ## Named routes - get 'admin' => 'administrators#index', as: :admin - - ## Route URL - root 'public/pages#home' + root 'samples#index' end