Commit 31750a44806473402bf9e691e4cecf302c3ecda1
1 parent
0d5e3192
Exists in
master
and in
29 other branches
Move labelled_form_for to new api format
Showing
31 changed files
with
35 additions
and
37 deletions
Show diff stats
app/controllers/admin/environment_role_manager_controller.rb
1 | class EnvironmentRoleManagerController < AdminController | 1 | class EnvironmentRoleManagerController < AdminController |
2 | protect 'manage_environment_roles', :environment | 2 | protect 'manage_environment_roles', :environment |
3 | - | 3 | + |
4 | def index | 4 | def index |
5 | @admins = Person.find(:all, :conditions => ['role_assignments.resource_type = ?', 'Environment'], :include => :role_assignments ) | 5 | @admins = Person.find(:all, :conditions => ['role_assignments.resource_type = ?', 'Environment'], :include => :role_assignments ) |
6 | end | 6 | end |
@@ -8,7 +8,7 @@ class EnvironmentRoleManagerController < AdminController | @@ -8,7 +8,7 @@ class EnvironmentRoleManagerController < AdminController | ||
8 | def change_roles | 8 | def change_roles |
9 | @admin = Person.find(params[:id]) | 9 | @admin = Person.find(params[:id]) |
10 | @roles = Role.find(:all).select{ |r| r.has_kind?(:environment) } | 10 | @roles = Role.find(:all).select{ |r| r.has_kind?(:environment) } |
11 | - end | 11 | + end |
12 | 12 | ||
13 | def update_roles | 13 | def update_roles |
14 | @roles = params[:roles] ? Role.find(params[:roles]) : [] | 14 | @roles = params[:roles] ? Role.find(params[:roles]) : [] |
@@ -20,7 +20,7 @@ class EnvironmentRoleManagerController < AdminController | @@ -20,7 +20,7 @@ class EnvironmentRoleManagerController < AdminController | ||
20 | end | 20 | end |
21 | redirect_to :action => :index | 21 | redirect_to :action => :index |
22 | end | 22 | end |
23 | - | 23 | + |
24 | def change_role | 24 | def change_role |
25 | @roles = Role.find(:all).select{ |r| r.has_kind?(:environment) } | 25 | @roles = Role.find(:all).select{ |r| r.has_kind?(:environment) } |
26 | @admin = Person.find(params[:id]) | 26 | @admin = Person.find(params[:id]) |
app/helpers/application_helper.rb
@@ -805,8 +805,7 @@ module ApplicationHelper | @@ -805,8 +805,7 @@ module ApplicationHelper | ||
805 | fields_for(name, object, { :builder => NoosferoFormBuilder }.merge(options), &proc) | 805 | fields_for(name, object, { :builder => NoosferoFormBuilder }.merge(options), &proc) |
806 | end | 806 | end |
807 | 807 | ||
808 | - def labelled_form_for(name, object = nil, options = {}, &proc) | ||
809 | - # FIXME remove the =object= argument and adapt the calling code | 808 | + def labelled_form_for(name, options = {}, &proc) |
810 | form_for(name, { :builder => NoosferoFormBuilder }.merge(options), &proc) | 809 | form_for(name, { :builder => NoosferoFormBuilder }.merge(options), &proc) |
811 | end | 810 | end |
812 | 811 |
app/views/account/_login_form.html.erb
1 | -<%= labelled_form_for :user, @user, | 1 | +<%= labelled_form_for :user, |
2 | :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') } do |f| %> | 2 | :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') } do |f| %> |
3 | 3 | ||
4 | <%= f.text_field :login, | 4 | <%= f.text_field :login, |
app/views/account/_signup_form.html.erb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | 11 | ||
12 | <%= error_messages_for :user, :person, :header_message => _('The account could not be created') %> | 12 | <%= error_messages_for :user, :person, :header_message => _('The account could not be created') %> |
13 | 13 | ||
14 | -<%= labelled_form_for :user, @user, :html => { :multipart => true, :id => 'signup-form', :honeypot => true } do |f| %> | 14 | +<%= labelled_form_for :user, :html => { :multipart => true, :id => 'signup-form', :honeypot => true } do |f| %> |
15 | 15 | ||
16 | <input type="hidden" id="signup_time_key" name="signup_time_key" /> | 16 | <input type="hidden" id="signup_time_key" name="signup_time_key" /> |
17 | <script type="text/javascript"> | 17 | <script type="text/javascript"> |
app/views/account/login.html.erb
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | 7 | ||
8 | <%= @message %> | 8 | <%= @message %> |
9 | 9 | ||
10 | -<%= labelled_form_for :user, @user, :url => login_url do |f| %> | 10 | +<%= labelled_form_for :user, :url => login_url do |f| %> |
11 | 11 | ||
12 | <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> | 12 | <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> |
13 | 13 |
app/views/account/login_block.html.erb
@@ -8,8 +8,8 @@ | @@ -8,8 +8,8 @@ | ||
8 | <% | 8 | <% |
9 | @user ||= User.new | 9 | @user ||= User.new |
10 | %> | 10 | %> |
11 | - | ||
12 | - <%= labelled_form_for :user, @user, :url => login_url do |f| %> | 11 | + |
12 | + <%= labelled_form_for :user, :url => login_url do |f| %> | ||
13 | 13 | ||
14 | <%= f.text_field :login, :onchange => 'this.value = convToValidLogin( this.value )' %> | 14 | <%= f.text_field :login, :onchange => 'this.value = convToValidLogin( this.value )' %> |
15 | 15 |
app/views/admin_panel/message_for_disabled_enterprise.html.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | <%= render :file => 'shared/tiny_mce' %> | 3 | <%= render :file => 'shared/tiny_mce' %> |
4 | 4 | ||
5 | -<%= labelled_form_for :environment, @environment, :url => {:action => 'site_info'} do |f| %> | 5 | +<%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> |
6 | 6 | ||
7 | <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%' %> | 7 | <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%' %> |
8 | 8 |
app/views/admin_panel/set_portal_news_amount.html.erb
1 | <h1><%= _('News amount by folder') %></h1> | 1 | <h1><%= _('News amount by folder') %></h1> |
2 | 2 | ||
3 | -<%= labelled_form_for :environment, @environment do |f| %> | 3 | +<%= labelled_form_for :environment do |f| %> |
4 | 4 | ||
5 | <%= labelled_form_field _('Number of news'), select(:environment, :news_amount_by_folder, (1..10).to_a) %> | 5 | <%= labelled_form_field _('Number of news'), select(:environment, :news_amount_by_folder, (1..10).to_a) %> |
6 | 6 |
app/views/admin_panel/site_info.html.erb
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | <%= render :file => 'shared/tiny_mce' %> | 5 | <%= render :file => 'shared/tiny_mce' %> |
6 | 6 | ||
7 | -<%= labelled_form_for :environment, @environment do |f| %> | 7 | +<%= labelled_form_for :environment do |f| %> |
8 | <% tabs = [] %> | 8 | <% tabs = [] %> |
9 | <% tabs << {:title => _('Site info'), :id => 'site-info', | 9 | <% tabs << {:title => _('Site info'), :id => 'site-info', |
10 | :content => (render :partial => 'site_info', :locals => {:f => f})} %> | 10 | :content => (render :partial => 'site_info', :locals => {:f => f})} %> |
app/views/categories/_form.html.erb
1 | <%= error_messages_for 'category' %> | 1 | <%= error_messages_for 'category' %> |
2 | 2 | ||
3 | -<%= labelled_form_for 'category', @category, :html => { :multipart => true} do |f| %> | 3 | +<%= labelled_form_for 'category', :html => { :multipart => true} do |f| %> |
4 | 4 | ||
5 | <%= required_fields_message %> | 5 | <%= required_fields_message %> |
6 | 6 |
app/views/cms/destroy.html.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for 'article' %> | 3 | <%= error_messages_for 'article' %> |
4 | 4 | ||
5 | -<%= labelled_form_for 'article', @article, :url => { :action => 'destroy' }, :method => 'post' do |f| %> | 5 | +<%= labelled_form_for 'article', :url => { :action => 'destroy' }, :method => 'post' do |f| %> |
6 | 6 | ||
7 | <strong> | 7 | <strong> |
8 | <% if @article.folder? %> | 8 | <% if @article.folder? %> |
app/views/cms/edit.html.erb
1 | <%= error_messages_for 'article' %> | 1 | <%= error_messages_for 'article' %> |
2 | 2 | ||
3 | <div class='<%= (environment.enabled?('media_panel') ? 'with_media_panel' : 'no_media_panel') %>'> | 3 | <div class='<%= (environment.enabled?('media_panel') ? 'with_media_panel' : 'no_media_panel') %>'> |
4 | -<%= labelled_form_for 'article', @article, :html => { :multipart => true, :class => @type } do |f| %> | 4 | +<%= labelled_form_for 'article', :html => { :multipart => true, :class => @type } do |f| %> |
5 | 5 | ||
6 | <%= hidden_field_tag("type", @type) if @type %> | 6 | <%= hidden_field_tag("type", @type) if @type %> |
7 | 7 |
app/views/cms/suggest_an_article.html.erb
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | <%= render :file => 'shared/tiny_mce' %> | 5 | <%= render :file => 'shared/tiny_mce' %> |
6 | 6 | ||
7 | -<%= labelled_form_for 'task', @task do |f| %> | 7 | +<%= labelled_form_for 'task' do |f| %> |
8 | 8 | ||
9 | <%= required labelled_form_field(_('Title'), text_field(:task, 'article_name', :size => 50)) %> | 9 | <%= required labelled_form_field(_('Title'), text_field(:task, 'article_name', :size => 50)) %> |
10 | 10 |
app/views/contact/new.html.erb
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | 8 | ||
9 | <%= error_messages_for 'contact' %> | 9 | <%= error_messages_for 'contact' %> |
10 | 10 | ||
11 | -<%= labelled_form_for :contact, @contact do |f| %> | 11 | +<%= labelled_form_for :contact do |f| %> |
12 | <%= hidden_field_tag(:confirm, 'false') %> | 12 | <%= hidden_field_tag(:confirm, 'false') %> |
13 | 13 | ||
14 | <%= required_fields_message %> | 14 | <%= required_fields_message %> |
app/views/enterprise_registration/basic_information.html.erb
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | 18 | ||
19 | <%= required_fields_message %> | 19 | <%= required_fields_message %> |
20 | 20 | ||
21 | - <%= labelled_form_for(:create_enterprise, @create_enterprise) do |f| %> | 21 | + <%= labelled_form_for :create_enterprise do |f| %> |
22 | <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %> | 22 | <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %> |
23 | <%= required labelled_form_field(_('Address'), content_tag('code', environment.top_url + "/" + text_field(:create_enterprise, 'identifier', :size => 26))) %> | 23 | <%= required labelled_form_field(_('Address'), content_tag('code', environment.top_url + "/" + text_field(:create_enterprise, 'identifier', :size => 26))) %> |
24 | <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %> | 24 | <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %> |
app/views/enterprise_validation/edit_validation_info.html.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for :info %> | 3 | <%= error_messages_for :info %> |
4 | 4 | ||
5 | -<%= labelled_form_for :info, @info do |f| %> | 5 | +<%= labelled_form_for :info do |f| %> |
6 | <%= f.text_area(:validation_methodology, :cols => 50, :rows => 10) %> | 6 | <%= f.text_area(:validation_methodology, :cols => 50, :rows => 10) %> |
7 | <%= f.text_area(:restrictions, :cols => 50, :rows => 7) %> | 7 | <%= f.text_area(:restrictions, :cols => 50, :rows => 7) %> |
8 | <% button_bar do %> | 8 | <% button_bar do %> |
app/views/environment_role_manager/change_role.html.erb
1 | <%= _('Changing role of %s') % @admin.name %> | 1 | <%= _('Changing role of %s') % @admin.name %> |
2 | 2 | ||
3 | -<%= labelled_form_for :member, @admin, :url => {:action => 'update_roles'} do |f| %> | ||
4 | - | 3 | +<%= labelled_form_for :admin, :url => {:action => 'update_roles'} do |f| %> |
5 | <%= _('Roles:') %> <br> | 4 | <%= _('Roles:') %> <br> |
6 | <% @roles.each do |r| %> | 5 | <% @roles.each do |r| %> |
7 | <%= labelled_form_field(r.name, (check_box_tag "roles[]", r.id, @admin.role_assignments.map{|ra|ra.role}.include?(r))) %> | 6 | <%= labelled_form_field(r.name, (check_box_tag "roles[]", r.id, @admin.role_assignments.map{|ra|ra.role}.include?(r))) %> |
app/views/environment_role_manager/make_admin.html.erb
1 | <h2> <% _('Make new admin') %> </h2> | 1 | <h2> <% _('Make new admin') %> </h2> |
2 | 2 | ||
3 | -<%= labelled_form_for :person, @person, :url => {:action => 'update_roles'} do |f| %> | 3 | +<%= labelled_form_for :person, :url => {:action => 'update_roles'} do |f| %> |
4 | <%= _('Admin') %> <br> | 4 | <%= _('Admin') %> <br> |
5 | <% @people.each do |p| %> | 5 | <% @people.each do |p| %> |
6 | <%= labelled_form_field(p.name, (radio_button_tag "person", p.id)) %> | 6 | <%= labelled_form_field(p.name, (radio_button_tag "person", p.id)) %> |
app/views/features/_manage_community_fields.html.erb
app/views/features/_manage_enterprise_fields.html.erb
1 | -<%= labelled_form_for(:environment, @environment, :url => {:action => 'manage_enterprise_fields'}) do |f| %> | 1 | +<%= labelled_form_for(:environment, :url => {:action => 'manage_enterprise_fields'}) do |f| %> |
2 | 2 | ||
3 | <table id='enterprise_fields_conf'> | 3 | <table id='enterprise_fields_conf'> |
4 | <tr> | 4 | <tr> |
app/views/features/_manage_person_fields.html.erb
app/views/features/index.html.erb
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | Check all the features you want to enable for your environment, uncheck all the ones you don\'t want, and use the <em>"Save changes" button</em> to confirm your changes.') %> | 8 | Check all the features you want to enable for your environment, uncheck all the ones you don\'t want, and use the <em>"Save changes" button</em> to confirm your changes.') %> |
9 | </p> | 9 | </p> |
10 | 10 | ||
11 | -<%= labelled_form_for(:environment, @environment, :url => {:action => 'update'}) do |f| %> | 11 | +<%= labelled_form_for(:environment, :url => {:action => 'update'}) do |f| %> |
12 | 12 | ||
13 | <table> | 13 | <table> |
14 | <tr> | 14 | <tr> |
app/views/memberships/new_community.html.erb
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | 10 | ||
11 | <div> | 11 | <div> |
12 | 12 | ||
13 | -<%= labelled_form_for :community, @community, :html => { :multipart => true } do |f| %> | 13 | +<%= labelled_form_for :community, :html => { :multipart => true } do |f| %> |
14 | 14 | ||
15 | <%= required_fields_message %> | 15 | <%= required_fields_message %> |
16 | 16 |
app/views/plugins/index.html.erb
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <%= _('Select which plugins you want to enable in your environment') %> | 4 | <%= _('Select which plugins you want to enable in your environment') %> |
5 | </p> | 5 | </p> |
6 | 6 | ||
7 | -<%= labelled_form_for(:environment, @environment, :url => {:action => 'update'}) do |f| %> | 7 | +<%= labelled_form_for(:environment, :url => {:action => 'update'}) do |f| %> |
8 | 8 | ||
9 | <table> | 9 | <table> |
10 | <% @active_plugins.sort_by(&:plugin_name).each do |plugin| %> | 10 | <% @active_plugins.sort_by(&:plugin_name).each do |plugin| %> |
app/views/profile_editor/edit.html.erb
1 | <h1><%= _('Profile settings for %s') % profile.name %></h1> | 1 | <h1><%= _('Profile settings for %s') % profile.name %></h1> |
2 | 2 | ||
3 | -<%= error_messages_for :profile %> | 3 | +<%= error_messages_for :profile_data %> |
4 | 4 | ||
5 | -<%= labelled_form_for :profile_data, @profile, :html => { :id => 'profile-data', :multipart => true } do |f| %> | 5 | +<%= labelled_form_for :profile_data, :html => { :id => 'profile-data', :multipart => true } do |f| %> |
6 | 6 | ||
7 | <% if user.has_permission?('manage_environment_templates', profile.environment) %> | 7 | <% if user.has_permission?('manage_environment_templates', profile.environment) %> |
8 | <div id="profile-is-template"> | 8 | <div id="profile-is-template"> |
app/views/profile_members/change_role.html.erb
1 | <h3> <%= _('Changing role of %s') % @member.name %> </h3> | 1 | <h3> <%= _('Changing role of %s') % @member.name %> </h3> |
2 | 2 | ||
3 | -<%= labelled_form_for :member, @member, :url => {:action => 'update_roles'} do |f| %> | 3 | +<%= labelled_form_for :member, :url => {:action => 'update_roles'} do |f| %> |
4 | 4 | ||
5 | <%= _('Roles:') %> <br> | 5 | <%= _('Roles:') %> <br> |
6 | <% @roles.each do |r| %> | 6 | <% @roles.each do |r| %> |
app/views/role/_form.html.erb
1 | <%= error_messages_for :role %> | 1 | <%= error_messages_for :role %> |
2 | 2 | ||
3 | -<%= labelled_form_for :role, role, :url => (mode == :edit) ? {:action => 'update', :id => role} : {:action => 'create'} do |f| %> | 3 | +<%= labelled_form_for :role, :url => (mode == :edit) ? {:action => 'update', :id => role} : {:action => 'create'} do |f| %> |
4 | 4 | ||
5 | <%= required_fields_message %> | 5 | <%= required_fields_message %> |
6 | 6 |
app/views/tasks/new.html.erb
1 | <h1><%= @ticket.target ? _('New request for %s') % @ticket.target.name : _('New request') %></h1> | 1 | <h1><%= @ticket.target ? _('New request for %s') % @ticket.target.name : _('New request') %></h1> |
2 | 2 | ||
3 | <%# FIXME: put style in css %> | 3 | <%# FIXME: put style in css %> |
4 | -<%= labelled_form_for :ticket, @ticket do |f| %> | 4 | +<%= labelled_form_for :ticket do |f| %> |
5 | <% if @ticket.target %> | 5 | <% if @ticket.target %> |
6 | <%= f.hidden_field :target_id %> | 6 | <%= f.hidden_field :target_id %> |
7 | <% else %> | 7 | <% else %> |
plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb
1 | <%= error_messages_for :contract %> | 1 | <%= error_messages_for :contract %> |
2 | 2 | ||
3 | -<%= labelled_form_for :contract, @contract, :html => {:id => 'bsc-plugin-sales-form'} do |f| %> | 3 | +<%= labelled_form_for :contract, :html => {:id => 'bsc-plugin-sales-form'} do |f| %> |
4 | <%= hidden_field_tag :contract_id, @contract.id %> | 4 | <%= hidden_field_tag :contract_id, @contract.id %> |
5 | <%= required f.text_field(:client_name) %> | 5 | <%= required f.text_field(:client_name) %> |
6 | <%= labelled_form_field(_('Client type'), f.select(:client_type, BscPlugin::Contract::ClientType.types.map{|type| [BscPlugin::Contract::ClientType.names[type], type]}))%> | 6 | <%= labelled_form_field(_('Client type'), f.select(:client_type, BscPlugin::Contract::ClientType.types.map{|type| [BscPlugin::Contract::ClientType.names[type], type]}))%> |
plugins/bsc/views/bsc_plugin_myprofile/create_enterprise.html.erb
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | <%= required_fields_message %> | 5 | <%= required_fields_message %> |
6 | 6 | ||
7 | -<%= labelled_form_for(:create_enterprise, @create_enterprise) do |f| %> | 7 | +<%= labelled_form_for(:create_enterprise) do |f| %> |
8 | 8 | ||
9 | <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %> | 9 | <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %> |
10 | <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %> | 10 | <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %> |
plugins/ldap/views/ldap_plugin_admin/index.html.erb