CC-5765 : Fixing up history page to match UI/UX
fixing dialog buttons to match most other dialogs in Airtime. Puttin context menu on right click, short cut to edit by double clicking.
This commit is contained in:
parent
f350ecbcf6
commit
ee6be2e22c
|
@ -187,6 +187,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
$this->view->prefix = $form::ID_PREFIX;
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
@ -227,6 +228,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
$this->view->prefix = $form::ID_PREFIX;
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,26 +120,6 @@ class Application_Form_EditHistory extends Zend_Form
|
||||||
|
|
||||||
$dynamic_attrs = new Zend_Form_SubForm();
|
$dynamic_attrs = new Zend_Form_SubForm();
|
||||||
$this->addSubForm($dynamic_attrs, $this::ID_PREFIX.'template');
|
$this->addSubForm($dynamic_attrs, $this::ID_PREFIX.'template');
|
||||||
|
|
||||||
// Add the submit button
|
|
||||||
$this->addElement('button', $this::ID_PREFIX.'save', array(
|
|
||||||
'ignore' => true,
|
|
||||||
'class' => 'btn '.$this::ID_PREFIX.'save',
|
|
||||||
'label' => _('Save'),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add the cancel button
|
|
||||||
$this->addElement('button', $this::ID_PREFIX.'cancel', array(
|
|
||||||
'ignore' => true,
|
|
||||||
'class' => 'btn '.$this::ID_PREFIX.'cancel',
|
|
||||||
'label' => _('Cancel'),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTemplateSubForm() {
|
protected function getTemplateSubForm() {
|
||||||
|
|
|
@ -26,12 +26,6 @@
|
||||||
</dd>
|
</dd>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<dd id="submitButtons-element">
|
|
||||||
<?php foreach (array("his_file_save", "his_file_cancel") as $name): ?>
|
|
||||||
<?php echo $form->getElement($name); ?>
|
|
||||||
<?php endforeach;?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</form>
|
</form>
|
|
@ -46,7 +46,7 @@
|
||||||
<option value="0"><?php echo _("No Show") ?></option>
|
<option value="0"><?php echo _("No Show") ?></option>
|
||||||
</select>
|
</select>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<button class="btn" type="button" id="his_instance_retrieve"><?php echo _("Find") ?></button>
|
<button class="btn btn-small" type="button" id="his_instance_retrieve"><?php echo _("Find") ?></button>
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
@ -68,12 +68,6 @@
|
||||||
</dd>
|
</dd>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<dd id="submitButtons-element">
|
|
||||||
<?php foreach (array("his_item_save", "his_item_cancel") as $name): ?>
|
|
||||||
<?php echo $form->getElement($name); ?>
|
|
||||||
<?php endforeach;?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -534,21 +534,91 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
return $el;
|
return $el;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeHistoryDialog(html) {
|
function fileSave() {
|
||||||
$hisDialogEl = $(html);
|
var data = $hisDialogEl.serializeArray();
|
||||||
|
var url = baseUrl+"Playouthistory/update-file-item/format/json";
|
||||||
|
|
||||||
|
$.post(url, data, function(json) {
|
||||||
|
|
||||||
|
//TODO put errors on form.
|
||||||
|
if (json.error !== undefined) {
|
||||||
|
//makeHistoryDialog(json.dialog);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeHistoryDialog();
|
||||||
|
redrawTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
}, "json");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function itemSave() {
|
||||||
|
|
||||||
|
var data = $hisDialogEl.serializeArray(),
|
||||||
|
id = data[0].value,
|
||||||
|
createUrl = baseUrl+"Playouthistory/create-list-item/format/json",
|
||||||
|
updateUrl = baseUrl+"Playouthistory/update-list-item/format/json",
|
||||||
|
url,
|
||||||
|
$select = $hisDialogEl.find("#his_instance_select"),
|
||||||
|
instance;
|
||||||
|
|
||||||
|
url = (id === "") ? createUrl : updateUrl;
|
||||||
|
|
||||||
|
if (fnServerData.instance !== undefined) {
|
||||||
|
data.push({
|
||||||
|
name: "instance_id",
|
||||||
|
value: fnServerData.instance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if ($select.length > 0) {
|
||||||
|
instance = $select.val();
|
||||||
|
|
||||||
|
if (instance > 0) {
|
||||||
|
data.push({
|
||||||
|
name: "instance_id",
|
||||||
|
value: instance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post(url, data, function(json) {
|
||||||
|
|
||||||
|
if (json.form !== undefined) {
|
||||||
|
var $newForm = $(json.form);
|
||||||
|
$newForm = processDialogHtml($newForm);
|
||||||
|
$hisDialogEl.html($newForm.html());
|
||||||
|
initializeDialog();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeHistoryDialog();
|
||||||
|
redrawTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
}, "json");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeHistoryDialog(json) {
|
||||||
|
$hisDialogEl = $(json.dialog);
|
||||||
$hisDialogEl = processDialogHtml($hisDialogEl);
|
$hisDialogEl = processDialogHtml($hisDialogEl);
|
||||||
|
|
||||||
|
var saveCallback = {
|
||||||
|
"his_item_": itemSave,
|
||||||
|
"his_file_": fileSave
|
||||||
|
};
|
||||||
|
|
||||||
$hisDialogEl.dialog({
|
$hisDialogEl.dialog({
|
||||||
title: $.i18n._("Edit History Record"),
|
title: $.i18n._("Edit History Record"),
|
||||||
modal: false,
|
modal: false,
|
||||||
open: function( event, ui ) {
|
open: function( event, ui ) {
|
||||||
initializeDialog();
|
initializeDialog();
|
||||||
},
|
},
|
||||||
close: removeHistoryDialog
|
close: removeHistoryDialog,
|
||||||
// buttons: [
|
buttons: [
|
||||||
// {text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog},
|
{text: $.i18n._("Cancel"), class: "btn btn-small", click: removeHistoryDialog},
|
||||||
// {text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: saveDialog}
|
{text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: saveCallback[json.prefix]}
|
||||||
//]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,7 +677,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
$.get(url, function(json) {
|
$.get(url, function(json) {
|
||||||
|
|
||||||
makeHistoryDialog(json.dialog);
|
makeHistoryDialog(json);
|
||||||
|
|
||||||
}, "json");
|
}, "json");
|
||||||
});
|
});
|
||||||
|
@ -616,80 +686,6 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
removeHistoryDialog();
|
removeHistoryDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on("click", ".his_file_save", function(e) {
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var $form = $(this).parents("form");
|
|
||||||
var data = $form.serializeArray();
|
|
||||||
|
|
||||||
var url = baseUrl+"Playouthistory/update-file-item/format/json";
|
|
||||||
|
|
||||||
$.post(url, data, function(json) {
|
|
||||||
|
|
||||||
//TODO put errors on form.
|
|
||||||
if (json.error !== undefined) {
|
|
||||||
//makeHistoryDialog(json.dialog);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
removeHistoryDialog();
|
|
||||||
redrawTables();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, "json");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('body').on("click", ".his_item_save", function(e) {
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var $form = $(this).parents("form"),
|
|
||||||
data = $form.serializeArray(),
|
|
||||||
id = data[0].value,
|
|
||||||
createUrl = baseUrl+"Playouthistory/create-list-item/format/json",
|
|
||||||
updateUrl = baseUrl+"Playouthistory/update-list-item/format/json",
|
|
||||||
url,
|
|
||||||
$select = $hisDialogEl.find("#his_instance_select"),
|
|
||||||
instance;
|
|
||||||
|
|
||||||
url = (id === "") ? createUrl : updateUrl;
|
|
||||||
|
|
||||||
if (fnServerData.instance !== undefined) {
|
|
||||||
data.push({
|
|
||||||
name: "instance_id",
|
|
||||||
value: fnServerData.instance
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if ($select.length > 0) {
|
|
||||||
instance = $select.val();
|
|
||||||
|
|
||||||
if (instance > 0) {
|
|
||||||
data.push({
|
|
||||||
name: "instance_id",
|
|
||||||
value: instance
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.post(url, data, function(json) {
|
|
||||||
|
|
||||||
if (json.form !== undefined) {
|
|
||||||
var $newForm = $(json.form);
|
|
||||||
$newForm = processDialogHtml($newForm);
|
|
||||||
$hisDialogEl.html($newForm.html());
|
|
||||||
initializeDialog();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
removeHistoryDialog();
|
|
||||||
redrawTables();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, "json");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$historyContentDiv.on("click", ".his_checkbox input", function(e) {
|
$historyContentDiv.on("click", ".his_checkbox input", function(e) {
|
||||||
var checked = e.currentTarget.checked,
|
var checked = e.currentTarget.checked,
|
||||||
$tr = $(e.currentTarget).parents("tr");
|
$tr = $(e.currentTarget).parents("tr");
|
||||||
|
@ -809,7 +805,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
$.post(editUrl, {format: "json"}, function(json) {
|
$.post(editUrl, {format: "json"}, function(json) {
|
||||||
|
|
||||||
makeHistoryDialog(json.dialog);
|
makeHistoryDialog(json);
|
||||||
|
|
||||||
}, "json");
|
}, "json");
|
||||||
});
|
});
|
||||||
|
@ -836,7 +832,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
$.post(editUrl, {format: "json"}, function(json) {
|
$.post(editUrl, {format: "json"}, function(json) {
|
||||||
|
|
||||||
makeHistoryDialog(json.dialog);
|
makeHistoryDialog(json);
|
||||||
|
|
||||||
}, "json");
|
}, "json");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue