diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-23 18:50:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-23 18:50:53 +0000 |
commit | dbcf2065b86d610bc714b362d253664d81166e87 (patch) | |
tree | a217cfdd7756ad499f2b9c4ccec0d3dc88e8acbb /extra/sample_plugin/app | |
parent | e4f0864e3a7f17f0e8a282aad29202f53bf11139 (diff) | |
download | redmine-dbcf2065b86d610bc714b362d253664d81166e87.tar.gz redmine-dbcf2065b86d610bc714b362d253664d81166e87.zip |
Added a sample plugin.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@753 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra/sample_plugin/app')
4 files changed, 34 insertions, 0 deletions
diff --git a/extra/sample_plugin/app/controllers/example_controller.rb b/extra/sample_plugin/app/controllers/example_controller.rb new file mode 100644 index 000000000..9bdaf448e --- /dev/null +++ b/extra/sample_plugin/app/controllers/example_controller.rb @@ -0,0 +1,17 @@ +# Sample plugin controller +class ExampleController < ApplicationController + layout 'base' + before_filter :find_project, :authorize + + 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 diff --git a/extra/sample_plugin/app/views/example/say_goodbye.rhtml b/extra/sample_plugin/app/views/example/say_goodbye.rhtml new file mode 100644 index 000000000..3f4d63dae --- /dev/null +++ b/extra/sample_plugin/app/views/example/say_goodbye.rhtml @@ -0,0 +1,5 @@ +<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" %> +<% end %> diff --git a/extra/sample_plugin/app/views/example/say_hello.rhtml b/extra/sample_plugin/app/views/example/say_hello.rhtml new file mode 100644 index 000000000..17aca7bc4 --- /dev/null +++ b/extra/sample_plugin/app/views/example/say_hello.rhtml @@ -0,0 +1,9 @@ +<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 %> + +<% content_for :header_tags do %> + <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %> +<% end %> diff --git a/extra/sample_plugin/app/views/settings/_settings.rhtml b/extra/sample_plugin/app/views/settings/_settings.rhtml new file mode 100644 index 000000000..bf06e2666 --- /dev/null +++ b/extra/sample_plugin/app/views/settings/_settings.rhtml @@ -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> |