소스 검색

issue assignee ui

FuXiaoHei 11 년 전
부모
커밋
11ca10ab2f
3개의 변경된 파일54개의 추가작업 그리고 3개의 파일을 삭제
  1. 22 0
      public/css/gogs.css
  2. 16 3
      public/js/app.js
  3. 16 0
      templates/issue/create.tmpl

+ 22 - 0
public/css/gogs.css

@@ -1441,6 +1441,28 @@ html, body {
     margin-left: .8em;
 }
 
+#issue .assignee,#issue .assignee ul{
+    padding: 0;
+    margin: 0;
+    min-width: 300px;
+}
+
+#issue .assignee li{
+    padding: 4px 12px;
+    line-height: 30px;
+}
+
+#issue .assignee li:hover{
+    background-color: #e8f0ff;
+    cursor: pointer;
+}
+
+#issue .assignee li img{
+    width: 28px;
+    height: 28px;
+    margin-right: 12px;
+}
+
 /* wrapper and footer */
 
 #wrapper {

+ 16 - 3
public/js/app.js

@@ -532,7 +532,20 @@ function initIssue() {
         $('.issue-write a[data-toggle]').on("click", function () {
             $('.issue-preview-content').html("loading...");
         });
-    }())
+    }());
+
+    // assignee
+    $('.assignee', '#issue').on('click', 'li', function () {
+        var uid = $(this).data("uid");
+        $('#assignee').val(uid);
+        if (uid > 0) {
+            $('.clear-assignee').toggleShow();
+            $('#assigned').text($(this).find("strong").text())
+        } else {
+            $('.clear-assignee').toggleHide();
+            $('#assigned').text($('#assigned').data("no-assigned"));
+        }
+    });
 
 }
 
@@ -580,7 +593,7 @@ function initRepoSetting() {
                     });
                     $this.next().toggleShow();
                     $this.next().find('ul').html(html);
-                }else{
+                } else {
                     $this.next().toggleHide();
                 }
             }
@@ -589,7 +602,7 @@ function initRepoSetting() {
         if (!$(this).val()) {
             $(this).next().toggleHide();
         }
-    }).next().on("click",'li',function(){
+    }).next().on("click", 'li', function () {
         $('#repo-collaborator').val($(this).text());
     });
 }

+ 16 - 0
templates/issue/create.tmpl

@@ -14,6 +14,22 @@
                 <div class="form-group panel-body">
                     <input class="form-control input-lg" type="text" name="title" required="required" placeholder="Title" value="{{.title}}" />
                 </div>
+                <div class="form-group panel-body">
+                    <span><strong id="assigned" data-no-assigned="No one">No one</strong> will be assigned</span>
+                    <input type="hidden" name="assigned" value="0" id="assignee"/>&nbsp;&nbsp;
+                    <div style="display: inline-block;position: relative">
+                        <button type="button" class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
+                            <i class="fa fa-group"></i>
+                            <span class="caret"></span>
+                        </button>
+                        <div class="dropdown-menu assignee">
+                            <ul class="list-unstyled">
+                                <li data-uid="0" class="clear-assignee hidden"><i class="fa fa-times-circle-o"></i> Clear assignee</li>
+                                <li data-uid="123"><img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132"><strong>fuxiaohei</strong> nickname</li>
+                            </ul>
+                        </div>
+                    </div>
+                </div>
                 <div class="form-group panel-body">
                     <div class="md-help pull-right"><!-- todo help link -->
                         Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>