cleans up

This commit is contained in:
rgarcia
2016-01-25 20:52:18 +01:00
parent 328f5b4472
commit dbc19090ed
17 changed files with 21 additions and 342 deletions

View File

@@ -4,23 +4,13 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js
def index
@tags = ActsAsTaggableOn::Tag.order(kind: :asc, id: :asc).page(params[:page])
@tags = ActsAsTaggableOn::Tag.order(featured: :desc).page(params[:page])
@tag = ActsAsTaggableOn::Tag.new
end
def create
@paramTag = params[:tag]
if @paramTag[:name] == ""
redirect_to admin_tags_path, notice: t("admin.tags.message")
else
search_tag
if @tag.present?
redirect_to admin_tags_path, notice: t("admin.tags.message_find")
else
ActsAsTaggableOn::Tag.create(tag_params)
redirect_to admin_tags_path
end
end
ActsAsTaggableOn::Tag.create(tag_params)
redirect_to admin_tags_path
end
def update
@@ -36,16 +26,11 @@ class Admin::TagsController < Admin::BaseController
private
def tag_params
params.require(:tag).permit(:featured, :name, :kind)
params.require(:tag).permit(:featured, :name)
end
def find_tag
@tag = ActsAsTaggableOn::Tag.find(params[:id])
end
def search_tag
# @tag = ActsAsTaggableOn::Tag.where("name = '#{@paramTag[:name]}' and
# kind = '#{@paramTag[:kind]}'")
@tag = ActsAsTaggableOn::Tag.where("upper(name) = upper('#{@paramTag[:name]}')")
end
end

View File

@@ -5,6 +5,8 @@ class Management::ProposalsController < Management::BaseController
before_action :check_verified_user, except: :print
before_action :set_proposal, only: [:vote, :show]
before_action :parse_search_terms, only: :index
before_action :load_categories, only: [:new, :edit]
before_action :load_geozones, only: [:edit]
has_orders %w{confidence_score hot_score created_at most_commented random}, only: [:index, :print]
has_orders %w{most_voted newest}, only: :show
@@ -43,7 +45,7 @@ class Management::ProposalsController < Management::BaseController
managed_user
end
### Duplicated in application_controller. Move to a concenrn.
### Duplicated in application_controller. Move to a concern.
def set_proposal_votes(proposals)
@proposal_votes = current_user ? current_user.proposal_votes(proposals) : {}
end