AutoCommit Don Aug 6 23:03:01 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-08-06 23:03:01 +02:00
parent bdb0025a8c
commit 73f364e620
7 changed files with 21 additions and 6 deletions

View File

@@ -210,7 +210,7 @@ float:clear; }
a.flag-true { color: $color_schema_3_dark}
a.flag-true.flag-goodquality-true { color: green}
a.flag-true.flag-template-true {color: $color_schema_1_dark}
a.flag-false { color: #CCC}
ul.ui-menu

View File

@@ -9,6 +9,7 @@ class Survey::QuestionsController < ApplicationController
format.html # index.html.erb
end
end
def answer
@survey_question = Survey::Question.find(params[:id])
if (params[:key].nil? || params[:key].empty?)
@@ -28,6 +29,11 @@ class Survey::QuestionsController < ApplicationController
end
# GET /survey/questions/1
# GET /survey/questions/1.json
def create_from_template
@template = Survey::Question.find(params[:id])
end
def show
@survey_question = Survey::Question.find(params[:id])

View File

@@ -1,2 +1,5 @@
module Survey::QuestionsHelper
def new_question_for(obj)
render partial: "survey/questions/new_question", locals: {question_templates: Survey::Question.templates}
end
end

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
class Survey::Question < ActiveRecord::Base
attr_accessible :text, :title, :typ, :choice_ids
belongs_to :parent, polymorphic: true
@@ -5,10 +6,12 @@ class Survey::Question < ActiveRecord::Base
has_many :answers, through: :choices
include IsCommentable
FLAG_ICONS={"delete" => "fa fa-trash", "template"=> "ffi1-cleaning1"}
FLAG_CONFIRM={}
FLAG_CONFIRM={"delete"=> "Sicher loeschen?"}
scope :templates, ->{ where(flag_template:true)}
acts_as_flagable
def attributes_for_copy
self.attributes
end
def add_yesno_choices
c=Survey::Choice.new(title: "Ja")
c.save

View File

@@ -14,10 +14,10 @@
<% end %>
</p>
<div id="<%= divid_for(comment,"newform") %>">
</div>
<div id="<%= Comment.wrapid_for( comment)%>">
<%= render partial:"comments/comments", object: comment.children.order(:created_at).reverse_order if comment.children.size >0 %>
</div>
<div id="<%= divid_for(comment,"newform") %>"></div>
</div>
</div>

View File

@@ -46,7 +46,7 @@
<% end%>
<%= new_question_for(neuigkeit_view) %>
<%= render_attachments_for(neuigkeit_view) %>
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>

View File

@@ -0,0 +1,3 @@
<% question_templates.each do |q| %>
<%= link_to q.title, new_survey_question_path() %>
<% end %>