fixes fuer choices

This commit is contained in:
Andreas Stephanides
2015-08-01 23:37:41 +02:00
parent 9933718750
commit 38183bdc00
3 changed files with 14 additions and 7 deletions

View File

@@ -84,11 +84,18 @@ class Survey::ChoicesController < ApplicationController
# DELETE /survey/choices/1.json
def destroy
@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
respond_to do |format|
format.html { redirect_to survey_choices_url }
format.json { head :no_content }
end
format.js
end
end
end
end

View File

@@ -43,14 +43,14 @@ m.save
language_path(locale: target_locale)
end
def ffi1_icon (name)
content_tag("i","", class: "ffi1-"+name )
content_tag("i","", class: "ficon ffi1-"+name )
end
def ffi2_icon (name)
content_tag("i","", class: "ffi2-"+name )
content_tag("i","", class: "ficon ffi2-"+name )
end
def ff_icon (name)
content_tag("i","", class: name )
content_tag("i","", class: "ficon "+name )
end
def ffi1_list

View File

@@ -7,7 +7,7 @@ if current_user.nil?
else
value=(current_user.id.nil?)? false : choice.answers.where(user_id: current_user.id).count>0
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
%>
@@ -15,5 +15,5 @@ end
<%= 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 %>