Code Monkey home page Code Monkey logo

widgets's Introduction

Widgets Lift Module

Build Status

Provides:

  • autocomplete
  • calendars
  • flot -- working with the Flot Javascript plotting library.
  • gravatar
  • logchanger -- change log levels dynamically at runtime.
  • menu
  • rssfeed
  • sparklines
  • tablesorter
  • tree
  • uploadprogress

To include this module in your Lift project, add the following to build.sbt:

libraryDependencies += "net.liftmodules" %% "widgets_3.0" % "<VERSION>"

..but replacing <VERSION> with one of the "Module Version" numbers listed in the table below (e.g., to end up with "1.4.1").

Releases

Lift Version Scala Version Module Version
3.2.x 2.12 Maven Central
3.2.x 2.11 Maven Central
3.1.x 2.12 Maven Central
3.1.x 2.11 Maven Central
3.0.x 2.12 Maven Central
3.0.x 2.11 Maven Central
2.6.x 2.10, 2.9 1.3
2.5.x 2.10, 2.9 1.3

Historic Snapshots

Lift 3.0.x for Scala 2.10:

"net.liftmodules" %% "widgets_3.0" % "1.3-SNAPSHOT"

Widget documentation

General documentation and starting points:

Note: The module package changed from net.liftweb.widgets to net.liftmodules.widgets in May 2012. Please consider this when referencing documentation written before that date.

Autocomplete

Calendar

Flot

Gravatar

Log changer

RSS Widget

Sparklines

Table Sorter

TreeView

Notes for module developers

Merge to master will trigger a Travis build and publish a SNAPSHOT (if the version is a -SNAPSHOT).

widgets's People

Contributors

0xroch avatar d6y avatar david04 avatar davidb avatar dcbriccetti avatar dchenbecker avatar debilski avatar dpp avatar erysavy avatar farmdawgnation avatar fmpwizard avatar hoffrocket avatar indrajitr avatar jeppenejsum avatar jgoday avatar joescii avatar jorgeortiz85 avatar jstrachan avatar limansky avatar mads-hartmann avatar pr1001 avatar timperrett avatar tuhlmann avatar vdichev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

widgets's Issues

Autocomplete in 1.4-SNAPSHOT builds endpoint URL incorrectly, unusable in Lift 3.0-M5

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.

Autocomplete() should have option to allow user to enter their own value

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.

New jQuery version problem

When you use jQuery version 1.10.2 there is an issue with: Uncaught TypeError: Cannot read property 'opera' of undefined.

Autocomplete widget 404ing indicator.gif on non-root contexts

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

Widgets localization

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.

Fix deprecations

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

Change FlotSerie to enable additional fields such as yaxis

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

Flot 0.6 Plugin Support

Add support in lift-flot for the plugin system introduced in Flot 0.6. Dependent upon Lift's general Javascript dependency support (Issue 281).

Note:

This is migrated form the ticket lift/framework#380

No longer compiles for Lift 2.6

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.

Running test web app

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.

Flot widget does not support horizontal bars option

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

Flot widget does not support tick formatting

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.