Merge pull request #2763 from aignatov-bio/ai-sci-4895-add-sorting-to-reults

Add ordering for result page [SCI-4895]
This commit is contained in:
Urban Rotnik 2020-08-04 11:17:43 +02:00 committed by GitHub
commit cce76f6f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 267 additions and 134 deletions

BIN
Moon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 KiB

View file

@ -48,13 +48,13 @@
}
function applyCollapseLinkCallBack() {
$('.result-panel-collapse-link')
.on('ajax:success', function() {
var collapseIcon = $(this).find('.collapse-result-icon');
var collapsed = $(this).hasClass('collapsed');
$('.panel-collapse')
.on('shown.bs.collapse hidden.bs.collapse', function() {
var collapseIcon = $(this).closest('.panel').find('.collapse-result-icon');
var collapsed = $(this).closest('.panel').find('.result-panel-collapse-link').hasClass('collapsed');
// Toggle collapse button
collapseIcon.toggleClass('fa-caret-square-up', !collapsed);
collapseIcon.toggleClass('fa-caret-square-down', collapsed);
collapseIcon.toggleClass('fa-caret-up', !collapsed);
collapseIcon.toggleClass('fa-caret-down', collapsed);
});
}
@ -81,8 +81,8 @@
function expandAllResults() {
$('.result .panel-collapse').collapse('show');
$(document).find('span.collapse-result-icon').each(function() {
$(this).addClass('fa-caret-square-up');
$(this).removeClass('fa-caret-square-down');
$(this).addClass('fa-caret-up');
$(this).removeClass('fa-caret-down');
});
$(document).find('div.step-result-hot-table').each(function() {
renderTable(this);
@ -92,8 +92,8 @@
function expandResult(result) {
$('.panel-collapse', result).collapse('show');
$(result).find('span.collapse-result-icon').each(function() {
$(this).addClass('fa-caret-square-up');
$(this).removeClass('fa-caret-square-down');
$(this).addClass('fa-caret-up');
$(this).removeClass('fa-caret-down');
});
renderTable($(result).find('div.step-result-hot-table'));
animateSpinner(null, false);
@ -215,7 +215,7 @@
$('#results-collapse-btn').click(function() {
$('.result .panel-collapse').collapse('hide');
$(document).find('span.collapse-result-icon')
.addClass('fa-caret-square-down')
.addClass('fa-caret-down')
.removeClass('fa-caret-square-up');
});

View file

@ -159,9 +159,7 @@ var MarvinJsEditorApi = (function() {
newAsset.find('.file-preview-link').css('top', '0px');
}, 200);
} else if (config.objectType === 'Result') {
newAsset.prependTo($(config.container));
Results.expandResult(newAsset);
Comments.init();
location.reload();
} else if (config.objectType === 'TinyMceAsset') {
json = tinymce.util.JSON.parse(result);
config.editor.execCommand('mceInsertContent', false, TinyMceBuildHTML(json));

View file

@ -143,7 +143,7 @@
}
}
.new-marvinjs-upload-button {
button.new-marvinjs-upload-button {
padding: 1px 16px !important;
.new-marvinjs-upload-icon {
@ -158,6 +158,21 @@
}
}
li.new-marvinjs-upload-button {
.new-marvinjs-upload-icon {
display: inline-block;
height: 24px;
margin-left: -9px;
width: 24px;
img {
height: 100%;
width: 100%;
}
}
}
.mce-i-marvinjs::before {
background-image: url("/images/icon_small/marvinjs.svg");
content: "";

View file

@ -7,14 +7,44 @@
@import "mixins";
#results-toolbar {
.add-result-toolbar {
align-items: center;
display: flex;
flex-wrap: wrap;
align-items: center;
display: flex;
.add-result-dropdown {
margin-right: auto;
li {
cursor: pointer;
padding: .5em 1em;
.fas {
padding-right: .5em;
}
.create-wopi-file-btn {
padding: 0;
img {
margin-left: -5px;
}
}
}
}
.add-result-text {
display: inline-block;
margin-right: 5px;
.sort-result-dropdown {
margin-left: .5em;
.dropdown-menu {
a {
@include font-button;
padding: .5em 1em;
&.selected::after {
@include font-awesome;
content: $font-fas-check;
float: right;
}
}
}
}
}

View file

@ -3,6 +3,10 @@
&:focus {
box-shadow: none;
}
.caret {
margin: 8px 0 8px 8px;
}
}
&.open {
@ -17,6 +21,7 @@
}
.dropdown-menu {
@include font-button;
border-top-left-radius: 0;
border-top-right-radius: 0;
box-shadow: $flyout-shadow;

View file

@ -1110,6 +1110,10 @@ ul.content-activities {
margin-left: 38px;
}
.result-panel-collapse-link {
text-decoration: none;
}
.row {
padding: 0 20px;
}

View file

@ -245,8 +245,16 @@ class MyModulesController < ApplicationController
.experiment
.project
.team)
@results_order = params[:order] || 'new'
@results = @my_module.results.where(archived: false).page(params[:page])
.per(Constants::RESULTS_PER_PAGE_LIMIT).order(created_at: :desc)
.per(Constants::RESULTS_PER_PAGE_LIMIT)
@results = case @results_order
when 'old' then @results.order(created_at: :asc)
when 'atoz' then @results.order(name: :asc)
when 'ztoa' then @results.order(name: :desc)
else @results.order(created_at: :desc)
end
end
def archive

View file

@ -29,7 +29,8 @@ class ResultAssetsController < ApplicationController
if obj.fetch(:status)
flash[:success] = t('result_assets.create.success_flash',
module: @my_module.name)
redirect_to results_my_module_path(@my_module)
p params.as_json
redirect_to results_my_module_path(@my_module, page: params[:page], order: params[:order])
else
flash[:error] = t('result_assets.error_flash')
render json: {}, status: :bad_request

View file

@ -44,7 +44,7 @@ class ResultTablesController < ApplicationController
if @result.save && @table.save
log_activity(:add_result)
flash[:success] = t('result_tables.create.success_flash', module: @my_module.name)
redirect_to results_my_module_path(@my_module)
redirect_to results_my_module_path(@my_module, page: params[:page], order: params[:order])
else
render json: @result.errors, status: :bad_request
end

View file

@ -46,7 +46,7 @@ class ResultTextsController < ApplicationController
result_annotation_notification
log_activity(:add_result)
flash[:success] = t('result_texts.create.success_flash', module: @my_module.name)
redirect_to results_my_module_path(@my_module)
redirect_to results_my_module_path(@my_module, page: params[:page], order: params[:order])
else
render json: @result.errors, status: :bad_request
end

View file

@ -1,4 +1,4 @@
<span
<button
class="btn btn-light new-marvinjs-upload-button"
data-object-id="<%= element_id %>"
data-object-type="<%= element_type %>"
@ -9,4 +9,4 @@
<%= image_tag 'icon_small/marvinjs.svg' %>
</span>
<%= t('marvinjs.new_button') %>
</span>
</button>

View file

@ -0,0 +1,12 @@
<li
class="new-marvinjs-upload-button"
data-object-id="<%= element_id %>"
data-object-type="<%= element_type %>"
data-marvin-url="<%= marvin_js_assets_path %>"
data-sketch-container="<%= sketch_container %>"
>
<span class="new-marvinjs-upload-icon">
<%= image_tag 'icon_small/marvinjs.svg' %>
</span>
<%= t('marvinjs.new_li_button') %>
</li>

View file

@ -0,0 +1,12 @@
<% if wopi_enabled? %>
<li>
<%= link_to create_wopi_file_path,
class: 'create-wopi-file-btn',
target: '_blank',
title: 'Create_new_file',
data: { 'id': element_id, 'type': element_type, } do %>
<%= image_tag 'office/office.svg' %>
<%=t 'assets.create_wopi_file.li_text' %>
<% end %>
</li>
<% end %>

View file

@ -32,8 +32,8 @@
<% end %>
<% end %>
</div>
<a class="result-panel-collapse-link" href="#result-panel-<%= result.id %>" data-toggle="collapse" data-remote="true">
<span class="fas fa-caret-square-down collapse-result-icon"></span>
<a class="result-panel-collapse-link" href="#result-panel-<%= result.id %>" data-toggle="collapse">
<span class="fas fa-caret-down collapse-result-icon"></span>
<strong><%= result.name %></strong> |
<span><%= t('my_modules.results.published_on', timestamp: l(result.created_at, format: :full), user: h(result.user.full_name)).html_safe %></span>
</a>

View file

@ -6,47 +6,51 @@
<div class="content-pane">
<div id="results-toolbar">
<div class="pull-right sci-btn-group">
<button class="btn btn-secondary" id="results-collapse-btn">
<span class="fas fa-caret-square-up"></span>
<span class="hidden-xs-custom"><%= t'my_modules.results.collapse_label' %></button></span>
<button class="btn btn-secondary" id="results-expand-btn">
<span class="fas fa-caret-square-down"></span>
<span class="hidden-xs-custom"><%= t'my_modules.results.expand_label' %></button></span>
</div>
<% if can_manage_module?(@my_module) %>
<div class="add-result-toolbar">
<span class="hidden-xs add-result-text"><%= t'my_modules.results.add_label' %></span>
<div class="sci-btn-group">
<a class="btn btn-primary"
id="new-result-text"
data-href="<%= new_my_module_result_text_path(my_module_id: @my_module.id) %>"
href="#">
<span class="fas fa-font"></span>
<span class="hidden-xs"><%= t("my_modules.results.new_text_result") %></span>
</a>
<a class="btn btn-primary"
id="new-result-table"
data-href="<%= new_my_module_result_table_path(my_module_id: @my_module.id) %>"
href="#">
<span class="fas fa-table"></span>
<span class="hidden-xs"><%= t("my_modules.results.new_table_result") %></span>
</a>
<a class="btn btn-primary"
id="new-result-asset"
data-href="<%= new_my_module_result_asset_path(my_module_id: @my_module.id) %>"
href="#">
<span class="fas fa-paperclip"></span>
<span class="hidden-xs"><%= t("my_modules.results.new_asset_result") %></span>
</a>
<%= render partial: '/assets/marvinjs/create_marvin_sketch_button.html.erb',
<div class="add-result-dropdown dropdown sci-dropdown">
<a href="#" id="add-result-button" class="btn btn-secondary" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="fas fa-plus"></span>
<span><%= t("my_modules.results.add_label") %></span>
<span class="caret pull-right"></span>
</a>
<ul class="dropdown-menu add-result-dropdown" aria-labelledby="add-result-button">
<li id="new-result-text" data-href="<%= new_my_module_result_text_path(my_module_id: @my_module.id, page: params[:page], order: params[:order]) %>">
<i class="fas fa-font"></i><%= t("my_modules.results.new_text_result") %>
</li>
<li id="new-result-table" data-href="<%= new_my_module_result_table_path(my_module_id: @my_module.id, page: params[:page], order: params[:order]) %>">
<i class="fas fa-table"></i><%= t("my_modules.results.new_table_result") %>
</li>
<li id="new-result-asset" data-href="<%= new_my_module_result_asset_path(my_module_id: @my_module.id, page: params[:page], order: params[:order]) %>">
<i class="fas fa-paperclip"></i><%= t("my_modules.results.new_asset_result") %>
</li>
<%= render partial: '/assets/marvinjs/create_marvin_sketch_li',
locals: { element_id: @my_module.id, element_type: 'Result', sketch_container: "#results[data-module-id=#{@my_module.id}]" } %>
<%= render partial: "assets/wopi/create_wopi_file_button",
<%= render partial: "assets/wopi/create_wopi_file_li",
locals: { element_id: @my_module.id, element_type: 'Result' } %>
</div>
</ul>
</div>
<% end %>
<div class="sci-btn-group">
<button class="btn btn-light" id="results-collapse-btn">
<span class="fas fa-caret-up"></span>
<span class="hidden-xs-custom"><%= t'my_modules.results.collapse_label' %></span>
</button>
<button class="btn btn-light" id="results-expand-btn">
<span class="fas fa-caret-down"></span>
<span class="hidden-xs-custom"><%= t'my_modules.results.expand_label' %></span>
</button>
</div>
<div class="sort-result-dropdown dropdown">
<button id="sort-result-button" class="btn btn-light icon-btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fas fa-sort-amount-up"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="sort-result-button">
<li><%= link_to t('general.sort_new.atoz'), results_my_module_path(@my_module, page: params[:page], order: 'atoz'), class: (@results_order == 'atoz' ? 'selected' : '') %></li>
<li><%= link_to t('general.sort_new.ztoa'), results_my_module_path(@my_module, page: params[:page], order: 'ztoa'), class: (@results_order == 'ztoa' ? 'selected' : '') %></li>
<li><%= link_to t('general.sort_new.old'), results_my_module_path(@my_module, page: params[:page], order: 'old'), class: (@results_order == 'old' ? 'selected' : '') %></li>
<li><%= link_to t('general.sort_new.new'), results_my_module_path(@my_module, page: params[:page], order: 'new'), class: (@results_order == 'new' ? 'selected' : '') %></li>
</ul>
</div>
</div>
<div style="height: 15px;"></div>

View file

@ -26,7 +26,7 @@
class: 'btn btn-primary save-result',
onclick: 'DragNDropResults.processResult(event);',
disabled: true,
data: { href: my_module_result_assets_path(format: :json) } %>
data: { href: my_module_result_assets_path(page: params[:page], order: params[:order], format: :json) } %>
</div>
<% end %>
</div>

View file

@ -1,5 +1,5 @@
<div id="table-form" class="well">
<%= bootstrap_form_for(@result, url: my_module_result_tables_path(format: :json),
<%= bootstrap_form_for(@result, url: my_module_result_tables_path(format: :json, page: params[:page], order: params[:order]),
data: { 'name-max-length': Constants::NAME_MAX_LENGTH },
remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />

View file

@ -1,5 +1,5 @@
<div class="well">
<%= bootstrap_form_for(@result, url: my_module_result_texts_path(format: :json),
<%= bootstrap_form_for(@result, url: my_module_result_texts_path(format: :json, page: params[:page], order: params[:order]),
data: { 'name-max-length': Constants::NAME_MAX_LENGTH, 'rich-text-max-length': Constants::RICH_TEXT_MAX_LENGTH },
remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />

View file

@ -779,7 +779,7 @@ en:
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:"
add_label: "Add new result"
new_text_result: "Text"
new_table_result: "Table"
new_asset_result: "File"
@ -2263,6 +2263,7 @@ en:
wopi_supported_presentation_formats_title: 'Only .pptx, ppsx, .odp file formats are supported for editing in Powerpoint Online.'
create_wopi_file:
button_text: 'New Office file'
li_text: "Office file"
modal_title: 'Create new Microsoft Office Online document'
text_field_label: 'Document name & type'
text_field_placeholder: 'New Document'
@ -2340,6 +2341,11 @@ en:
old_html: "Oldest first &#8593;"
atoz_html: "Name &#8595;"
ztoa_html: "Name &#8593;"
sort_new:
new: "Newest"
old: "Oldest"
atoz: "A-Z"
ztoa: "Z-A"
module:
one: "task"
other: "tasks"
@ -2479,6 +2485,7 @@ en:
marvinjs:
new_sketch: "New Chemical Drawing"
new_button: "Create Chemical Drawing"
new_li_button: "Chemical drawing"
structure_placeholder: "Click here to enter Chemical Drawing name"
modal_name_title: "Chemical Drawing name:"
checmical_drawing: "Chemical drawings"

View file

@ -2658,15 +2658,12 @@ CREATE TABLE public.users (
authentication_token character varying(30),
settings jsonb DEFAULT '{}'::jsonb NOT NULL,
variables jsonb DEFAULT '{}'::jsonb NOT NULL,
<<<<<<< HEAD
two_factor_auth_enabled boolean DEFAULT false NOT NULL,
otp_secret character varying,
otp_recovery_codes jsonb,
failed_attempts integer DEFAULT 0 NOT NULL,
locked_at timestamp without time zone,
unlock_token character varying
=======
two_factor_auth_enabled boolean DEFAULT false NOT NULL,
otp_secret character varying,
otp_recovery_codes jsonb
>>>>>>> features/2fa
);
@ -7288,3 +7285,4 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200709142830'),
('20200714082503');

View file

@ -220,7 +220,7 @@ Feature: Home page
And I click "Create" button
And I hover over element with css ".panel-heading"
And I click button with id "dropdownMenu1"
And I click "Archive" link within dropdown menu
And I click on "Archive" within dropdown menu
And I click to Cancel on confirm dialog
Then I should see "Mangart"
@ -232,7 +232,7 @@ Feature: Home page
And I click "Create" button
And I hover over element with css ".panel-heading"
And I click button with id "dropdownMenu1"
And I click "Archive" link within dropdown menu
And I click on "Archive" within dropdown menu
And I click to OK on confirm dialog
Then I should not see "Mangart"
@ -244,12 +244,12 @@ Feature: Home page
And I click "Create" button
And I hover over element with css ".panel-heading"
And I click button with id "dropdownMenu1"
And I click "Archive" link within dropdown menu
And I click on "Archive" within dropdown menu
And I click to OK on confirm dialog
And I click "Archived" link
And I hover over element with css ".panel-title"
And I click button with id "dropdownMenu1"
And I click "Restore" link within dropdown menu
And I click on "Restore" within dropdown menu
And I am on the home page of Biosistemika Process team
Then I should see "Mangart"

View file

@ -18,7 +18,8 @@ Background:
@javascript
Scenario: Unsuccessful add Text result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I click "Add" button
Then I should see "can't be blank"
And I click "Cancel" button
@ -26,7 +27,8 @@ Scenario: Unsuccessful add Text result
@javascript
Scenario: Successful add text result with Text name
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -35,7 +37,8 @@ Scenario: Successful add text result with Text name
@javascript
Scenario: Successful add Text result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "Vse to pa zaradi botra petelina, bog mu daj zdravje!" in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
Then I should see "Vse to pa zaradi botra petelina, bog mu daj zdravje!"
@ -43,7 +46,8 @@ Scenario: Successful add Text result
@javascript
Scenario: Successful edit Text task result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -56,7 +60,8 @@ Scenario: Successful edit Text task result
@javascript
Scenario: Successful add comment to a Text task result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -68,7 +73,8 @@ Scenario: Successful add comment to a Text task result
@wip
Scenario: Unsuccessful add comment to a Text task result BUG!!!!!
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -80,7 +86,8 @@ Scenario: Unsuccessful add comment to a Text task result BUG!!!!!
@javascript
Scenario: Successful edit comment to a Text task result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -95,7 +102,8 @@ Scenario: Successful edit comment to a Text task result
@javascript
Scenario: Unsuccessful edit comment to a Text task result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -110,7 +118,8 @@ Scenario: Unsuccessful edit comment to a Text task result
@javascript
Scenario: Unsuccessful delete comment to a Text task resultGiven I am on Task results page
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -125,7 +134,8 @@ Scenario: Unsuccessful delete comment to a Text task resultGiven I am on Task re
@javascript
Scenario: Successful delete comment to a Text task result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -141,7 +151,8 @@ Scenario: Successful delete comment to a Text task result
@javascript
Scenario: Successful archive text result with Text name
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -152,7 +163,8 @@ Scenario: Successful archive text result with Text name
@wip
Scenario: Unsuccessful add Table result ##########this one doesnt work
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
Then I should see "can't be blank"
And I click "Cancel" button
@ -160,7 +172,8 @@ Scenario: Unsuccessful add Table result ##########this one doesnt work
@javascript
Scenario: Successful add table result with Table name
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I fill in "ZOO" in "#result_name" field
And I click on table cell one
And I input "Živali pa so se odpravile dalje po svetu." in cell
@ -170,7 +183,8 @@ Scenario: Successful add table result with Table name
@javascript
Scenario: Successful add Table result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click on table cell one
And I input "Vse to pa zaradi botra petelina, bog mu daj zdravje!" in cell
And I click "Add" button
@ -179,7 +193,8 @@ Scenario: Successful add Table result
@javascript
Scenario: Successful edit Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I fill in "ZOO" in "#result_name" field
And I click on table cell one
And I input "Živali pa so se odpravile dalje po svetu." in cell
@ -194,7 +209,8 @@ Scenario: Successful edit Table task result
@javascript
Scenario: Successful add comment to a Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I fill in "I was on Triglav one summer." in "message" textarea field
And I click "fa-paper-plane" icon
@ -204,7 +220,8 @@ Scenario: Successful add comment to a Table task result
@javascript
Scenario: Successful edit comment to a Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I fill in "I was on Triglav one summer." in "message" textarea field
And I click "fa-paper-plane" icon
@ -218,7 +235,8 @@ Scenario: Successful edit comment to a Table task result
@javascript
Scenario: Unsuccessful edit comment to a Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I fill in "I was on Triglav one summer." in "message" textarea field
And I click "fa-paper-plane" icon
@ -231,7 +249,8 @@ Scenario: Unsuccessful edit comment to a Table task result
@javascript
Scenario: Unsuccessful delete comment to a Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I fill in "I was on Triglav one summer." in "message" textarea field
And I click "fa-paper-plane" icon
@ -244,7 +263,8 @@ Scenario: Unsuccessful delete comment to a Table task result
@javascript
Scenario: Successful delete comment to a Table task result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I fill in "I was on Triglav one summer." in "message" textarea field
And I click "fa-paper-plane" icon
@ -257,7 +277,8 @@ Scenario: Successful delete comment to a Table task result
@javascript
Scenario: Successful archive Table result with Table name
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I click "fa-briefcase" icon
And I click to OK on confirm dialog
@ -266,7 +287,8 @@ Scenario: Successful archive Table result with Table name
@wip
Scenario: Unsuccessful add File result #doesnt work
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I click "Add" button
Then I should see File "can't be blank"
And I click "Cancel" button
@ -274,7 +296,8 @@ Scenario: Unsuccessful add File result #doesnt work
@javascript
Scenario: Successful add File result with File name
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -284,7 +307,8 @@ Scenario: Successful add File result with File name
@javascript
Scenario: Successful add File result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I click "Add" button
And WAIT
@ -293,7 +317,8 @@ Scenario: Successful add File result
@wip
Scenario: Successful edit File result with File name
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -305,7 +330,8 @@ Scenario: Successful edit File result with File name
@javascript
Scenario: Successful add comment to a File task result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -317,7 +343,8 @@ Scenario: Successful add comment to a File task result
@javascript
Scenario: Successful edit comment to a File task result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -332,7 +359,8 @@ Scenario: Successful edit comment to a File task result
@javascript
Scenario: Unsuccessful edit comment to a File task result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -347,7 +375,8 @@ Scenario: Unsuccessful edit comment to a File task result
@javascript
Scenario: Unsuccessful delete comment to a File task result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -362,7 +391,8 @@ Scenario: Unsuccessful delete comment to a File task result
@javascript
Scenario: Successful delete comment to a File task result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -376,7 +406,8 @@ Scenario: Successful delete comment to a File task result
@javascript
Scenario: Successful archive File result with File name
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -387,7 +418,8 @@ Scenario: Successful archive File result with File name
@javascript
Scenario: Download archived Text result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -396,26 +428,31 @@ Scenario: Download archived Text result
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
Then I click "Download" link within dropdown menu
Then I click on "Download" within dropdown menu
And I delete downloaded file "LJ ZOO.txt"
#no notification can be found
@javascript
Scenario: Download archived Table result
Given I am on Task results page
And I click "Table" button
And I click element with css ".save-result"
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I fill in "Test table" in "#result_name" field
And I click "Add" button
And I click "fa-briefcase" icon
And I click to OK on confirm dialog
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
Then I click "Download" link within dropdown menu
Then I click on "Download" within dropdown menu
And I delete downloaded file "Test table.txt"
#no notification can be found
@javascript
Scenario: Download archived File result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -424,14 +461,16 @@ Scenario: Download archived File result
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
And I click "View" link within dropdown menu
And I click on "View" within dropdown menu
Then I click element with css ".file-download-link"
And I delete downloaded file "Moon.png"
#no notification can be found
@javascript
Scenario: Delete archived Text result
Given I am on Task results page
And I click "Text" button
And I click "Add new result" button
And I click on "Text" within dropdown menu
And I fill in "LJ ZOO" in "#result_name" field
And I fill in "Živali pa so se odpravile dalje po svetu." in "#result_text_attributes_textarea" rich text editor field
And I click "Add" button
@ -440,28 +479,30 @@ Scenario: Delete archived Text result
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
And I click "Delete" link within dropdown menu
And I click on "Delete" within dropdown menu
And I click to OK on confirm dialog
Then I should see "Sucessfully removed result LJ ZOO from task Experiment design." flash message
@javascript
Scenario: Delete archived Table result
Given I am on Task results page
And I click "Table" button
And I click "Add new result" button
And I click on "Table" within dropdown menu
And I click "Add" button
And I click "fa-briefcase" icon
And I click to OK on confirm dialog
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
Then I click "Delete" link within dropdown menu
Then I click on "Delete" within dropdown menu
And I click to OK on confirm dialog
Then I should see "Sucessfully removed result from task Experiment design." flash message
@javascript
Scenario: Delete archived File result
Given I am on Task results page
And I click "File" button
And I click "Add new result" button
And I click on "File" within dropdown menu
And I attach file "Moon.png" to the drag-n-drop field
And I fill in "MED" in "div.form-group:nth-child(1) > input:nth-child(2)" field
And I click "Add" button
@ -470,6 +511,6 @@ Scenario: Delete archived File result
And WAIT
And I am on Task archive page
And I click button with id "dropdownMenu1"
And I click "Delete" link within dropdown menu
And I click on "Delete" within dropdown menu
And I click to OK on confirm dialog
Then I should see "Sucessfully removed result MED from task Experiment design." flash message

View file

@ -61,16 +61,9 @@ Given(/^I click first "(.+)" link$/) do |link_text|
first(:link, link_text).click
end
Then(/^I click "(.+)" link within dropdown menu$/) do |link|
within('.dropdown-menu') do
click_link link
end
end
Then(/^I click on "(.+)" within dropdown menu$/) do |link1|
within('.inner') do
find('.text', text: link1).click
Then(/^I click on "(.+)" within dropdown menu$/) do |text|
within('.dropdown.open .dropdown-menu, .dropdown-menu.open') do
find('li', text: text).click
end
end
@ -241,4 +234,9 @@ Then('I fill bootsrap tags input with {string}') do |value|
find('.bootstrap-tagsinput > input[type="text"]').set(value)
end
Then('I delete downloaded file {string}') do |file_name|
sleep 3
FileUtils.rm_f(Rails.root.join(file_name))
end