Skip to content

Commit

Permalink
SAK-32296 Add NYU's "auto favorites" feature (sakaiproject#4147)
Browse files Browse the repository at this point in the history
There are a few components to this:

  * The "Organize Favorites" tab of the "Sites" drawer now shows an
    "Automatically add new sites to your favorites bar" toggle.  If
    this is enabled (the default), user favorites are automatically
    added to include sites as they appear.

  * To avoid the user being overwhelmed by sites, we introduce a limit
    of 15 sites (configurable via sakai.properties) to the site bar at
    the top of the portal.  The "Organize Favorites" tab shows a warning
    if the user has more than this many sites, and provides a visual
    indication of which sites are above the fold.

  * Since users will want to occasionally prune their list of favorite
    sites, there's a "select all/select none" star at the top of each
    term shown in the Sites drawer.  This allows all sites within a term
    to be favorited or unfavorited at once.

  * The "Reload to see your updated favorites" indicator will now only
    show if the user has made a change.  I.e. favoriting and then
    unfavoriting a site won't show the indicator.
  • Loading branch information
marktriggs authored and ottenhoff committed Mar 29, 2017
1 parent cb73c35 commit e3ad4f4
Show file tree
Hide file tree
Showing 10 changed files with 662 additions and 60 deletions.
304 changes: 279 additions & 25 deletions library/src/morpheus-master/js/src/sakai.morpheus.more.sites.js

Large diffs are not rendered by default.

140 changes: 132 additions & 8 deletions library/src/morpheus-master/sass/modules/more-sites/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ body.active-more-sites{

#selectSiteModal{
position: fixed;
z-index: 10000;
z-index: 10000;
overflow:visible;
outline: none;
@include transition( left 0.4s linear 0s );
&.dhtml_more_tabs{
background: $tool-menu-background-color;
Expand Down Expand Up @@ -80,6 +81,7 @@ body.active-more-sites{
.tab-box{
border: 1px solid $tool-border-color;
padding: 5px 5px 5px 1em;
height: 100%;

background-color: $tool-background-color;
}
Expand Down Expand Up @@ -240,19 +242,23 @@ ul.otherSitesCategorList{
margin-bottom: 1em;
}

@media #{$desktop}{
text-align: right;
}

label{
color: $text-color;
}

margin: 1em 1em 0 0;
margin: 1em 1em 1em 0;

#txtSearch{
width: 18em;
min-height: 2em;

padding: 0 5px 0 5px;
border-radius: 50px !important;
border: 1px solid #e5e5e5;
}

#txtSearch:focus {
outline: none;
}

.other-site-search-clear{
Expand All @@ -263,8 +269,8 @@ ul.otherSitesCategorList{

.other-site-search-clear:before{
position: absolute;
top: -3px;
right: 8px;
top: -5px;
right: 14px;
content: '\f057';
font-family: 'FontAwesome';
color: #ccc;
Expand Down Expand Up @@ -405,8 +411,53 @@ ul.favoriteSiteList{
.site-favorite-btn{
padding-right: 0.5em;
}

.site-favorite-is-past-max {
opacity: 0.5;
}
}


li.organizeFavorites:not(.active) .favoriteCountAndWarning.maxFavoritesReached {
font-weight: bold;
color: #de8e07;
}

/* If we've hit max favorites, show a warning icon */
.favoriteCountAndWarning {
&.maxFavoritesReached {
#favoriteMaxWarningIndicator {
display: inline;
}
}
&:not(.maxFavoritesReached) {
#favoriteMaxWarningIndicator {
display: none;
}
}
}

/* Selector length arms race! */
#selectSiteModal #selectSite .tab-pane .organizeFavoritesList li.favorites-max-marker {
font-family: $header-font-family;
width: 95%;
border: 0;
background: transparent !important;
border-top: rgb(229, 229, 229) 2px dashed;
padding-left: 12px !important;
&:hover {
border-top: rgb(229, 229, 229) 2px dashed;
background: transparent !important;
}

.warning-icon {
color: #de8e07;
padding-right: 8px;
}

}


#organizeFavoritesPurgatoryList{
.fav-drag-handle{
display: none;
Expand Down Expand Up @@ -445,6 +496,19 @@ ul.favoriteSiteList{
top: 2px;
}

.favorites-select-all-none {
margin-left: 10px;
margin-right: 6px;

.site-favorite-icon {
font-size: 80%;
}
}

.favorites-help-text {
margin-top: 1em;
}

.site-favorite-icon.site-favorite:hover{
text-shadow: -1px 0 #F49D08, 0 1px #F49D08, 1px 0 #F49D08, 0 -1px #F49D08;
}
Expand Down Expand Up @@ -486,3 +550,63 @@ ul.favoriteSiteList{
display: none;
}
}

#organize-favorites-pane {
float: left;
width: 70%;
border-right: solid 1px #ababab;
}

#favorite-settings-pane {
float: left;
width: 28%;
padding-left: 1em;

/* Switch generator CSS from https://proto.io/freebies/onoff/ */
.onoffswitch {
position: relative; width: 66px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 20px;
}
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 23px; padding: 0; line-height: 23px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "ON";
padding-left: 10px;
background-color: #4ACC5F; color: #FFFFFF;
}
.onoffswitch-inner:after {
content: "OFF";
padding-right: 10px;
background-color: #EEEEEE; color: #999999;
text-align: right;
}
.onoffswitch-switch {
display: block; width: 16px; margin: 3.5px;
background: #FFFFFF;
position: absolute; top: 0; bottom: 0;
right: 39px;
border: 2px solid #999999; border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
/* End switch generator CSS from https://proto.io/freebies/onoff/ */
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public interface Portal

public static final String TOOLCONFIG_HELP_DOCUMENT_URL = "help.url";

/*
* Configuration option for default number of site tabs to display to users
*/
public static final String CONFIG_DEFAULT_TABS = "portal.default.tabs";

/**
* Tool property used to indicate if JSR_168 tools are to be pre-rendered
* as they are being placed in the context.
Expand Down
5 changes: 5 additions & 0 deletions portal/portal-impl/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<artifactId>xom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json.simple.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
8 changes: 7 additions & 1 deletion portal/portal-impl/impl/src/bundle/sitenav.properties
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ sit_tutorial = Tutorial
sit_profile = Profile
sit_preferences = Preferences
sit_dashboard = Dashboard
sit_search=Search sites in this drawer
sit_search=Filter sites
sit_search_cancel=Cancel Search
sit_search_none=No search results found
sit_drawer=Sites in drawer
sit_othersitesclose=Close this drawer
sit_refresh_favorites=<a href=\"javascript:location.reload()\">Reload</a> to see your updated favorite sites
sit_star_sites_description=Star sites below to add them to your favorites bar.
sit_star_sites_with_autofav_description=Star sites below to add them to your favorites bar. New sites will be automatically added to your favorites.
sit_drag_sites_to_reorder=Drag sites to reorder them. Up to {0} sites can be displayed in your favorites bar.
sit_no_favorites_selected=You do not have any favorite sites. Star sites in the "My Sites" menu to add them to your favorites.
sit_autofav_description=Automatically add new sites to your favorites bar:
sit_favorite_limit_reached=Only the first {0} sites (above) will display in your favorites bar.

sit_noscript_message = Sakai works much better when JavaScript is enabled. Please enable JavaScript in your Browser.
rs_enterRoleSwapWithRole = Enter {0} View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sit_newsite = Create New Site
sit_tutorial = Tutorial
sit_profile = Profile
sit_preferences = Preferences
sit_search=Search sites in this drawer
sit_search=Filter sites
sit_search_cancel=Cancel Search
sit_search_none=No search results found
sit_drawer=Sites in drawer
Expand Down
Loading

0 comments on commit e3ad4f4

Please sign in to comment.