From 5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 25 Apr 2012 17:17:49 +0000 Subject: Merged rails-3.2 branch. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9528 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- extra/sample_plugin/README | 7 ++++--- extra/sample_plugin/app/views/example/say_goodbye.html.erb | 4 +++- extra/sample_plugin/app/views/example/say_hello.html.erb | 10 ++++++++-- extra/sample_plugin/config/routes.rb | 7 +++++++ extra/sample_plugin/init.rb | 5 +---- 5 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 extra/sample_plugin/config/routes.rb (limited to 'extra') diff --git a/extra/sample_plugin/README b/extra/sample_plugin/README index d576ecfbf..5fe8a2a31 100644 --- a/extra/sample_plugin/README +++ b/extra/sample_plugin/README @@ -4,10 +4,11 @@ This is a sample plugin for Redmine == Installation -1. Copy the plugin directory into the vendor/plugins directory +1. Copy the plugin directory into the "plugins" directory at the root + of your Redmine directory -2. Migrate plugin: - rake db:migrate_plugins +2. Migrate and copy plugin assets: + rake redmine:plugins 3. Start Redmine diff --git a/extra/sample_plugin/app/views/example/say_goodbye.html.erb b/extra/sample_plugin/app/views/example/say_goodbye.html.erb index 3f4d63dae..978fbd9b2 100644 --- a/extra/sample_plugin/app/views/example/say_goodbye.html.erb +++ b/extra/sample_plugin/app/views/example/say_goodbye.html.erb @@ -1,5 +1,7 @@ +

Good Bye

+

<%= l(:text_say_goodbye) %>

<% content_for :header_tags do %> - <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %> + <%= stylesheet_link_tag "/plugin_assets/sample_plugin/stylesheets/example.css", :media => "screen" %> <% end %> diff --git a/extra/sample_plugin/app/views/example/say_hello.html.erb b/extra/sample_plugin/app/views/example/say_hello.html.erb index 17aca7bc4..9bfa8cc4f 100644 --- a/extra/sample_plugin/app/views/example/say_hello.html.erb +++ b/extra/sample_plugin/app/views/example/say_hello.html.erb @@ -1,9 +1,15 @@ +

Hello

+

<%= l(:text_say_hello) %>

: <%= @value %>

-<%= link_to_if_authorized 'Good bye', :action => 'say_goodbye', :id => @project %> +<%= link_to('Good bye', :action => 'say_goodbye', :id => @project) if User.current.allowed_to?(:example_say_goodbye, @project) %> + +<% content_for :sidebar do %> +

Adding content to the sidebar...

+<% end %> <% content_for :header_tags do %> - <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %> + <%= stylesheet_link_tag "/plugin_assets/sample_plugin/stylesheets/example.css", :media => "screen" %> <% end %> diff --git a/extra/sample_plugin/config/routes.rb b/extra/sample_plugin/config/routes.rb new file mode 100644 index 000000000..53428a7c5 --- /dev/null +++ b/extra/sample_plugin/config/routes.rb @@ -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' diff --git a/extra/sample_plugin/init.rb b/extra/sample_plugin/init.rb index 5a5e26694..be7eeceb6 100644 --- a/extra/sample_plugin/init.rb +++ b/extra/sample_plugin/init.rb @@ -1,7 +1,4 @@ -# Redmine sample plugin -require 'redmine' - -RAILS_DEFAULT_LOGGER.info 'Starting Example plugin for RedMine' +Rails.logger.info 'Starting Example plugin for RedMine' Redmine::Plugin.register :sample_plugin do name 'Example plugin' -- cgit v1.2.3