diff options
Diffstat (limited to 'extra/sample_plugin')
-rw-r--r-- | extra/sample_plugin/README | 7 | ||||
-rw-r--r-- | extra/sample_plugin/app/views/example/say_goodbye.html.erb | 4 | ||||
-rw-r--r-- | extra/sample_plugin/app/views/example/say_hello.html.erb | 10 | ||||
-rw-r--r-- | extra/sample_plugin/config/routes.rb | 7 | ||||
-rw-r--r-- | extra/sample_plugin/init.rb | 5 |
5 files changed, 23 insertions, 10 deletions
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 @@ +<h2>Good Bye</h2> + <p class="icon icon-example-works"><%= l(:text_say_goodbye) %></p> <% 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 @@ +<h2>Hello</h2> + <p class="icon icon-example-works"><%= l(:text_say_hello) %></p> <p><label>Example setting</label>: <%= @value %></p> -<%= 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 %> + <p>Adding content to the sidebar...</p> +<% 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' |