CC-84: Smart Playlists
-added save button for static playlists
This commit is contained in:
parent
fc09baacd7
commit
e0a674a96c
|
@ -205,8 +205,16 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
$save = new Zend_Form_Element_Button('save_button');
|
||||
$save->setAttrib('class', 'ui-button ui-state-default right-floated');
|
||||
$save->setIgnore(true);
|
||||
$save->setLabel('Generate');
|
||||
$save->setLabel('Save');
|
||||
$save->setDecorators(array('viewHelper'));
|
||||
$this->addElement($save);
|
||||
|
||||
$generate = new Zend_Form_Element_Button('generate_button');
|
||||
$generate->setAttrib('class', 'ui-button ui-state-default right-floated');
|
||||
$generate->setIgnore(true);
|
||||
$generate->setLabel('Generate');
|
||||
$generate->setDecorators(array('viewHelper'));
|
||||
$this->addElement($generate);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<?php echo $this->element->getElement('sp_criteria_modifier_'.$i) ?>
|
||||
<?php echo $this->element->getElement('sp_criteria_value_'.$i) ?><span id="extra_criteria" <?php echo $this->element->getElement('sp_criteria_extra_'.$i)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>> to <?php echo $this->element->getElement('sp_criteria_extra_'.$i) ?></span>
|
||||
<?php if ($i != 0) { ?>
|
||||
<a class='ui-button sp-add sp-ui-button-icon-only' id='criteria_remove_<?php echo $i ?>'>
|
||||
<a class='ui-button sp-ui-button-icon-only' id='criteria_remove_<?php echo $i ?>'>
|
||||
<span class='ui-icon ui-icon-closethick'></span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
@ -45,10 +45,10 @@
|
|||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
||||
</label>
|
||||
</dd>
|
||||
|
||||
<dd id='sp_save'>
|
||||
<?php echo $this->element->getElement('save_button') ?>
|
||||
</dd>
|
||||
<dd id='action_buttons'>
|
||||
<?php echo $this->element->getElement('save_button') ?>
|
||||
<?php echo $this->element->getElement('generate_button') ?>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
|
||||
echo $this->form; ?>
|
||||
<?php echo $this->form; ?>
|
||||
|
||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
|
|
|
@ -439,8 +439,12 @@ input.input_text.sp_extra_input_text{
|
|||
left: 50%;
|
||||
}
|
||||
|
||||
.sp-add .sp-ui-button-icon-only .ui-icon{
|
||||
left: 90% !important;
|
||||
.sp-add.sp-ui-button-icon-only .ui-icon{
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.sp-ui-button-icon-only .ui-icon-closethick:hover, .sp-ui-button-icon-only .ui-icon-plusthick:hover {
|
||||
background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png)
|
||||
}
|
||||
|
||||
label {
|
||||
|
|
|
@ -111,31 +111,29 @@ function setSmartPlaylistEvents() {
|
|||
form.find('button[id="save_button"]').live("click", function(event){
|
||||
var playlist_type = form.find('input:radio[name=sp_type]:checked').val(),
|
||||
data = $('form').serializeArray(),
|
||||
static_action = 'Playlist/smart-playlist-generate',
|
||||
dynamic_action ='Playlist/smart-playlist-criteria-save',
|
||||
action,
|
||||
callback,
|
||||
save_action = 'Playlist/smart-playlist-criteria-save',
|
||||
playlist_id = $('input[id="pl_id"]').val();
|
||||
|
||||
$.post(save_action, {format: "json", data: data, pl_id: playlist_id}, saveCallback);
|
||||
});
|
||||
|
||||
form.find('button[id="generate_button"]').live("click", function(event){
|
||||
var playlist_type = form.find('input:radio[name=sp_type]:checked').val(),
|
||||
data = $('form').serializeArray(),
|
||||
generate_action = 'Playlist/smart-playlist-generate',
|
||||
playlist_id = $('input[id="pl_id"]').val();
|
||||
|
||||
if (playlist_type == "0") {
|
||||
action = static_action;
|
||||
callback = staticCallback;
|
||||
} else {
|
||||
action = dynamic_action;
|
||||
callback = dynamicCallback;
|
||||
}
|
||||
$.post(action, {format: "json", data: data, pl_id: playlist_id}, callback);
|
||||
$.post(generate_action, {format: "json", data: data, pl_id: playlist_id}, generateCallback);
|
||||
});
|
||||
|
||||
form.find('dd[id="sp_type-element"]').live("change", function(){
|
||||
var playlist_type = $('input:radio[name=sp_type]:checked').val(),
|
||||
button_text;
|
||||
var playlist_type = $('input:radio[name=sp_type]:checked').val();
|
||||
if (playlist_type == "0") {
|
||||
button_text = 'Generate';
|
||||
$('button[id="generate_button"]').show();
|
||||
|
||||
} else {
|
||||
button_text = 'Save';
|
||||
}
|
||||
$('button[id="save_button"]').text(button_text);
|
||||
$('button[id="generate_button"]').hide();
|
||||
}
|
||||
});
|
||||
|
||||
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
|
||||
|
@ -176,7 +174,7 @@ function disableAndHideExtraField(valEle, index) {
|
|||
spanExtra.children('#sp_criteria_extra_'+index).val("").attr("disabled", "disabled");
|
||||
spanExtra.hide();
|
||||
|
||||
//make value input larger because we don't have extra field now
|
||||
//make value input larger since we don't have extra field now
|
||||
var criteria_value = $('#sp_criteria_value_'+index);
|
||||
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
|
||||
}
|
||||
|
@ -209,7 +207,7 @@ function populateModifierSelect(e) {
|
|||
}
|
||||
}
|
||||
|
||||
function staticCallback(data) {
|
||||
function generateCallback(data) {
|
||||
var form = $('#smart-playlist-form');
|
||||
form.find('span[class="errors sp-errors"]').remove();
|
||||
var json = $.parseJSON(data);
|
||||
|
@ -229,7 +227,7 @@ function staticCallback(data) {
|
|||
}
|
||||
}
|
||||
|
||||
function dynamicCallback(json) {
|
||||
function saveCallback(json) {
|
||||
var form = $('#smart-playlist-form');
|
||||
form.find('span[class="errors sp-errors"]').remove();
|
||||
var json = $.parseJSON(json);
|
||||
|
@ -247,8 +245,8 @@ function dynamicCallback(json) {
|
|||
}
|
||||
|
||||
function appendAddButton(rows) {
|
||||
var add_button = "<a class='ui-button sp-ui-button-icon-only' id='criteria_add' class='criteria_add'>" +
|
||||
"<span class='ui-icon ui-icon-plusthick'</span></a>";
|
||||
var add_button = "<a class='ui-button sp-add sp-ui-button-icon-only' id='criteria_add' class='criteria_add'>" +
|
||||
"<span class='ui-icon ui-icon-plusthick'></span></a>";
|
||||
|
||||
if (rows.find('select[name^="sp_criteria_field"]:enabled').length > 1) {
|
||||
rows.find('select[name^="sp_criteria_field"]:enabled:last')
|
||||
|
@ -256,7 +254,7 @@ function appendAddButton(rows) {
|
|||
.after(add_button);
|
||||
} else {
|
||||
rows.find('select[name^="sp_criteria_field"]:enabled')
|
||||
.siblings('[name^="sp_criteria_value"]')
|
||||
.siblings('input:last')
|
||||
.after(add_button);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
||||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
Loading…
Reference in New Issue