Class LinkedLogisController
In: app/controllers/linked_logis_controller.rb
Parent: ApplicationController

Methods

Public Instance methods

[Source]

    # File app/controllers/linked_logis_controller.rb, line 35
35:   def create
36:     @new_logi, @new_logi_version = self.create_logi(
37:         params[:logi], :untagged => :if_unset)
38:     body_with_inserts = params[:body_with_inserts]
39: 
40:     if body_with_inserts !~ /#{Const::Logi::INSERT_STRING}/
41:       @logi.errors.add(:text, t('c.linked_logis.error_select_text'))
42:     end
43: 
44:     transfer_errors(@new_logi, @logi)
45: 
46:     if @logi.errors.empty? and @new_logi_version.valid? and 
47:         self.thorny_form_free_of_spam?
48:       # we can save as we know the link is valid on the logi
49:       @new_logi.save
50: 
51:       body_with_comment_link = self.insert_link_to_new_logi(
52:           body_with_inserts, @new_logi)
53:       self.insert_links(@logi, @logi_version, body_with_comment_link)
54: 
55:       flash[:notice] = t 'c.linked_logis.created',
56:           :logi => @new_logi.to_s(:for => :full_show)
57: 
58:       if !params[:and_attach] or params[:and_attach].empty?
59:         redirect_to logi_ll_url(@logi)
60:       else
61:         @selected = 'link'
62:         @link_selected = 'linked_logi'
63:         render :template => 'logi_inserts/new'
64:       end
65:     else
66:       transfer_errors(@new_logi_version, @logi_version)
67: 
68:       flash[:error] = t 'c.linked_logis.error_creating'
69:       @selected = 'link'
70:       @link_selected = 'linked_logi'
71:       render :template => 'logi_inserts/new'
72:       return
73:     end
74:   end

REST-methods

[Source]

    # File app/controllers/linked_logis_controller.rb, line 24
24:   def new
25:     @selected = params[:selected] || 'link'
26:     @link_selected = 'linked_logi'
27:     @new_logi = Logi.new_with(:creator => current_user,
28:         :user_group => current_prefs.user_group)
29:     @new_logi_version = @new_logi.current_logi_version
30:     render :template => 'logi_inserts/new'
31:   end
show()

Alias for new

Protected Instance methods

Private methods

[Source]

    # File app/controllers/linked_logis_controller.rb, line 80
80:   def insert_link_to_new_logi(body_with_inserts, new_logi)
81:     return body_with_inserts.gsub(/#{Const::Logi::INSERT_STRING}/,
82:         new_logi.link.to_s)
83:   end

[Validate]