private void UpdateRendering()
        {
            _list.Empty();
            _itemTemplate.RenderTemplate(_todoList.Items).AppendTo(_list);

            _clearButton.SwitchClass("hidden", _todoList.CompletedCount == 0);
            _activeCount.Text(_todoList.ActiveCount + " item(s) left");
        }
        private void ResetButtonClick(jQueryEvent e)
        {
            e.PreventDefault();

            rowsDiv.Empty();
            SetCurrentFilter(null, null);
            UpdateParens();
            UpdateButtons();
            OnHeightChange();
        }
Example #3
0
        protected void UpdateRowsFromStore()
        {
            rowsDiv.Empty();

            foreach (var item in Store.Items)
            {
                AddEmptyRow(false);
                var row = rowsDiv.Children().Last();

                var divl = row.Children("div.l");
                divl.Children(".leftparen").ToggleClass("active", Q.IsTrue(item.LeftParen));
                divl.Children(".rightparen").ToggleClass("active", Q.IsTrue(item.RightParen));
                divl.Children(".andor").ToggleClass("or", Q.IsTrue(item.IsOr))
                .Text(Q.Text(Q.IsTrue(item.IsOr) ? "Controls.FilterPanel.Or" : "Controls.FilterPanel.And"));

                var fieldSelect = row.Children("div.f").Find("input.field-select").GetWidget <FieldSelect>();
                fieldSelect.Value = item.Field;
                RowFieldChange(row);

                var operatorSelect = row.Children("div.o").Find("input.op-select").GetWidget <OperatorSelect>();
                operatorSelect.Value = item.Operator;
                RowOperatorChange(row);

                var filtering = GetFilteringFor(row);
                if (filtering != null)
                {
                    filtering.Operator = item.Operator;
                    filtering.LoadState(item.State);
                }
            }

            if (ShowInitialLine && rowsDiv.Children().Length == 0)
            {
                AddEmptyRow(false);
            }

            UpdateParens();
        }
    public static jQueryObject Gallery(GalleryPluginOptions customOptions)
    {
        GalleryPluginOptions defaultOptions =
            new GalleryPluginOptions("count", 10,
                                     "photoService", new FlickrService());
        GalleryPluginOptions options =
            (GalleryPluginOptions)jQuery.Extend(new Dictionary <string, object>(), defaultOptions, customOptions);

        return(jQuery.Current.Each(delegate(int i, Element element) {
            jQueryObject thumbnailList = jQuery.Select("#" + options.thumbsListID);
            jQueryObject photoPanel = jQuery.Select("#" + options.photoPanelID);

            options.photoService.SearchPhotos(options.tags, options.count, delegate(List <PhotoResult> photos) {
                if ((photos == null) || (photos.Count == 0))
                {
                    return;
                }

                thumbnailList.Empty();
                jQuery.Select("#" + options.thumbnailTemplateID).Plugin <jQueryTemplateObject>().
                RenderTemplate(photos).
                CSS("opacity", "0.5").
                AppendTo(thumbnailList).
                MouseEnter(delegate(jQueryEvent e) {
                    jQuery.FromElement(e.CurrentTarget).FadeTo(250, 1.0f, delegate() {
                        jQuery.This.CSS("opacity", "1");
                    });
                })
                .MouseLeave(delegate(jQueryEvent e) {
                    jQuery.FromElement(e.CurrentTarget).FadeTo(250, 0.5f, delegate() {
                        jQuery.This.CSS("opacity", "0.5");
                    });
                })
                .Click(delegate(jQueryEvent e) {
                    PhotoResult photo = (PhotoResult)jQueryTemplating.GetTemplateInstance(e.CurrentTarget).Data;

                    jQueryTemplate photoTemplate = jQueryTemplating.CreateTemplate(jQuery.Select("#" + options.photoTemplateID));
                    photoPanel.FadeOut(EffectDuration.Slow, delegate() {
                        jQuery.This.Empty().CSS("display", "").
                        Append(jQueryTemplating.RenderTemplate(photoTemplate, photo)).
                        FadeIn(EffectDuration.Slow);
                    });
                }).
                Eq(0).Click();
            });

            return false;
        }));
    }
        public void ClassInitialize()
        {
            divContainer = TestHarness.AddElement();
            Css.SetSize(divContainer, 200, 300);

            string url = "/Samples/AccordianTest";
            Log.Info("Downloading HTML. " + Html.ToHyperlink(url));
            jQuery.Get(url, delegate(object data)
                                                     {
                                                         Log.Success("HTML downloaded.");
                                                         divContainer.Append(data.ToString());
                                                         isInitialized = true;
                                                         TestHarness.UpdateLayout();
                                                     });

            divContainer.Empty();
        }
Example #6
0
    static PhotoGridPage()
    {
        jQuery.OnDocumentReady(delegate() {
            string apiKey = (string)jQuery.FromElement(Document.Body).GetDataValue("flickrKey");
            IPhotoService flickrService = new FlickrPhotoService();

            jQuery.Select("#searchButton").Click(delegate(jQueryEvent e) {
                string tags = jQuery.Select("#tagsTextBox").GetValue();

                flickrService.SearchPhotos(tags, 20).Done(
                    delegate(IEnumerable <Photo> photos) {
                    jQueryObject thumbnailList = jQuery.Select("#thumbsList");
                    thumbnailList.Empty();

                    if (photos == null)
                    {
                        return;
                    }

                    jQuery.Select("#thumbnailTemplate").Plugin <jQueryTemplateObject>().
                    RenderTemplate(photos).
                    AppendTo(thumbnailList);

                    thumbnailList.
                    Plugin <jQueryIsotopeObject>().Isotope(new IsotopeOptions("layoutMode", IsotopeLayout.Masonry)).
                    Find("a").
                    Plugin <jQueryLightBoxObject>().LightBox();

                    thumbnailList.Find("li").
                    MouseOver(delegate(jQueryEvent e2) {
                        jQuery.This.CSS("box-shadow", "0 0 15px #888");
                    }).
                    MouseOut(delegate(jQueryEvent e2) {
                        jQuery.This.CSS("box-shadow", "");
                    });
                });

                jQuery.FromElement(Document.Body).Focus();
                e.PreventDefault();
            });
        });
    }
        private void linkFn(AcgSpacesScope scope, jQueryObject element, object attrs)
        {
            var updater = new Action(() =>
                                     {
                                         element.Children()
                                             .Each((ind, e) => { angular.Element(e).Scope<BaseScope>().Destroy(); });


                                         element.Empty();

                                         var content = @"<div>
    <div acg-draw-space ng-style='spaceStyle'>
        <div ng-repeat='card in space.pile.cards' acg-draw-card ng-style='cardStyle'>
        </div>
    </div> 
</div>";

                                         angular.ForEach(scope.Spaces,
                                             (space) =>
                                             {
                                                 var e = angular.Element(content);
                                                 var _scope = scope.New<AcgSpacesScope>();
                                                 _scope.Space = space;
                                                 var elk = myCompile(e.Contents())(_scope);

                                                 element.Append(elk);
                                             });
                                     });

            //scope["$watch"]("spaces",updater);

            myGameContentManagerService.Redraw += () =>
                                                  {
                                                      Console.WriteLine("updating board");
                                                      updater();
                                                      scope.Apply();
                                                  };

            updater();
        }
        public void constructPagerUI()
        {
            _container.Empty();

            jQueryObject pager = jQuery.FromHtml("<table cellspacing='0' cellpadding='0' class='sparkle-grid-status'><tbody><tr>" +
                                                 "<td class='sparkle-grid-status-label'>1 - 1 of 1&nbsp;(0 selected)</td>" +
                                                 "<td class='sparkle-grid-status-paging'>" +
                                                 "<img src='../../sparkle_/css/images/transparent_spacer.gif' class='sparkle-grid-paging-first'>" +
                                                 "<img src='../../sparkle_/css/images/transparent_spacer.gif' class='sparkle-grid-paging-back'>" +
                                                 "<span class='sparkle-grid-status-paging-page'>Page 1</span>" +
                                                 "<img src='../../sparkle_/css/images/transparent_spacer.gif' class='sparkle-grid-paging-next'>" +
                                                 "&nbsp;</td></tr></tbody></table>");

            jQueryObject firstButton = pager.Find(".sparkle-grid-paging-first");
            jQueryObject backButton  = pager.Find(".sparkle-grid-paging-back");
            jQueryObject nextButton  = pager.Find(".sparkle-grid-paging-next");
            jQueryObject label       = pager.Find(".sparkle-grid-status-label");
            jQueryObject pageInfo    = pager.Find(".sparkle-grid-status-paging-page");

            _container.Append(pager);
            firstButton.Click(gotoFirst);
            backButton.Click(gotoPrev);
            nextButton.Click(gotoNext);
        }
        static PhotoTilesPage()
        {
            jQuery.OnDocumentReady(delegate() {
                string apiKey = (string)jQuery.FromElement(Document.Body).GetDataValue("flickrKey");
                IPhotoService flickrService = new FlickrPhotoService();

                jQuery.Select("#searchButton").Click(delegate(jQueryEvent e) {
                    string tags = jQuery.Select("#tagsTextBox").GetValue();

                    flickrService.SearchPhotos(tags, 20).Done(
                        delegate(IEnumerable <Photo> photos) {
                        jQueryObject thumbnailList = jQuery.Select("#thumbsList");
                        thumbnailList.Empty();

                        if (photos == null)
                        {
                            return;
                        }

                        int photoIndex = 0;
                        foreach (Photo photo in photos)
                        {
                            if (photoIndex % 6 == 0)
                            {
                                jQuery.Select("#bigThumbnailTemplate").Plugin <jQueryTemplateObject>()
                                .RenderTemplate(photo)
                                .AppendTo(thumbnailList);
                            }
                            else if ((photoIndex % 3 == 0) || (photo.imageWidth == photo.imageHeight))
                            {
                                jQuery.Select("#sqThumbnailTemplate").Plugin <jQueryTemplateObject>()
                                .RenderTemplate(photo)
                                .AppendTo(thumbnailList);
                            }
                            else if (photo.thumbnailWidth > photo.thumbnailHeight)
                            {
                                jQuery.Select("#horzThumbnailTemplate").Plugin <jQueryTemplateObject>()
                                .RenderTemplate(photo)
                                .AppendTo(thumbnailList);
                            }
                            else
                            {
                                jQuery.Select("#vertThumbnailTemplate").Plugin <jQueryTemplateObject>()
                                .RenderTemplate(photo)
                                .AppendTo(thumbnailList);
                            }

                            photoIndex++;
                        }

                        GridsterOptions gridOptions = new GridsterOptions();
                        gridOptions.Margins         = new int[] { 10, 10 };
                        gridOptions.BaseDimensions  = new int[] { 140, 140 };

                        thumbnailList.Plugin <jQueryGridsterObject>().Gridster(gridOptions)
                        .Find("a")
                        .Plugin <jQueryLightBoxObject>().LightBox();

                        GridsterObject gridster =
                            (GridsterObject)thumbnailList.GetDataValue("gridster");
                        gridster.DisableDragging();
                    });

                    jQuery.FromElement(Document.Body).Focus();
                    e.PreventDefault();
                });
            });
        }
        private void linkFn(dynamic scope, jQueryObject element, object attrs)
        {
            scope["$watch"]("showGrid", new Action(() =>
                                                   {
                                                       if (scope.showGrid)
                                                       {
                                                           element.Show(EffectDuration.Fast);
                                                       }
                                                       else
                                                       {
                                                           element.Hide(EffectDuration.Fast);
                                                       }
                                                   }));

            scope["$watch"]("scale", new Action(() =>
                                                {
                                                    element.Empty();
                                                    var scale = (Point) scope.scale;
                                                    var n = (CanvasElement) Document.CreateElement("canvas");
                                                    var w = scale.X;
                                                    var h = scale.Y;
                                                    n.Width = (int) w + 1;
                                                    n.Height = (int) h + 1;
                                                    var context = (CanvasContext2D) n.GetContext("2d");
                                                    context.StrokeStyle = "#EEEEEE";
                                                    context.LineWidth = 1;
                                                    context.MoveTo(w, 0);
                                                    context.LineTo(w, h);
                                                    context.Stroke();
                                                    context.MoveTo(0, h);
                                                    context.LineTo(w, h);
                                                    context.Stroke();
                                                    var url = (string) ((dynamic) n).toDataURL("image/png");
                                                    element.CSS("background-image", string.Format("url({0})", url));
                                                    element.CSS("background-repeat", "repeat-x repeat-y");
                                                    element.CSS("width", "100%");
                                                    element.CSS("height", "100%");
                                                    element.CSS("margin-left", "auto");
                                                    element.CSS("margin-right", "auto");
                                                    element.CSS("margin-bottom", "auto");
                                                    element.CSS("margin-top", "auto");
                                                    element.ZIndex(-10000);
                                                }), true);
/*
            scope["$watch"]("scale", new Action(() =>
                                                {
                                                    element.Empty();
                                                    var scale = (Point) scope.scale;
                                                    var w = jQueryApi.jQuery.Window.GetWidth();
                                                    var h = jQueryApi.jQuery.Window.GetHeight();

                                                    for (int i = 0; i < (w/scale.X) + 2; i++)
                                                    {
                                                        for (int j = 0; j < (h/scale.Y) + 2; j++)
                                                        {
                                                            element.Append(
                                                                string.Format(
                                                                    "<div style='border:solid 1px black;position:absolute;left:{0}px;top:{1}px;width:{2}px;height:{3}px;'></div>",
                                                                    i*scale.X, j*scale.Y, scale.X, scale.Y));
                                                        }
                                                    }
                                                }), true);
*/
        }