Skip to content

Commit 2f77f41

Browse files
committed
added tag dots
1 parent bd2f45d commit 2f77f41

5 files changed

Lines changed: 83 additions & 41 deletions

File tree

‎cache.manifest‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
CACHE MANIFEST
2-
# Build: 20160122114657
2+
# Build: 20160122060335
33

44
CACHE:
5+
resources/images/codelf_logo.png
6+
resources/images/paypal.png
7+
resources/images/twohardtings.jpg
8+
resources/images/wechatpay.jpg
9+
resources/images/zhifubao.png
510
resources/fonts/Dressedless_Three.svg
611
resources/fonts/Dressedless_Three.ttf
712
resources/fonts/FontAwesome.otf
@@ -10,11 +15,6 @@ resources/fonts/fontawesome-webfont.svg
1015
resources/fonts/fontawesome-webfont.ttf
1116
resources/fonts/fontawesome-webfont.woff
1217
resources/fonts/fontawesome-webfont.woff2
13-
resources/images/codelf_logo.png
14-
resources/images/paypal.png
15-
resources/images/twohardtings.jpg
16-
resources/images/wechatpay.jpg
17-
resources/images/zhifubao.png
1818
src/lib/libs.f851782e.js
1919

2020
NETWORK:

‎index.html‎

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

‎static/app/index.html‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,17 @@ <h5>Add GitHub accounts to organize your stars and repositories</h5>
202202
</script>
203203
<script type="text/html" data-template="groupItem">
204204
<div class="dropdown-item add-repo" data-id="{id}">
205-
{name}
205+
<span class="label label-default label-pill"><i class="fa fa-check"></i></span> {name}
206206
</div>
207207
</script>
208208
<script type="text/html" data-template="tagItem">
209209
<div class="dropdown-item add-repo" data-id="{id}">
210-
<span class="label label-pill" style="background:{color};"><i class="fa fa-times"></i></span> {name}
210+
<span class="label label-pill" style="background:{color};"><i class="fa fa-check"></i></span> {name}
211211
</div>
212212
</script>
213+
<script type="text/html" data-template="tagDot">
214+
<span style="color: {color}"><i class="fa fa-circle"></i></span>
215+
</script>
213216
<script type="text/html" data-template="repoItem">
214217
<article class="card repo-item" data-id="{id}" data-repoid="{originRepoId}" data-name="{_full_name}">
215218
<div class="card-block">
@@ -228,9 +231,6 @@ <h5>Add GitHub accounts to organize your stars and repositories</h5>
228231
<div class="dropdown-item text-primary add-group">
229232
<i class="fa fa-plus-circle"></i> Add new group
230233
</div>
231-
<div class="dropdown-item text-danger add-repo" data-id="0">
232-
<i class="fa fa-times-circle"></i> Remove from group
233-
</div>
234234
</div>
235235
</div>
236236
</div>
@@ -244,6 +244,7 @@ <h5>Add GitHub accounts to organize your stars and repositories</h5>
244244
</div>
245245
</div>
246246
</div>
247+
<div class="btn-group btn-group-sm tag-dots fade" role="group"></div>
247248
</div>
248249
</article>
249250
</script>

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ html,body{
268268
padding: 0 .4rem;
269269
cursor: pointer;
270270
}
271-
.bookmark-modal .repo-group-item[data-id="0"]>.hd .ctrl,
272-
.bookmark-modal .repo-group-item[data-id="0"] .group-menu .dropdown-menu>.dropdown-item:last-child{
271+
.bookmark-modal .repo-group-item[data-id="0"]>.hd .ctrl{
273272
display: none;
274273
}
275274
.bookmark-modal .repo-group-item .repo-item{
@@ -284,23 +283,25 @@ html,body{
284283
.bookmark-modal .repo-group-item .repo-item .card-footer{
285284
border-top: 0;
286285
}
287-
.bookmark-modal .tag-menu .add-repo .label{
288-
position: relative;
289-
min-width: 1.15rem;
290-
min-height: 1.15rem;
291-
margin-bottom: -0.125rem;
286+
.bookmark-modal .dropdown-menu .dropdown-item.add-repo .label{
287+
width: 1.15rem;
288+
height: 1.15rem;
289+
margin-bottom: -0.2rem;
292290
}
293-
.bookmark-modal .tag-menu .add-repo .label i{
291+
.bookmark-modal .dropdown-menu .dropdown-item.add-repo .label i{
294292
display: none;
295-
color: #515153;
293+
color: #fff;
296294
}
297-
.bookmark-modal .tag-menu .add-repo[data-tagged] .label{
295+
.bookmark-modal .dropdown-menu .dropdown-item.add-repo[data-selected] .label{
298296
padding-left: 0;
299297
padding-right: 0;
300298
}
301-
.bookmark-modal .tag-menu .add-repo[data-tagged] .label i{
299+
.bookmark-modal .dropdown-menu .dropdown-item.add-repo[data-selected] .label i{
302300
display: inline-block;
303301
}
302+
.bookmark-modal .tag-dots span{
303+
margin-left: -.5rem;
304+
}
304305
.bookmark-user-modal .user-item:first-child{
305306
margin-top: 1rem;
306307
}

‎static/app/src/App.js‎

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ $(function () {
997997
bookmarkModalGroupTpl: $('.bookmark-modal script[data-template="repoGroup"]').html(),
998998
bookmarkModalGroupItemTpl: $('.bookmark-modal script[data-template="groupItem"]').html(),
999999
bookmarkModalTagItemTpl: $('.bookmark-modal script[data-template="tagItem"]').html(),
1000+
bookmarkModalTagDotTpl: $('.bookmark-modal script[data-template="tagDot"]').html(),
10001001
bookmarkModalReopTpl: $('.bookmark-modal script[data-template="repoItem"]').html(),
10011002

10021003
bookmarkUserModal: $('.bookmark-user-modal'),
@@ -1078,7 +1079,9 @@ $(function () {
10781079
});
10791080
els.bookmarkModalContent.on('click', '.group-menu .add-repo', beforeAddRepoToGroup);
10801081
els.bookmarkModalContent.on('click', '.tag-menu .add-repo', beforeAddRepoToTag);
1082+
els.bookmarkModalContent.on('click', '.repo-item .group-menu', renderBookmarkRepoGroupMenu);
10811083
els.bookmarkModalContent.on('click', '.repo-item .tag-menu', renderBookmarkRepoTagMenu);
1084+
els.bookmarkModalContent.on('mouseenter mouseleave', '.repo-item', renderBookmarkRepoTagDots);
10821085
els.bookmarkModalContent.on('keyup','.repo-group-item>.hd .search input',renderBookmarkSearchRepos);
10831086
els.bookmarkModalContent.on('click','.repo-group-item>.hd .search submit',renderBookmarkSearchRepos);
10841087
els.bookmarkUserModal.on('click', '.submit', function(){
@@ -1560,6 +1563,7 @@ $(function () {
15601563
els.bookmarkModalContent.find('.repo-group-item:last-child .collapse').addClass('in');
15611564
}, 100);
15621565

1566+
updateBookmarkGroupsData();
15631567
renderBookmarkTagMenu(allTagHtm);
15641568
renderBookmarkUsers(data.users);
15651569
}
@@ -1583,6 +1587,14 @@ $(function () {
15831587
});
15841588
}
15851589

1590+
function renderBookmarkRepoGroupMenu(){
1591+
var el = $(this),
1592+
id = el.parents('.repo-item').attr('data-repoid');
1593+
els.lastBookmarkGroupsData.forEach(function(key){
1594+
el.find('.add-repo[data-id="'+key.id+'"]')[key.repoIds.indexOf(id)==-1?'removeAttr':'attr']('data-selected',true);
1595+
});
1596+
}
1597+
15861598
function renderBookmarkTagMenu(htm){
15871599
els.bookmarkModalTagMenu.find('.add-repo').remove();
15881600
els.bookmarkModalTagMenu.append(htm);
@@ -1593,9 +1605,28 @@ $(function () {
15931605
var el = $(this),
15941606
id = el.parents('.repo-item').attr('data-repoid');
15951607
els.lastBookmarkTagsData.forEach(function(key){
1596-
el.find('.add-repo[data-id="'+key.id+'"]')[key.repoIds.indexOf(id)==-1?'removeAttr':'attr']('data-tagged',true);
1608+
el.find('.add-repo[data-id="'+key.id+'"]')[key.repoIds.indexOf(id)==-1?'removeAttr':'attr']('data-selected',true);
15971609
});
15981610
}
1611+
function renderBookmarkRepoTagDots(e){
1612+
var el = $(this),
1613+
id = el.attr('data-repoid'),
1614+
dotsEl = el.find('.tag-dots'),
1615+
htm = [];
1616+
if(e.type=='mouseenter'){
1617+
els.lastBookmarkTagsData.forEach(function(key){
1618+
if(key.repoIds.indexOf(id)!=-1){
1619+
htm.push(
1620+
els.bookmarkModalTagDotTpl
1621+
.replace(/\{color\}/g,key.color)
1622+
);
1623+
}
1624+
});
1625+
dotsEl.html(htm.join('')).addClass('in');
1626+
}else{
1627+
dotsEl.html('').removeClass('in');
1628+
}
1629+
}
15991630

16001631
function renderBookmarkSearchRepos(){
16011632
var gEl = els.bookmarkModalContent.find('.repo-group-item[data-id="0"]'),
@@ -1702,6 +1733,7 @@ $(function () {
17021733
function beforeAddRepoToGroup() {
17031734
var el = $(this),
17041735
targetGroupId = el.attr('data-id'),
1736+
selected = el.attr('data-selected'),
17051737
repoEl = el.parents('.repo-item'),
17061738
repoId = repoEl.attr('data-repoid'),
17071739
repoUrl = repoEl.find('.repo-item__hd a').attr('href'),
@@ -1713,33 +1745,38 @@ $(function () {
17131745
targetGroupName = targetGoupEl.find('>.hd>a').html(),
17141746
targetGoupCountEl = targetGoupEl.find('.hd>.count'),
17151747
targetGoupCountNum = parseInt(targetGoupCountEl.html()||0),
1716-
targetGroupHasRepo = targetGoupEl.find('.repo-item[data-repoid="'+repoId+'"]').length;
1748+
targetGroupRepo = targetGoupEl.find('.repo-item[data-repoid="'+repoId+'"]');
17171749

1718-
if (targetGroupId != undefined && targetGroupId != 0) {
1750+
if (!selected) {
17191751
bookmarkModel.RepoGroupTable.addRopoId(targetGroupId, repoId);
17201752

1721-
if(!targetGroupHasRepo){
1753+
if(!targetGroupRepo.length){
17221754
targetGoupCountEl.html(++targetGoupCountNum);
17231755
targetGoupEl.find('.repo-list').append(repoEl.clone());
17241756
}
17251757
els.isGithub && DDMSModel.postBookmarkGroup(repoId,repoUrl,targetGroupName);
17261758

1727-
} else if (curGroupId != 0) {
1728-
bookmarkModel.RepoGroupTable.removeRopoId(curGroupId, repoId);
1759+
} else{
1760+
bookmarkModel.RepoGroupTable.removeRopoId(targetGroupId, repoId);
17291761

1730-
curGroupElCountEl.html(--curGoupCountNum||'');
1731-
repoEl.remove();
1762+
if(targetGroupId==curGroupId){
1763+
repoEl.remove();
1764+
curGroupElCountEl.html(--curGoupCountNum||'');
1765+
}else{
1766+
targetGroupRepo.remove();
1767+
targetGoupCountEl.html(--targetGoupCountNum||'');
1768+
}
17321769
}
17331770
}
17341771
function beforeAddRepoToTag() {
17351772
var el = $(this),
17361773
targetId = el.attr('data-id'),
1737-
tagged = el.attr('data-tagged'),
1774+
selected = el.attr('data-selected'),
17381775
repoEl = el.parents('.repo-item'),
17391776
repoId = repoEl.attr('data-repoid');
17401777

17411778
if (targetId != undefined && targetId != 0){
1742-
bookmarkModel.RepoTagTable[tagged?'removeRopoId':'addRopoId'](targetId, repoId);
1779+
bookmarkModel.RepoTagTable[selected?'removeRopoId':'addRopoId'](targetId, repoId);
17431780
}
17441781
}
17451782

@@ -1770,6 +1807,11 @@ $(function () {
17701807
els.lastBookmarkTagsData = res;
17711808
});
17721809
}
1810+
function updateBookmarkGroupsData(){
1811+
bookmarkModel.RepoGroupTable.getAll(function(res){
1812+
els.lastBookmarkGroupsData = res;
1813+
});
1814+
}
17731815

17741816
init();
17751817
//end view and render

0 commit comments

Comments
 (0)