Ejemplo n.º 1
0
        public static JObject BuildDefaultSlackHome(string userId, List <string> skilloptions)
        {
            Home homeView = new Home();

            homeView.AddBlock(new Section(new Text(" ")));
            homeView.AddBlock(new Section(new Text(" ")));

            if (skilloptions.Count > 0)
            {
                Section       fields  = new Section();
                List <Option> options = new List <Option>();

                foreach (string option in skilloptions)
                {
                    fields.AddField(option);
                    options.Add(new Option(option, option));
                }

                //add fields array
                homeView.AddBlock(fields);

                homeView.AddBlock(new Divider());

                Section multiStaticSelect = new Section(new Text("Pick one or more skills to be removed"));
                multiStaticSelect.AddAccessory(new MultiLineSelect(options, "deleteSkills_select", "Select items"));
                homeView.AddBlock(multiStaticSelect);
            }

            homeView.AddBlock(new SlackAction("home_actions").AddElement(new Button("addSkills_btn", "Add skills", ButtonStyle.PRIMARY)));

            ViewBuilder builder = new ViewBuilder(userId, homeView);

            return(builder.GetJObject());
        }