Sha256: d37bda73a7b10fa8855f061eba467ef9f3fe46aecf45caed3dd1e899c0fb8d62
Contents?: true
Size: 1.51 KB
Versions: 8
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true module AdditionalTags module Patches module WikiControllerPatch extend ActiveSupport::Concern included do prepend InstanceOverwriteMethods helper :additional_tags helper :additional_tags_wiki include AdditionalTagsWikiHelper before_action :find_page_for_update_tags, only: :update_tags end module InstanceOverwriteMethods 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 l :notice_successful_update else t :notice_failed_to_add_tags end redirect_to project_wiki_page_path(@page.project, @page.title) end 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 private # find_existing_page can not be used from wiki_controller, because it would be disable index only rule def find_page_for_update_tags @page = @wiki.find_page params[:id] render_404 if @page.nil? end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems