forked from bofh/fetsite
fixes fuer choices
This commit is contained in:
@@ -84,11 +84,18 @@ class Survey::ChoicesController < ApplicationController
|
|||||||
# DELETE /survey/choices/1.json
|
# DELETE /survey/choices/1.json
|
||||||
def destroy
|
def destroy
|
||||||
@survey_choice = Survey::Choice.find(params[:id])
|
@survey_choice = Survey::Choice.find(params[:id])
|
||||||
|
|
||||||
|
if @survey_choice.answers.count>0
|
||||||
|
redirect_to action: :show
|
||||||
|
else
|
||||||
|
@divid = divid_for(@survey_choice)
|
||||||
@survey_choice.destroy
|
@survey_choice.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to survey_choices_url }
|
format.html { redirect_to survey_choices_url }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ m.save
|
|||||||
language_path(locale: target_locale)
|
language_path(locale: target_locale)
|
||||||
end
|
end
|
||||||
def ffi1_icon (name)
|
def ffi1_icon (name)
|
||||||
content_tag("i","", class: "ffi1-"+name )
|
content_tag("i","", class: "ficon ffi1-"+name )
|
||||||
end
|
end
|
||||||
|
|
||||||
def ffi2_icon (name)
|
def ffi2_icon (name)
|
||||||
content_tag("i","", class: "ffi2-"+name )
|
content_tag("i","", class: "ficon ffi2-"+name )
|
||||||
end
|
end
|
||||||
def ff_icon (name)
|
def ff_icon (name)
|
||||||
content_tag("i","", class: name )
|
content_tag("i","", class: "ficon "+name )
|
||||||
end
|
end
|
||||||
|
|
||||||
def ffi1_list
|
def ffi1_list
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if current_user.nil?
|
|||||||
else
|
else
|
||||||
value=(current_user.id.nil?)? false : choice.answers.where(user_id: current_user.id).count>0
|
value=(current_user.id.nil?)? false : choice.answers.where(user_id: current_user.id).count>0
|
||||||
cstyle=(value) ? "true" :"false"
|
cstyle=(value) ? "true" :"false"
|
||||||
t= link_to(raw("" + choice.html+ (( choice.picture.nil? || choice.picture.to_s.empty?) ? "":image_tag(choice.picture.thumb.url))), answer_survey_question_path(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice-"+cstyle,remote: true )
|
t= link_to(raw("" + choice.html+ (( choice.picture.nil? || choice.picture.to_s.empty?) ? "":image_tag(choice.picture.thumb.url))), answer_survey_question_path(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice choice-"+cstyle,remote: true )
|
||||||
end
|
end
|
||||||
|
|
||||||
%>
|
%>
|
||||||
@@ -15,5 +15,5 @@ end
|
|||||||
|
|
||||||
<%= t %> <%= link_to fa_icon("pencil"), edit_survey_choice_path(choice) , class: "btn btn-link navbar-btn" , remote: true
|
<%= t %> <%= link_to fa_icon("pencil"), edit_survey_choice_path(choice) , class: "btn btn-link navbar-btn" , remote: true
|
||||||
%>
|
%>
|
||||||
<%= link_to fa_icon("pencil"), delete_survey_choice_path(choice) , class: "btn btn-link navbar-btn" , remote: true %>
|
<%= link_to fa_icon("trash"), survey_choice_path(choice) , class: "btn btn-link navbar-btn" , remote: true , method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user