displays proposal created within management layout
This commit is contained in:
@@ -34,7 +34,8 @@ module CommentableActions
|
||||
|
||||
if @resource.save_with_captcha
|
||||
track_event
|
||||
redirect_to @resource, notice: t('flash.actions.create.notice', resource_name: "#{resource_name.capitalize}")
|
||||
redirect_path = url_for(controller: controller_name, action: :show, id: @resource.id)
|
||||
redirect_to redirect_path, notice: t('flash.actions.create.notice', resource_name: "#{resource_name.capitalize}")
|
||||
else
|
||||
load_featured_tags
|
||||
set_resource_instance
|
||||
|
||||
@@ -3,7 +3,7 @@ class Management::ProposalsController < Management::BaseController
|
||||
include CommentableActions
|
||||
|
||||
before_action :check_verified_user, except: :print
|
||||
before_action :set_proposal, only: :vote
|
||||
before_action :set_proposal, only: [:vote, :show]
|
||||
before_action :parse_search_terms, only: :index
|
||||
|
||||
has_orders %w{hot_score confidence_score created_at most_commented random}, only: [:index, :print]
|
||||
@@ -42,9 +42,14 @@ class Management::ProposalsController < Management::BaseController
|
||||
managed_user
|
||||
end
|
||||
|
||||
#Duplicated in application_controller. Move to a concenrn.
|
||||
### Duplicated in application_controller. Move to a concenrn.
|
||||
def set_proposal_votes(proposals)
|
||||
@proposal_votes = current_user ? current_user.proposal_votes(proposals) : {}
|
||||
end
|
||||
|
||||
def set_comment_flags(comments)
|
||||
@comment_flags = current_user ? current_user.comment_flags(comments) : {}
|
||||
end
|
||||
###
|
||||
|
||||
end
|
||||
1
app/views/management/proposals/show.html.erb
Normal file
1
app/views/management/proposals/show.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render template: 'proposals/show' %>
|
||||
@@ -88,7 +88,7 @@
|
||||
<%= render 'shared/tags', taggable: @proposal %>
|
||||
|
||||
<div class="js-moderator-proposal-actions moderator-actions">
|
||||
<%= render 'actions', proposal: @proposal %>
|
||||
<%= render 'proposals/actions', proposal: @proposal %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -108,4 +108,4 @@
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
<%= render "comments" %>
|
||||
<%= render "proposals/comments" %>
|
||||
|
||||
@@ -189,7 +189,7 @@ Rails.application.routes.draw do
|
||||
get 'sign_in', to: 'sessions#create'
|
||||
|
||||
resource :session, only: [:create, :destroy]
|
||||
resources :proposals, only: [:index, :new, :create] do
|
||||
resources :proposals, only: [:index, :new, :create, :show] do
|
||||
member do
|
||||
post :vote
|
||||
end
|
||||
|
||||
@@ -36,6 +36,8 @@ feature 'Proposals' do
|
||||
expect(page).to have_content 'http://youtube.com'
|
||||
expect(page).to have_content user.name
|
||||
expect(page).to have_content I18n.l(Proposal.last.created_at.to_date)
|
||||
|
||||
expect(URI.parse(current_url).path).to eq(management_proposal_path(Proposal.last))
|
||||
end
|
||||
|
||||
scenario "Should not allow unverified users to create proposals" do
|
||||
|
||||
Reference in New Issue
Block a user