Module: AdditionalTags::Patches::WikiControllerPatch::InstanceOverwriteMethods

Defined in:
lib/additional_tags/patches/wiki_controller_patch.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/additional_tags/patches/wiki_controller_patch.rb', line 30

def index
  @tag = params[:tag]
  return super unless AdditionalTags.setting?(:active_wiki_tags) && @tag.present?

  @pages = WikiPage.with_tags @tag, project: @project

  respond_to do |format|
    format.html do
      render template: 'wiki/tag_index'
    end
    format.api
  end
end

#update_tagsObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/additional_tags/patches/wiki_controller_patch.rb', line 19

def update_tags
  @page.safe_attributes = [:tag_list]
  @page.tag_list = params[:wiki_page][:tag_list].to_a.reject(&:empty?)
  flash[:notice] = if @page.save
                     flash_msg :update
                   else
                     t :notice_failed_to_add_tags
                   end
  redirect_to project_wiki_page_path(@page.project, @page.title)
end