Add experiment level to project report contents modal

This commit is contained in:
Jure Grabnar 2016-07-27 14:44:12 +02:00
parent c7e1dea1bc
commit 598c5a63fd
3 changed files with 42 additions and 25 deletions

View file

@ -131,6 +131,10 @@ ul.project-contents-list {
padding-left: 15px !important;
}
ul.experiment-contents-list {
padding-left: 30px !important;
}
/** "New element" floating element */
.new-element {
display: block;

View file

@ -9,7 +9,7 @@
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.project_tab") %></span>
</a>
</li>
<% if project.my_modules.count > 0 %>
<% if project.project_my_modules.count > 0 %>
<li role="presentation">
<a href="#project-modules-tab" aria-controls="project-modules-tab" role="tab" data-toggle="tab">
<span class="glyphicon glyphicon-link visible-xs"></span>
@ -37,7 +37,7 @@
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.project_tab") %></h5>
<%= render partial: "reports/new/modal/project_contents_inner.html.erb", locals: { form: f, project: project } %>
</div>
<% if project.my_modules.count > 0 %>
<% if project.project_my_modules.count > 0 %>
<div role="tabpanel" class="tab-pane" id="project-modules-tab">
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.modules_tab") %></h5>
<%= render partial: "reports/new/modal/module_contents_inner.html.erb", locals: { form: f } %>
@ -69,9 +69,13 @@
if (nextUl.length && nextUl.is("ul.project-contents-list")) {
nextUl.find("input:checkbox").prop("checked", this.checked);
}
if (nextUl.length && nextUl.is("ul.experiment-contents-list")) {
nextUl.find("input:checkbox").prop("checked", this.checked);
}
});
projectAll.click(function() {
var parentLists = $(this).parents("ul.project-contents-list");
var parentLists = $(this).parents("ul.project-contents-list, ul.experiment-contents-list");
if (parentLists.length) {
var prevEl = parentLists.prev();
if (prevEl.length && prevEl.is("div.checkbox")) {

View file

@ -1,4 +1,3 @@
<% modules_without_group = project.modules_without_group %>
<div>
<em>
@ -6,36 +5,46 @@
</em>
</div>
<% if project.my_modules.count > 0 %>
<% if project.project_my_modules.count > 0 %>
<%= form.check_box :project, label: project.name, class: "project-all-cb" %>
<ul class="no-style project-contents-list">
<% project.my_module_groups.each do |my_module_group| %>
<% project.experiments.each do |experiment| %>
<li>
<%= form.check_box "module_group_#{my_module_group.id}", label: my_module_group.name, class: "project-all-cb" %>
<% if my_module_group.my_modules.present? then %>
<ul class="no-style project-contents-list">
<% my_module_group.ordered_modules.each do |my_module| %>
<%= form.check_box "experiment_#{experiment.id}", label: experiment.name, class: "project-all-cb" %>
<ul class="no-style experiment-contents-list">
<% experiment.my_module_groups.each do |my_module_group| %>
<li>
<%= form.check_box "module_group_#{my_module_group.id}", label: my_module_group.name, class: "project-all-cb" %>
<% if my_module_group.my_modules.present? then %>
<ul class="no-style experiment-contents-list">
<% my_module_group.ordered_modules.each do |my_module| %>
<li>
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
</li>
<% end %>
</ul>
<% end %>
</li>
<% end %>
</ul>
</li>
<!-- Tasks without groups -->
<% modules_without_group = experiment.modules_without_group %>
<% if modules_without_group.present? and modules_without_group.count > 0 %>
<li>
<%= form.check_box :no_module_group, label: t("projects.reports.elements.modals.project_contents_inner.no_module_group"), class: "project-all-cb" %>
<ul class="no-style experiment-contents-list">
<% modules_without_group.each do |my_module| %>
<li>
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
</li>
<% end %>
</ul>
<% end %>
</li>
</li>
<% end %>
<% end %>
<% if modules_without_group.present? and modules_without_group.count > 0 %>
<li>
<%= form.check_box :no_module_group, label: t("projects.reports.elements.modals.project_contents_inner.no_module_group"), class: "project-all-cb" %>
<ul class="no-style project-contents-list">
<% modules_without_group.each do |my_module| %>
<li>
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
</li>
<% end %>
</ul>
</li>
<% end %>
</ul>
<% else %>
<div>
@ -43,4 +52,4 @@
<%= t("projects.reports.elements.modals.project_contents_inner.no_modules") %>
</em>
</div>
<% end %>
<% end %>