]> gitweb.factorcode.org Git - factor.git/commitdiff
misc ui.frp fixes
authorSam Anklesaria <sam@Tintin.local>
Tue, 16 Jun 2009 20:50:48 +0000 (15:50 -0500)
committerSam Anklesaria <sam@Tintin.local>
Tue, 16 Jun 2009 20:50:48 +0000 (15:50 -0500)
extra/recipes/recipes.factor
extra/ui/frp/signals/signals.factor

index f9663403f5d199903ce9a01482106c5ccf4d84f6..3fa65d336d9942de5e24593c4196848150dc3cd8 100644 (file)
@@ -32,21 +32,22 @@ STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } {
       <frp-table*> :> tbl
       "okay" <frp-border-button> BUTTON -> :> ok
       "submit" <image-button> [ store-tuple ] >>value TOOLBAR -> :> submit
-      "love" <image-button> TOOLBAR -> [ 1 ] <$
-      "hate" <image-button> -> [ -1 ] <$ 2array <merge> :> votes
+      "love" <image-button> 1 >>value TOOLBAR ->
+      "hate" <image-button> -1 >>value -> 2array <merge> :> votes
       "back" <image-button> -> [ -30 ] <$
       "more" <image-button> -> [ 30 ] <$ 2array <merge> :> viewed
       <frp-field*> SEARCH ->% 1 :> search
       submit ok [ [ drop ] ] <$ 2array <merge> [ drop ] >>value :> quot
-      viewed 0 [ + ] <fold> search ok t <basic> "all" <frp-button> GENRES -> 3array <merge>
+      viewed 0 [ + ] <fold> search ok t <basic> "all" <frp-button> GENRES ->
+      tbl selected-value>> votes [ [ + ] curry change-votes modify-tuple ] 2$>-|
+        4array <merge>
         [ drop [ f ] [ "%" dup surround <pattern> ] if-empty top-recipes ] 3fmap-| :> updates
       updates [ top-genres UI[ <frp-button> GENRES ->? ] map <merge> ] bind*
         [ text>> T{ recipe } swap >>genre get-tuples ] fmap
       tbl swap updates 2array <merge> >>model
         [ [ title>> ] [ genre>> ] bi 2array ] >>quot
-        { "Title" "Genre" } >>column-titles dup <scroller> RECIPES ,% 1 actions>> :> val
-      val votes [ [ + ] curry change-votes store-tuple ] 2$>-| ,
-      val submit [ "" dup dup <recipe> ] <$ 2array <merge>
+        { "Title" "Genre" } >>column-titles dup <scroller> RECIPES ,% 1 actions>>
+      submit [ "" dup dup <recipe> ] <$ 2array <merge>
         { [ [ title>> ] fmap <frp-field> TITLE ->% .5 ]
           [ [ genre>> ] fmap <frp-field> GENRE ->% .5 ]
           [ [ txt>> ] fmap <frp-editor> BODY ->% 1 ]
index e7b63745272394991aaf61fdbb9aea37b9f74c72..e48d477465fb34197d4a9e6f482e9943c768f189 100644 (file)
@@ -92,10 +92,8 @@ M: | models-changed drop ;
 M: | model-changed
     nip
     dup dependencies>> [ value>> ] all?
-    [ [ dup [ value>> ] product-value >>value notify-connections ] keep models-changed ]
+    [ [ dup [ value>> ] product-value swap set-model ] keep models-changed ]
     [ drop ] if ;
-M: | update-model
-    dup value>> swap [ set-model ] set-product-value ;
 M: | model-activated dup model-changed ;
 
 TUPLE: & < | ;