mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-10-31 18:46:28 +01:00 
			
		
		
		
	Add Settings page.
This commit is contained in:
		| @@ -8,6 +8,7 @@ class ScalatraBootstrap extends LifeCycle { | ||||
|     context.mount(new WikiController, "/*") | ||||
|     context.mount(new CreateRepositoryController, "/*") | ||||
|     context.mount(new RepositoryViewerController, "/*") | ||||
|     context.mount(new SettingsController, "/*") | ||||
|      | ||||
|     context.addListener(new ServletContextListener(){ | ||||
|       def contextInitialized(e: ServletContextEvent): Unit = { | ||||
|   | ||||
							
								
								
									
										14
									
								
								src/main/scala/app/SettingsController.scala
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/main/scala/app/SettingsController.scala
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| package app | ||||
|  | ||||
| import util.JGitUtil | ||||
|  | ||||
| class SettingsController extends ControllerBase { | ||||
|    | ||||
|   get("/:owner/:repository/settings") { | ||||
|     val owner      = params("owner") | ||||
|     val repository = params("repository") | ||||
|      | ||||
|     html.settings(JGitUtil.getRepositoryInfo(owner, repository, servletContext)) | ||||
|   } | ||||
|  | ||||
| } | ||||
| @@ -4,7 +4,7 @@ | ||||
| @diffs.zipWithIndex.map { case (diff, i) => | ||||
|   <table class="table table-bordered"> | ||||
|     <tr> | ||||
|       <th style="font-weight: normal;"> | ||||
|       <th style="font-weight: normal;" class="box-header"> | ||||
|         @if(diff.changeType == ChangeType.COPY || diff.changeType == ChangeType.RENAME){ | ||||
|           @diff.oldPath -> @diff.newPath | ||||
|         } | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|       <li@if(active=="code"){ class="active"}><a href="@path/@repository.owner/@repository.name">Code</a></li> | ||||
|       <li@if(active=="issue"){ class="active"}><a href="#">Issue</a></li> | ||||
|       <li@if(active=="wiki"){ class="active"}><a href="@path/@repository.owner/@repository.name/wiki">Wiki</a></li> | ||||
|       <li@if(active=="settings"){ class="active"}><a href="#">Settings</a></li> | ||||
|       <li@if(active=="settings"){ class="active"}><a href="@path/@repository.owner/@repository.name/settings">Settings</a></li> | ||||
|     </ul> | ||||
|   </div> | ||||
| </div> | ||||
|   | ||||
							
								
								
									
										39
									
								
								src/main/twirl/settings.scala.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/main/twirl/settings.scala.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| @(repository: app.RepositoryInfo)(implicit context: app.Context) | ||||
| @import context._ | ||||
| @main("Settings"){ | ||||
|   @header("settings", repository) | ||||
|   <form id="form" method="post" action="@path/new" validate="true"> | ||||
|     <div class="box"> | ||||
|       <div class="box-header">Settings</div> | ||||
|       <div class="box-content"> | ||||
|         <fieldset> | ||||
|           <label for="defaultBranch"><strong>Default Branch</strong></label> | ||||
|           <select name="defaultBranch" id="defaultBranch"> | ||||
|             <option value="master">master</option> | ||||
|           </select> | ||||
|         </fieldset> | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="box"> | ||||
|       <div class="box-header">Features</div> | ||||
|         <div class="box-content"> | ||||
|           <dl> | ||||
|             <dt> | ||||
|               <label class="checkbox"> | ||||
|                 <input type="checkbox" name="wiki" id="wiki"/> <strong>Wiki</strong> | ||||
|               </label> | ||||
|             </dt> | ||||
|             <dt> | ||||
|               <label class="checkbox"> | ||||
|                 <input type="checkbox" name="issue" id="issue"/> <strong>Issue</strong> | ||||
|               </label> | ||||
|             </dt> | ||||
|         </dl> | ||||
|       </div> | ||||
|     </div> | ||||
|     <fieldset> | ||||
|       <input type="submit" class="btn btn-primary" value="Apply changes"/> | ||||
|       <input type="submit" class="btn btn-danger" value="Delete this repository"/> | ||||
|     </fieldset> | ||||
|   </form> | ||||
| } | ||||
| @@ -74,3 +74,51 @@ h1.wiki-title { | ||||
|   cursor: default; | ||||
|   width: 350px; | ||||
| } | ||||
|  | ||||
| div.box { | ||||
|   background-color: #efefef; | ||||
|   padding: 2px; | ||||
|   margin-bottom: 20px; | ||||
| } | ||||
|  | ||||
| div.box-header { | ||||
|   font-size: 120%; | ||||
|   font-weight: bold; | ||||
|   background-color: #e0e0e0; | ||||
|   background-image: -moz-linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-image: -webkit-linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-image: linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-repeat: repeat-x; | ||||
|   margin: 0; | ||||
|   border-top-left-radius: 1px; | ||||
|   border-top-right-radius: 1px; | ||||
|   border: 1px solid #d8d8d8; | ||||
|   border-bottom: none; | ||||
|   padding: 10px 10px 11px 10px; | ||||
|   text-shadow: 0 1px 0 #fff | ||||
| } | ||||
|  | ||||
| div.box-content { | ||||
|   background-color: white; | ||||
|   border: 1px solid silver; | ||||
|   padding: 4px; | ||||
| } | ||||
|  | ||||
| th.box-header { | ||||
|   background-color: #e0e0e0; | ||||
|   background-image: -moz-linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-image: -webkit-linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-image: linear-gradient(#fafafa, #e0e0e0); | ||||
|   background-repeat: repeat-x; | ||||
|   margin: 0; | ||||
|   border-top-left-radius: 1px; | ||||
|   border-top-right-radius: 1px; | ||||
|   border: 1px solid #d8d8d8; | ||||
|   border-bottom: none; | ||||
|   text-shadow: 0 1px 0 #fff | ||||
| } | ||||
|  | ||||
|  | ||||
| dl { | ||||
|   margin: 0px; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user