mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
prevent project step reordering to trigger unsaved-changes dialog
This commit is contained in:
parent
d793af5012
commit
6e94850522
@ -155,15 +155,18 @@ class ProjectsController
|
||||
##
|
||||
# Change the step_nb property of the given step to the new value provided. The step that was previously at this
|
||||
# index will be assigned to the old position of the provided step.
|
||||
# @param event {Object} see https://docs.angularjs.org/guide/expression#-event-
|
||||
# @param step {Object} the project's step to reindex
|
||||
# @param newIdx {number} the new index to assign to the step
|
||||
##
|
||||
$scope.changeStepIndex = (step, newIdx) ->
|
||||
$scope.changeStepIndex = (event, step, newIdx) ->
|
||||
event.preventDefault() if event
|
||||
for s in $scope.project.project_steps_attributes
|
||||
if s.step_nb == newIdx
|
||||
s.step_nb = step.step_nb
|
||||
step.step_nb = newIdx
|
||||
break
|
||||
false
|
||||
|
||||
|
||||
$scope.autoCompleteName = (nameLookup) ->
|
||||
|
@ -79,13 +79,13 @@
|
||||
{{ 'step_N' | translate:{ INDEX:step.step_nb } }}/{{totalSteps}} <i class="fa fa-caret-down" aria-hidden="true"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button">
|
||||
<li role="menuitem" ng-repeat="step_idx in intArray(1, totalSteps +1)"><a href="#" ng-click="changeStepIndex(step, step_idx)">{{ 'step_N' | translate:{ INDEX:step_idx } }}</a></li>
|
||||
<li role="menuitem" ng-repeat="step_idx in intArray(1, totalSteps +1)"><a href="#" ng-click="changeStepIndex($event, step, step_idx)">{{ 'step_N' | translate:{ INDEX:step_idx } }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="label label-warning m-t m-b"></span>
|
||||
<input type="hidden" name="project[project_steps_attributes][][id]" ng-value="step.id" />
|
||||
<input type="hidden" name="project[project_steps_attributes][][_destroy]" ng-value="step._destroy" />
|
||||
<input type="hidden" name="project[project_steps_attributes][][step_nb]" ng-value="step.step_nb" />
|
||||
<input type="hidden" name="project[project_steps_attributes][][step_nb]" ng-value="step.step_nb"/>
|
||||
<input ng-model="step.title"
|
||||
type="text"
|
||||
name="project[project_steps_attributes][][title]"
|
||||
@ -97,7 +97,7 @@
|
||||
<summernote ng-model="step.description" placeholder="" config="summernoteOpts" name=project[project_steps_attributes][][description]></summernote>
|
||||
|
||||
<div class="fileinput" data-provides="fileinput" ng-class="fileinputClass(step.project_step_image)">
|
||||
<span class="btn btn-default btn-file"><span class="fileinput-new" translate>{{ 'add_a_picture' }}</span><span class="fileinput-exists" translate>{{ 'change_the_picture' }}</span>
|
||||
<span class="btn btn-default btn-file"><span class="fileinput-new">{{ 'add_a_picture' | translate }} <i class="fa fa-file-image-o m-l-sm" aria-hidden="true"></i></span><span class="fileinput-exists" translate>{{ 'change_the_picture' }}</span>
|
||||
<input type="file"
|
||||
name="project[project_steps_attributes][][project_step_image_attributes][attachment]"></span>
|
||||
<span class="fileinput-filename">{{step.project_step_image}}</span>
|
||||
@ -105,11 +105,13 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a class="btn btn-sm btn-danger" ng-click="deleteStep(step)" role="button"><i class="fa fa-trash-o"></i> {{ 'delete_the_step' | translate }}</a>
|
||||
<a class="btn btn-sm btn-danger" ng-click="deleteStep(step)" role="button"><i class="fa fa-trash-o m-r-xs"></i> {{ 'delete_the_step' | translate }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-default m-b" ng-click="addStep()" role="button" translate>{{ 'add_a_new_step' }}</a>
|
||||
<a class="btn btn-default m-b" ng-click="addStep()" role="button">
|
||||
<i class="fa fa-plus m-r-sm" aria-hidden="true"></i>
|
||||
<span translate>{{ 'add_a_new_step' }}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user