app/controllers/decidim/proposals/collaborative_drafts_controller.rb in decidim-proposals-0.26.10 vs app/controllers/decidim/proposals/collaborative_drafts_controller.rb in decidim-proposals-0.27.0.rc1
- old
+ new
@@ -23,17 +23,17 @@
before_action :authenticate_user!, only: [:new, :create]
before_action :retrieve_collaborative_draft, only: [:show, :edit, :update, :withdraw, :publish]
def index
@collaborative_drafts = search
- .results
+ .result
.not_hidden
.includes(:category)
.includes(:scope)
- @collaborative_drafts = reorder(@collaborative_drafts)
@collaborative_drafts = paginate(@collaborative_drafts)
+ @collaborative_drafts = reorder(@collaborative_drafts)
end
def show
raise ActionController::RoutingError, "Not Found" unless retrieve_collaborative_draft
@@ -61,11 +61,11 @@
redirect_to Decidim::ResourceLocatorPresenter.new(collaborative_draft).path
end
on(:invalid) do
flash.now[:alert] = I18n.t("proposals.collaborative_drafts.create.error", scope: "decidim")
- render :new
+ render :complete
end
end
end
def edit
@@ -132,22 +132,22 @@
def retrieve_collaborative_draft
@collaborative_draft = CollaborativeDraft.not_hidden.where(component: current_component).find_by(id: params[:id])
end
def geocoded_collaborative_draft
- @geocoded_collaborative_draft ||= search.results.not_hidden.select(&:geocoded_and_valid?)
+ @geocoded_collaborative_draft ||= search.result.not_hidden.select(&:geocoded_and_valid?)
end
- def search_klass
- CollaborativeDraftSearch
+ def search_collection
+ CollaborativeDraft.where(component: current_component).not_hidden
end
def default_filter_params
{
- search_text: "",
- category_id: default_filter_category_params,
- state: %w(open),
- scope_id: default_filter_scope_params,
+ search_text_cont: "",
+ with_any_category: default_filter_category_params,
+ with_any_state: %w(open),
+ with_any_scope: default_filter_scope_params,
related_to: ""
}
end
def default_filter_category_params