initial version

This commit is contained in:
Frédéric Péters 2014-09-05 13:21:40 +02:00
commit e179d2516e
4 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<h2>
Softwares and solutions from <a href="http://www.entrouvert.com/en/" class="external">Entr'ouvert</a>
Logiciels et solutions d'<a href="http://www.entrouvert.com/fr/" class="external">Entr'ouvert</a>
</h2>
<p>All our internal and customer projects are here.
/
Tous nos projets internes et nos projets clients publics sont ici.</p>
<div>
<% if @projects.any? %>
<div class="projects">
<div class="projects-listing">
<% for project in @projects %>
<% @project = project %>
<div class="project box">
<strong><%= link_to_project project %></strong>
<%= textilizable project.short_description, :project => project %>
</div>
<% end %>
<% @project = nil %>
</div> <!-- .projects-listing -->
</div>
<% end %>
<%= call_hook(:view_welcome_index_right, :projects => @projects) %>
</div>
<div>
<%= textilizable Setting.welcome_text %>
<% if @news.any? %>
<div class="news box">
<h3><%=l(:label_news_latest)%></h3>
<%= render :partial => 'news/news', :collection => @news %>
<%= link_to l(:label_news_view_all), :controller => 'news' %>
</div>
<% end %>
<%= call_hook(:view_welcome_index_left, :projects => @projects) %>
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
:title => "#{Setting.app_title}: #{l(:label_news_latest)}") %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
:title => "#{Setting.app_title}: #{l(:label_activity)}") %>
<% end %>

10
init.rb Normal file
View File

@ -0,0 +1,10 @@
require 'redmine'
require_dependency 'welcome_controller_patch'
require_dependency 'project_model_patch'
Redmine::Plugin.register :redmine_entrouvert do
name 'Redmine Entr\'ouvert plugin'
author 'Entr\'ouvert'
version '0.1.0'
end

View File

@ -0,0 +1,12 @@
module ProjectModelPatch
def self.included(base)
base.class_eval do
# Returns a short description of the projects (first lines)
def short_description(length = 255)
description.lines.first.strip if description and description.lines.first
end
end
end
end
Project.send(:include, ProjectModelPatch)

View File

@ -0,0 +1,13 @@
module WelcomeControllerPatch
def self.included(base)
base.class_eval do
def index
@news = News.latest User.current
@projects = Project.all_public.active.find(:all, :order => "LOWER(name)").find_all { |project| not project.repository.nil? }
end
end
end
end
# Add module to Welcome Controller
WelcomeController.send(:include, WelcomeControllerPatch)