public void ChangeIcon()
 {
     if (_checkAll)
     {
         //change icon
         _thisButton.RemoveClass("glyphicon-chevron-down");
         _thisButton.AddClass("glyphicon-ok");
     }
     else
     {
         _thisButton.RemoveClass("glyphicon-ok");
         _thisButton.AddClass("glyphicon-chevron-down");
     }
 }
Beispiel #2
0
        public static jQuery CreateRadioInput(string id, string label, string[] options)
        {
            jQuery divRadio = new jQuery("<div>");

            divRadio.AddClass("col-sm-10");

            for (int i = 0; i < options.Length; i++)
            {
                divRadio
                .Append(new jQuery("<label>")
                        .AddClass("radio-inline")
                        .Append(new InputElement
                {
                    Type  = InputType.Radio,
                    Id    = id + "-" + i,
                    Name  = id,
                    Value = options[i]
                })
                        .Append(options[i])
                        );
            }

            return(new jQuery("<div>")
                   .AddClass("form-group")
                   .Append(new LabelElement
            {
                ClassName = "control-label col-sm-2",
                HtmlFor = id,
                InnerHTML = label + ":"
            })
                   .Append(divRadio));
        }
Beispiel #3
0
 public static jQuery AddClass(this jQuery root, params string[] classes)
 {
     foreach (var cls in classes)
     {
         root = root.AddClass(cls);
     }
     return(root);
 }
Beispiel #4
0
		void Clicked(jQueryMouseEvent evt) {
			var tr = new jQuery(evt.Target).Closest("tr");
			if(tr.Length == 0)
				return;
			var idx = (int) tr.Data("row-id");
			if(!rowBindings.ContainsKey(idx))
				return;
			var obj = rowBindings[idx];
			Click?.Invoke(this, obj);
			if(Select != null) {
				tr.Parent().Children(".table-row-selected").RemoveClass("table-row-selected");
				tr.AddClass("table-row-selected");
				Select(this, obj);
			}
		}
Beispiel #5
0
        /// <summary>
        /// Add the ui column player container
        /// </summary>
        /// <param name="playerObject"></param>
        public static void AddPlayerContainer(Player playerObject, int playerCount)
        {
            // Get main container
            var scoreboard = jQuery.Select("#" + DiceView.PlayerContainerId);

            // Max 6 item per real row
            var rowIndex = Convert.ToInt32(playerObject.Index / (DiceView.PlayerSlots / DiceView.MinColSizeLg));

            var playerRow = scoreboard.Find(string.Format("[PlayerRowAttribute={0}]", rowIndex));

            if (playerRow.Length <= 0)
            {
                playerRow = new jQuery("<div>")
                            .AddClass("row low-pad")
                            .Attr("PlayerRowAttribute", rowIndex);
                scoreboard.Append(playerRow);

                // correct row heights
                scoreboard.Find("[PlayerRowAttribute]")
                .RemoveClass("fill-height-" + rowIndex)
                .AddClass("fill-height-" + (rowIndex + 1));
            }

            // This is the column
            var playerContainer = new jQuery("<div>");

            playerContainer.Attr(DiceView.PlayerColumnAttribute, playerObject.Index)
            .AddClass("fill-height");
            // Panel with title and scoreboard
            var playerPanel = new jQuery("<div>");

            playerPanel
            .AddClass("panel panel-default low-pad")
            .Attr(DiceView.PlayerPanelAttribute, playerObject.Index)
            .Append(new jQuery("<div>").AddClass("panel-heading low-pad")
                    // Adding title
                    .Append(new jQuery("<h3>").AddClass("panel-title")
                            .Attr("id", DiceView.PlayerPanelTitleBaseId + playerObject.Index)
                            .Append(new jQuery("<span>").AddClass("player-name").Text(playerObject.Name))
                            .Append(new jQuery("<span>").AddClass("glyphicon glyphicon-edit pull-right player-icon")
                                    .On("click", null, playerObject.Index.ToString(), (Action <jQueryEvent>)Ui.ShowRename))))
            // Adding body (scoreboard)
            .Append(new jQuery("<div>").AddClass("panel-body low-pad")
                    .Append(new jQuery("<ul>").AddClass("list-group")
                            .Attr(DiceView.PlayerScoreBoardAttribute, playerObject.Index)))
            // Total in footer
            .Append(new jQuery("<div>").AddClass("panel-footer low-pad")
                    .Append(new jQuery("<h5>")
                            .AddClass("")
                            .Attr(DiceView.PlayerPanelFooterAttribute, playerObject.Index)
                            .Text("Total: 0")));
            // Adding to containers
            playerContainer.Append(playerPanel);
            playerRow.Append(playerContainer);
            // Force wrapping on a new line
            //if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeLg) == 0)
            //{
            //    scoreboard.Append(new jQuery("<div>").AddClass("clearfix visible-lg-block"));
            //}
            // Break into logical rows on small devices
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeMd) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-md-block"));
            }
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeSm) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-sm-block"));
            }
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeXs) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-xs-block"));
            }
            // update columns classes
            Ui.SetColumnClass(playerCount);
        }
Beispiel #6
0
 public void ShowTab(jQuery tab, jQuery page)
 {
     CloseTabs(tab);
     page.AddClass("active");
     tab.Children("header").Children($"a[data-pageid='{page.Attr("data-pageid")}']").AddClass("active");
 }