Skip to content

Commit

Permalink
Merge 6ca5f3e into 9b56639
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen committed Apr 8, 2021
2 parents 9b56639 + 6ca5f3e commit a3e9c0b
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@
<!--page num -->
<span class="sr-only">no data</span>
</th>
<th>
<th class="hide-xs">
<!--public/private status-->
<span class="sr-only">no data</span>
</th>
<th class="hide-xs">
<!-- has collaborators -->
<span class="sr-only">no data</span>
</th>
<th>
Library
<button
Expand All @@ -65,6 +69,18 @@
{{/compare}}{{/compare}}
</button>
</th>
<th>
Owner
<button
title="sort by owner"
class="btn btn-xs {{#compare sort 'owner'}} s-sort-active {{/compare}} btn-default"
data-sort='{"sort":"owner","type":"string"}'
>
<i class="fa fa-lg fa-sort" aria-hidden="true"></i> {{#compare sort
'owner'}} {{#compare order "asc"}} asc {{else}} desc
{{/compare}}{{/compare}}
</button>
</th>
<th>
Permission
<button
Expand All @@ -77,11 +93,11 @@
{{/compare}}{{/compare}}
</button>
</th>
<th class="hide-xs">
<th class="hide-xxs">
Last Modified
<button
title="sort by last modified"
class="btn btn-xs {{#compare sort 'date_last_modified'}} s-sort-active {{/compare}} btn-default hide-xs"
class="btn btn-xs {{#compare sort 'date_last_modified'}} s-sort-active {{/compare}} btn-default hide-xxs"
data-sort='{"sort":"date_last_modified","type":"date"}'
>
<i class="fa fa-lg fa-sort" aria-hidden="true"></i> {{#compare sort
Expand Down
47 changes: 44 additions & 3 deletions src/js/widgets/libraries_all/templates/library-item.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<td class="hide-xs">
{{libNum}}
</td>
<td>
<td class="hide-xs">
{{#if public}}
<i
class="fa fa-lg fa-unlock"
Expand All @@ -17,15 +17,56 @@
{{/if}}
</td>

<td class="hide-xs">
{{#compare permission 'owner'}}
{{#compare num_users 1 operator=">"}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{else}}
<i class="fa fa-user" aria-hidden="true" title="This library has no collaborators"></i>
{{/compare}}
{{else}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{/compare}}
</td>

<td>
<a href="#user/libraries/{{id}}"><h3 class="s-library-title">{{name}}</h3></a>
<div class="hide-xs">
<span class="s-library-title">{{name}}</span>
</div>
<div class="hide-all-but-xs">
<span class="s-library-title">{{name}}</span><br/>
{{#if public}}
<i
class="fa fa-lg fa-unlock"
aria-hidden="true"
title="this library is public"
></i>
{{else}}
<i
class="fa fa-lg fa-lock text-light"
aria-hidden="true"
title="this library is private"
></i>
{{/if}}
{{#compare permission 'owner'}}
{{#compare num_users 1 operator=">"}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{else}}
<i class="fa fa-user" aria-hidden="true" title="This library has no collaborators"></i>
{{/compare}}
{{else}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{/compare}}
</div>
{{#if description}}
<p class="library-description">{{description}}</p>
{{/if}}
</td>

<td>{{num_documents}}</td>

<td>{{#compare permission 'owner'}}Me{{else}}{{owner}}{{/compare}}</td>

<td>{{permission}}</td>

<td class="hide-xs">{{date_last_modified}}</td>
<td class="hide-xxs">{{date_last_modified}}</td>
27 changes: 26 additions & 1 deletion src/js/widgets/library_individual/templates/library-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ <h5>Date Last Modified:</h5>
{{/if}} {{else}}
<!-- not public -->

<!-- In private view -->
<div class="pull-right-md" style="position:relative;z-index:1">
{{#if largeLibrary}}
<button
Expand Down Expand Up @@ -183,6 +184,30 @@ <h5>Date Last Modified:</h5>
</button>
{{/if}}
</div>

<div>
{{#if public}}
<i
class="fa fa-lg fa-unlock"
aria-hidden="true"
title="this library is public"
></i>
{{else}}
<i
class="fa fa-lg fa-lock text-light"
aria-hidden="true"
title="this library is private"
></i>
{{/if}}
{{#compare permission 'owner'}}
{{#compare num_users 1 operator=">"}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{/compare}}
{{else}}
<i class="fa fa-users" aria-hidden="true" title="This library has collaborators"></i>
{{/compare}}
</div>

{{#if edit}}
<div class="editable-item">
<h2>
Expand Down Expand Up @@ -284,7 +309,7 @@ <h5>Owner:</h5>
data-target="#library-actions"
aria-expanded="false"
>
<i class="fa fa-cog" aria-hidden="true"></i> View editing options<span class="hide-xs"> (You have
<i class="fa fa-cog" aria-hidden="true"></i> View editing options<span class="hide-xxs"> (You have
<b>{{permission}}</b> privileges)</span>
</button>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/js/widgets/query_info/query_info_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<label for="library-select">to an <span class="s-text-bold">existing library:</span></label>
<select id="library-select" name="library-select" class="form-control input-sm s-library-select" aria-label="select existing library">
{{#each libraries}}
<option value="{{this.id}}" {{#compare id ../selectedLibrary}} selected="true" {{/compare}}>{{this.name}}</option>
<option value="{{this.id}}" {{#compare id ../selectedLibrary}} selected="true" {{/compare}}>{{this.name}}{{#compare permission "owner" operator="!=="}} ({{this.owner}}){{/compare}}</option>
{{/each}}
</select>
<button class="btn btn-sm btn-primary-faded submit-add-to-library">submit</button>
Expand Down
2 changes: 1 addition & 1 deletion src/js/wraps/abstract_page_library_add/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<label for="#library-select">add to an existing library:</label>
<select id="library-select" name="library-select" class="form-control input-sm s-library-select" aria-label="select existing library">
{{#each libraries}}
<option value="{{this.id}}" {{#compare id ../selectedLibrary}} selected="true" {{/compare}}>{{this.name}}</option>
<option value="{{this.id}}" {{#compare id ../selectedLibrary}} selected="true" {{/compare}}>{{this.name}}{{#compare permission "owner" operator="!=="}} ({{this.owner}}){{/compare}}</option>
{{/each}}
</select>
<button class="btn btn-sm btn-primary-faded submit-add-to-library">submit</button>
Expand Down
40 changes: 38 additions & 2 deletions src/styles/sass/ads-sass/library.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,23 @@
margin: 0 0 5px 0;
font-weight: 500;
font-size: 18px;
word-wrap: break-word;

@media screen and (max-width: $screen-sm) {
font-size: 1em;
max-width: 70px;
}
}

.libraries-list-container th {
font-weight: 500;
font-variant: small-caps;
text-transform: lowercase;
font-size: 18px;

@media screen and (max-width: $screen-sm) {
font-size: 1em;
}
}

tbody tr {
Expand All @@ -110,6 +120,10 @@
border-top: 1px solid #ddd;
vertical-align: top;
line-height: 1.428571429;

@media screen and (max-width: $screen-sm) {
padding: 5px;
}
}

a:hover {
Expand All @@ -120,10 +134,29 @@
.all-libraries-widget .library-description {
margin: 0;
max-width: 370px;
word-wrap: break-word;

@media screen and (max-width: $screen-sm) {
max-width: 70px;
}
}

.all-libraries-widget .fa-unlock {
.fa-unlock {
color: $brand-success;
padding: 4px 2px;
}

.fa-lock {
padding: 4px 2px;
}

.fa-users {
color: $brand-info;
padding: 4px 2px;
}

.fa-user {
padding: 4px 2px;
}

.all-libraries-widget tbody tr {
Expand All @@ -133,7 +166,7 @@
.library-detail-view,
.library-widget .main {
margin: 15px auto;
padding: 20px 10px;
padding: 20px 3.7%;
max-width: 1000px;

@extend .s-ads-card;
Expand Down Expand Up @@ -227,6 +260,9 @@
.s-library-description p {
display: inline;
font-size: 18px;
@media screen and (max-width: $screen-sm) {
font-size: 1em;
}
}

.s-library-title,
Expand Down
16 changes: 14 additions & 2 deletions src/styles/sass/ads-sass/utility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,25 @@
}

@media screen and (max-width: $screen-xs) {
.hide-xs {
.hide-xxs {
display: none;
}
}

@media screen and (max-width: $screen-sm) {
.hide-sm {
.hide-xs {
display: none;
}
}

@media screen and (min-width: $screen-xs) {
.hide-all-but-xxs {
display: none;
}
}

@media screen and (min-width: $screen-sm) {
.hide-all-but-xs {
display: none;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/mocha/js/widgets/libraries_all.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ define([

if (entry.match('7:57pm')) {
expect(entry).to.eql(
'1 Aliens Among Us Are you one of them? 300 owner Jun 11 2015, 7:57pm'
'1 Aliens Among Us Aliens Among Us Are you one of them? 300 Me owner Jun 11 2015, 7:57pm'
);
} else {
expect(entry).to.eql(
'1 Aliens Among Us Are you one of them? 300 owner Jun 11 2015, 3:57pm'
'1 Aliens Among Us Aliens Among Us Are you one of them? 300 Me owner Jun 11 2015, 3:57pm'
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/js/widgets/query_info_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ define([
expect($("#test #all-vs-selected")[0].options[1].value).to.eql("all");

expect($("#test #library-select")[0].options[1].value).to.eql("1");
expect($("#test #library-select")[0].options[1].textContent).to.eql("Stars? Stars!!!");
expect($("#test #library-select")[0].options[1].textContent).to.eql("Stars? Stars!!! ()");


$("#test .submit-add-to-library").click();
Expand Down

0 comments on commit a3e9c0b

Please sign in to comment.