コード例 #1
0
        public void FormsWidget_AddWidgetToFormDescription_FormIsUpdated()
        {
            var gridVirtualPath = "~/Frontend-Assembly/Telerik.Sitefinity.Frontend/GridSystem/Templates/grid-3+9.html";
            var control = new GridControl();
            control.Layout = gridVirtualPath;
            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var pageManager = PageManager.GetManager();

            try
            {
                var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(template, "Template was not found");

                var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "FormsPageCacheTest", "forms-page-cache-test");
                ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

                string pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);

                Assert.IsTrue(pageContent.Contains("class=\"sf_colsIn four wide column\""), "SemanticUI grid content not found.");

                ServerOperationsFeather.Forms().AddFormWidget(formId, new GridControl() { Layout = "<div class=\"sf_colsIn\">Funny widget.</div>" });
                pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);

                Assert.IsTrue(pageContent.Contains("Funny widget."), "Form did not render the new control.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
コード例 #2
0
        public void FormsWidget_WithGridWidget_AdaptsToPackage()
        {
            var gridVirtualPath = "~/Frontend-Assembly/Telerik.Sitefinity.Frontend/GridSystem/Templates/grid-3+9.html";
            var control = new GridControl();
            control.Layout = gridVirtualPath;
            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var pageManager = PageManager.GetManager();

            try
            {
                var semanticTemplate = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(semanticTemplate, "Template was not found");

                var semanticPageId = FeatherServerOperations.Pages().CreatePageWithTemplate(semanticTemplate, "FormsPageSemantic", "forms-page-semantic");
                ServerOperationsFeather.Forms().AddFormControlToPage(semanticPageId, formId);

                string semanticPageContent = FeatherServerOperations.Pages().GetPageContent(semanticPageId);

                Assert.IsTrue(semanticPageContent.Contains("class=\"sf_colsIn four wide column\""), "SemanticUI grid content not found.");

                var bootstrapTemplate = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "Bootstrap.default" && t.Title == "default");
                Assert.IsNotNull(bootstrapTemplate, "Template was not found");

                var bootstrapPageId = FeatherServerOperations.Pages().CreatePageWithTemplate(bootstrapTemplate, "FormsPageBootstrap", "forms-page-bootstrap");
                ServerOperationsFeather.Forms().AddFormControlToPage(bootstrapPageId, formId);

                string bootstrapPageContent = FeatherServerOperations.Pages().GetPageContent(bootstrapPageId);

                Assert.IsTrue(bootstrapPageContent.Contains("class=\"sf_colsIn col-md-3\""), "Bootstrap grid content not found.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
コード例 #3
0
ファイル: GridWidgetsTests.cs プロジェクト: sbschase/feather
        private void AddGridControlToPage(Guid pageId, string controlPath, string placeHolder, string caption)
        {
            var control = new GridControl();
            control.Layout = controlPath;

            PageContentGenerator.AddControlToPage(pageId, control, caption, placeHolder);
        }
コード例 #4
0
ファイル: GridWidgetsTests.cs プロジェクト: sbschase/feather
        private void AddGridControlToPageTemplate(Guid pageId, string controlPath, string placeHolder, string caption)
        {
            var control = new GridControl();
            control.Layout = controlPath;

            SampleUtilities.AddControlToTemplate(pageId, control, placeHolder, caption);
        }
コード例 #5
0
        private void AddLayoutControls(PageManager pageManager, PageTemplate template, LayoutControlDescription[] layoutControls)
        {
            if (layoutControls == null)
                return;

            var siblingId = Guid.Empty;
            for (int i = 0; i < layoutControls.Length; i++)
            {
                var description = layoutControls[i];
                var layout = new GridControl();
                layout.Layout = description.Path;
                var ctrlData = pageManager.CreateControl<TemplateControl>(isBackendObject: false);
                ctrlData.ObjectType = layout.GetType().FullName;
                ctrlData.PlaceHolder = "Contentplaceholder1";
                ctrlData.SiblingId = siblingId;
                siblingId = ctrlData.Id;
                ctrlData.Caption = description.Caption;
                ctrlData.Description = description.Description;

                pageManager.ReadProperties(layout, ctrlData);
                pageManager.SetControlId(template, ctrlData);

                ctrlData.SetDefaultPermissions(pageManager);
                template.Controls.Add(ctrlData);
            }
        }