Skip to content

Commit 15b9823

Browse files
committed
optimize first add github account
1 parent 44de984 commit 15b9823

5 files changed

Lines changed: 70 additions & 32 deletions

File tree

‎cache.manifest‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Build: 20160119092030
2+
# Build: 20160119110213
33

44
CACHE:
55
resources/fonts/Dressedless_Three.svg

‎index.html‎

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

‎static/app/index.html‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-val="{val}"><sp
125125
</div>
126126
</section>
127127
<div class="bookmark-btn" data-toggle="tooltip" data-placement="right" title="Group GitHub stars">
128-
<i class="fa fa-bookmark fa-2x hidden-sm-up"></i>
129-
<i class="fa fa-bookmark fa-3x hidden-xs-down"></i>
128+
<i class="bookmark-logo fa fa-bookmark fa-2x hidden-sm-up"></i>
129+
<i class="bookmark-logo fa fa-bookmark fa-3x hidden-xs-down"></i>
130130
</div>
131131
<section class="modal fade bookmark-modal modal--fix" tabindex="-1" role="dialog" aria-labelledby="bookmarkModal" aria-hidden="true">
132132
<div class="modal-dialog modal-lg">
@@ -144,8 +144,17 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-val="{val}"><sp
144144
<div class="logo"><img class="spinner" src="resources/images/codelf_logo.png"></div>
145145
</div>
146146
<div class="empty">
147-
<i class="fa fa-plus-circle fa-5x add-account"></i>
148-
<h5>Add GitHub accounts to group your stars and repos</h5>
147+
<div class="top">
148+
<i class="bookmark-logo fa fa-bookmark fa-5x"></i>
149+
<h5>Add GitHub accounts to group your stars and repos</h5>
150+
</div>
151+
<div class="input-group form">
152+
<input type="text" class="form-control" placeholder="account">
153+
<span class="input-group-btn">
154+
<button class="btn btn-secondary submit" type="button">Add</button>
155+
</span>
156+
</div>
157+
<div class="tip text-muted">*e.g. https://github.com/<span class="text-danger">account</span></div>
149158
</div>
150159
</header>
151160
<section class="bd" role="tablist">
@@ -178,7 +187,7 @@ <h5>Add GitHub accounts to group your stars and repos</h5>
178187
<div class="btn-group btn-group-sm" role="group">
179188
<div class="btn-group" role="group">
180189
<a class="dropdown-toggle btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="javascript:void(0);">
181-
Add to group...
190+
Add to group
182191
</a>
183192
<div class="dropdown-menu">
184193
{groupItems}
@@ -187,7 +196,7 @@ <h5>Add GitHub accounts to group your stars and repos</h5>
187196
<i class="fa fa-plus-circle"></i> Add new group
188197
</div>
189198
<div class="dropdown-item text-danger" data-id="0">
190-
<i class="fa fa-minus-circle"></i> Remove from group
199+
<i class="fa fa-times-circle"></i> Remove from group
191200
</div>
192201
</div>
193202
</div>

‎static/app/resources/css/style.css‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ html,body{
197197
top: 0;
198198
left: 4%;
199199
cursor: pointer;
200-
color: #70B7FD;
201200
transition: all 1s;
202201
}
202+
.bookmark-logo{
203+
color: #70B7FD;
204+
}
203205
.bookmark-modal .modal-body>.hd{
204206
padding-bottom: 1rem;
205207
}
@@ -215,15 +217,19 @@ html,body{
215217
margin: 0 auto;
216218
}
217219
.bookmark-modal .modal-body>.hd>.empty{
218-
padding: 5rem 0;
219220
text-align: center;
220-
cursor: pointer;
221+
}
222+
.bookmark-modal .modal-body>.hd>.empty .top{
223+
margin: 2em;
224+
}
225+
.bookmark-modal .modal-body>.hd>.empty .tip{
226+
text-align: left;
221227
}
222228
.bookmark-modal .repo-item .card-footer {
223229
padding: .3rem 1.25rem;
224230
}
225-
.bookmark-modal .repo-group-item:last-child>.hd .del,
226-
.bookmark-modal .repo-group-item:last-child .dropdown-menu>.dropdown-item:last-child{
231+
.bookmark-modal .repo-group-item[data-id="0"]>.hd .del,
232+
.bookmark-modal .repo-group-item[data-id="0"] .dropdown-menu>.dropdown-item:last-child{
227233
display: none;
228234
}
229235
.bookmark-user-modal .user-item:first-child{

‎static/app/src/App.js‎

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,24 @@ $(function () {
868868
els.bookmarkBtn.on('click', showBookmark);
869869
els.bookmarkModal.on('click', '.add-account', showBookmarkUserModal);
870870
els.bookmarkModal.on('click', '.add-group', showBookmarkGroupModal);
871-
els.bookmarkUserModal.on('click', '.submit', beforeAddBookmarkUser);
871+
els.bookmarkModalContentHd.on('click', '.submit', function(){
872+
beforeAddBookmarkUser(els.bookmarkModalContentHd);
873+
});
874+
els.bookmarkUserModal.on('click', '.submit', function(){
875+
beforeAddBookmarkUser();
876+
});
877+
els.bookmarkModalContentHd.keypress(function (e) {
878+
if (e.which == 13) {
879+
beforeAddBookmarkUser();
880+
return false;
881+
}
882+
});
883+
els.bookmarkUserModal.keypress(function (e) {
884+
if (e.which == 13) {
885+
beforeAddBookmarkUser(els.bookmarkModalContentHd);
886+
return false;
887+
}
888+
});
872889
els.bookmarkGroupModal.on('click', '.submit', beforeAddBookmarkGroup);
873890
els.bookmarkModalContent.on('click', '.repo-group-item>.hd .ctrl .del', beforeDelBookmarkGroup);
874891
els.bookmarkModalContent.on('click', '.dropdown-item', beforeAddRepoToGroup);
@@ -1292,20 +1309,25 @@ $(function () {
12921309
.replace(/\{itemCount\}/g, rhtm.length)
12931310
);
12941311
});
1295-
//add all group
1296-
data.repos.forEach(function (key) {
1297-
allRhtm.push(getBookmarkRopeHtm(key, allGhtm));
1298-
});
1299-
htm.push(els.bookmarkModalGroupTpl
1300-
.replace(/\{id\}/g, 0)
1301-
.replace(/\{name\}/g, 'All')
1302-
.replace(/\{items\}/g, allRhtm.join(''))
1303-
.replace(/\{itemCount\}/g, data.repos.length)
1304-
);
1312+
if(data.repos.length){
1313+
//add all group
1314+
data.repos.forEach(function (key) {
1315+
allRhtm.push(getBookmarkRopeHtm(key, allGhtm));
1316+
});
1317+
htm.push(els.bookmarkModalGroupTpl
1318+
.replace(/\{id\}/g, 0)
1319+
.replace(/\{name\}/g, 'All')
1320+
.replace(/\{items\}/g, allRhtm.join(''))
1321+
.replace(/\{itemCount\}/g, data.repos.length)
1322+
);
1323+
}
13051324

13061325
if(data.repos.length || data.groups.length){
13071326
els.bookmarkModalContent.html(htm.join(''));
13081327
renderBookmarkHeader();
1328+
}else{
1329+
els.bookmarkModalContent.html('');
1330+
renderBookmarkHeader('empty');
13091331
}
13101332
setTimeout(function () {
13111333
var gel = els.bookmarkModalContent.find('.repo-group-item[data-id="' + els.lastEditBookmarkRepoGroupId + '"] .collapse');
@@ -1364,9 +1386,10 @@ $(function () {
13641386
els.body.find('.popover--variable').remove();
13651387
}
13661388

1367-
function beforeAddBookmarkUser() {
1368-
els.bookmarkUserModalInput = els.bookmarkUserModalInput || els.bookmarkUserModal.find('input');
1369-
var val = els.bookmarkUserModalInput.val().trim();
1389+
function beforeAddBookmarkUser(el) {
1390+
el = el || els.bookmarkUserModal;
1391+
var inputEl = el.find('input'),
1392+
val = inputEl.val().trim();
13701393
val = val.replace(/(\/)*$/, '').replace(/^(.{0,}\/)/, '').replace(/@/g,'');
13711394
if (val.length) {
13721395
bookmarkModel.setCurUserName(val);
@@ -1376,7 +1399,7 @@ $(function () {
13761399
els.isGithub && DDMSModel.postBookmarks(val);
13771400
renderAnalytics('bk&u=' + val);
13781401
}
1379-
els.bookmarkUserModalInput.val('');
1402+
inputEl.val('');
13801403
}
13811404

13821405
function beforeAddBookmarkGroup() {

0 commit comments

Comments
 (0)