--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.api.web;
+
+import org.sonar.api.ServerExtension;
+
+/**
+ * @since 3.3
+ */
+public abstract class PageDecoration extends AbstractRubyTemplate implements ServerExtension {
+
+}
import org.sonar.server.rules.ProfilesConsole;
import org.sonar.server.rules.RulesConsole;
import org.sonar.server.startup.*;
-import org.sonar.server.ui.CodeColorizers;
-import org.sonar.server.ui.JRubyI18n;
-import org.sonar.server.ui.SecurityRealmFactory;
-import org.sonar.server.ui.Views;
+import org.sonar.server.ui.*;
import javax.servlet.ServletContext;
servicesContainer.addSingleton(ResourceTypes.class);
servicesContainer.addSingleton(NewUserNotifier.class);
servicesContainer.addSingleton(SettingsChangeNotifier.class);
+ servicesContainer.addSingleton(PageDecorations.class);
// Notifications
servicesContainer.addSingleton(EmailSettings.class);
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.server.ui;
+
+import org.sonar.api.ServerComponent;
+import org.sonar.api.web.PageDecoration;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @since 3.3
+ */
+public final class PageDecorations implements ServerComponent {
+
+ private final PageDecoration[] decorations;
+
+ public PageDecorations(List<PageDecoration> decorations) {
+ this.decorations = decorations.toArray(new PageDecoration[decorations.size()]);
+ }
+
+ public PageDecorations() {
+ this(Collections.<PageDecoration>emptyList());
+ }
+
+ public PageDecoration[] get() {
+ return decorations;
+ }
+}
period_param = "period=#{params[:period]}" if params[:period]
%>
<div id="container">
+<%= yield :header -%>
<div id="hd">
<div id="nav-left">
<ul>
<% end %>
</ul>
+ <%= yield :sidebar %>
<div id="logo">
<center><a href="http://www.sonarsource.org/" target="SonarSource"><%= image_tag('sonar.png', :alt => message('layout.sonar.slogan'), :class => 'png') -%></a></center>
</div>
</div>
<% unless params[:hd]=='false' %>
+ <%= yield :footer %>
<div id="footer">
<% controller.java_facade.getWebFooters().each do |footer| %>
<% if footer.getHtml() %>
+<%
+ controller.java_facade.getCoreComponentByClassname('org.sonar.server.ui.PageDecorations').get().each do |decoration|
+ begin
+%>
+ <%= render :inline => decoration.getTemplate() -%>
+ <%
+ rescue => error
+ logger.error(error)
+ end
+ end
+ %>
<%= render :partial => 'layouts/head' unless params[:hd]=='false' %>
<% if params[:layout]=='false' %>
<%= render :partial => 'layouts/nolayout' %>
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.server.ui;
+
+import org.junit.Test;
+import org.sonar.api.web.PageDecoration;
+
+import java.util.Arrays;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+public class PageDecorationsTest {
+
+ @Test
+ public void should_not_fail_if_no_decorations() {
+ assertThat(new PageDecorations().get()).isEmpty();
+ }
+
+ @Test
+ public void should_register_decorations() {
+ PageDecoration deco1 = mock(PageDecoration.class);
+ PageDecoration deco2 = mock(PageDecoration.class);
+
+ PageDecorations decorations = new PageDecorations(Arrays.asList(deco1, deco2));
+
+ assertThat(decorations.get()).hasSize(2);
+ }
+}