-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.6.11] expansion block select modal update
- Loading branch information
extracold1209
committed
Aug 22, 2018
1 parent
032b1a0
commit 5a6113c
Showing
5 changed files
with
233 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
|
||
angular.module('common').controller('ExpansionBlockController', ['$scope', '$uibModalInstance', '$routeParams', '$http', 'parent', | ||
function ($scope, $uibModalInstance, $routeParams, $http, parent) { | ||
$scope.parent = parent; | ||
|
||
$scope.systemBlocks = []; | ||
$scope.selectedSystem = []; | ||
$scope.selectedBlock = { description : "" }; | ||
|
||
$scope.main_menu = "test"; | ||
$scope.menu = ""; | ||
$scope.cursor = 0; | ||
|
||
$scope.initList = function() { | ||
var expansionBlocks = _.uniq(_.values(Entry.EXPANSION_BLOCK_LIST)); | ||
expansionBlocks = _.sortBy(expansionBlocks, function (item) { | ||
var result = ''; | ||
if(item.title) { | ||
item.nameByLang = item.title[Lang.type]; | ||
result = item.title.ko.toLowerCase(); | ||
} | ||
return result; | ||
}); | ||
|
||
$scope.systemBlocks = expansionBlocks; | ||
} | ||
|
||
$scope.init = function() { | ||
$routeParams.type = 'default'; | ||
$routeParams.main = 'test'; | ||
$scope.collapse(1); | ||
$scope.initList(); | ||
|
||
}; | ||
|
||
// 현재 선택한 탭 | ||
$scope.currentTab = 'system'; //for modal(sprite,upload,paint,character,text,etc) | ||
|
||
$scope.selectedUpload = []; | ||
$scope.currentIndex = 0; | ||
|
||
$scope.applySystem = function(block) { | ||
$scope.selectedSystem = []; | ||
$scope.selectedSystem.push(block); | ||
$scope.selectedBlock = block; | ||
|
||
$uibModalInstance.close({ | ||
target: $scope.currentTab, | ||
data: $scope.currentSelected() | ||
}); | ||
}; | ||
|
||
function _selectedMapFunc(datum) { | ||
var ret = _.findWhere($scope.selectedSystem || [], { | ||
_id: datum.name, | ||
}); | ||
if (ret) { | ||
datum.selected = 'boxOuter selected'; | ||
} else { | ||
datum.selected = 'boxOuter'; | ||
} | ||
return datum; | ||
} | ||
|
||
// 선택 | ||
$scope.selectSystem = function(block) { | ||
var blockId = block.name; | ||
var idx = _.findIndex($scope.selectedSystem, function(item) { | ||
return blockId === item.name; | ||
}); | ||
|
||
var selector = '#'+ blockId + '.boxOuter'; | ||
|
||
if (~idx) { | ||
$scope.selectedSystem.splice(idx, 1); | ||
jQuery(selector).attr('class', 'boxOuter'); | ||
$scope.moveContainer('right'); | ||
} else { | ||
$scope.selectedSystem.push(block); | ||
$scope.selectedBlock = block; | ||
// 스프라이트 다중 선택. | ||
jQuery(selector).attr('class', 'boxOuter selected'); | ||
$scope.moveContainer('left'); | ||
} | ||
}; | ||
|
||
$scope.moveContainer = function (direction) { | ||
var mover = jQuery('.modal_selected_container_moving').eq(0); | ||
var blocks = $scope.selectedSystem; | ||
|
||
if (direction == 'left' && (blocks.length-1 < 5 || $scope.cursor == blocks.length-1)) return; | ||
if (direction == 'right' && ($scope.cursor == 0 || blocks.length < 5 && $scope.cursor > blocks.length)) return; | ||
|
||
var marginL = parseInt(mover.css("margin-left")); | ||
if (direction == 'left') { | ||
mover.css("margin-left", (marginL - 106) + 'px'); | ||
$scope.cursor = $scope.cursor + 1; | ||
} else { | ||
mover.css("margin-left", (marginL + 106) + 'px'); | ||
$scope.cursor = $scope.cursor - 1; | ||
} | ||
} | ||
|
||
$scope.currentSelected = function() { | ||
if ($scope.currentTab === 'system') { | ||
return $scope.selectedSystem; | ||
} else if ($scope.currentTab === 'upload') { | ||
return $scope.selectedUpload; | ||
} else if ($scope.currentTab === 'textBox') { | ||
return 'textBox'; | ||
} else { | ||
return null; | ||
} | ||
}; | ||
|
||
$scope.addExpansionBlock = function() { | ||
$uibModalInstance.close({ | ||
target: 'new' | ||
}); | ||
}; | ||
|
||
$scope.collapse = function(dest) { | ||
for (var i=1; i<10; i++) | ||
$scope['isCollapsed' + i] = true; | ||
|
||
if (dest > 0) { | ||
$scope['isCollapsed' + dest] = false; | ||
$('#searchWord').val(''); | ||
} | ||
}; | ||
|
||
// 적용 | ||
$scope.ok = function () { | ||
if (!$scope.currentSelected()) { | ||
entrylms.alert(Lang.Workspace.select_sprite); | ||
} else { | ||
$uibModalInstance.close({ | ||
target: $scope.currentTab, | ||
data: $scope.currentSelected() | ||
}); | ||
} | ||
}; | ||
|
||
// 취소 | ||
$scope.cancel = function () { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
$scope.dict = { | ||
'WORKSPACE_LOAD_EXPANSION_BLOCK': Lang.Workspace.load_exapnsion_block, | ||
'WORKSPACE_SELECT_EXPANSION_BLOCK': Lang.Workspace.select_expansion_block, | ||
'BUTTONS_APPLY': Lang.Buttons.apply, | ||
'BUTTONS_CANCEL': Lang.Buttons.cancel, | ||
'WEATHER_DESC': Lang.Msgs.expansion_weather_description | ||
} | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
<div data-ng-init="init()"> | ||
<div class="modal-content" ng-class="{'modal-lecture': parent == 'lecture', 'modal-workspace': parent == 'workspace'}"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" ng-click="cancel()"> | ||
<img src='images/close_modal_workspace.png'/> | ||
</button> | ||
<h4 class="modal-title">{{::dict.WORKSPACE_LOAD_EXPANSION_BLOCK}}</h4> | ||
</div> | ||
<div class="modal-body" style="margin:0"> | ||
<div class="row"> | ||
<div class="col-md-9 tab-right" style="width:100%; padding-left:0; padding-right: 0"> | ||
<div class="wrap wrap_sprite"> | ||
<div class="box" data-ng-repeat="block in systemBlocks"> | ||
<div id="{{::block.name}}" class="boxOuter {{::block.selected}}" data-ng-click="selectSystem(block)" data-ng-dblclick="applySystem(block)"> | ||
<div class="boxInner" style="background-image: url('bower_components/entryjs/images/hardware/{{::block.imageName}}');"></div> | ||
<img class="overlay" src="images/check_inside_new.png"/> | ||
</div> | ||
<div class="titleBox">{{block.nameByLang}}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="modal_choosen" style="width: 100%; margin-left: 0"> | ||
<div class='modal_selected_arrow modal_selected_left_arrow' ng-click='moveContainer("right")'></div> | ||
<div class='modal_selected_arrow modal_selected_right_arrow' ng-click='moveContainer("left")'></div> | ||
<div class="modal_selected_container"> | ||
<div class="modal_selected_container_moving"> | ||
<div class="box" data-ng-repeat="block in selectedSystem" ng-if="currentTab == 'system'"> | ||
<div id="{{::block.name}}" class="boxOuter {{::block.selected}} boxOuterChoosen"> | ||
<img class="modal_choosen_cancel" src="images/modal_choosen_cancel.png" data-ng-click="selectSystem(block)"/> | ||
<div class="boxInner" style="background-image: url('bower_components/entryjs/images/hardware/{{::block.imageName}}');"></div> | ||
</div> | ||
<div class="titleBox titleBoxChoosen">{{::block.nameByLang}}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modalFilter" ng-if="selectedSystem.length > 0" style="width:100%; margin-left: 0;font-size: 14px; color: #565656; padding-right: 12px; text-align: right"> | ||
{{::selectedBlock.description}} | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn_confirm_modal" data-ng-click="ok()">{{::dict.BUTTONS_APPLY}} ({{currentSelected().length}})</button> | ||
<button type="button" class="btn btn_cancel_modal" data-ng-click="cancel()">{{::dict.BUTTONS_CANCEL}}</button> | ||
</div> | ||
</div> | ||
</div> | ||
|