Commit ce611e88 authored by Enrique García's avatar Enrique García

transformed featured_projects into a submodule

parent 3361abd7
......@@ -13,3 +13,6 @@
[submodule "vendor/plugins/redmine-gitolite"]
path = vendor/plugins/redmine-gitolite
url = git://github.com/splendeo/redmine-gitolite.git
[submodule "vendor/plugins/featured_projects"]
path = vendor/plugins/featured_projects
url = git://github.com/splendeo/featured_projects.git
<h2><%= l(:label_home) %></h2>
<div class="splitcontentleft">
<div class="splitcontentright">
<div class="wiki"><%= textilizable Setting.welcome_text %></div>
<% if @news.any? %>
<div class="news box">
......@@ -12,7 +12,7 @@
<%= call_hook(:view_welcome_index_left, :projects => @projects) %>
</div>
<div class="splitcontentright">
<div class="splitcontentleft">
<% if @projects.any? %>
<div class="projects box">
<h3><%=l(:label_project_latest)%></h3>
......
# MySQL (default setup).
production:
adapter: mysql
database: chiliproject
host: localhost
username: root
password:
encoding: utf8
development:
adapter: mysql
database: chiliproject_development
host: localhost
username: root
password:
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: chiliproject_test
host: localhost
username: root
password:
encoding: utf8
test_pgsql:
adapter: postgresql
database: chiliproject_test
host: localhost
username: postgres
password: "postgres"
test_sqlite3:
adapter: sqlite3
database: db/test.sqlite3
......@@ -11,14 +11,14 @@ body {
* Links
*/
a, a:link, a:visited {
color: #8c8c8c;
text-decoration: none;
font-weight: bold;
color: #8c8c8c;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #b3b3b3;
text-decoration: underline;
color: #b3b3b3;
text-decoration: underline;
}
/*
......@@ -956,4 +956,4 @@ Additional wiki styles
.wiki p.smallnote, .wiki span.smallnote {
background: url(../images/wiki_styles/note_small.png) 5px 4px no-repeat #F5FFFA;
border: 1px solid #C7CFCA;
}
\ No newline at end of file
}
../../../ohwr-theme
\ No newline at end of file
Subproject commit 9d1d7eaa62d1cd8bf52194e6a35fff6109b4513b
Copyright (C) 2011 by Splendeo Innovación
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
== Redmine/Chiliproject Featured Projects Plugin
This plugin allows the redmine/chiliproject administrator to mark any project he wants as "featured" (notice that this is an "admin" right, not a project administrator right).
It also changes the redmine home page to show a "featured projects" box. This box replaces the default "Latest projects" box.
Finally, it adds two named scopes to Project: Project.featured and Project.not_featured
This plugin can be used in consonance with our Redmine Project Filtering plugin ( https://github.com/splendeo/redmine_project_filtering )
== Installation
1. Copy the plugin directory into the vendor/plugins directory
2. Migrate plugin:
rake db:migrate_plugins
3. Start Redmine
Installed plugins are listed and can be configured from 'Admin -> Plugins' screen.
== Credits
Development of this plugin was financed by the Open Hardware Repository - www.ohwr.org
<% content_for :header_tags do %>
<%= stylesheet_link_tag "featured_projects.css", :plugin => "featured_projects" %>
<% end %>
<% if User.current.allowed_to?(:update_featured_project_flags, nil, :global => true) %>
<p><%= form.check_box :is_featured %></p>
<% elsif project.is_featured? %>
<p><span class="icon icon-featured"><%= t('label_project_featured') %></span></p>
<% end %>
<h2><%= l(:label_home) %></h2>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "featured_projects.css", :plugin => "featured_projects", :media => "screen" %>
<% end %>
<div class="splitcontentleft">
<div class="wiki"><%= textilizable Setting.welcome_text %></div>
<% 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>
<div class="splitcontentright">
<% if @projects.any? %>
<div class="box">
<h3 class="icon icon-featured"><%=l(:label_featured_projects)%></h3>
<ul>
<% for project in @projects %>
<% @project = project %>
<li>
<%= link_to_project project %> (<%= format_time(project.created_on) %>)
<%= textilizable project.short_description, :project => project %>
</li>
<% end %>
<% @project = nil %>
</ul>
</div>
<% end %>
<%= call_hook(:view_welcome_index_right, :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 %>
.icon-featured { background-image: url(../images/ribbon-16x16.png); }
# featured projects
en:
field_is_featured: Featured Project
label_featured_projects: Featured Projects
label_project_featured: This project is featured
# Sample plugin migration
# Use rake db:migrate_plugins to migrate installed plugins
class AddIsFeaturedToProjects < ActiveRecord::Migration
def self.up
add_column :projects, :is_featured, :boolean, :default => false, :null => false
end
def self.down
remove_column :accounts, :is_featured
end
end
# Redmine sample plugin
require 'redmine'
require 'dispatcher'
Dispatcher.to_prepare :featured_projects do
require_dependency 'featured_projects/hooks'
require_dependency 'project'
Project.send(:include, FeaturedProjects::Patches::ProjectPatch)
require_dependency 'welcome_controller'
unless WelcomeController.included_modules.include? FeaturedProjects::Patches::WelcomeControllerPatch
WelcomeController.send(:include, FeaturedProjects::Patches::WelcomeControllerPatch)
end
end
Redmine::Plugin.register :featured_projects do
name 'Featured Projects'
author 'Enrique García'
description 'Redmine featured projects'
version '0.0.1'
end
module FeaturedProjects
class Hooks < Redmine::Hook::ViewListener
# :project
# :form
render_on :view_projects_form, :partial => 'hooks/projects/featured_project_fields'
end
end
module FeaturedProjects
module Patches
module ProjectPatch
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
safe_attributes 'is_featured',
:if => lambda {|project, user| user.allowed_to?(:update_featured_project_flags, nil, :global => true) }
named_scope :featured, {:conditions => {:is_featured => true}}
named_scope :not_featured, { :conditions => ["#{Project.table_name}.is_featured <> :true", {:true => true}] }
end
end
module ClassMethods
end
module InstanceMethods
end
end
end
end
module FeaturedProjects
module Patches
module WelcomeControllerPatch
def self.included(base)
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :index, :featured_projects
end
end
end
module InstanceMethods
def index_with_featured_projects
index_without_featured_projects
@projects = Project.visible.featured.all(:order => 'name ASC')
end
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment