Commit 094382c6b80ce81e4379ea5bc7334d1de65ea0df
1 parent
150d3860
Exists in
master
and in
9 other branches
adding the possibility to add proposal discussion, host and private_key config
Showing
3 changed files
with
54 additions
and
0 deletions
Show diff stats
controllers/proposals_discussion_plugin_admin_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,13 @@ |
1 | +class ProposalsDiscussionPluginAdminController < PluginAdminController | |
2 | + | |
3 | + def index | |
4 | + @settings = Noosfero::Plugin::Settings.new(environment, ProposalsDiscussionPlugin, params[:settings]) | |
5 | + | |
6 | + if request.post? | |
7 | + @settings.save! | |
8 | + session[:notice] = _('Settings succefully saved.') | |
9 | + redirect_to :action => 'index' | |
10 | + end | |
11 | + end | |
12 | + | |
13 | +end | ... | ... |
... | ... | @@ -0,0 +1,32 @@ |
1 | +<h1><%= _('Proposals Discussion settings')%></h1> | |
2 | + | |
3 | +<script type='text/javascript'> | |
4 | + | |
5 | +function add_host() { | |
6 | + var new_host = jQuery('.hosts>li').clone(); | |
7 | + new_host.show(); | |
8 | + jQuery('.hosts').append(new_host); | |
9 | +} | |
10 | + | |
11 | +</script> | |
12 | + | |
13 | +<%= form_for(:settings) do |f| %> | |
14 | + | |
15 | + <%= display_form_field(_('Proposal Discussion'), f.select(:proposal_discussion_id, environment.discussions.map{|d|[d.name, d.id]})) %> | |
16 | + | |
17 | + <ul class='hosts'> | |
18 | + <% for access in environment.settings[:proposals_discussion_plugin][:proposal_app_accesses] do %> | |
19 | + <li> | |
20 | + <%= labelled_form_field _('Host:'), text_field_tag('settings[proposal_app_accesses][][host]', access[:host]) %> | |
21 | + <%= labelled_form_field _('Private key:'), text_field_tag('settings[proposal_app_accesses][][private_key]', access[:private_key]) %> | |
22 | + </li> | |
23 | + <% end %> | |
24 | + </ul> | |
25 | + <%= link_to_function(_('New Host'), 'add_host();', :class => 'button icon-add with-text') %> | |
26 | + | |
27 | + <% button_bar do %> | |
28 | + <%= submit_button(:save, c_('Save'), :cancel => {:controller => 'plugins', :action => 'index'}) %> | |
29 | + <% end %> | |
30 | + | |
31 | +<% end %> | |
32 | + | ... | ... |