Merge pull request #95 from ZmagoD/zd_SCI_374

adds edit workflow link if no workflow [fixes SCI-374]
This commit is contained in:
Zmago Devetak 2016-08-25 14:07:33 +02:00 committed by GitHub
commit b090fd8d5b
5 changed files with 57 additions and 16 deletions

View file

@ -3263,6 +3263,13 @@ function initJsPlumb(containerSel, containerChildSel, modulesSel, params) {
jsPlumb.fire("jsPlumbLoaded", instance);
}
// Opens edit mode if redirected from empty experiment
(function noWorkflowimgEditMode(){
if( getParam('editMode') ){
$("#edit-canvas-button").click();
}
})();
// Initialize first-time tutorial
function initializeTutorial(isEditMode) {
if (showTutorial()) {

View file

@ -407,40 +407,63 @@ li.module-hover {
}
}
/* EXPERIMENT PANEL */
// EXPERIMENT PANEL
.experiment-panel {
@include box-shadow(0 4px 8px 0 $color-dove-gray);
height: 550px;
margin: 0 auto;
margin-bottom: 35px;
margin-top: 45px;
max-width: 700px;
height: 550px;
@include box-shadow(0px 4px 8px 0px $color-dove-gray);
.experiment-description {
margin-top:20px;
margin-top: 20px;
}
.no-description {
color: $color-alto;
display: block;
font-size: 18px;
font-weight: bold;
text-align: center;
font-size: 16px;
a {
color: $color-alto;
text-decoration: none;
}
}
.no-workflowimg {
color: $color-alto;
display: block;
font-size: 26px;
font-weight: bold;
height: 300px;
margin: 15px 0;
padding-top: 150px;
text-align: center;
a {
color: $color-alto;
text-decoration: none;
}
}
}
.workflowimg-container {
margin: 15px 0;
height: 300px;
margin: 15px 0;
img {
max-width:100%;
max-height: 300px;
max-width: 100%;
}
}
/* SHOW */
// SHOW
.center-btn {
margin: 0 auto;
display: block;
margin: 0 auto;
max-width: 200px;
}
@ -452,10 +475,10 @@ li.module-hover {
text-align: center;
&:hover {
color:$color-alto;
color: $color-alto;
}
&:focus {
color:$color-alto;
color: $color-alto;
}
}

View file

@ -66,6 +66,7 @@ class ExperimentsController < ApplicationController
@experiment.update_attributes(experiment_params)
@experiment.last_modified_by = current_user
if @experiment.save
@experiment.touch(:workflowimg_updated_at)
flash[:success] = t('experiments.update.success_flash',
experiment: @experiment.name)
redirect_to canvas_experiment_path(@experiment)

View file

@ -29,7 +29,15 @@
>
</div>
<% else %>
<div class="workflowimg-container"></div>
<div class="no-workflowimg">
<% if can_edit_experiment(experiment) %>
<p><%= link_to( t('experiments.edit.add_task'),
canvas_experiment_path(experiment,
editMode: true)) %></p>
<% else %>
<p><%= t('experiments.edit.no_workflowimg') %></p>
<% end %>
</div>
<% end %>
<span>
<span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
@ -39,13 +47,13 @@
<p class="experiment-description"><%= experiment.description %></p>
<% else %>
<% if can_edit_experiment(experiment) %>
<p class="experiment-description"><i class="no-description"><%= link_to t('experiments.edit.add-description'),
<p class="experiment-description"><span class="no-description"><%= link_to t('experiments.edit.add-description'),
edit_project_experiment_url(@project, experiment),
remote: true,
data: { id: experiment.id },
class: 'no-description-experiment' %></i></p>
class: 'no-description-experiment' %></span></p>
<% else %>
<p class="experiment-description"><i class="no-description"><%= t('experiments.edit.no-description') %></i></p>
<p class="experiment-description"><span class="no-description"><%= t('experiments.edit.no-description') %></span></p>
<% end %>
<% end %>
</div>

View file

@ -606,8 +606,10 @@ en:
modal_create: 'Save'
label_title: "Edit details"
panel_label: 'Change details'
add-description: 'Add description'
add-description: 'Add description...'
no-description: 'No description'
no_workflowimg: 'No workflow'
add_task: 'Add a task to experiment...'
create:
success_flash: "Successfully created experiment %{experiment}"
error_flash: 'Could not create a new experiment.'