New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to a "contains" semantics for search #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="/~dj/sapui5/sapui5-static/resources/sap-ui-core.js" | ||
<script src="./sap-ui-core.js" | ||
type="text/javascript" | ||
id="sap-ui-bootstrap" | ||
data-sap-ui-libs="sap.ui.commons" | ||
|
@@ -28,13 +28,14 @@ | |
}); | ||
|
||
// Load the plugin to use 'jQuery.sap.startsWithIgnoreCase' | ||
jQuery.sap.require("jquery.sap.strings"); | ||
// jQuery.sap.require("jquery.sap.strings"); | ||
|
||
// Filter the forums according to the given prefix | ||
var filterSdnForums = function (sPrefix) { | ||
var filterSdnForums = function (sTerm) { | ||
var re = new RegExp(sTerm,"i") | ||
var aResult = []; | ||
for (var i = 0; i < aSdnForums.length; i++) { | ||
if (!sPrefix || sPrefix.length == 0 || jQuery.sap.startsWithIgnoreCase(aSdnForums[i], sPrefix)) { | ||
if (!sTerm || sTerm.length == 0 || re.test(aSdnForums[i])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like this. The original is, as you say, too restrictive, and also a bit ugly anyway (startsWith...). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I looked at the UI5 library I was kind of shocked to see these utility methods and not jQuery.sap.containsIgnoreCase(). So RegExp it is! |
||
aResult.push(aSdnForums[i]); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand where you're coming from with this change, but am curious: with sap-ui-core.js in the same directory, does that imply that all the rest of the sapui5-static/resources files are in that same root-level directory alongside this HTML file? I want to get to a situation where we can have the resources held in a single (abstract) place. Or am I missing the point?
(Hmm, perhaps we can get SAP to host...?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if it was at a central location that would be good, but barring that it makes more sense to me to have it in the same directory rather than somewhere that only exists on one machine. The normal practice would be to host the sap-ui-core.js file in the same Git repository as the application, but given SAP's licensing restrictions that is not possible. Just one more way that SAP is shooting itself in the foot with developer licensing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SAPUI5 is too huge to host in same dir as app. So will assume / suggest a 'definitive' dir to use as convention: '/sapui5/' like this:
And each user can replace that with whatever is relevant for them.