Skip to content
Snippets Groups Projects
Commit 3bbe378d authored by Florian Gnaegi - frentix GmbH's avatar Florian Gnaegi - frentix GmbH
Browse files

OO-1068 bootstrapify notifications

parent f6866033
No related branches found
No related tags found
No related merge requests found
Showing
with 82 additions and 28 deletions
...@@ -78,7 +78,7 @@ public class SubscriptionInfo { ...@@ -78,7 +78,7 @@ public class SubscriptionInfo {
if (!hasNews()) return ""; if (!hasNews()) return "";
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
boolean firstDone = false; boolean firstDone = false;
if (mimeType.equals(SubscriptionInfo.MIME_HTML)) sb.append("<ul>"); if (mimeType.equals(SubscriptionInfo.MIME_HTML)) sb.append("<ul class='list-unstyled'>");
for (SubscriptionListItem subListItem : subsList) { for (SubscriptionListItem subListItem : subsList) {
if (firstDone && mimeType.equals(SubscriptionInfo.MIME_PLAIN)) { if (firstDone && mimeType.equals(SubscriptionInfo.MIME_PLAIN)) {
sb.append("\n"); sb.append("\n");
......
...@@ -126,12 +126,11 @@ public class SubscriptionListItem { ...@@ -126,12 +126,11 @@ public class SubscriptionListItem {
Translator trans = Util.createPackageTranslator(ContextualSubscriptionController.class, locale); Translator trans = Util.createPackageTranslator(ContextualSubscriptionController.class, locale);
Formatter form = Formatter.getInstance(locale); Formatter form = Formatter.getInstance(locale);
String datePart = trans.translate("subscription.listitem.dateprefix", new String [] { form.formatDateAndTime(date) } ) ; String datePart = trans.translate("subscription.listitem.dateprefix", new String [] { form.formatDateAndTime(date) } ) ;
sb.append("<li>");
if (iconCssClass != null) { if (iconCssClass != null) {
sb.append("<li class=\"b_with_small_icon_left "); sb.append("<i class=\"o_icon o_icon-fw ");
sb.append(iconCssClass); sb.append(iconCssClass);
sb.append("\">"); sb.append("\"></i>");
} else {
sb.append("<li>");
} }
if (StringHelper.containsNonWhitespace(link)) { if (StringHelper.containsNonWhitespace(link)) {
sb.append("<a href=\""); sb.append("<a href=\"");
...@@ -142,7 +141,7 @@ public class SubscriptionListItem { ...@@ -142,7 +141,7 @@ public class SubscriptionListItem {
sb.append(new OWASPAntiSamyXSSFilter().filter(description.trim())); sb.append(new OWASPAntiSamyXSSFilter().filter(description.trim()));
} }
if (StringHelper.containsNonWhitespace(link)) sb.append("</a>"); if (StringHelper.containsNonWhitespace(link)) sb.append("</a>");
sb.append(" ").append(datePart.trim()); sb.append(" <span class='o_nowrap o_date'>").append(datePart.trim()).append("</span>");
sb.append("</li>"); sb.append("</li>");
return sb.toString(); return sb.toString();
} }
......
...@@ -42,9 +42,9 @@ public class TitleItem extends SubscriptionInfoItem { ...@@ -42,9 +42,9 @@ public class TitleItem extends SubscriptionInfoItem {
return "<h4>" + content + "</h4>"; return "<h4>" + content + "</h4>";
} else { } else {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("<h4 class=\"b_with_small_icon_left "); sb.append("<h4><i class=\"o_icon o_icon-fw ");
sb.append(iconCssClass); sb.append(iconCssClass);
sb.append("\">"); sb.append("\"> </i>"); // space required by antisamy
sb.append(content); sb.append(content);
sb.append("</h4>"); sb.append("</h4>");
return sb.toString(); return sb.toString();
......
<div class="o_notifications_news_wrapper"> <div class="o_notifications_news_wrapper">
<h4>$r.translate("news.title")</h4> <h3>$r.translate("news.title")</h3>
<p> <p>
$r.translate("news.desc") $r.translate("news.desc")
</p> </p>
<div class="o_notifications_news_datechooser"> <div class="o_notifications_news_datechooser o_block_large row">
<div class="b_float_right"> <div class="col-xs-12 col-sm-6">
$r.render("emailLink") $r.render("dateChooserCtr")
</div>
<div class="col-xs-12 col-sm-6">
<div class="pull-right">
$r.render("emailLink")
</div>
</div> </div>
$r.render("dateChooserCtr")
</div> </div>
#foreach($sub in $subs) #foreach($sub in $subs)
#if($subsFormatter.hasNews($sub)) #if($subsFormatter.hasNews($sub))
<div class="o_notifications_news_subscription"> <div class="o_notifications_news_subscription">
...@@ -36,6 +40,7 @@ ...@@ -36,6 +40,7 @@
#if($subscrItem) #if($subscrItem)
<a href="$subscrItem.getLink()" onkeypress="return o2cl();" onclick="return o2cl();"> <a href="$subscrItem.getLink()" onkeypress="return o2cl();" onclick="return o2cl();">
$r.translate("resource.open", $subsFormatter.getType($sub)) $r.translate("resource.open", $subsFormatter.getType($sub))
<i class="o_icon o_icon_start"></i>
</a> </a>
#end #end
#end #end
......
<div class="b_float_right"> <h3>
$r.contextHelp("org.olat.home","home-rss.html","help.hover.rss") $r.translate("notifcations.rss.title")
</div> $r.contextHelpWithWrapper("org.olat.home","home-rss.html","help.hover.rss")
<h4>$r.translate("notifcations.rss.title")</h4> </h3>
<p> <p>
$r.translate("notifcations.rss.desc") $r.translate("notifcations.rss.desc")
</p> </p>
<p> <p>
<a class="b_with_small_icon_left o_rss_icon" href="$rssLink" target="_blank">$r.translate("rss.title", $fullName)</a> <a href="$rssLink" target="_blank">
<i class='o_icon o_icon_rss'></i>
$r.translate("rss.title", $fullName)
</a>
</p> </p>
<div class="b_float_right"> <h3>
$r.contextHelp("org.olat.core.commons.services.notifications.ui","home-notifications.html","help.hover.notif") $r.translate("subscriptions.title")
</div> $r.contextHelpWithWrapper("org.olat.core.commons.services.notifications.ui","home-notifications.html","help.hover.notif")
<h4>$r.translate("subscriptions.title")</h4> </h3>
<p> <p>
$r.translate("subscriptions.desc") $r.translate("subscriptions.desc")
</p> </p>
......
...@@ -116,7 +116,7 @@ public class TableRenderer implements ComponentRenderer { ...@@ -116,7 +116,7 @@ public class TableRenderer implements ComponentRenderer {
// starting real table table // starting real table table
target.append("<div class=\"o_table_wrapper table-responsive\" id=\"b_overflowscrollbox_").append(table.hashCode()).append("\">"); target.append("<div class=\"o_table_wrapper table-responsive\" id=\"b_overflowscrollbox_").append(table.hashCode()).append("\">");
target.append("<table id=\"b_table").append(table.hashCode()).append("\" class=\"o_table table table-bordered table-hover").append(CLOSE_HTML_BRACE); target.append("<table id=\"b_table").append(table.hashCode()).append("\" class=\"o_table table table-striped table-condensed table-hover").append(CLOSE_HTML_BRACE);
appendHeaderLinks(target, translator, table, formName, cols, asc); appendHeaderLinks(target, translator, table, formName, cols, asc);
appendDataRows(renderer, target, ubu, table, iframePostEnabled, cols, selRowUnSelectable, selRowId, startRowId, endRowId); appendDataRows(renderer, target, ubu, table, iframePostEnabled, cols, selRowUnSelectable, selRowId, startRowId, endRowId);
target.append("</table><div class='o_table_footer'>"); target.append("</table><div class='o_table_footer'>");
......
...@@ -386,7 +386,11 @@ ...@@ -386,7 +386,11 @@
<tag name="span" action="validate"> <tag name="span" action="validate">
<attribute name="class" /> <attribute name="class" />
</tag> </tag>
<tag name="i" action="validate" /> <!-- necessary for font-awesome icons -->
<tag name="i" action="validate" >
<attribute name="class" />
</tag>
<tag name="b" action="validate" /> <tag name="b" action="validate" />
<tag name="strong" action="validate" /> <tag name="strong" action="validate" />
<tag name="s" action="validate" /> <tag name="s" action="validate" />
......
...@@ -88,6 +88,7 @@ $fa-css-prefix: "o_icon" !default; ...@@ -88,6 +88,7 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_readwrite { @extend .o_icon-edit; } .o_icon_readwrite { @extend .o_icon-edit; }
.o_icon_recycle { @extend .o_icon-recycle; } .o_icon_recycle { @extend .o_icon-recycle; }
.o_icon_refresh { @extend .o_icon-refresh; } .o_icon_refresh { @extend .o_icon-refresh; }
.o_icon_rss { @extend .o_icon-rss;}
.o_icon_search {@extend .o_icon-search;} .o_icon_search {@extend .o_icon-search;}
.o_icon_settings{ @extend .o_icon-gears;} .o_icon_settings{ @extend .o_icon-gears;}
.o_icon_show_more { @extend .o_icon-toggle-down; } .o_icon_show_more { @extend .o_icon-toggle-down; }
...@@ -129,6 +130,12 @@ a.o_icon { ...@@ -129,6 +130,12 @@ a.o_icon {
.o_FileResource-TEST_icon{ @extend .o_icon-pencil-square-o; } .o_FileResource-TEST_icon{ @extend .o_icon-pencil-square-o; }
.o_FileResource-WIKI_icon{ @extend .o_icon-globe; } .o_FileResource-WIKI_icon{ @extend .o_icon-globe; }
/* notification icons */
.o_forum_message_icon {@extend .o_icon-comment-o; }
.o_calendar_icon {@extend .o_icon-calendar; }
/* Access control icons */ /* Access control icons */
.o_ac_token_icon { @extend .o_icon-key;} .o_ac_token_icon { @extend .o_icon-key;}
.o_ac_free_icon { @extend .o_icon-gift;} .o_ac_free_icon { @extend .o_icon-gift;}
......
...@@ -50,6 +50,36 @@ ...@@ -50,6 +50,36 @@
.o_author {} .o_author {}
} }
/* notifications and subscription */
.o_notifications_news_wrapper {
.o_notifications_news_datechooser {}
.o_notifications_news_subscription {
margin: $padding-large-vertical 0;
h4 i {
display: none;
}
.o_notifications_news_context {
@extend .text-muted;
}
.o_notifications_news_content {
margin-left: 1.5em;
position: relative;
.o_icon {
position: absolute;
left: -1.5em;
line-height: 1.5em;
top: 0;
}
.o_date {
@extend .text-muted;
}
}
.o_notifications_news_url {
margin-left: 1.5em;
}
}
}
/* toogle box */ /* toogle box */
.o_togglebox_wrapper { .o_togglebox_wrapper {
a.o_togglebox_closed i { a.o_togglebox_closed i {
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -250,6 +250,12 @@ public class XSSFilterTest { ...@@ -250,6 +250,12 @@ public class XSSFilterTest {
// t("<span title=\"a>b\">&nbsp;</span>", "<span title=\"a&gt;b\">&nbsp;</span>"); // t("<span title=\"a>b\">&nbsp;</span>", "<span title=\"a&gt;b\">&nbsp;</span>");
} }
@Test
public void test_font_awesome() {
// for now i tags must have at least a space to not b removed
t("<i class=\"o_icon o_icon_dev\"> </i> ", "<i class=\"o_icon o_icon_dev\"> </i> ");
}
@Test @Test
public void test_big_tiny_output(){ public void test_big_tiny_output(){
testsToRun = 1; testsToRun = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment