trim long names [fixes SCI-774] adds secondary navigation and sidebar [fixes SCI-775]

This commit is contained in:
zmagod 2016-12-12 10:30:03 +01:00
parent e83bce22a3
commit 8bb452e4f7
10 changed files with 78 additions and 13 deletions

View file

@ -3,6 +3,11 @@
.sample_types_groups_list {
margin-top: 50px;
.sample-type-group-name {
display: inline-block;
width: 80%;
}
li {
border-bottom: 1px solid $color-alto;
padding: 15px 5px;

View file

@ -2,6 +2,8 @@ class SampleGroupsController < ApplicationController
before_action :load_vars_nested
before_action :check_create_permissions
before_action :set_sample_group, except: [:create, :index]
before_action :set_project_my_module, only: :index
layout 'fluid'
def create
@sample_group = SampleGroup.new(sample_group_params)
@ -112,6 +114,13 @@ class SampleGroupsController < ApplicationController
private
def set_project_my_module
@project = Project.find_by_id(params[:project_id]) if params[:project_id]
@my_module = MyModule
.find_by_id(params[:my_module_id]) if params[:my_module_id]
render_403 unless @project || @my_module
end
def set_sample_group
@sample_group = SampleGroup.find_by_id(params[:id])
end

View file

@ -2,6 +2,8 @@ class SampleTypesController < ApplicationController
before_action :load_vars_nested
before_action :check_create_permissions
before_action :set_sample_type, except: [:create, :index]
before_action :set_project_my_module, only: :index
layout 'fluid'
def create
@sample_type = SampleType.new(sample_type_params)
@ -112,6 +114,13 @@ class SampleTypesController < ApplicationController
private
def set_project_my_module
@project = Project.find_by_id(params[:project_id]) if params[:project_id]
@my_module = MyModule
.find_by_id(params[:my_module_id]) if params[:my_module_id]
render_403 unless @project || @my_module
end
def load_vars_nested
@organization = Organization.find_by_id(params[:organization_id])

View file

@ -11,4 +11,20 @@ module ApplicationHelper
controller_name == 'projects' ||
(controller_name == 'reports' && action_name == 'index')
end
def sample_types_page_project?
controller_name == 'sample_types' && !(defined? @my_module)
end
def sample_groups_page_project?
controller_name == 'sample_groups' && !(defined? @my_module)
end
def sample_types_page_my_module?
controller_name == 'sample_types' && defined? @my_module
end
def sample_groups_page_my_module?
controller_name == 'sample_groups' && defined? @my_module
end
end

View file

@ -5,7 +5,7 @@
organization_sample_group_destroy_confirmation_path(organization,
sample_group) %>"
data-color="<%= sample_group.color %>">
<%= sample_group.name %>
<span class="sample-type-group-name"><%= sample_group.name %></span>
<span class="pull-right sample-group-controls">
<span class="color-picker">
<%= bootstrap_form_for [organization, sample_group], remote: true do |f| %>

View file

@ -1,14 +1,20 @@
<% provide(:head_title, t('sample_groups.index.head_title')) %>
<%= render partial: "shared/sidebar" %>
<%= render partial: "shared/secondary_navigation" %>
<% if current_organization %>
<ul class="nav nav-tabs nav-settings" data-position="bottom">
<li role="presentation">
<%= link_to t('sample_types.index.sample_types'),
organization_sample_types_path(current_organization) %>
organization_sample_types_path(current_organization,
project_id: (@project.id if @project),
my_module_id: (@my_module.id if @my_module)) %>
</li>
<li role="presentation" class="active">
<%= link_to t('sample_types.index.sample_groups'),
organization_sample_groups_path(current_organization) %>
organization_sample_groups_path(current_organization,
project_id: (@project.id if @project),
my_module_id: (@my_module.id if @my_module)) %>
</li>
</ul>
<div class="tab-content">

View file

@ -6,7 +6,7 @@
data-delete="<%=
organization_sample_type_destroy_confirmation_path(organization, sample_type)
%>">
<%= sample_type.name %>
<span class="sample-type-group-name"><%= sample_type.name %></span>
<span class="pull-right">
<span class="edit glyphicon glyphicon-pencil"></span>
<span class="delete glyphicon glyphicon-trash"></span>

View file

@ -1,14 +1,20 @@
<% provide(:head_title, t('sample_types.index.head_title')) %>
<%= render partial: "shared/sidebar" %>
<%= render partial: "shared/secondary_navigation" %>
<% if current_organization %>
<ul class="nav nav-tabs nav-settings" data-position="bottom">
<li role="presentation" class="active">
<%= link_to t('sample_types.index.sample_types'),
organization_sample_types_path(current_organization) %>
organization_sample_types_path(current_organization,
project_id: (@project.id if @project),
my_module_id: (@my_module.id if @my_module)) %>
</li>
<li role="presentation">
<%= link_to t('sample_types.index.sample_groups'),
organization_sample_groups_path(current_organization) %>
organization_sample_groups_path(current_organization,
project_id: (@project.id if @project),
my_module_id: (@my_module.id if @my_module)) %>
</li>
</ul>
<div class="tab-content">

View file

@ -66,7 +66,10 @@
<% if can_add_sample_related_things_to_organization %>
<div class="dropdown pull-right" style="display: inline;">
<%= link_to(t('samples.types_and_groups'),
organization_sample_types_path(@organization),
organization_sample_types_path(@organization,
project_id: (@project.id if @project),
my_module_id: (@my_module.id if @my_module),
experiment_id: (@experiment.id if @experiment)),
class: 'btn btn-default' ) %>
</div>
<% end %>

View file

@ -22,7 +22,9 @@
</a>
<% end %>
</li>
<% if project_page? %>
<% if project_page? ||
sample_types_page_project? ||
sample_groups_page_project? %>
<li class="active">
<span class="glyphicon glyphicon-blackboard"></span>
</li>
@ -37,7 +39,8 @@
<% end %>
</li>
<% end %>
<% if experiment_page? || module_page? %>
<% if experiment_page? ||
module_page? %>
<% if !module_page? %>
<li class="active">
<%= fa_icon 'fa-flask' %>
@ -67,7 +70,9 @@
<!-- True secondary navigation (buttons on the right side) -->
<ul class="nav navbar-nav navbar-right" style="vertical-align: bottom">
<% if project_page? %>
<% if project_page? ||
sample_types_page_project? ||
sample_groups_page_project? %>
<% if can_view_project(@project) then %>
<li id="canvas-nav-tab" class="<%= "active" if is_project_show? %>">
<a href="<%= project_url(@project) %>" title="<%=t "nav2.projects.show" %>">
@ -77,7 +82,9 @@
</li>
<% end %>
<% if can_view_project_samples(@project) then %>
<li id="project-samples-nav-tab" class="<%= "active" if is_project_samples? %>">
<li id="project-samples-nav-tab" class="<%= "active" if is_project_samples? ||
sample_types_page_project? ||
sample_groups_page_project? %>">
<a href="<%= samples_project_url(@project) %>" title="<%=t "nav2.projects.samples" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.projects.samples" %></span>
<span class="hidden-xs hidden-lg glyphicon glyphicon-tint"></span>
@ -129,7 +136,9 @@
</li>
<% end %>
<% elsif module_page? %>
<% elsif module_page? ||
sample_types_page_my_module? ||
sample_groups_page_my_module? %>
<% if can_view_module_protocols(@my_module) then %>
<li id="steps-nav-tab" class="<%= "active" if is_module_protocols? %>">
<a href="<%= protocols_my_module_url(@my_module) %>" title="<%=t "nav2.modules.steps" %>">
@ -155,7 +164,9 @@
</li>
<% end %>
<% if can_view_module_samples(@my_module) then %>
<li id="module-samples-nav-tab" class="<%= "active" if is_module_samples? %>">
<li id="module-samples-nav-tab" class="<%= "active" if is_module_samples? ||
sample_types_page_my_module? ||
sample_groups_page_my_module? %>">
<a href="<%= samples_my_module_url(@my_module) %>" title="<%=t "nav2.modules.samples" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.samples" %></span>
<span class="hidden-xs hidden-lg glyphicon glyphicon-tint"></span>