From e179d2516e5d6a572752bcd78d958adf22dfd892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 5 Sep 2014 13:21:40 +0200 Subject: [PATCH] initial version --- app/views/welcome/index.html.erb | 48 ++++++++++++++++++++++++++++++++ init.rb | 10 +++++++ lib/project_model_patch.rb | 12 ++++++++ lib/welcome_controller_patch.rb | 13 +++++++++ 4 files changed, 83 insertions(+) create mode 100644 app/views/welcome/index.html.erb create mode 100644 init.rb create mode 100644 lib/project_model_patch.rb create mode 100644 lib/welcome_controller_patch.rb diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb new file mode 100644 index 0000000..83287f8 --- /dev/null +++ b/app/views/welcome/index.html.erb @@ -0,0 +1,48 @@ +

+ Softwares and solutions from Entr'ouvert +— + Logiciels et solutions d'Entr'ouvert +

+ +

All our internal and customer projects are here. +/ +Tous nos projets internes et nos projets clients publics sont ici.

+ + +
+ <% if @projects.any? %> +
+
+ <% for project in @projects %> + <% @project = project %> +
+ <%= link_to_project project %> + <%= textilizable project.short_description, :project => project %> +
+ <% end %> + <% @project = nil %> +
+
+ <% end %> + <%= call_hook(:view_welcome_index_right, :projects => @projects) %> +
+ +
+ <%= textilizable Setting.welcome_text %> + <% if @news.any? %> +
+

<%=l(:label_news_latest)%>

+ <%= render :partial => 'news/news', :collection => @news %> + <%= link_to l(:label_news_view_all), :controller => 'news' %> +
+ <% end %> + <%= call_hook(:view_welcome_index_left, :projects => @projects) %> +
+ + +<% 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 %> diff --git a/init.rb b/init.rb new file mode 100644 index 0000000..35baeac --- /dev/null +++ b/init.rb @@ -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 diff --git a/lib/project_model_patch.rb b/lib/project_model_patch.rb new file mode 100644 index 0000000..8a1b7fe --- /dev/null +++ b/lib/project_model_patch.rb @@ -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) diff --git a/lib/welcome_controller_patch.rb b/lib/welcome_controller_patch.rb new file mode 100644 index 0000000..b689287 --- /dev/null +++ b/lib/welcome_controller_patch.rb @@ -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)