mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-24 21:59:55 +09:00
widget module
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9015 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8e20c6057e
commit
cc987e4fd6
7 changed files with 210 additions and 165 deletions
|
|
@ -1,20 +1,19 @@
|
|||
(function($){
|
||||
|
||||
xe.ModuleListManager = xe.createApp("ModuleListManager", {
|
||||
values: null,
|
||||
keyObj: null,
|
||||
moduleNameObj: null,
|
||||
moduleSrlObj: null,
|
||||
selectedObj: null,
|
||||
$keyObj: null,
|
||||
$moduleNameObj: null,
|
||||
$moduleSrlObj: null,
|
||||
$selectedObj: null,
|
||||
|
||||
init: function(key, values){
|
||||
var values = this.values = values, self = this;
|
||||
var $keyObj = this.keyObj = $('input[name='+key+']');
|
||||
this.moduleNameObj = $keyObj.parent().find('.moduleList');
|
||||
this.moduleSrlObj = $keyObj.parent().find('.moduleIdList');
|
||||
this.selectedObj = $keyObj.parent().find('.modulelist_selected');
|
||||
|
||||
this.moduleSrlObj
|
||||
init: function(key){
|
||||
var self = this;
|
||||
var $keyObj = this.$keyObj = $('input[name='+key+']');
|
||||
this.$moduleNameObj = $keyObj.parent().find('.moduleList');
|
||||
this.$moduleSrlObj = $keyObj.parent().find('.moduleIdList');
|
||||
this.$selectedObj = $keyObj.parent().find('.modulelist_selected');
|
||||
|
||||
this.$moduleSrlObj
|
||||
.nextAll('button')
|
||||
.filter('.modulelist_add').bind('click', function(){ self.cast('MODULELIST_ADD'); return false; }).hide().end()
|
||||
.filter('.modulelist_del').bind('click', function(){ self.cast('MODULELIST_DEL'); return false; }).end()
|
||||
|
|
@ -27,37 +26,37 @@ xe.ModuleListManager = xe.createApp("ModuleListManager", {
|
|||
},
|
||||
|
||||
API_MODULELIST_ADD: function(){
|
||||
var moduleTitle = this.moduleNameObj.find('>option:selected').text();
|
||||
|
||||
this.moduleSrlObj
|
||||
var moduleTitle = this.$moduleNameObj.find('>option:selected').text();
|
||||
|
||||
this.$moduleSrlObj
|
||||
.find('>option:selected').clone(true)
|
||||
.text(function(){ return $(this).text() + ' ('+moduleTitle+')'; })
|
||||
.appendTo(this.selectedObj);
|
||||
.appendTo(this.$selectedObj);
|
||||
|
||||
this.removeDuplicated();
|
||||
this.refreshValue();
|
||||
},
|
||||
|
||||
API_MODULELIST_DEL: function(){
|
||||
this.selectedObj.find('>option:selected').remove();
|
||||
this.$selectedObj.find('>option:selected').remove();
|
||||
this.refreshValue();
|
||||
},
|
||||
|
||||
API_MODULELIST_UP: function(){
|
||||
var $selected = this.selectedObj.find('>option:selected');
|
||||
var $selected = this.$selectedObj.find('>option:selected');
|
||||
$selected.eq(0).prev('option').before($selected);
|
||||
this.refreshValue();
|
||||
},
|
||||
|
||||
API_MODULELIST_DOWN: function(){
|
||||
var $selected = this.selectedObj.find('>option:selected');
|
||||
var $selected = this.$selectedObj.find('>option:selected');
|
||||
$selected.eq(-1).next('option').after($selected);
|
||||
this.refreshValue();
|
||||
},
|
||||
|
||||
removeDuplicated : function() {
|
||||
var selected = {};
|
||||
this.selectedObj.find('>option').each(function(){
|
||||
this.$selectedObj.find('>option').each(function(){
|
||||
if(selected[this.value]) $(this).remove();
|
||||
selected[this.value] = true;
|
||||
});
|
||||
|
|
@ -65,12 +64,12 @@ xe.ModuleListManager = xe.createApp("ModuleListManager", {
|
|||
|
||||
refreshValue : function() {
|
||||
var srls = [];
|
||||
|
||||
this.selectedObj.find('>option').each(function(){
|
||||
|
||||
this.$selectedObj.find('>option').each(function(){
|
||||
srls.push(this.value);
|
||||
});
|
||||
|
||||
this.keyObj.val(srls.join(','));
|
||||
|
||||
this.$keyObj.val(srls.join(','));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue