Redmine 3.4.4

This commit is contained in:
Manuel Cillero 2018-02-02 22:19:29 +01:00
commit 64924a6376
2112 changed files with 259028 additions and 0 deletions

View file

@ -0,0 +1,15 @@
== Sample plugin
This is a sample plugin for Redmine
== Installation
1. Copy the plugin directory into the "plugins" directory at the root
of your Redmine directory
2. Migrate and copy plugin assets:
rake redmine:plugins
3. Start Redmine
Installed plugins are listed and can be configured from 'Admin -> Plugins' screen.

View file

@ -0,0 +1,20 @@
# Sample plugin controller
class ExampleController < ApplicationController
unloadable
layout 'base'
before_action :find_project, :authorize
menu_item :sample_plugin
def say_hello
@value = Setting.plugin_sample_plugin['sample_setting']
end
def say_goodbye
end
private
def find_project
@project=Project.find(params[:id])
end
end

View file

@ -0,0 +1,12 @@
class Meeting < ActiveRecord::Base
belongs_to :project
acts_as_event :title => Proc.new {|o| "#{o.scheduled_on} Meeting"},
:datetime => :scheduled_on,
:author => nil,
:url => Proc.new {|o| {:controller => 'meetings', :action => 'show', :id => o.id}}
acts_as_activity_provider :timestamp => 'scheduled_on',
:scope => includes(:project),
:permission => nil
end

View file

@ -0,0 +1,7 @@
<h2>Good Bye</h2>
<p class="icon icon-example-works"><%= l(:text_say_goodbye) %></p>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'example', :plugin => 'sample_plugin', :media => "screen" %>
<% end %>

View file

@ -0,0 +1,15 @@
<h2>Hello</h2>
<p class="icon icon-example-works"><%= l(:text_say_hello) %></p>
<p><label>Example setting</label>: <%= @value %></p>
<%= link_to('Good bye', :action => 'say_goodbye', :id => @project) if User.current.allowed_to?(:example_say_goodbye, @project) %>
<% content_for :sidebar do %>
<p>Adding content to the sidebar...</p>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'example', :plugin => 'sample_plugin', :media => "screen" %>
<% end %>

View file

@ -0,0 +1,3 @@
<h3>Sample block</h3>
You are <strong><%= h(User.current) %></strong> and this is a sample block for My Page added from a plugin.

View file

@ -0,0 +1,3 @@
<p><label>Example setting</label><%= text_field_tag 'settings[sample_setting]', @settings['sample_setting'] %></p>
<p><label>Foo</label><%= text_field_tag 'settings[foo]', @settings['foo'] %></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -0,0 +1 @@
.icon-example-works { background-image: url(../images/it_works.png); }

View file

@ -0,0 +1,6 @@
# Sample plugin
en:
label_plugin_example: Sample Plugin
label_meeting_plural: Meetings
text_say_hello: Plugin say 'Hello'
text_say_goodbye: Plugin say 'Good bye'

View file

@ -0,0 +1,6 @@
# Sample plugin
fr:
label_plugin_example: Plugin exemple
label_meeting_plural: Meetings
text_say_hello: Plugin dit 'Bonjour'
text_say_goodbye: Plugin dit 'Au revoir'

View file

@ -0,0 +1,7 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
match 'projects/:id/hello', :to => 'example#say_hello', :via => 'get'
match 'projects/:id/bye', :to => 'example#say_goodbye', :via => 'get'
resources 'meetings'

View file

@ -0,0 +1,15 @@
# Sample plugin migration
# Use rake db:migrate_plugins to migrate installed plugins
class CreateMeetings < ActiveRecord::Migration
def self.up
create_table :meetings do |t|
t.column :project_id, :integer, :null => false
t.column :description, :string
t.column :scheduled_on, :datetime
end
end
def self.down
drop_table :meetings
end
end

View file

@ -0,0 +1,27 @@
Rails.logger.info 'Starting Example plugin for RedMine'
Redmine::Plugin.register :sample_plugin do
name 'Example plugin'
author 'Author name'
description 'This is a sample plugin for Redmine'
version '0.0.1'
settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/sample_plugin_settings'
# This plugin adds a project module
# It can be enabled/disabled at project level (Project settings -> Modules)
project_module :example_module do
# A public action
permission :example_say_hello, {:example => [:say_hello]}, :public => true
# This permission has to be explicitly given
# It will be listed on the permissions screen
permission :example_say_goodbye, {:example => [:say_goodbye]}
# This permission can be given to project members only
permission :view_meetings, {:meetings => [:index, :show]}, :require => :member
end
# A new item is added to the project menu
menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample'
# Meetings are added to the activity view
activity_provider :meetings
end

View file

@ -0,0 +1,12 @@
require File.expand_path(File.dirname(__FILE__) + '../../../../../test/test_helper')
class SamplePluginRoutingTest < ActionDispatch::IntegrationTest
def test_example
assert_routing(
{ :method => 'get', :path => "/projects/1234/hello" },
{ :controller => 'example', :action => 'say_hello',
:id => '1234' }
)
end
end