migration: Update migration layout for new sidebar
@2bde559bcaaf100b430eb08b8d6e047f02572f73
--- app/views/migration/migrationPageLayout.scala.html
+++ app/views/migration/migrationPageLayout.scala.html
... | ... | @@ -23,6 +23,7 @@ |
23 | 23 |
<link rel="stylesheet" type="text/css" media="all" href="@routes.Assets.at("javascripts/lib/select2/select2.css")"/> |
24 | 24 |
<link rel="stylesheet" type="text/css" media="all" href="@routes.Assets.at("javascripts/lib/pikaday/pikaday.css")" /> |
25 | 25 |
<link rel="stylesheet" type="text/css" media="all" href="@routes.Assets.at("stylesheets/yobi.css")"> |
26 |
+ <link rel="stylesheet" type="text/css" media="all" href="@routes.Assets.at("stylesheets/usermenu.css")"> |
|
26 | 27 |
<link rel='stylesheet' href="@routes.Assets.at("javascripts/lib/nprogress/nprogress.css")"/> |
27 | 28 |
|
28 | 29 |
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/nprogress/nprogress.js")"></script> |
... | ... | @@ -47,6 +48,138 @@ |
47 | 48 |
@content |
48 | 49 |
|
49 | 50 |
@common.scripts() |
51 |
+ |
|
52 |
+ <script type="text/javascript"> |
|
53 |
+ $(function() { |
|
54 |
+ NProgress.configure({minimum: 0.7}); |
|
55 |
+ |
|
56 |
+ /* Set side navigation */ |
|
57 |
+ // Also, see index.scala.html for home page menu sliding actions !! |
|
58 |
+ var $sidebar = $("#mySidenav"); |
|
59 |
+ var viewSize = $(window).width(); |
|
60 |
+ |
|
61 |
+ $("#main").on("click", function(event){ |
|
62 |
+ if( $sidebar.width() !== 0 && $(event.target).parents("#mySidenav").length == 0) { |
|
63 |
+ closeSidebar($sidebar); |
|
64 |
+ } |
|
65 |
+ }); |
|
66 |
+ |
|
67 |
+ $("#sidebar-open-btn").on("click", function (event) { |
|
68 |
+ event.stopPropagation(); |
|
69 |
+ if( $sidebar.width() !== 0){ |
|
70 |
+ closeSidebar($sidebar); |
|
71 |
+ } else { |
|
72 |
+ openSidebar($sidebar); |
|
73 |
+ updateStar(); |
|
74 |
+ } |
|
75 |
+ }); |
|
76 |
+ |
|
77 |
+ function closeSidebar($sidebar) { |
|
78 |
+ $sidebar.width("0").css("border", "none"); |
|
79 |
+ $(".main-stream").removeClass("span8").addClass("span12"); |
|
80 |
+ } |
|
81 |
+ |
|
82 |
+ function openSidebar($sidebar){ |
|
83 |
+ $sidebar.width("420px").css("border", "1px solid #ccc"); |
|
84 |
+ $(".main-stream").removeClass("span12").addClass("span8"); |
|
85 |
+ if (viewSize > 720) { |
|
86 |
+ $(".search-input").focus(); |
|
87 |
+ } |
|
88 |
+ } |
|
89 |
+ |
|
90 |
+ // used for new project list ui |
|
91 |
+ $(".right-menu").on('click', ".myProjectList, a[href='#recentlyVisited'], a[href='#createdByMe'], a[href='#watching'], a[href='#joinmember']", function() { |
|
92 |
+ updateStar(); |
|
93 |
+ setTimeout(function focusToProjectSearchInput() { |
|
94 |
+ var $projectSearch = $('.project-search'); |
|
95 |
+ var $orgSearch = $('.org-search'); |
|
96 |
+ if (viewSize > 720) { |
|
97 |
+ $projectSearch.focus(); |
|
98 |
+ } |
|
99 |
+ if(!$projectSearch.val()){ |
|
100 |
+ $projectSearch.val($orgSearch.val()); |
|
101 |
+ } |
|
102 |
+ $orgSearch.val(""); |
|
103 |
+ }, 200); |
|
104 |
+ |
|
105 |
+ }); |
|
106 |
+ |
|
107 |
+ $('.myOrganizationList').on('click', function focusToOrgSearchInput(){ |
|
108 |
+ setTimeout(function () { |
|
109 |
+ var $projectSearch = $('.project-search'); |
|
110 |
+ var $orgSearch = $('.org-search'); |
|
111 |
+ if (viewSize > 720) { |
|
112 |
+ $orgSearch.focus(); |
|
113 |
+ } |
|
114 |
+ $orgSearch.val($projectSearch.val()); |
|
115 |
+ $projectSearch.val(""); |
|
116 |
+ }, 200); |
|
117 |
+ }); |
|
118 |
+ |
|
119 |
+ // search by keyword |
|
120 |
+ $(".search-input").on("keyup", function() { |
|
121 |
+ var value = $(this).val().toLowerCase().trim(); |
|
122 |
+ $(".user-li").each(function() { |
|
123 |
+ $(this).toggle($(this).text().toLowerCase().indexOf(value) !== -1); |
|
124 |
+ }); |
|
125 |
+ }).on("keydown.moveCursorFromInputform", function(e) { |
|
126 |
+ switch (e.keyCode) { |
|
127 |
+ case 27: // ESC |
|
128 |
+ closeSidebar($sidebar); |
|
129 |
+ break; |
|
130 |
+ default: |
|
131 |
+ break; |
|
132 |
+ } |
|
133 |
+ }); |
|
134 |
+ |
|
135 |
+ $(".project-list > .star-project").on("click", function toggleProjectFavorite(e) { |
|
136 |
+ e.stopPropagation(); |
|
137 |
+ var that = $(this); |
|
138 |
+ $.post("@api.routes.UserApi.toggleFoveriteProject("")" + that.data("projectId")) |
|
139 |
+ .done(function (data) { |
|
140 |
+ if(data.favored){ |
|
141 |
+ that.find('i').addClass("starred"); |
|
142 |
+ } else { |
|
143 |
+ that.find('i').removeClass("starred"); |
|
144 |
+ } |
|
145 |
+ }) |
|
146 |
+ .fail(function (data) { |
|
147 |
+ $yobi.alert("Update failed: " + JSON.parse(data.responseText).reason); |
|
148 |
+ }); |
|
149 |
+ }); |
|
150 |
+ |
|
151 |
+ $(".org-list > .star-org").on("click", function toggleOrgFavorite(e) { |
|
152 |
+ e.stopPropagation(); |
|
153 |
+ var that = $(this); |
|
154 |
+ $.post("@api.routes.UserApi.toggleFoveriteOrganization("")" + that.data("organizationId")) |
|
155 |
+ .done(function (data) { |
|
156 |
+ if(data.favored){ |
|
157 |
+ that.find('i').addClass("starred"); |
|
158 |
+ } else { |
|
159 |
+ that.find('i').removeClass("starred"); |
|
160 |
+ } |
|
161 |
+ }) |
|
162 |
+ .fail(function (data) { |
|
163 |
+ $yobi.alert("Update failed: " + JSON.parse(data.responseText).reason); |
|
164 |
+ }); |
|
165 |
+ }); |
|
166 |
+ |
|
167 |
+ // This method intended to sync sub tab list of projects |
|
168 |
+ function updateStar(){ |
|
169 |
+ $.get("@api.routes.UserApi.getFoveriteProjects()") |
|
170 |
+ .done(function(data){ |
|
171 |
+ $(".star-project").each(function () { |
|
172 |
+ var $this = $(this); |
|
173 |
+ if (data.projectIds.includes($this.data("projectId"))) { |
|
174 |
+ $this.find("i").addClass("starred"); |
|
175 |
+ } else { |
|
176 |
+ $this.find("i").removeClass("starred"); |
|
177 |
+ } |
|
178 |
+ }); |
|
179 |
+ }); |
|
180 |
+ } |
|
181 |
+ }); |
|
182 |
+ </script> |
|
50 | 183 |
</body> |
51 | 184 |
</html> |
52 | 185 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?