v/pol
1
0
mirror of https://github.com/taroved/pol synced 2025-05-19 15:50:08 -07:00
This commit is contained in:
Alexandr Nesterenko 2017-05-16 12:33:46 -07:00
parent 51dcd46df6
commit 49d3f05d12

View File

@ -132,6 +132,10 @@ function Item(name, button) {
switch (that.state) { switch (that.state) {
case STATE_INACTIVE: case STATE_INACTIVE:
that.state = STATE_SELECTING; that.state = STATE_SELECTING;
if (currentItem && currentItem.state == STATE_SELECTING) {
currentItem.state = STATE_INACTIVE;
currentItem.updateButton();
}
currentItem = that; currentItem = that;
break; break;
case STATE_SELECTING: case STATE_SELECTING:
@ -150,12 +154,12 @@ function Item(name, button) {
updateSelection(); updateSelection();
break; break;
} }
_update_button(); that.updateButton();
updateCreateButton(); updateCreateButton();
} }
$(this.button).click(_button_click); $(this.button).click(_button_click);
function _update_button(){ this.updateButton = function() {
switch (that.state) { switch (that.state) {
case STATE_INACTIVE: case STATE_INACTIVE:
$(button).css('color', '#333'); $(button).css('color', '#333');
@ -182,7 +186,8 @@ function Item(name, button) {
updateSelection().then(function(){ updateSelection().then(function(){
that.state = STATE_SELECTED; that.state = STATE_SELECTED;
_update_button(); that.updateButton();
updateCreateButton();
}); });
} }
@ -424,7 +429,7 @@ function updateCreateButton() {
function onCreateButtonClick() { function onCreateButtonClick() {
var active = !$('#create').hasClass('disabled'); var active = !$('#create').hasClass('disabled');
if (active) if (active) {
//freeze UI //freeze UI
loader(true); loader(true);
createFeed().then(function(feed_page_url){ createFeed().then(function(feed_page_url){
@ -436,6 +441,7 @@ function onCreateButtonClick() {
console.log('Server error: '+ error); console.log('Server error: '+ error);
}); });
} }
}
function createFeed() { function createFeed() {
var htmlJson = buildJsonFromHtml($('iframe').contents()); var htmlJson = buildJsonFromHtml($('iframe').contents());