Created
March 25, 2011 14:30
-
-
Save anonymous/886919 to your computer and use it in GitHub Desktop.
new.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= error_messages_for 'typeCustomFields' %> | |
<div class="box"> | |
<p> | |
<%= f.text_field :descrizione, :label=>l(:label_descrizione), :required => true-%> | |
</p> | |
<p> | |
<%= f.text_field 'figlia_di', :label=>l(:label_parent) -%> | |
</p> | |
<p> | |
<%= f.text_field :riferimento, :label=>l(:label_riferimento), :required => true %> | |
</p> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2><%=l(:label_type)%></h2> | |
<% labelled_tabular_form_for :type, @type, :url => {:action => 'create' } do |f| %> | |
<%= render :partial => 'form', :locals => { :f => f } %> | |
<%= submit_tag l(:button_create) %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TypeCustomFields < ActiveRecord::Base | |
validates_presence_of :descrizione | |
validates_presence_of :riferimento | |
def self.findAll | |
TypeCustomFields.find(:all) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TypeCustomFieldsController < ApplicationController | |
before_filter :get_type_new | |
def get_type_new | |
@type = TypeCustomFields.new | |
end | |
def new | |
@type = TypeCustomFields.new | |
end | |
def create | |
@type = TypeCustomFields.new(params[:typeCustomFields]) | |
if @type.save | |
flash[:notice] = l(:notice_successful_create) | |
redirect_to :controller => 'type_custom_fields', :action => 'settings' | |
else | |
render :action => 'new' | |
end | |
end | |
def edit | |
if request.post? and @type.update_attributes(params[:descrizione]) and @type.update_attributes(params[:riferimento]) | |
flash[:notice] = l(:notice_successful_update) | |
redirect_to :controller => 'type_custom_fields', :action => 'settings' | |
end | |
end | |
def settings | |
respond_to do |format| | |
format.html { render :template => ' settings/redmine_linked_custom_fields_settings', :layout => !request.xhr? } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment