liftmodules / widgets Goto Github PK
View Code? Open in Web Editor NEWA collection of useful widgets for use with Lift
A collection of useful widgets for use with Lift
There is a test web application that demonstrates Widgets. It is in src/test/
. Please make it possible to run the test application with container:start
in SBT.
See: lift/framework#892 (imported from http://www.assembla.com/spaces/liftweb/tickets/892)
The Autocomplete user allows the user to start typing, then select any of a popped up list of strings, and have the selected string passed to a function at submit time.
However, if the user types their own value, instead of choosing from the list, the string "" is passed to the specified function at submit time. This is right for some apps (where only the choices to be completed from are valid), but wrong for others (where the popped up completions are only suggestions).
The following javascript, from Mads Jensen, can be manually added to the page to fix this behavior:
Paul,
Am I correct in assuming that what you want is to be able to submit a value that isn't part of the drop-down box? If this is the case you can fix it with a bit of javascript. In a javascript somew\
here that you load on the page with the form put this
$(document).ready(function(){
$('#idOfTheAutocompleteField').bind('blur',function(){
$(this).next().val($(this).val());
});
});
Hope that helps,
Mads Hartmann Jensen
There should be a way to make this happen automatically (especially as this code is JQuery-specific). I'm not sure which behavior should be the default.
The widgets source code is no longer compatible with Lift 2.6. I don't think this is a problem. I propose to modify the build.sbt to specify Lift 3.0-SNAPSHOT.
When compiling with Lift 2.6 the error is:
[info] Compiling 25 Scala sources to /Users/richard/Developer/lift/modules/widgets/target/scala-2.11/classes...
[error] /Users/richard/Developer/lift/modules/widgets/src/main/scala/net/liftmodules/widgets/autocomplete/AutoComplete.scala:181: value liftPath is not a member of object net.liftweb.http.LiftRules
[error] val what: String = encodeURL(S.contextPath + "/" + LiftRules.liftPath + "/ajax/"+ S.renderVersion+"?"+func+"=foo")
[error] ^
and
[error] /Users/richard/Developer/lift/modules/widgets/src/main/scala/net/liftmodules/widgets/tree/TreeView.scala:120: value liftPath is not a member of object net.liftweb.http.LiftRules
[error] "/"+LiftRules.liftPath + "/ajax/"+ S.renderVersion)+"?"+key+"=_"
[error] ^
[warn] three warnings found
[error] two errors found
There are also deprecation warnings about deprecations to @deprecations
. Which is my all time favourite deprecation.
Hi!
I've just started to use widgets module. It's really helpful! (Actually for now I tried only bootstrap modal). But I've found that localization is not used. So I have to rewrite object ConfirmRemoveDialog in my project to wrap strings in S.?.
Do you have any plans to support localization? If no, will you interested in such patch, I can try to make it.
Flot 0.7 ships with a pie chart plugin. Enhance the Lift Flot widget to support some reasonable subset of the pie chart’s features.
See https://groups.google.com/forum/#!searchin/liftweb/flot$20pie/liftweb/okbMDE3RyL0/3d401H6MdZkJ for a discussion in the Lift group.
Migrated from lift/framework#1151
please change id="gravatar_image" to class="gravatar" as id must be unique and you can use this widget multiple times in a single page.
The autocomplete widget attempts to fire Ajax at URLs of the following form: http://lift/ajax/...etc.
rather than creating a relative URL.
The line referenced in issue #19 is the problem:
val what: String = encodeURL(S.contextPath + "/" + LiftRules.liftPath+"/ajax/"+S.renderVersion+"?"+func+"=foo")
The definition of LiftRules.liftPath
is:
def liftPath: String = S.contextPath + "/" + liftContextRelativePath
So the problem is clear, S.contextPath + "/"
is prepended twice; and if S.contextPath
is the empty string the result is //
.
For me, the following replacement works:
val what: String = encodeURL(LiftRules.liftPath + "/ajax/"+ S.renderVersion+"?"+func+"=foo")
However I'm not well-versed enough in LiftRules to be confident it's going to play well in all cases.
Summary: When running on a non-root context, the autocomplete widget references CSS for a background image that will 404 because the context is not included in the img URL.
Expectation: the indicator.gif should be found when using the autocomplete widget in a root or non-root context.
Actual: the browser receives a 404 for this image in a non-root context.
Steps to reproduce: The image comes into play when you type into the text field, and you have to look at the browser console to see the error.
Discussion: https://groups.google.com/forum/#!msg/liftweb/7eNw_pWT2ZE/Ua9yeUKMxJEJ
The Flot widget does not support formatting ticks. The Flot JavaScript library provides a "tickFormatter" option for customizing the axes.
Alternatively the "tick" option supports passing in a two-element array to map numeric ticks to a string to display as the label. Here is an example from the the Flot API.txt:
ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]]
See http://groups.google.com/group/liftweb/browse_thread/thread/c89dcdef4389cd4d?hl=en# for reference.
Migrated from lift/framework#845
Add support in lift-flot for the plugin system introduced in Flot 0.6. Dependent upon Lift's general Javascript dependency support (Issue 281).
This is migrated form the ticket lift/framework#380
When you use jQuery version 1.10.2 there is an issue with: Uncaught TypeError: Cannot read property 'opera' of undefined
.
The Flot widget should support horizontal bars. The Flot JavaScript library provides a "series.bars.horizontal" option for this purpose. Here is an example from the Flot API.txt:
series: {
bars: {
barWidth: number
align: "left" or "center"
horizontal: boolean
}
}
The net.liftweb.widgets.flot.FlotBarsOptions trait does not provide any options other than barWidth.
Migrated from lift/framework#846
FlotSerie does not provide for putting data on second y axis.
Proposed FlotSerie:
trait FlotSerie extends BaseFlotOptions
{
def data: List[(Double, Double)] = Nil
def label: Box[String] = Empty
def lines: Box[FlotLinesOptions] = Empty
def points: Box[FlotPointsOptions] = Empty
def bars: Box[FlotBarsOptions] = Empty
def color: Box[Either[String, Int]] = Empty
def shadowSize: Box[Int] = Empty
def buildOptions = {
List(label.map(v => ("label", Str(v))),
lines.map(v => ("lines", v.asJsObj)),
points.map(v => ("points", v.asJsObj)),
bars.map(v => ("bars", v.asJsObj)),
color.map {
case Left(c) => ("color", Str(c))
case Right(c) => ("color", Num(c))
},
shadowSize.map(s => ("shadowSize", Num(s)))
)
}
}
Then using it in Flot:
def renderOneSerie(data: FlotSerie, idPlaceholder: String, idSerie: Int): JsObj = {
val info: List[Box[(String, JsExp)]] =
Full(("data", JsVar("data_"+idPlaceholder + "_" + idSerie))) ::
data.buildOptions
JsObj(info.flatten(_.toList) :_*)
}
Enables user code such as:
series = new FlotSerie () {
override val label = Full(theDs.split("@")(0))
override val data = theDataMap(theDs)
val yaxis = Full (2)
override def buildOptions = {
yaxis.map( v => ("yaxis", Num(v))) ::
super.buildOptions
}
} :: series
Migrated from lift/framework#559
Compile complains:
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:190: @deprecated now takes two arguments; see the scaladoc.
[warn] @deprecated def lines: Box[FlotLinesOptions] = Empty
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:191: @deprecated now takes two arguments; see the scaladoc.
[warn] @deprecated def points: Box[FlotPointsOptions] = Empty
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:196: @deprecated now takes two arguments; see the scaladoc.
[warn] @deprecated def shadowSize: Box[Int] = Empty
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/Flot.scala:173: value NaN_DOUBLE in object Math is deprecated: Use scala.Double.NaN instead
[warn] case (Math.NaN_DOUBLE, _) => JsNull
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/Flot.scala:173: object Math is deprecated: use the scala.math package object instead.
[warn] (Example package object usage: scala.math.Pi )
[warn] case (Math.NaN_DOUBLE, _) => JsNull
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/Flot.scala:174: value NaN_DOUBLE in object Math is deprecated: Use scala.Double.NaN instead
[warn] case (_, Math.NaN_DOUBLE) => JsNull
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/Flot.scala:174: object Math is deprecated: use the scala.math package object instead.
[warn] (Example package object usage: scala.math.Pi )
[warn] case (_, Math.NaN_DOUBLE) => JsNull
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:204: method lines in trait FlotOptions is deprecated: scala.this.deprecated.init$default$1
[warn] lines.map(v => ("lines", v.asJsObj)),
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:205: method points in trait FlotOptions is deprecated: scala.this.deprecated.init$default$1
[warn] points.map(v => ("points", v.asJsObj)),
[warn] ^
[warn] /Users/richard/Developer/lift/widgets/src/main/scala/net/liftmodules/widgets/flot/FlotOptions.scala:210: method shadowSize in trait FlotOptions is deprecated: scala.this.deprecated.init$default$1
[warn] c("shadowSize", shadowSize),
[warn] ^
[warn] 10 warnings found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.