├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── README.md ├── SimpleFormGenerator.DataLayer ├── App.config ├── Context │ ├── IUnitOfWork.cs │ └── SimpleFormGeneratorContext.cs ├── Migrations │ ├── 201412031213188_InitialCreate.Designer.cs │ ├── 201412031213188_InitialCreate.cs │ ├── 201412031213188_InitialCreate.resx │ ├── 201412270643411_updates.Designer.cs │ ├── 201412270643411_updates.cs │ ├── 201412270643411_updates.resx │ └── Configuration.cs ├── Properties │ └── AssemblyInfo.cs ├── SimpleFormGenerator.DataLayer.csproj └── packages.config ├── SimpleFormGenerator.DomainClasses ├── Field.cs ├── FieldValidation.cs ├── Form.cs ├── Properties │ └── AssemblyInfo.cs ├── SimpleFormGenerator.DomainClasses.csproj └── Value.cs ├── SimpleFormGenerator.ServiceLayer ├── FieldService.cs ├── FormService.cs ├── IFieldService.cs ├── IFormService.cs ├── IValueService.cs ├── Properties │ └── AssemblyInfo.cs ├── SimpleFormGenerator.ServiceLayer.csproj └── ValueService.cs ├── SimpleFormGenerator.UI ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ └── RouteConfig.cs ├── Content │ ├── Site.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ └── bootstrap.min.css ├── Controllers │ └── DynamicFormController.cs ├── Global.asax ├── Global.asax.cs ├── Project_Readme.html ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-2.1.1.intellisense.js │ ├── jquery-2.1.1.js │ ├── jquery-2.1.1.min.js │ ├── jquery-2.1.1.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.8.3.js │ ├── npm.js │ ├── respond.js │ ├── respond.matchmedia.addListener.js │ ├── respond.matchmedia.addListener.min.js │ └── respond.min.js ├── SimpleFormGenerator.UI.csproj ├── SimpleFormGenerator.UI.csproj.user ├── Views │ ├── DynamicForm │ │ ├── CreateField.cshtml │ │ ├── CreateForm.cshtml │ │ ├── Index.cshtml │ │ └── ShowForm.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff └── packages.config ├── SimpleFormGenerator.sln └── SimpleFormGenerator.v12.suo /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/.nuget/NuGet.exe -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 "$(NuGetExePath)" 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir) " 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SimpleFormGenerator 2 | =================== 3 | 4 | ASP.NET MVC simple form generator 5 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Context/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | 4 | namespace SimpleFormGenerator.DataLayer.Context 5 | { 6 | public interface IUnitOfWork 7 | { 8 | IDbSet Set() where TEntity : class; 9 | int SaveAllChanges(); 10 | void MarkAsChanged(TEntity entity) where TEntity : class; 11 | IList GetRows(string sql, params object[] parameters) where T : class; 12 | } 13 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Context/SimpleFormGeneratorContext.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using SimpleFormGenerator.DomainClasses; 5 | 6 | namespace SimpleFormGenerator.DataLayer.Context 7 | { 8 | public class SimpleFormGeneratorContext : DbContext, IUnitOfWork 9 | { 10 | public SimpleFormGeneratorContext() 11 | : base("SimpleFormGenerator") 12 | { 13 | } 14 | 15 | public DbSet
Forms { get; set; } 16 | public DbSet Fields { get; set; } 17 | public DbSet Values { get; set; } 18 | 19 | 20 | public new IDbSet Set() where TEntity : class 21 | { 22 | return base.Set(); 23 | } 24 | 25 | public int SaveAllChanges() 26 | { 27 | return base.SaveChanges(); 28 | } 29 | 30 | public void MarkAsChanged(TEntity entity) where TEntity : class 31 | { 32 | Entry(entity).State = EntityState.Modified; 33 | } 34 | 35 | public IList GetRows(string sql, params object[] parameters) where T : class 36 | { 37 | return Database.SqlQuery(sql, parameters).ToList(); 38 | } 39 | 40 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 41 | { 42 | base.OnModelCreating(modelBuilder); 43 | 44 | modelBuilder.Entity() 45 | .HasRequired(d => d.Form) 46 | .WithMany() 47 | .HasForeignKey(d => d.FormId) 48 | .WillCascadeOnDelete(false); 49 | } 50 | 51 | protected override void Dispose(bool disposing) 52 | { 53 | base.Dispose(disposing); //فقط تعريف شده تا يك برك پوينت در اينجا قرار داده شود براي آزمايش فراخواني آن 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412031213188_InitialCreate.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | namespace SimpleFormGenerator.DataLayer.Migrations 3 | { 4 | using System.CodeDom.Compiler; 5 | using System.Data.Entity.Migrations; 6 | using System.Data.Entity.Migrations.Infrastructure; 7 | using System.Resources; 8 | 9 | [GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")] 10 | public sealed partial class InitialCreate : IMigrationMetadata 11 | { 12 | private readonly ResourceManager Resources = new ResourceManager(typeof(InitialCreate)); 13 | 14 | string IMigrationMetadata.Id 15 | { 16 | get { return "201412031213188_InitialCreate"; } 17 | } 18 | 19 | string IMigrationMetadata.Source 20 | { 21 | get { return null; } 22 | } 23 | 24 | string IMigrationMetadata.Target 25 | { 26 | get { return Resources.GetString("Target"); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412031213188_InitialCreate.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleFormGenerator.DataLayer.Migrations 2 | { 3 | using System; 4 | using System.Data.Entity.Migrations; 5 | 6 | public partial class InitialCreate : DbMigration 7 | { 8 | public override void Up() 9 | { 10 | CreateTable( 11 | "dbo.Fields", 12 | c => new 13 | { 14 | Id = c.Int(nullable: false, identity: true), 15 | TitleEn = c.String(), 16 | TitleFa = c.String(), 17 | FieldType = c.Int(nullable: false), 18 | FormId = c.Int(nullable: false), 19 | }) 20 | .PrimaryKey(t => t.Id) 21 | .ForeignKey("dbo.Forms", t => t.FormId, cascadeDelete: true) 22 | .Index(t => t.FormId); 23 | 24 | CreateTable( 25 | "dbo.Forms", 26 | c => new 27 | { 28 | Id = c.Int(nullable: false, identity: true), 29 | Title = c.String(), 30 | Page = c.String(), 31 | }) 32 | .PrimaryKey(t => t.Id); 33 | 34 | CreateTable( 35 | "dbo.Values", 36 | c => new 37 | { 38 | Id = c.Int(nullable: false, identity: true), 39 | Val = c.String(), 40 | FieldId = c.Int(nullable: false), 41 | FormId = c.Int(nullable: false), 42 | }) 43 | .PrimaryKey(t => t.Id) 44 | .ForeignKey("dbo.Fields", t => t.FieldId, cascadeDelete: true) 45 | .ForeignKey("dbo.Forms", t => t.FormId) 46 | .Index(t => t.FieldId) 47 | .Index(t => t.FormId); 48 | 49 | } 50 | 51 | public override void Down() 52 | { 53 | DropForeignKey("dbo.Values", "FormId", "dbo.Forms"); 54 | DropForeignKey("dbo.Values", "FieldId", "dbo.Fields"); 55 | DropForeignKey("dbo.Fields", "FormId", "dbo.Forms"); 56 | DropIndex("dbo.Values", new[] { "FormId" }); 57 | DropIndex("dbo.Values", new[] { "FieldId" }); 58 | DropIndex("dbo.Fields", new[] { "FormId" }); 59 | DropTable("dbo.Values"); 60 | DropTable("dbo.Forms"); 61 | DropTable("dbo.Fields"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412031213188_InitialCreate.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | H4sIAAAAAAAEAO1cX28jtxF/L5DvsNintHAk29emiWEluOisVsj5bFi+oG8HapeWiXC56pLrSgj6yfqQj9Sv0CH3H3fJ/as/Vg+He7G5wyFn5seZIWd8//3P79c/bgLqvOCIk5BN3IvRuetg5oU+YauJG4unb75zf/zhqz9c3/jBxvklo3sj6WAm4xP3WYj11XjMvWccID4KiBeFPHwSIy8MxsgPx5fn59+PLy7GGFi4wMtxrh9iJkiA1S/w6zRkHl6LGNHb0MeUp+PwZaG4Oh9QgPkaeXjiLkiwpngWRsHfMMMREmE0eocEeo+2OBoBJ4E3wnXeUoJgcwtMn1wHMRYKJGDrVx85XogoZKvFGgYQfdyuMdA9IcpxKtJVQd5VuvNLKd24mJix8mIuwqAnw4s3qbrG1emDlO7m6gSF3oDixVZKrZQ6cWcEU991qitdTWkkqWoUDqSETSniHPORYnHmtBKe5QACnMl/Z840piKO8IThWESInjn38ZIS72e8fQx/xWzCYkr1/YME8K00AEP3UbjGkdg+4KdUqjmINC7PG1cn5tO0OYnIcybeXLrOB1gcLSnO4aGpZwHS4VRO7N8jIXDEJA+sFGysXlnrkQiKb1i2IEASDpzr3KLNe8xW4nniwo+uMyMb7Gcj6SY+MgLnEyaJKMad1pmhg6+jICDXyFeCgzfSRg1dtvADFLXbo8LjA3ohK2Ue2+5+QZT46it3nQdMkx+fyVrfbEH0KT0YsygMHkJqckkIPj2iaIXB4TyGTVSLMI68PjsG+e27hA8JT17aWzFs7kj7ZtvH9bhwCu2uohBtD06jYPbFffRxHw8xxfs/083nZ5+HJoNh86HJgDwMrOoE7YRQ+PYFlr2j2sFjzT1aHR38NSGj3RkbSLc46kH4htMipdgF4IrFF4T3QTio7Di5VO/k5/AJlPUIKAyZbl8bNo6A/s12BAblRSlT9dnYhjxzNbuQn/qdwziopkRJhjvnM4pWxV1y5+RIEh/wdAIofRzRLYBYB0nZELc4WOIoFfanWAiZ9inVTdxzw2wl6ukz9n5dhpuc/qKZfkZk7EhpL5tp/058OLA59Ztm6nmgIkZK/Odm4ntQ6r/CyM/p/9JM/4B8EubE37YQYy6BlhL/tZl4ES8DUlB/10z9qJ49UtrvTTAnsNUH33IeekRh057gp8e6vOgN851OqV3lGqjfG24Bn2QNiIQDNnH/ZAjWtkZ+w6msUeV8PhpdVDWhSd2iDC24127PFum1TSl3VN7ThVuNgnfsHaZYYOetlzwRTRH3kG+6Z7Ci32UnXdVjKh4CMY5kJER0Cu4VnAdhwozahHlkjWi9EipTOoZ6KWLOvPrlHV5jJqN0vcBdVs3iorlyvkBF6W066QEpPVjWGdIaOQtDpmlf9xNki7ZtwNgrRgdhyrLrI2DKovtOmMoSttcElXQ1LRgopUG7Q0pPnVqd3l48jbnw8UChKe/E/EySqMrKB8wosgczb8yLI0Zq+pHjNDvl6R2lanu5xAKLyp24yJHL7sSAjmV66T3WzkjPGdpYgqBWPgqNLZOViW2z06NRma7ZoVam7Eqk0TY+mVVh0jXNykWxadUAX9fEqsrV4FUCI9B1UZD+WGJRS1261Zpw6ZtNUNAktyVPOoS0pXuxKW1tJtCaC2ibzWDbIK4t+h9QXHXYaqU1QlRbkBokqx6W2qDRIGn2AJD71aIoPU6q0ln1elxTvr6+Res13K61cnY64iySWvb0m0X/im6Q8Bh73FLYzXebrwR+H26/la+wNOx0RiIuZO18ieSDxdQPDLKGKFLjUrOFS4HCNFrmaDNy+XNt4DIL/CPr0Sk0PAOhAxnD1XtfFfHmPNVqgCiKLG+L05DGAavPJepn51VenUU+2JOPrOIafORgdz7aa5XOSRvuwStNcEqMapIeeUgqhjHSIgMSxr2iDLDu8NND4oGAqCUqAyHZxOEw4ExqiPr8ZOR0jKc89gEsZolDXcxknXZAx2E57n14JGUynUUycjL2TUP6/g2cZO39LVwz7zAmVpUkfboa6OnLDQdc9xLRwOek/Hg5HWt05llyvaPDztj09Moy72zuMmp7veqEqYSH/SFB28HQzdU+aAwGfOO2wAQ+UU9Xcy5rkXmtrIvI1VzdxI+RsldJcvTmqXslRb9O0+X2NlQjf05IXAdkfyG+yp23XOBAIXC0+CedUgLnpSC4RYw8YS6Skpx7eX5xWWlbPZ0W0jHnPrVcN4w+0rLFjlDyJ1KlrUX9nsXzSncme0GR94yirwO0+aPObEAH5k68jC5LJf1OnQGKg/EeOGc+3kzc39SUK2f+j0/JrDPnLgLoXjnnzr9bFh7cVfh5QEjv0Nvd5p8GGCydV2cyc+1+rXWfh5lKHWs72UnvSuvBqGe/1+ehda2LavezMfBo9HJmJ+dF99K7MaSBoqmIsFvTx7Deg5pnwP23G7Q+89TUhWuS9yMUhrs2sLxay0o3DO6xS+VoQDm1EvGwVpSOBjoQPNLaa/9GhdN2JHWPU/+HbSUdnUdLI8nxTHwkD9DDwq/dJGJWAWtebst94HVtH8kbyMT1lyFYNUlqakrMLS0hXTpCaldr6IGw9o3Uto1YV7DWka0dJfUNJTbG9gr3azSbmC0CfVpJmnpSTqmNxOgOaBeyXTGv1SkyxG4ljGoFkJPoBulvod3F6dHyYb4Tg2/W/lMDCAqcrAoW8umbYa/klXOaOXsKs+BQ2VFGUrl93mKB4ESht5EgT8gT8NnDnKu/R0r/BOAmWGJ/zu5isY4FiIyDJS39eZMMMk3rq76W8p6v79bKq+5DhNQp4Dv2U0xo8ecWM8sluIaFjF7pq4S0pZCvE6ttzulDyDoyStWXB91HHKwpMON3bIFe8JC9feT4PV4hb5s999czaTdEWe3X7whaRSjgKY9iPvwKGPaDzQ//AxRvr8zbQwAA 122 | 123 | 124 | dbo 125 | 126 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412270643411_updates.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | namespace SimpleFormGenerator.DataLayer.Migrations 3 | { 4 | using System.CodeDom.Compiler; 5 | using System.Data.Entity.Migrations; 6 | using System.Data.Entity.Migrations.Infrastructure; 7 | using System.Resources; 8 | 9 | [GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")] 10 | public sealed partial class updates : IMigrationMetadata 11 | { 12 | private readonly ResourceManager Resources = new ResourceManager(typeof(updates)); 13 | 14 | string IMigrationMetadata.Id 15 | { 16 | get { return "201412270643411_updates"; } 17 | } 18 | 19 | string IMigrationMetadata.Source 20 | { 21 | get { return null; } 22 | } 23 | 24 | string IMigrationMetadata.Target 25 | { 26 | get { return Resources.GetString("Target"); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412270643411_updates.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleFormGenerator.DataLayer.Migrations 2 | { 3 | using System; 4 | using System.Data.Entity.Migrations; 5 | 6 | public partial class updates : DbMigration 7 | { 8 | public override void Up() 9 | { 10 | AlterColumn("dbo.Fields", "TitleEn", c => c.String(nullable: false)); 11 | } 12 | 13 | public override void Down() 14 | { 15 | AlterColumn("dbo.Fields", "TitleEn", c => c.String()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/201412270643411_updates.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | H4sIAAAAAAAEAO1c224bNxB9L9B/WOxTWziS7fSSGFaCRLFaoXFsWE7Qt4DapWUiXK665LoSin5ZH/pJ/YWS3Bt3Se5NF6tBkBebOxzOcA5nhpxx/v37n/OXqwA7DzCiKCQj92Rw7DqQeKGPyGLkxuzuyTP35Yuvvzq/8IOV8yGjeyro+ExCR+49Y8uz4ZB69zAAdBAgLwppeMcGXhgMgR8OT4+Pnw9PToaQs3A5L8c5v4kJQwGUv/BfxyHx4JLFAF+GPsQ0HedfZpKr8w4EkC6BB0fuDAVLDCdhFPwMCYwAC6PBG8DAW7CG0YBzYnDFXOcVRoALN4P4znUAISEDjIt+9p7CGYtCspgt+QDAt+sl5HR3AFOYqnRWkLfV7vhUaDcsJmasvJiyMOjI8ORpul3D6vRem+7m28k39IJvPFsLreWmjtwJgth3nepKZ2McCSrLhnNSRMYYUArpQLI4choJj3IAcZyJf0fOOMYsjuCIwJhFAB851/EcI+9XuL4NP0EyIjHGqvxcA/6tNMCHrqNwCSO2voF3qVZTrtKwPG9YnZhPU+YkKk8Je3rqOu/44mCOYQ4PZXtmXDuY6gn9a8AYjIjgAeUGa6tX1rpFDMMLki3IIckPnOtcgtVbSBbsfuTyH11nglbQz0ZSId4TxM8nn8SiGBqEbLHwBGxh4fp1JCbEGvlK/CQOlNGOcgtYNRuowuMdeEALaS+TdB8ARr78Sl3nBuLkx3u0VIUtiD6mJ2UShcFNiHUuCcHHWxAtIPdAt2Ed1SyMI6+LxFx/s5T8Q8KTlmQrhnWJlG8mOc6HhZdo9h2FalvwIgWzL/6kiz+5iTHc/pmuPz/bPDQZDOsPTQbkfmCVJ2gjhPJvX2DZOcztPNZcg8XewW8JGc3OWEO6wVH3wjc/LUKLTQAuWXxBeBeE8y3bTy7VOfnZfQJlPAISQ7rbV4a1I6B+Mx2BXnlRylR+1sQQZ84ihfjU7RzGQTUlSjLcKZ1gsCgulxsnR4J4h6eTg9KHEV5zEKsgKRviEgZzGKXKvo4ZE2mf3LqRe6yZrUQ9vofep3m4yulP6uknSMSOlPa0nvYX5PMDm1M/raeeBjJipMTf1xNf8039I4z8nP6Hevob4KMwJ/6xgRhSAbSU+Kd64lk8D1BB/aye+la+g6S0z3UwJ7BVB19RGnpIYtOc4KfHurzoBfGdVqld5Rqo3hsuOT7RkiOSH7CR+52mWNMa+Q2nskaV8/FgcFLdCUXrhs1QgrtVPFOkV4SS7qgs04lbjYJX5A3EkEHnlZe8GY0B9YCvu2duRb+NJG23R994HohhJCIhwGPuXrnzQITpURsRDy0Btm9CZUrLUC9UzJlXv7yBS0hElLYr3GbVLC7qK+cLVDa9aU86QEoNljZDGiNnYcg07Wt/gkzRtgkYW8VoL0wZpN4Dpgx73wpTWcL2mKASrqYBA6U0aHNIqalTo9PbiqfRF94fKJTNOzA/kySqohTCZxTZg5435tUSLTV9T2GandL0jlK1vVhiBlnlTlzkyGV3okHHML30HmtmpOYMTSy5okY+Eo0Nk6WJTbPTo1GZrtjBqlN2JVJoa5/MqjBpm2blqph2VQNf28SqylXjVQIjp2uzQepjiWFbbOlWY8KlCpugoE5vQ560C21L92JdW2sm0JgLKMJmsK1R1xT9d6iuPGxWbbUQ1RSkeumqhqUmaNRomj0A5H61qFIPkzJ1Vs4eWurZ55dgueS3a6W+nY44s6S4PX4y617iDRIeQ48aKr25tPlK3O/z22/lK1+aSzpBEWWimD4H4sFi7AcaWU0UsbjUbOFSoNCNljnajFz8bA1cesV/YDw6xQ5PuNKBiOHyva+KeH2e7D0AGESGt8VxiOOA2HMJ++y87KuyyAc78hFVXI2PGGzPR3mtUjkpwx14pQlOiZEl6RGHpGIYLS3SIKHdK8oAaw8/NSTuCIhKotITknUcdgPOpIaozk9GDsd40mPvwGKGONTGTMZpO3QchuPehUdSJlNZJCMHY980pG/fwEnW3t3Clnm7MbGsJKnT5UBHX645YNtLRA2fg/Lj5XSs1plnyfWGDjtj09Eri7yzvsuo6fWqFaYSHuaHBEWCvsJZHzR6A75WLG4CH8mnqykVtci8VtZG5WquruNHS9mrJDl689S9kqKfp+lyc1+qlj8nJK7DdX9Avsyd15TBQCJwMPsdjzHi56UguAQE3UHKkpKce3p8clrpYz2cntIhpT42XDe0xtKyxfZQ8kdiSxuL+n26Jot2TfIAIu8eRN8EYPXtpi2YVma92iyl+hu1BkgO2oPglPhwNXL/lFPOnOlvH5NZR85VxLF75hw7fzUs3Lut8PPAkNqit7nNP/YwWDrPZjJ97W69dZ+HmUotaxvZSW1L68CoY8PX57HrShvV5mej59Ho5MwOzotupXmjTwdFXRVhs66Pfs0HlnfA7fcbNL7zWArDlux9D5Xhth0sj9az0g6DW2xT2RtQDq1G3K8XpaWBdgSPtPjavVPhsB2J7XXqf9hX0tJ5NHSS7M/Ee/IAHSz82F0iehnQ8nRbbgS39X0kjyAj15+H3KpJUmOpMTf0hLRpCbGuVtMEYWwcsfaNGFcwFpKNLSX2jhITY3OJ+zG6TfQegS69JHVNKYfUR6K1BzQr2bwxj9Uq0sduJYwqFZCDaAfpbqHN1enQ86E/FHPfrPw3BzwoULQoWIi3bwK9klfOaabkLsyCQ0WijKRy+7yEDPATBV5FDN0Bj/HPHqRU/kFS+jcAF8Ec+lNyFbNlzLjKMJjj0t83iSBTt75sbCnLfH61lF51GyqkTgFekdcxwsXfW0wMl2ALCxG90lcJYUsmXicW65zTu5C0ZJRuXx50b2GwxJwZvSIz8AD7yPaewrdwAbx19t5vZ9JsiPK2n79BYBGBgKY8ivn8V45hP1i9+A/Y39h07UMAAA== 122 | 123 | 124 | dbo 125 | 126 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleFormGenerator.DataLayer.Migrations 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.Data.Entity.Migrations; 6 | using System.Linq; 7 | 8 | internal sealed class Configuration : DbMigrationsConfiguration 9 | { 10 | public Configuration() 11 | { 12 | AutomaticMigrationsEnabled = true; 13 | ContextKey = "SimpleFormGenerator.DataLayer.Context.SimpleFormGeneratorContext"; 14 | } 15 | 16 | protected override void Seed(SimpleFormGenerator.DataLayer.Context.SimpleFormGeneratorContext context) 17 | { 18 | // This method will be called after migrating to the latest version. 19 | 20 | // You can use the DbSet.AddOrUpdate() helper extension method 21 | // to avoid creating duplicate seed data. E.g. 22 | // 23 | // context.People.AddOrUpdate( 24 | // p => p.FullName, 25 | // new Person { FullName = "Andrew Peters" }, 26 | // new Person { FullName = "Brice Lambson" }, 27 | // new Person { FullName = "Rowan Miller" } 28 | // ); 29 | // 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimpleFormGenerator.DataLayer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SimpleFormGenerator.DataLayer")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7f550441-bc97-4a76-895b-23b449ba766a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/SimpleFormGenerator.DataLayer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7002C347-53D5-4740-AA88-B3160824D6FF} 8 | Library 9 | Properties 10 | SimpleFormGenerator.DataLayer 11 | SimpleFormGenerator.DataLayer 12 | v4.5.1 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll 37 | 38 | 39 | ..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 201412031213188_InitialCreate.cs 56 | 57 | 58 | 59 | 201412270643411_updates.cs 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8} 71 | SimpleFormGenerator.DomainClasses 72 | 73 | 74 | 75 | 76 | 201412031213188_InitialCreate.cs 77 | 78 | 79 | 201412270643411_updates.cs 80 | 81 | 82 | 83 | 84 | 85 | 86 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 87 | 88 | 89 | 90 | 97 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DataLayer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/Field.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace SimpleFormGenerator.DomainClasses 5 | { 6 | public class Field 7 | { 8 | public int Id { get; set; } 9 | [Required(ErrorMessage = "عنوان را وارد نمائید")] 10 | public string TitleEn { get; set; } 11 | public string TitleFa { get; set; } 12 | public FieldType FieldType { get; set; } 13 | 14 | public virtual Form Form { get; set; } 15 | public int FormId { get; set; } 16 | 17 | public virtual ICollection FieldValidations { get; set; } 18 | 19 | 20 | 21 | } 22 | 23 | public enum FieldType 24 | { 25 | Button, 26 | Checkbox, 27 | File, 28 | Hidden, 29 | Image, 30 | Password, 31 | Radio, 32 | Reset, 33 | Submit, 34 | Text 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/FieldValidation.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleFormGenerator.DomainClasses 2 | { 3 | public class FieldValidation 4 | { 5 | public int Id { get; set; } 6 | public string Rule { get; set; } 7 | public virtual Field Field { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/Form.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimpleFormGenerator.DomainClasses 4 | { 5 | public class Form 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Title { get; set; } 10 | public string Page { get; set; } 11 | public virtual ICollection Fields { get; set; } 12 | 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimpleFormGenerator.DomainClasses")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SimpleFormGenerator.DomainClasses")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("051453d0-9deb-493a-b324-367822a3ba46")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/SimpleFormGenerator.DomainClasses.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8} 8 | Library 9 | Properties 10 | SimpleFormGenerator.DomainClasses 11 | SimpleFormGenerator.DomainClasses 12 | v4.5.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /SimpleFormGenerator.DomainClasses/Value.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | namespace SimpleFormGenerator.DomainClasses 4 | { 5 | public class Value 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Val { get; set; } 10 | 11 | 12 | 13 | public virtual Field Field { get; set; } 14 | [ForeignKey("Field")] 15 | public int FieldId { get; set; } 16 | 17 | 18 | 19 | public virtual Form Form { get; set; } 20 | [ForeignKey("Form")] 21 | public int FormId { get; set; } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/FieldService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using SimpleFormGenerator.DataLayer.Context; 5 | using SimpleFormGenerator.DomainClasses; 6 | 7 | namespace SimpleFormGenerator.ServiceLayer 8 | { 9 | public class FieldService : IFieldService 10 | { 11 | private readonly IUnitOfWork _uow; 12 | private readonly IDbSet _fields; 13 | 14 | public FieldService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _fields = uow.Set(); 18 | } 19 | 20 | public void AddField(Field field) 21 | { 22 | _fields.Add(field); 23 | } 24 | 25 | public IList GetFields() 26 | { 27 | return _fields.ToList(); 28 | } 29 | 30 | public List GetFieldByFormId(int formId) 31 | { 32 | return _fields.Where(x => x.FormId == formId).ToList(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/FormService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using SimpleFormGenerator.DataLayer.Context; 5 | using SimpleFormGenerator.DomainClasses; 6 | 7 | namespace SimpleFormGenerator.ServiceLayer 8 | { 9 | public class FormService : IFormService 10 | { 11 | private readonly IUnitOfWork _uow; 12 | private readonly IDbSet _form; 13 | 14 | public FormService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _form = _uow.Set(); 18 | } 19 | 20 | public void AddForm(Form form) 21 | { 22 | _form.Add(form); 23 | } 24 | 25 | public IList GetForms() 26 | { 27 | return _form.ToList(); 28 | } 29 | 30 | public Form GetForm(int formId) 31 | { 32 | return _form.Find(formId); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/IFieldService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimpleFormGenerator.DomainClasses; 3 | 4 | namespace SimpleFormGenerator.ServiceLayer 5 | { 6 | public interface IFieldService 7 | { 8 | void AddField(Field field); 9 | IList GetFields(); 10 | 11 | List GetFieldByFormId(int formId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/IFormService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimpleFormGenerator.DomainClasses; 3 | 4 | namespace SimpleFormGenerator.ServiceLayer 5 | { 6 | public interface IFormService 7 | { 8 | void AddForm(Form form); 9 | IList GetForms(); 10 | 11 | Form GetForm(int formId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/IValueService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimpleFormGenerator.DomainClasses; 3 | 4 | namespace SimpleFormGenerator.ServiceLayer 5 | { 6 | public interface IValueService 7 | { 8 | void AddValue(Value value); 9 | IList GetValues(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimpleFormGenerator.ServiceLayer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SimpleFormGenerator.ServiceLayer")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1990695d-ccff-4180-b490-889d03955663")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/SimpleFormGenerator.ServiceLayer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {596E4E08-C349-417F-850B-FD8170C18AE8} 8 | Library 9 | Properties 10 | SimpleFormGenerator.ServiceLayer 11 | SimpleFormGenerator.ServiceLayer 12 | v4.5.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {7002C347-53D5-4740-AA88-B3160824D6FF} 56 | SimpleFormGenerator.DataLayer 57 | 58 | 59 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8} 60 | SimpleFormGenerator.DomainClasses 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /SimpleFormGenerator.ServiceLayer/ValueService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using SimpleFormGenerator.DataLayer.Context; 5 | using SimpleFormGenerator.DomainClasses; 6 | 7 | namespace SimpleFormGenerator.ServiceLayer 8 | { 9 | 10 | 11 | public class ValueService : IValueService 12 | { 13 | private readonly IUnitOfWork _uow; 14 | private readonly IDbSet _values; 15 | 16 | public ValueService(IUnitOfWork uow) 17 | { 18 | _uow = uow; 19 | _values = _uow.Set(); 20 | } 21 | 22 | public void AddValue(Value value) 23 | { 24 | _values.Add(value); 25 | } 26 | 27 | public IList GetValues() 28 | { 29 | return _values.ToList(); 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace SimpleFormGenerator.UI 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | 30 | // Set EnableOptimizations to false for debugging. For more information, 31 | // visit http://go.microsoft.com/fwlink/?LinkId=301862 32 | BundleTable.EnableOptimizations = true; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace SimpleFormGenerator.UI 4 | { 5 | public class FilterConfig 6 | { 7 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 8 | { 9 | filters.Add(new HandleErrorAttribute()); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using System.Web.Routing; 3 | 4 | namespace SimpleFormGenerator.UI 5 | { 6 | public class RouteConfig 7 | { 8 | public static void RegisterRoutes(RouteCollection routes) 9 | { 10 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 11 | 12 | routes.MapRoute("Default", "{controller}/{action}/{id}", 13 | new {controller = "DynamicForm", action = "Index", id = UrlParameter.Optional} 14 | ); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | .ra-well-title { 19 | line-height: 1.2857em; 20 | border-bottom: 1px solid #e7e7e7; 21 | margin: -5px -19px 0.8333em; 22 | padding: 0 19px 0.7222em; 23 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Content/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.1 (http://getbootstrap.com) 3 | * Copyright 2011-2014 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */.btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-default .badge,.btn-primary .badge,.btn-success .badge,.btn-info .badge,.btn-warning .badge,.btn-danger .badge{text-shadow:none}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:hover,.btn-primary:focus{background-color:#265a88;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#265a88;border-color:#245580}.btn-primary:disabled,.btn-primary[disabled]{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:hover .badge,.list-group-item.active:focus .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Controllers/DynamicFormController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Web.Mvc; 3 | using SimpleFormGenerator.DataLayer.Context; 4 | using SimpleFormGenerator.DomainClasses; 5 | using SimpleFormGenerator.ServiceLayer; 6 | 7 | namespace SimpleFormGenerator.UI.Controllers 8 | { 9 | public class DynamicFormController : Controller 10 | { 11 | readonly IFormService _formService; 12 | readonly IFieldService _fieldService; 13 | readonly IValueService _valueService; 14 | readonly IUnitOfWork _uow; 15 | 16 | public DynamicFormController(IFormService formService, IUnitOfWork uow, IFieldService fieldService, IValueService valueService) 17 | { 18 | _formService = formService; 19 | _uow = uow; 20 | _fieldService = fieldService; 21 | _valueService = valueService; 22 | } 23 | 24 | public ActionResult Index() 25 | { 26 | var forms = _formService.GetForms(); 27 | return View(forms); 28 | } 29 | 30 | public ActionResult CreateField() 31 | { 32 | ViewBag.FormList = new SelectList(_formService.GetForms(), "Id", "Title"); 33 | ViewBag.FormTitle = "ایجاد فیلد"; 34 | return View(); 35 | } 36 | [HttpPost] 37 | public ActionResult CreateField(Field field) 38 | { 39 | if (ModelState.IsValid) 40 | { 41 | _fieldService.AddField(field); 42 | _uow.SaveAllChanges(); 43 | } 44 | return RedirectToAction("Index"); 45 | } 46 | 47 | public ActionResult CreateForm() 48 | { 49 | ViewBag.FormTitle = "ایجاد یک فرم جدید"; 50 | return View(); 51 | } 52 | [HttpPost] 53 | public ActionResult CreateForm(Form form) 54 | { 55 | if (ModelState.IsValid) 56 | { 57 | _formService.AddForm(form); 58 | _uow.SaveAllChanges(); 59 | } 60 | return RedirectToAction("Index"); 61 | } 62 | 63 | public ActionResult ShowForm(int id) 64 | { 65 | var field = _fieldService.GetFieldByFormId(id); 66 | ViewBag.FormTitle = _formService.GetForm(id).Title; 67 | ViewBag.FormId = id; 68 | return View(field); 69 | } 70 | 71 | [HttpPost] 72 | public ActionResult ShowForm(IEnumerable values) 73 | { 74 | if (!ModelState.IsValid) return View(values); 75 | foreach (var value in values) 76 | { 77 | _valueService.AddValue(new Value { Val = value.TitleEn, FormId = value.FormId, FieldId = value.Id }); 78 | _uow.SaveAllChanges(); 79 | } 80 | return View(values); 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="SimpleFormGenerator.UI.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | using SimpleFormGenerator.DataLayer.Context; 10 | using SimpleFormGenerator.ServiceLayer; 11 | using StructureMap; 12 | using StructureMap.Web; 13 | using StructureMap.Web.Pipeline; 14 | 15 | namespace SimpleFormGenerator.UI 16 | { 17 | public class MvcApplication : System.Web.HttpApplication 18 | { 19 | protected void Application_Start() 20 | { 21 | AreaRegistration.RegisterAllAreas(); 22 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 23 | RouteConfig.RegisterRoutes(RouteTable.Routes); 24 | BundleConfig.RegisterBundles(BundleTable.Bundles); 25 | 26 | InitStructureMap(); 27 | } 28 | protected void Application_EndRequest(object sender, EventArgs e) 29 | { 30 | HttpContextLifecycle.DisposeAndClearAll(); 31 | } 32 | 33 | private void InitStructureMap() 34 | { 35 | ObjectFactory.Initialize(x => 36 | { 37 | x.For().HybridHttpOrThreadLocalScoped().Use(() => new SimpleFormGeneratorContext()); 38 | x.For().Use(); 39 | x.For().Use(); 40 | x.For().Use(); 41 | }); 42 | ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); 43 | } 44 | } 45 | public class StructureMapControllerFactory : DefaultControllerFactory 46 | { 47 | protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) 48 | { 49 | if (controllerType == null && requestContext.HttpContext.Request.Url != null) 50 | throw new InvalidOperationException(string.Format("Page not found: {0}", 51 | requestContext.HttpContext.Request.Url.AbsoluteUri.ToString(CultureInfo.InvariantCulture))); 52 | return ObjectFactory.GetInstance(controllerType) as Controller; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Project_Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Your ASP.NET application 6 | 95 | 96 | 97 | 98 | 102 | 103 |
104 |
105 |

This application consists of:

106 |
    107 |
  • Sample pages showing basic nav between Home, About, and Contact
  • 108 |
  • Theming using Bootstrap
  • 109 |
  • Authentication, if selected, shows how to register and sign in
  • 110 |
  • ASP.NET features managed using NuGet
  • 111 |
112 |
113 | 114 | 131 | 132 |
133 |

Deploy

134 | 139 |
140 | 141 |
142 |

Get help

143 | 147 |
148 |
149 | 150 | 151 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimpleFormGenerator.UI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SimpleFormGenerator.UI")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c44bb2e8-c5d5-4692-8cb1-9f4db6ad2727")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/jquery.validate.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 2 | * http://jqueryvalidation.org/ 3 | * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ 4 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+"")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})}); -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/jquery.validate.unobtrusive.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | 20 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 21 | /*global document: false, jQuery: false */ 22 | 23 | (function ($) { 24 | var $jQval = $.validator, 25 | adapters, 26 | data_validation = "unobtrusiveValidation"; 27 | 28 | function setValidationValues(options, ruleName, value) { 29 | options.rules[ruleName] = value; 30 | if (options.message) { 31 | options.messages[ruleName] = options.message; 32 | } 33 | } 34 | 35 | function splitAndTrim(value) { 36 | return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); 37 | } 38 | 39 | function escapeAttributeValue(value) { 40 | // As mentioned on http://api.jquery.com/category/selectors/ 41 | return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); 42 | } 43 | 44 | function getModelPrefix(fieldName) { 45 | return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); 46 | } 47 | 48 | function appendModelPrefix(value, prefix) { 49 | if (value.indexOf("*.") === 0) { 50 | value = value.replace("*.", prefix); 51 | } 52 | return value; 53 | } 54 | 55 | function onError(error, inputElement) { // 'this' is the form element 56 | var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), 57 | replaceAttrValue = container.attr("data-valmsg-replace"), 58 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null; 59 | 60 | container.removeClass("field-validation-valid").addClass("field-validation-error"); 61 | error.data("unobtrusiveContainer", container); 62 | 63 | if (replace) { 64 | container.empty(); 65 | error.removeClass("input-validation-error").appendTo(container); 66 | } 67 | else { 68 | error.hide(); 69 | } 70 | } 71 | 72 | function onErrors(event, validator) { // 'this' is the form element 73 | var container = $(this).find("[data-valmsg-summary=true]"), 74 | list = container.find("ul"); 75 | 76 | if (list && list.length && validator.errorList.length) { 77 | list.empty(); 78 | container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); 79 | 80 | $.each(validator.errorList, function () { 81 | $("
  • ").html(this.message).appendTo(list); 82 | }); 83 | } 84 | } 85 | 86 | function onSuccess(error) { // 'this' is the form element 87 | var container = error.data("unobtrusiveContainer"), 88 | replaceAttrValue = container.attr("data-valmsg-replace"), 89 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null; 90 | 91 | if (container) { 92 | container.addClass("field-validation-valid").removeClass("field-validation-error"); 93 | error.removeData("unobtrusiveContainer"); 94 | 95 | if (replace) { 96 | container.empty(); 97 | } 98 | } 99 | } 100 | 101 | function onReset(event) { // 'this' is the form element 102 | var $form = $(this); 103 | $form.data("validator").resetForm(); 104 | $form.find(".validation-summary-errors") 105 | .addClass("validation-summary-valid") 106 | .removeClass("validation-summary-errors"); 107 | $form.find(".field-validation-error") 108 | .addClass("field-validation-valid") 109 | .removeClass("field-validation-error") 110 | .removeData("unobtrusiveContainer") 111 | .find(">*") // If we were using valmsg-replace, get the underlying error 112 | .removeData("unobtrusiveContainer"); 113 | } 114 | 115 | function validationInfo(form) { 116 | var $form = $(form), 117 | result = $form.data(data_validation), 118 | onResetProxy = $.proxy(onReset, form), 119 | defaultOptions = $jQval.unobtrusive.options || {}, 120 | execInContext = function (name, args) { 121 | var func = defaultOptions[name]; 122 | func && $.isFunction(func) && func.apply(form, args); 123 | } 124 | 125 | if (!result) { 126 | result = { 127 | options: { // options structure passed to jQuery Validate's validate() method 128 | errorClass: defaultOptions.errorClass || "input-validation-error", 129 | errorElement: defaultOptions.errorElement || "span", 130 | errorPlacement: function () { 131 | onError.apply(form, arguments); 132 | execInContext("errorPlacement", arguments); 133 | }, 134 | invalidHandler: function () { 135 | onErrors.apply(form, arguments); 136 | execInContext("invalidHandler", arguments); 137 | }, 138 | messages: {}, 139 | rules: {}, 140 | success: function () { 141 | onSuccess.apply(form, arguments); 142 | execInContext("success", arguments); 143 | } 144 | }, 145 | attachValidation: function () { 146 | $form 147 | .off("reset." + data_validation, onResetProxy) 148 | .on("reset." + data_validation, onResetProxy) 149 | .validate(this.options); 150 | }, 151 | validate: function () { // a validation function that is called by unobtrusive Ajax 152 | $form.validate(); 153 | return $form.valid(); 154 | } 155 | }; 156 | $form.data(data_validation, result); 157 | } 158 | 159 | return result; 160 | } 161 | 162 | $jQval.unobtrusive = { 163 | adapters: [], 164 | 165 | parseElement: function (element, skipAttach) { 166 | /// 167 | /// Parses a single HTML element for unobtrusive validation attributes. 168 | /// 169 | /// The HTML element to be parsed. 170 | /// [Optional] true to skip attaching the 171 | /// validation to the form. If parsing just this single element, you should specify true. 172 | /// If parsing several elements, you should specify false, and manually attach the validation 173 | /// to the form when you are finished. The default is false. 174 | var $element = $(element), 175 | form = $element.parents("form")[0], 176 | valInfo, rules, messages; 177 | 178 | if (!form) { // Cannot do client-side validation without a form 179 | return; 180 | } 181 | 182 | valInfo = validationInfo(form); 183 | valInfo.options.rules[element.name] = rules = {}; 184 | valInfo.options.messages[element.name] = messages = {}; 185 | 186 | $.each(this.adapters, function () { 187 | var prefix = "data-val-" + this.name, 188 | message = $element.attr(prefix), 189 | paramValues = {}; 190 | 191 | if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy) 192 | prefix += "-"; 193 | 194 | $.each(this.params, function () { 195 | paramValues[this] = $element.attr(prefix + this); 196 | }); 197 | 198 | this.adapt({ 199 | element: element, 200 | form: form, 201 | message: message, 202 | params: paramValues, 203 | rules: rules, 204 | messages: messages 205 | }); 206 | } 207 | }); 208 | 209 | $.extend(rules, { "__dummy__": true }); 210 | 211 | if (!skipAttach) { 212 | valInfo.attachValidation(); 213 | } 214 | }, 215 | 216 | parse: function (selector) { 217 | /// 218 | /// Parses all the HTML elements in the specified selector. It looks for input elements decorated 219 | /// with the [data-val=true] attribute value and enables validation according to the data-val-* 220 | /// attribute values. 221 | /// 222 | /// Any valid jQuery selector. 223 | 224 | // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one 225 | // element with data-val=true 226 | var $selector = $(selector), 227 | $forms = $selector.parents() 228 | .addBack() 229 | .filter("form") 230 | .add($selector.find("form")) 231 | .has("[data-val=true]"); 232 | 233 | $selector.find("[data-val=true]").each(function () { 234 | $jQval.unobtrusive.parseElement(this, true); 235 | }); 236 | 237 | $forms.each(function () { 238 | var info = validationInfo(this); 239 | if (info) { 240 | info.attachValidation(); 241 | } 242 | }); 243 | } 244 | }; 245 | 246 | adapters = $jQval.unobtrusive.adapters; 247 | 248 | adapters.add = function (adapterName, params, fn) { 249 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation. 250 | /// The name of the adapter to be added. This matches the name used 251 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 252 | /// [Optional] An array of parameter names (strings) that will 253 | /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and 254 | /// mmmm is the parameter name). 255 | /// The function to call, which adapts the values from the HTML 256 | /// attributes into jQuery Validate rules and/or messages. 257 | /// 258 | if (!fn) { // Called with no params, just a function 259 | fn = params; 260 | params = []; 261 | } 262 | this.push({ name: adapterName, params: params, adapt: fn }); 263 | return this; 264 | }; 265 | 266 | adapters.addBool = function (adapterName, ruleName) { 267 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 268 | /// the jQuery Validate validation rule has no parameter values. 269 | /// The name of the adapter to be added. This matches the name used 270 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 271 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 272 | /// of adapterName will be used instead. 273 | /// 274 | return this.add(adapterName, function (options) { 275 | setValidationValues(options, ruleName || adapterName, true); 276 | }); 277 | }; 278 | 279 | adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { 280 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 281 | /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and 282 | /// one for min-and-max). The HTML parameters are expected to be named -min and -max. 283 | /// The name of the adapter to be added. This matches the name used 284 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 285 | /// The name of the jQuery Validate rule to be used when you only 286 | /// have a minimum value. 287 | /// The name of the jQuery Validate rule to be used when you only 288 | /// have a maximum value. 289 | /// The name of the jQuery Validate rule to be used when you 290 | /// have both a minimum and maximum value. 291 | /// [Optional] The name of the HTML attribute that 292 | /// contains the minimum value. The default is "min". 293 | /// [Optional] The name of the HTML attribute that 294 | /// contains the maximum value. The default is "max". 295 | /// 296 | return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { 297 | var min = options.params.min, 298 | max = options.params.max; 299 | 300 | if (min && max) { 301 | setValidationValues(options, minMaxRuleName, [min, max]); 302 | } 303 | else if (min) { 304 | setValidationValues(options, minRuleName, min); 305 | } 306 | else if (max) { 307 | setValidationValues(options, maxRuleName, max); 308 | } 309 | }); 310 | }; 311 | 312 | adapters.addSingleVal = function (adapterName, attribute, ruleName) { 313 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 314 | /// the jQuery Validate validation rule has a single value. 315 | /// The name of the adapter to be added. This matches the name used 316 | /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name). 317 | /// [Optional] The name of the HTML attribute that contains the value. 318 | /// The default is "val". 319 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 320 | /// of adapterName will be used instead. 321 | /// 322 | return this.add(adapterName, [attribute || "val"], function (options) { 323 | setValidationValues(options, ruleName || adapterName, options.params[attribute]); 324 | }); 325 | }; 326 | 327 | $jQval.addMethod("__dummy__", function (value, element, params) { 328 | return true; 329 | }); 330 | 331 | $jQval.addMethod("regex", function (value, element, params) { 332 | var match; 333 | if (this.optional(element)) { 334 | return true; 335 | } 336 | 337 | match = new RegExp(params).exec(value); 338 | return (match && (match.index === 0) && (match[0].length === value.length)); 339 | }); 340 | 341 | $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { 342 | var match; 343 | if (nonalphamin) { 344 | match = value.match(/\W/g); 345 | match = match && match.length >= nonalphamin; 346 | } 347 | return match; 348 | }); 349 | 350 | if ($jQval.methods.extension) { 351 | adapters.addSingleVal("accept", "mimtype"); 352 | adapters.addSingleVal("extension", "extension"); 353 | } else { 354 | // for backward compatibility, when the 'extension' validation method does not exist, such as with versions 355 | // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for 356 | // validating the extension, and ignore mime-type validations as they are not supported. 357 | adapters.addSingleVal("extension", "extension", "accept"); 358 | } 359 | 360 | adapters.addSingleVal("regex", "pattern"); 361 | adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); 362 | adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); 363 | adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength"); 364 | adapters.add("equalto", ["other"], function (options) { 365 | var prefix = getModelPrefix(options.element.name), 366 | other = options.params.other, 367 | fullOtherName = appendModelPrefix(other, prefix), 368 | element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; 369 | 370 | setValidationValues(options, "equalTo", element); 371 | }); 372 | adapters.add("required", function (options) { 373 | // jQuery Validate equates "required" with "mandatory" for checkbox elements 374 | if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { 375 | setValidationValues(options, "required", true); 376 | } 377 | }); 378 | adapters.add("remote", ["url", "type", "additionalfields"], function (options) { 379 | var value = { 380 | url: options.params.url, 381 | type: options.params.type || "GET", 382 | data: {} 383 | }, 384 | prefix = getModelPrefix(options.element.name); 385 | 386 | $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { 387 | var paramName = appendModelPrefix(fieldName, prefix); 388 | value.data[paramName] = function () { 389 | return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val(); 390 | }; 391 | }); 392 | 393 | setValidationValues(options, "remote", value); 394 | }); 395 | adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { 396 | if (options.params.min) { 397 | setValidationValues(options, "minlength", options.params.min); 398 | } 399 | if (options.params.nonalphamin) { 400 | setValidationValues(options, "nonalphamin", options.params.nonalphamin); 401 | } 402 | if (options.params.regex) { 403 | setValidationValues(options, "regex", options.params.regex); 404 | } 405 | }); 406 | 407 | $(function () { 408 | $jQval.unobtrusive.parse(document); 409 | }); 410 | }(jQuery)); -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this);b.data("validator").resetForm();b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){return a(b.form).find(":input").filter("[name='"+f(c)+"']").val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/respond.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | (function(w) { 4 | "use strict"; 5 | w.matchMedia = w.matchMedia || function(doc, undefined) { 6 | var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); 7 | div.id = "mq-test-1"; 8 | div.style.cssText = "position:absolute;top:-100em"; 9 | fakeBody.style.background = "none"; 10 | fakeBody.appendChild(div); 11 | return function(q) { 12 | div.innerHTML = '­'; 13 | docElem.insertBefore(fakeBody, refNode); 14 | bool = div.offsetWidth === 42; 15 | docElem.removeChild(fakeBody); 16 | return { 17 | matches: bool, 18 | media: q 19 | }; 20 | }; 21 | }(w.document); 22 | })(this); 23 | 24 | /*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ 25 | (function(w) { 26 | "use strict"; 27 | var respond = {}; 28 | w.respond = respond; 29 | respond.update = function() {}; 30 | var requestQueue = [], xmlHttp = function() { 31 | var xmlhttpmethod = false; 32 | try { 33 | xmlhttpmethod = new w.XMLHttpRequest(); 34 | } catch (e) { 35 | xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); 36 | } 37 | return function() { 38 | return xmlhttpmethod; 39 | }; 40 | }(), ajax = function(url, callback) { 41 | var req = xmlHttp(); 42 | if (!req) { 43 | return; 44 | } 45 | req.open("GET", url, true); 46 | req.onreadystatechange = function() { 47 | if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { 48 | return; 49 | } 50 | callback(req.responseText); 51 | }; 52 | if (req.readyState === 4) { 53 | return; 54 | } 55 | req.send(null); 56 | }; 57 | respond.ajax = ajax; 58 | respond.queue = requestQueue; 59 | respond.regex = { 60 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, 61 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, 62 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, 63 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, 64 | only: /(only\s+)?([a-zA-Z]+)\s?/, 65 | minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, 66 | maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ 67 | }; 68 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; 69 | if (respond.mediaQueriesSupported) { 70 | return; 71 | } 72 | var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() { 73 | var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; 74 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 75 | if (!body) { 76 | body = fakeUsed = doc.createElement("body"); 77 | body.style.background = "none"; 78 | } 79 | docElem.style.fontSize = "100%"; 80 | body.style.fontSize = "100%"; 81 | body.appendChild(div); 82 | if (fakeUsed) { 83 | docElem.insertBefore(body, docElem.firstChild); 84 | } 85 | ret = div.offsetWidth; 86 | if (fakeUsed) { 87 | docElem.removeChild(body); 88 | } else { 89 | body.removeChild(div); 90 | } 91 | docElem.style.fontSize = originalHTMLFontSize; 92 | if (originalBodyFontSize) { 93 | body.style.fontSize = originalBodyFontSize; 94 | } 95 | ret = eminpx = parseFloat(ret); 96 | return ret; 97 | }, applyMedia = function(fromResize) { 98 | var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime(); 99 | if (fromResize && lastCall && now - lastCall < resizeThrottle) { 100 | w.clearTimeout(resizeDefer); 101 | resizeDefer = w.setTimeout(applyMedia, resizeThrottle); 102 | return; 103 | } else { 104 | lastCall = now; 105 | } 106 | for (var i in mediastyles) { 107 | if (mediastyles.hasOwnProperty(i)) { 108 | var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; 109 | if (!!min) { 110 | min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 111 | } 112 | if (!!max) { 113 | max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 114 | } 115 | if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { 116 | if (!styleBlocks[thisstyle.media]) { 117 | styleBlocks[thisstyle.media] = []; 118 | } 119 | styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); 120 | } 121 | } 122 | } 123 | for (var j in appendedEls) { 124 | if (appendedEls.hasOwnProperty(j)) { 125 | if (appendedEls[j] && appendedEls[j].parentNode === head) { 126 | head.removeChild(appendedEls[j]); 127 | } 128 | } 129 | } 130 | appendedEls.length = 0; 131 | for (var k in styleBlocks) { 132 | if (styleBlocks.hasOwnProperty(k)) { 133 | var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); 134 | ss.type = "text/css"; 135 | ss.media = k; 136 | head.insertBefore(ss, lastLink.nextSibling); 137 | if (ss.styleSheet) { 138 | ss.styleSheet.cssText = css; 139 | } else { 140 | ss.appendChild(doc.createTextNode(css)); 141 | } 142 | appendedEls.push(ss); 143 | } 144 | } 145 | }, translate = function(styles, href, media) { 146 | var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; 147 | href = href.substring(0, href.lastIndexOf("/")); 148 | var repUrls = function(css) { 149 | return css.replace(respond.regex.urls, "$1" + href + "$2$3"); 150 | }, useMedia = !ql && media; 151 | if (href.length) { 152 | href += "/"; 153 | } 154 | if (useMedia) { 155 | ql = 1; 156 | } 157 | for (var i = 0; i < ql; i++) { 158 | var fullq, thisq, eachq, eql; 159 | if (useMedia) { 160 | fullq = media; 161 | rules.push(repUrls(styles)); 162 | } else { 163 | fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; 164 | rules.push(RegExp.$2 && repUrls(RegExp.$2)); 165 | } 166 | eachq = fullq.split(","); 167 | eql = eachq.length; 168 | for (var j = 0; j < eql; j++) { 169 | thisq = eachq[j]; 170 | mediastyles.push({ 171 | media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", 172 | rules: rules.length - 1, 173 | hasquery: thisq.indexOf("(") > -1, 174 | minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 175 | maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") 176 | }); 177 | } 178 | } 179 | applyMedia(); 180 | }, makeRequests = function() { 181 | if (requestQueue.length) { 182 | var thisRequest = requestQueue.shift(); 183 | ajax(thisRequest.href, function(styles) { 184 | translate(styles, thisRequest.href, thisRequest.media); 185 | parsedSheets[thisRequest.href] = true; 186 | w.setTimeout(function() { 187 | makeRequests(); 188 | }, 0); 189 | }); 190 | } 191 | }, ripCSS = function() { 192 | for (var i = 0; i < links.length; i++) { 193 | var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 194 | if (!!href && isCSS && !parsedSheets[href]) { 195 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 196 | translate(sheet.styleSheet.rawCssText, href, media); 197 | parsedSheets[href] = true; 198 | } else { 199 | if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { 200 | if (href.substring(0, 2) === "//") { 201 | href = w.location.protocol + href; 202 | } 203 | requestQueue.push({ 204 | href: href, 205 | media: media 206 | }); 207 | } 208 | } 209 | } 210 | } 211 | makeRequests(); 212 | }; 213 | ripCSS(); 214 | respond.update = ripCSS; 215 | respond.getEmValue = getEmValue; 216 | function callMedia() { 217 | applyMedia(true); 218 | } 219 | if (w.addEventListener) { 220 | w.addEventListener("resize", callMedia, false); 221 | } else if (w.attachEvent) { 222 | w.attachEvent("onresize", callMedia); 223 | } 224 | })(this); -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/respond.matchmedia.addListener.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | (function(w) { 4 | "use strict"; 5 | w.matchMedia = w.matchMedia || function(doc, undefined) { 6 | var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); 7 | div.id = "mq-test-1"; 8 | div.style.cssText = "position:absolute;top:-100em"; 9 | fakeBody.style.background = "none"; 10 | fakeBody.appendChild(div); 11 | return function(q) { 12 | div.innerHTML = '­'; 13 | docElem.insertBefore(fakeBody, refNode); 14 | bool = div.offsetWidth === 42; 15 | docElem.removeChild(fakeBody); 16 | return { 17 | matches: bool, 18 | media: q 19 | }; 20 | }; 21 | }(w.document); 22 | })(this); 23 | 24 | /*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ 25 | (function(w) { 26 | "use strict"; 27 | if (w.matchMedia && w.matchMedia("all").addListener) { 28 | return false; 29 | } 30 | var localMatchMedia = w.matchMedia, hasMediaQueries = localMatchMedia("only all").matches, isListening = false, timeoutID = 0, queries = [], handleChange = function(evt) { 31 | w.clearTimeout(timeoutID); 32 | timeoutID = w.setTimeout(function() { 33 | for (var i = 0, il = queries.length; i < il; i++) { 34 | var mql = queries[i].mql, listeners = queries[i].listeners || [], matches = localMatchMedia(mql.media).matches; 35 | if (matches !== mql.matches) { 36 | mql.matches = matches; 37 | for (var j = 0, jl = listeners.length; j < jl; j++) { 38 | listeners[j].call(w, mql); 39 | } 40 | } 41 | } 42 | }, 30); 43 | }; 44 | w.matchMedia = function(media) { 45 | var mql = localMatchMedia(media), listeners = [], index = 0; 46 | mql.addListener = function(listener) { 47 | if (!hasMediaQueries) { 48 | return; 49 | } 50 | if (!isListening) { 51 | isListening = true; 52 | w.addEventListener("resize", handleChange, true); 53 | } 54 | if (index === 0) { 55 | index = queries.push({ 56 | mql: mql, 57 | listeners: listeners 58 | }); 59 | } 60 | listeners.push(listener); 61 | }; 62 | mql.removeListener = function(listener) { 63 | for (var i = 0, il = listeners.length; i < il; i++) { 64 | if (listeners[i] === listener) { 65 | listeners.splice(i, 1); 66 | } 67 | } 68 | }; 69 | return mql; 70 | }; 71 | })(this); 72 | 73 | /*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ 74 | (function(w) { 75 | "use strict"; 76 | var respond = {}; 77 | w.respond = respond; 78 | respond.update = function() {}; 79 | var requestQueue = [], xmlHttp = function() { 80 | var xmlhttpmethod = false; 81 | try { 82 | xmlhttpmethod = new w.XMLHttpRequest(); 83 | } catch (e) { 84 | xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); 85 | } 86 | return function() { 87 | return xmlhttpmethod; 88 | }; 89 | }(), ajax = function(url, callback) { 90 | var req = xmlHttp(); 91 | if (!req) { 92 | return; 93 | } 94 | req.open("GET", url, true); 95 | req.onreadystatechange = function() { 96 | if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { 97 | return; 98 | } 99 | callback(req.responseText); 100 | }; 101 | if (req.readyState === 4) { 102 | return; 103 | } 104 | req.send(null); 105 | }; 106 | respond.ajax = ajax; 107 | respond.queue = requestQueue; 108 | respond.regex = { 109 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, 110 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, 111 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, 112 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, 113 | only: /(only\s+)?([a-zA-Z]+)\s?/, 114 | minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, 115 | maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ 116 | }; 117 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; 118 | if (respond.mediaQueriesSupported) { 119 | return; 120 | } 121 | var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() { 122 | var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; 123 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 124 | if (!body) { 125 | body = fakeUsed = doc.createElement("body"); 126 | body.style.background = "none"; 127 | } 128 | docElem.style.fontSize = "100%"; 129 | body.style.fontSize = "100%"; 130 | body.appendChild(div); 131 | if (fakeUsed) { 132 | docElem.insertBefore(body, docElem.firstChild); 133 | } 134 | ret = div.offsetWidth; 135 | if (fakeUsed) { 136 | docElem.removeChild(body); 137 | } else { 138 | body.removeChild(div); 139 | } 140 | docElem.style.fontSize = originalHTMLFontSize; 141 | if (originalBodyFontSize) { 142 | body.style.fontSize = originalBodyFontSize; 143 | } 144 | ret = eminpx = parseFloat(ret); 145 | return ret; 146 | }, applyMedia = function(fromResize) { 147 | var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime(); 148 | if (fromResize && lastCall && now - lastCall < resizeThrottle) { 149 | w.clearTimeout(resizeDefer); 150 | resizeDefer = w.setTimeout(applyMedia, resizeThrottle); 151 | return; 152 | } else { 153 | lastCall = now; 154 | } 155 | for (var i in mediastyles) { 156 | if (mediastyles.hasOwnProperty(i)) { 157 | var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; 158 | if (!!min) { 159 | min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 160 | } 161 | if (!!max) { 162 | max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 163 | } 164 | if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { 165 | if (!styleBlocks[thisstyle.media]) { 166 | styleBlocks[thisstyle.media] = []; 167 | } 168 | styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); 169 | } 170 | } 171 | } 172 | for (var j in appendedEls) { 173 | if (appendedEls.hasOwnProperty(j)) { 174 | if (appendedEls[j] && appendedEls[j].parentNode === head) { 175 | head.removeChild(appendedEls[j]); 176 | } 177 | } 178 | } 179 | appendedEls.length = 0; 180 | for (var k in styleBlocks) { 181 | if (styleBlocks.hasOwnProperty(k)) { 182 | var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); 183 | ss.type = "text/css"; 184 | ss.media = k; 185 | head.insertBefore(ss, lastLink.nextSibling); 186 | if (ss.styleSheet) { 187 | ss.styleSheet.cssText = css; 188 | } else { 189 | ss.appendChild(doc.createTextNode(css)); 190 | } 191 | appendedEls.push(ss); 192 | } 193 | } 194 | }, translate = function(styles, href, media) { 195 | var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; 196 | href = href.substring(0, href.lastIndexOf("/")); 197 | var repUrls = function(css) { 198 | return css.replace(respond.regex.urls, "$1" + href + "$2$3"); 199 | }, useMedia = !ql && media; 200 | if (href.length) { 201 | href += "/"; 202 | } 203 | if (useMedia) { 204 | ql = 1; 205 | } 206 | for (var i = 0; i < ql; i++) { 207 | var fullq, thisq, eachq, eql; 208 | if (useMedia) { 209 | fullq = media; 210 | rules.push(repUrls(styles)); 211 | } else { 212 | fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; 213 | rules.push(RegExp.$2 && repUrls(RegExp.$2)); 214 | } 215 | eachq = fullq.split(","); 216 | eql = eachq.length; 217 | for (var j = 0; j < eql; j++) { 218 | thisq = eachq[j]; 219 | mediastyles.push({ 220 | media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", 221 | rules: rules.length - 1, 222 | hasquery: thisq.indexOf("(") > -1, 223 | minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 224 | maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") 225 | }); 226 | } 227 | } 228 | applyMedia(); 229 | }, makeRequests = function() { 230 | if (requestQueue.length) { 231 | var thisRequest = requestQueue.shift(); 232 | ajax(thisRequest.href, function(styles) { 233 | translate(styles, thisRequest.href, thisRequest.media); 234 | parsedSheets[thisRequest.href] = true; 235 | w.setTimeout(function() { 236 | makeRequests(); 237 | }, 0); 238 | }); 239 | } 240 | }, ripCSS = function() { 241 | for (var i = 0; i < links.length; i++) { 242 | var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 243 | if (!!href && isCSS && !parsedSheets[href]) { 244 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 245 | translate(sheet.styleSheet.rawCssText, href, media); 246 | parsedSheets[href] = true; 247 | } else { 248 | if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { 249 | if (href.substring(0, 2) === "//") { 250 | href = w.location.protocol + href; 251 | } 252 | requestQueue.push({ 253 | href: href, 254 | media: media 255 | }); 256 | } 257 | } 258 | } 259 | } 260 | makeRequests(); 261 | }; 262 | ripCSS(); 263 | respond.update = ripCSS; 264 | respond.getEmValue = getEmValue; 265 | function callMedia() { 266 | applyMedia(true); 267 | } 268 | if (w.addEventListener) { 269 | w.addEventListener("resize", callMedia, false); 270 | } else if (w.attachEvent) { 271 | w.attachEvent("onresize", callMedia); 272 | } 273 | })(this); -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Scripts/respond.matchmedia.addListener.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";if(a.matchMedia&&a.matchMedia("all").addListener)return!1;var b=a.matchMedia,c=b("only all").matches,d=!1,e=0,f=[],g=function(){a.clearTimeout(e),e=a.setTimeout(function(){for(var c=0,d=f.length;d>c;c++){var e=f[c].mql,g=f[c].listeners||[],h=b(e.media).matches;if(h!==e.matches){e.matches=h;for(var i=0,j=g.length;j>i;i++)g[i].call(a,e)}}},30)};a.matchMedia=function(e){var h=b(e),i=[],j=0;return h.addListener=function(b){c&&(d||(d=!0,a.addEventListener("resize",g,!0)),0===j&&(j=f.push({mql:h,listeners:i})),i.push(b))},h.removeListener=function(a){for(var b=0,c=i.length;c>b;b++)i[b]===a&&i.splice(b,1)},h}}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b #mq-test-1 { width: 42px; }',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | SimpleFormGenerator.UI 15 | SimpleFormGenerator.UI 16 | v4.5.1 17 | false 18 | true 19 | 20 | 21 | 22 | 23 | ..\ 24 | true 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | 35 | 36 | pdbonly 37 | true 38 | bin\ 39 | TRACE 40 | prompt 41 | 4 42 | 43 | 44 | 45 | False 46 | ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll 47 | 48 | 49 | False 50 | ..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll 51 | 52 | 53 | ..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll 54 | 55 | 56 | 57 | False 58 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll 59 | 60 | 61 | False 62 | ..\packages\structuremap.3.1.4.143\lib\net40\StructureMap.dll 63 | 64 | 65 | False 66 | ..\packages\structuremap.3.1.4.143\lib\net40\StructureMap.Net4.dll 67 | 68 | 69 | ..\packages\structuremap.web.3.1.0.133\lib\net40\StructureMap.Web.dll 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | False 82 | ..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.Helpers.dll 83 | 84 | 85 | False 86 | ..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll 87 | 88 | 89 | False 90 | ..\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll 91 | 92 | 93 | False 94 | ..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll 95 | 96 | 97 | False 98 | ..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Deployment.dll 99 | 100 | 101 | False 102 | ..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | True 115 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 116 | 117 | 118 | 119 | 120 | 121 | 122 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 123 | 124 | 125 | False 126 | ..\packages\WebGrease.1.6.0\lib\WebGrease.dll 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | Global.asax 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | Web.config 174 | 175 | 176 | Web.config 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | {7002C347-53D5-4740-AA88-B3160824D6FF} 201 | SimpleFormGenerator.DataLayer 202 | 203 | 204 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8} 205 | SimpleFormGenerator.DomainClasses 206 | 207 | 208 | {596E4E08-C349-417F-850B-FD8170C18AE8} 209 | SimpleFormGenerator.ServiceLayer 210 | 211 | 212 | 213 | 10.0 214 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | True 227 | True 228 | 48697 229 | / 230 | http://localhost:48697/ 231 | False 232 | False 233 | 234 | 235 | False 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 244 | 245 | 246 | 247 | 253 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/SimpleFormGenerator.UI.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectFiles 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | CurrentPage 13 | True 14 | False 15 | False 16 | False 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | True 26 | True 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/DynamicForm/CreateField.cshtml: -------------------------------------------------------------------------------- 1 | @model SimpleFormGenerator.DomainClasses.Field 2 | 3 | @{ 4 | ViewBag.Title = "CreateField"; 5 | } 6 | 7 | @using (Html.BeginForm()) 8 | { 9 | @Html.AntiForgeryToken() 10 | 11 |
    12 |
    13 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 14 |
    15 | عنوان انگلیسی 16 |
    17 | @Html.EditorFor(model => model.TitleEn, new { htmlAttributes = new { @class = "form-control" } }) 18 | @Html.ValidationMessageFor(model => model.TitleEn, "", new { @class = "text-danger" }) 19 |
    20 |
    21 | 22 |
    23 | عنوان فارسی 24 |
    25 | @Html.EditorFor(model => model.TitleFa, new { htmlAttributes = new { @class = "form-control" } }) 26 | @Html.ValidationMessageFor(model => model.TitleFa, "", new { @class = "text-danger" }) 27 |
    28 |
    29 | 30 |
    31 | نوع فیلد 32 |
    33 | @Html.EnumDropDownListFor(model => model.FieldType, htmlAttributes: new { @class = "form-control" }) 34 | @Html.ValidationMessageFor(model => model.FieldType, "", new { @class = "text-danger" }) 35 |
    36 |
    37 | 38 |
    39 | فرم 40 |
    41 | @Html.DropDownList("FormId", (SelectList)ViewBag.FormList) 42 | @Html.ValidationMessageFor(model => model.FormId, "", new { @class = "text-danger" }) 43 |
    44 |
    45 |
    46 | اعتبارسنجی 47 |
    48 | @Html.EditorFor(model => model.FieldValidations.ElementAt(0).Rule, new { htmlAttributes = new { @class = "form-control" } }) 49 | 50 |
    51 |
    52 | 53 |
    54 |
    55 | 56 |
    57 |
    58 |
    59 | } 60 | 61 |
    62 | @Html.ActionLink("بازگشت ", "Index") 63 |
    64 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/DynamicForm/CreateForm.cshtml: -------------------------------------------------------------------------------- 1 | @model SimpleFormGenerator.DomainClasses.Form 2 | 3 | @{ 4 | ViewBag.Title = "CreateForm"; 5 | } 6 | 7 | 8 | @using (Html.BeginForm()) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |
    13 |
    14 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 15 |
    16 | عنوان 17 |
    18 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 19 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 20 |
    21 |
    22 | 23 |
    24 | صفحه 25 |
    26 | @Html.EditorFor(model => model.Page, new { htmlAttributes = new { @class = "form-control" } }) 27 | @Html.ValidationMessageFor(model => model.Page, "", new { @class = "text-danger" }) 28 |
    29 |
    30 | 31 |
    32 |
    33 | 34 |
    35 |
    36 |
    37 | } 38 | 39 |
    40 | @Html.ActionLink("بازگشت", "Index") 41 |
    42 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/DynamicForm/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Dynamic Form"; 5 | } 6 | 7 | @Html.ActionLink("ایجاد فرم", "CreateForm") 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | @foreach (var form in Model) 18 | { 19 | 20 | 21 | 22 | 23 | 27 | 28 | } 29 |
    کدعنوان فرممربوط به صفحهعملیات
    @form.Id@form.Title@form.Page 24 | @Html.ActionLink("تعریف فیلد", "CreateField") | 25 | @Html.ActionLink("مشاهده فرم", "ShowForm", new { id = form.Id }) 26 |
    -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/DynamicForm/ShowForm.cshtml: -------------------------------------------------------------------------------- 1 | @using SimpleFormGenerator.DomainClasses 2 | @model IEnumerable 3 | 4 | @{ 5 | ViewBag.Title = "ShowForm"; 6 | } 7 | 8 | @Html.ValidationSummary(true) 9 | 10 |
    11 |
    12 |
    13 | @using (Html.BeginForm()) 14 | { 15 | @Html.AntiForgeryToken() 16 | for (int i = 0; i < Model.Count(); i++) 17 | { 18 | if (Model.ElementAt(i).FieldType == FieldType.Text) 19 | { 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 | 28 | 29 |
    30 |
    31 | 32 | 33 | 34 | 35 | 36 | 37 |
    38 | } 39 | } 40 |
    41 |
    42 | 43 |
    44 |
    45 | } 46 |
    47 |
    48 | @Html.ActionLink("بازگشت", "Index") 49 |
    50 |
    51 |
    -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |

    Use this area to provide additional information.

    8 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |
    8 | One Microsoft Way
    9 | Redmond, WA 98052-6399
    10 | P: 11 | 425.555.0100 12 |
    13 | 14 |
    15 | Support: Support@example.com
    16 | Marketing: Marketing@example.com 17 |
    -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
    6 |

    ASP.NET

    7 |

    ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

    8 |

    Learn more »

    9 |
    10 | 11 |
    12 |
    13 |

    Getting started

    14 |

    15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that 16 | enables a clean separation of concerns and gives you full control over markup 17 | for enjoyable, agile development. 18 |

    19 |

    Learn more »

    20 |
    21 |
    22 |

    Get more libraries

    23 |

    NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

    24 |

    Learn more »

    25 |
    26 |
    27 |

    Web Hosting

    28 |

    You can easily find a web hosting company that offers the right mix of features and price for your applications.

    29 |

    Learn more »

    30 |
    31 |
    -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | Error 10 | 11 | 12 |
    13 |

    Error.

    14 |

    An error occurred while processing your request.

    15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 12 |
    13 | 14 |
    15 |
    16 |
    17 |

    @ViewBag.FormTitle

    18 | @RenderBody() 19 |
    20 |
    21 |
    22 |
    23 |
    24 |

    25 | 26 |
    27 | 28 |
    29 |
    30 |
    31 | 32 | @Scripts.Render("~/bundles/jquery") 33 | 34 | 35 | @Scripts.Render("~/bundles/bootstrap") 36 | @RenderSection("scripts", required: false) 37 | 38 | 39 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/SimpleFormGenerator.UI/favicon.ico -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/SimpleFormGenerator.UI/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /SimpleFormGenerator.UI/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /SimpleFormGenerator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{97CBD754-5BF5-4799-A960-541A8B00B1F0}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MvcApp", "MvcApp", "{F2296196-63B4-4F06-8F33-396AA948E417}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleFormGenerator.DataLayer", "SimpleFormGenerator.DataLayer\SimpleFormGenerator.DataLayer.csproj", "{7002C347-53D5-4740-AA88-B3160824D6FF}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleFormGenerator.DomainClasses", "SimpleFormGenerator.DomainClasses\SimpleFormGenerator.DomainClasses.csproj", "{28C4ED18-B820-48AA-B1F0-732DA9F674E8}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleFormGenerator.ServiceLayer", "SimpleFormGenerator.ServiceLayer\SimpleFormGenerator.ServiceLayer.csproj", "{596E4E08-C349-417F-850B-FD8170C18AE8}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleFormGenerator.UI", "SimpleFormGenerator.UI\SimpleFormGenerator.UI.csproj", "{FD43863E-A66B-4AF4-9095-4F4A2D47254C}" 17 | EndProject 18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8CBD56B3-F2EB-4241-82E3-F1259AB7F029}" 19 | ProjectSection(SolutionItems) = preProject 20 | .nuget\NuGet.Config = .nuget\NuGet.Config 21 | .nuget\NuGet.exe = .nuget\NuGet.exe 22 | .nuget\NuGet.targets = .nuget\NuGet.targets 23 | EndProjectSection 24 | EndProject 25 | Global 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|Any CPU = Debug|Any CPU 28 | Release|Any CPU = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 31 | {7002C347-53D5-4740-AA88-B3160824D6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {7002C347-53D5-4740-AA88-B3160824D6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {7002C347-53D5-4740-AA88-B3160824D6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {7002C347-53D5-4740-AA88-B3160824D6FF}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {596E4E08-C349-417F-850B-FD8170C18AE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {596E4E08-C349-417F-850B-FD8170C18AE8}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {596E4E08-C349-417F-850B-FD8170C18AE8}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {596E4E08-C349-417F-850B-FD8170C18AE8}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C}.Release|Any CPU.Build.0 = Release|Any CPU 47 | EndGlobalSection 48 | GlobalSection(SolutionProperties) = preSolution 49 | HideSolutionNode = FALSE 50 | EndGlobalSection 51 | GlobalSection(NestedProjects) = preSolution 52 | {7002C347-53D5-4740-AA88-B3160824D6FF} = {97CBD754-5BF5-4799-A960-541A8B00B1F0} 53 | {28C4ED18-B820-48AA-B1F0-732DA9F674E8} = {97CBD754-5BF5-4799-A960-541A8B00B1F0} 54 | {596E4E08-C349-417F-850B-FD8170C18AE8} = {97CBD754-5BF5-4799-A960-541A8B00B1F0} 55 | {FD43863E-A66B-4AF4-9095-4F4A2D47254C} = {F2296196-63B4-4F06-8F33-396AA948E417} 56 | EndGlobalSection 57 | EndGlobal 58 | -------------------------------------------------------------------------------- /SimpleFormGenerator.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirwanAfifi/SimpleFormGenerator/5f9bd6be70dc37a5419bc3525ffd3f5f153d46ff/SimpleFormGenerator.v12.suo --------------------------------------------------------------------------------