app/controllers/works_controller.rb
def update_tags
    unless @work.errors.empty?
      render :edit_tags and return
    end

    if params[:preview_button]
      preview_mode(:edit_tags) do
        render :preview_tags
      end
    elsif params[:cancel_button]
      cancel_posting_and_redirect
    elsif params[:edit_button]
      render :edit_tags
    elsif params[:save_button]
        flash[:notice] = ts('Tags were successfully updated.')
      redirect_to(@work)
    else
      saved = true

      if @work.has_required_tags? && @work.invalid_tags.blank?
        @work.posted = true
        @work.minor_version = @work.minor_version + 1
        saved = @work.save
        # @work.update_minor_version
      end

      preview_mode(:edit_tags, saved) do
        flash[:notice] = ts('Work was successfully updated.')
        redirect_to(@work)
      end
    end
  end
# only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
def update_tags
    unless @work.errors.empty?
      render :edit_tags and return
    end
    if params[:preview_button]
      preview_mode(:edit_tags) do
        render :preview_tags
      end
    elsif params[:cancel_button]
      cancel_posting_and_redirect
    elsif params[:edit_button]
      render :edit_tags
    elsif params[:save_button]
        flash[:notice] = ts('Tags were successfully updated.')
      redirect_to(@work)
    else
      saved = true
      if @work.has_required_tags? && @work.invalid_tags.blank?
        @work.posted = true
        @work.minor_version = @work.minor_version + 1
        saved = @work.save
      end
      preview_mode(:edit_tags, saved) do
        flash[:notice] = ts('Work was successfully updated.')
        redirect_to(@work)
      end
    end
  end
def update_tags unless @work . errors . empty? render :edit_tags and return end if params [ :preview_button ] preview_mode ( :edit_tags ) do render :preview_tags end elsif params [ :cancel_button ] cancel_posting_and_redirect elsif params [ :edit_button ] render :edit_tags elsif params [ :save_button ] flash [ :notice ] = ts ( 'Tags were successfully updated.' ) redirect_to ( @work ) else saved = true if @work . has_required_tags? && @work . invalid_tags . blank? @work . posted = true @work . minor_version = @work . minor_version + 1 saved = @work . save end preview_mode ( :edit_tags , saved ) do flash [ :notice ] = ts ( 'Work was successfully updated.' ) redirect_to ( @work ) end end end
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
# @work.update_minor_version