From dbcf2065b86d610bc714b362d253664d81166e87 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 23 Sep 2007 18:50:53 +0000 Subject: Added a sample plugin. git-svn-id: http://redmine.rubyforge.org/svn/trunk@753 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../sample_plugin/app/controllers/example_controller.rb | 17 +++++++++++++++++ extra/sample_plugin/app/views/example/say_goodbye.rhtml | 5 +++++ extra/sample_plugin/app/views/example/say_hello.rhtml | 9 +++++++++ extra/sample_plugin/app/views/settings/_settings.rhtml | 3 +++ 4 files changed, 34 insertions(+) create mode 100644 extra/sample_plugin/app/controllers/example_controller.rb create mode 100644 extra/sample_plugin/app/views/example/say_goodbye.rhtml create mode 100644 extra/sample_plugin/app/views/example/say_hello.rhtml create mode 100644 extra/sample_plugin/app/views/settings/_settings.rhtml (limited to 'extra/sample_plugin/app') 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 @@ +

<%= l(:text_say_goodbye) %>

+ +<% 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 @@ +

<%= l(:text_say_hello) %>

+ +

: <%= @value %>

+ +<%= 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 @@ +

<%= text_field_tag 'settings[sample_setting]', @settings['sample_setting'] %>

+ +

<%= text_field_tag 'settings[foo]', @settings['foo'] %>

-- cgit v1.2.3