Commit 8abe7568 authored by Boxiang Sun's avatar Boxiang Sun Committed by Eteri

erp5_officejs_support_request_ui: Button improvements on homepage.

- "Restore Filter" button.
Allow to remove the filters applied on the homepage
listbox. Disabled when no filter applied.

- Generate RSS button.
Generate the RSS link. Click this button will generate
a RSS link for an anchor tag and hide the button itself.

- Create Support Request button.
Make the appearance same in desktop and iphone browser.
parent 091b8de4
#generate-rss {
padding: 8pt;
margin-top: 30pt;
padding: 5.5pt;
margin-right: 12pt;
background-color: #FF6600;
border-color: #FF6600;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 1px;
border-width: 0.5px;
border-style: solid;
min-width: 6em;
line-height: 1.5;
display: none;
text-align: center;
width: fit-content;
}
.restore-button {
padding: 6pt;
margin-right: 12pt;
background-color: #FF6600;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 0.5px;
border-style: solid;
min-width: 8em;
line-height: 1.5;
......@@ -26,6 +41,15 @@
}
.gadget-content .ui-field-contain .bottom .first-line-buttons {
-webkit-appearance: none;
margin-top: 0;
margin-bottom: 20px;
}
button:disabled{
background-color:#FFC9A4;
}
input[type="submit"] {
-webkit-appearance: none;
}
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.58280.64149.54152</string> </value>
<value> <string>962.1022.173.35635</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1504625908.37</float>
<float>1505136124.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -21,8 +21,9 @@
<form>
<div class='ui-field-contain'>
<div class='bottom'>
<input class='first-line-buttons' data-theme="b" data-inline="true" type="submit" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" data-icon="check" />
<a id="generate-rss">Generate RSS</a>
<input class='first-line-buttons' id="createSR" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" data-icon="check"/>
<input class='first-line-buttons' id="generateRSS" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Generate RSS" value="Generate RSS" data-icon="check"/>
<a id="generate-rss" href="#" target="_blank">RSS Link</a>
</div>
</div>
......@@ -37,7 +38,10 @@
<div id="wrap2" style="height:300px;"></div>
</div>
</div>
<div class='bottom'>
<button class='restore-button'id="restoreButton" data-i18n="[value]Restore Filter" disabled="disabled">Restore Filter</button>
</div>
<div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="last"></div>
</form>
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.57886.54821.53077</string> </value>
<value> <string>962.1011.37939.53486</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1504602240.34</float>
<float>1505136135.97</float>
<string>UTC</string>
</tuple>
</state>
......
/*global document, window, Option, rJS, RSVP, loopEventListener*/
/*jslint nomen: true, indent: 2, maxerr: 150 */
(function (window, rJS, RSVP, loopEventListener) {
/*global document, window, Option, rJS, RSVP*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
......@@ -70,6 +70,10 @@
.push(function (search_criteria) {
gadget.changeState({extended_search: search_criteria});
});
})
.push(function () {
var restore = document.getElementById("restoreButton");
restore.removeAttribute('disabled');
});
// method code
})
......@@ -296,36 +300,6 @@
}
return queue;
})
.declareService(function () {
var gadget = this;
function getRSS(click_event) {
var rss_button = gadget.element.querySelector("#generate-rss");
if (rss_button.href === '') {
return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) {
return gadget.jio_getAttachment(
'support_request_module',
hateoas_url + 'support_request_module'
+ "/SupportRequestModule_generateRSSLinkAsJson"
)
.push(function (result) {
rss_button.href = result.restricted_access_url;
rss_button.innerHTML = "RSS Link";
rss_button.target = "_blank";
});
});
}
click_event.returnValue = true;
}
// Listen to form submit
return loopEventListener(
gadget.element.querySelector("#generate-rss"),
'click',
false,
getRSS
);
})
.onEvent('change', function (evt) {
if (evt.target.id === "field_your_project") {
var gadget = this;
......@@ -352,6 +326,53 @@
});
}
}, false, false)
.onEvent('click', function (event) {
var gadget = this, rss_link = gadget.element.querySelector("#generate-rss"),
generate_button = gadget.element.querySelector("#generateRSS");
if (event.target.id === "restoreButton") {
return gadget.changeState({extended_search: null})
.push(function () {
var restore = document.getElementById("restoreButton");
restore.setAttribute("disabled", "disabled");
});
}
if (event.target.id === "generateRSS") {
if (rss_link.getAttribute("href") === '#') {
return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) {
return gadget.jio_getAttachment(
'support_request_module',
hateoas_url + 'support_request_module'
+ "/SupportRequestModule_generateRSSLinkAsJson"
)
.push(function (result) {
rss_link.href = result.restricted_access_url;
rss_link.style.display = "inline-block";
generate_button.style.display = "none";
});
});
}
} else if (event.target.id === "createSR") {
return gadget.jio_getAttachment('support_request_module', 'links')
.push(function (links) {
var fast_create_url = links._links.view[2].href;
return gadget.getUrlFor({
command: 'display',
options: {
jio_key: "support_request_module",
view: fast_create_url,
page: 'support_request_fast_view_dialog'
}
});
})
.push(function (url) {
window.location.href = url;
});
}
event.returnValue = true;
})
.onEvent('submit', function () {
var gadget = this;
return gadget.jio_getAttachment('support_request_module', 'links')
......@@ -371,4 +392,4 @@
});
});
}(window, rJS, RSVP, loopEventListener));
\ No newline at end of file
}(window, rJS, RSVP));
\ No newline at end of file
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.57878.63760.62037</string> </value>
<value> <string>962.1253.14163.7168</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1504601728.55</float>
<float>1505136353.12</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment