AutoCommit Mon Aug 10 20:03:02 CEST 2015
This commit is contained in:
@@ -51,7 +51,7 @@ end
|
||||
authorize! :comment, c
|
||||
|
||||
@comment = Comment.build_for(c, current_user,"", params_new)
|
||||
|
||||
@commentable=c
|
||||
if @comment.parent_object.class==Comment
|
||||
@comments= @comment.parent_object.children
|
||||
else
|
||||
|
||||
@@ -16,16 +16,11 @@ class LvasController < ApplicationController
|
||||
end
|
||||
def beispiel_sammlung
|
||||
@lva = Lva.find_by_id(params[:id])
|
||||
#Attachment name
|
||||
filename = 'beispiel_sammlung_' + @lva.lvanr.to_s + '_' + l(Date.today).to_s + '.zip'
|
||||
temp_file = Tempfile.new(filename)
|
||||
begin
|
||||
#This is the tricky part
|
||||
#Initialize the temp file as a zip file
|
||||
Zip::OutputStream.open(temp_file) { |zos| }
|
||||
#Add files to the zip file as usual
|
||||
Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|
|
||||
#Put files in here
|
||||
i=1
|
||||
@lva.beispiele.each do |bsp|
|
||||
zip.add(i.to_s + '_' + File.basename(bsp.beispieldatei.current_path), bsp.beispieldatei.current_path)
|
||||
@@ -53,29 +48,26 @@ class LvasController < ApplicationController
|
||||
@beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show)
|
||||
@toolbar_elements =[]
|
||||
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.manage'),:path => verwalten_lva_path(@lva)} if can? :verwalten, @lva
|
||||
@crawlobjects = @lva.crawlobjects.roots.accessible_by(current_ability)
|
||||
@crawlobjects = @lva.crawlobjects.roots.accessible_by(current_ability)
|
||||
@questions=@lva.questions.accessible_by(current_ability,:show)
|
||||
end
|
||||
|
||||
def verwalten
|
||||
@lva = Lva.find_by_id(params[:id])
|
||||
@beispiel=Beispiel.new
|
||||
@beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show)
|
||||
@beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show)
|
||||
@beispiele = @lva.beispiele.not_flag_badquality.not_flag_delete.order(:lecturer_id,:datum).accessible_by(current_ability, :show)
|
||||
@beispiele_badQ = @lva.beispiele.flag_badquality.not_flag_delete.order(:datum).accessible_by(current_ability, :show)
|
||||
@beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show)
|
||||
|
||||
render :show
|
||||
end
|
||||
|
||||
# GET /lvas/new
|
||||
# GET /lvas/new.json
|
||||
def new
|
||||
@lva = Lva.new
|
||||
modul=Modul.find_by_id(params[:modul_id])
|
||||
@lva.modul<<modul unless modul.nil? #
|
||||
|
||||
end
|
||||
|
||||
# GET /lvas/1/edit
|
||||
def edit
|
||||
@lva = Lva.find(params[:id])
|
||||
@semester = @lva.modul.map(&:modulgruppen).flatten.map(&:studium).map(&:semester).flatten.uniq
|
||||
@@ -126,7 +118,6 @@ class LvasController < ApplicationController
|
||||
def destroy
|
||||
@lva = Lva.find(params[:id])
|
||||
@lva.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to lvas_url }
|
||||
end
|
||||
@@ -139,10 +130,6 @@ private
|
||||
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)} if can? :edit, @lva
|
||||
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>"Tissvergleichladen", :path=> compare_tiss_lva_path(@lva)} if can? :compare_tiss, @lva
|
||||
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('lva.delete'), :path=> lva_path(@lva), :method=>:delete, :confirm=>t('lva.deletesure') } if can? :delete, @lva
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -48,6 +48,8 @@ class Lva < ActiveRecord::Base
|
||||
has_and_belongs_to_many :lecturers
|
||||
has_many :nlinks, as: :link
|
||||
has_many :crawlobjects, :as=>:something
|
||||
has_many :questions, :class_name=>"Survey::Question", as: :parent
|
||||
|
||||
# scope :search, ->(query) {where("name like ? or lvas.desc like ?", "%#{query}%", "%#{query}%")}
|
||||
|
||||
validates :lvanr,:format=>{ :with => /^[0-9][0-9][0-9]\.[0-9A][0-9][0-9]$/}, :presence=>true, :uniqueness=>true # , :uniqueness=>true # LVA-Nummer muss das Format 000.000 besitzen (uniqueness?) oder 000 für nicht
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</p>
|
||||
<%= render partial: "neuigkeit_view", object: @neuigkeit %>
|
||||
|
||||
|
||||
<%= new_question_for(@neuigkeit) if can? :new, Survey::Question %>
|
||||
<% @questions.each do |q| %>
|
||||
<%= render q if can? :show, q %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<div id="container_question_<%= answeredquestion.id %>" style="min-width: 310px; max-width: 800px; height: <%= (100+answeredquestion.choices.count * 90).to_s %>px; margin: 0 auto" class="contentbox">
|
||||
<div style="background:red">
|
||||
<b><%= answeredquestion.title%></b>
|
||||
<b>
|
||||
<%= answeredquestion.title%>
|
||||
</b>
|
||||
<ul>
|
||||
<% answeredquestion.choices.each do |c| %>
|
||||
<li>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><%= link_to "Neue FRage", new_survey_question_path(params: {parent_type: parent.class.to_s, parent_id: parent.id.to_s}) %></li>
|
||||
<% question_templates.each do |q| %>
|
||||
|
||||
<li><%= link_to q.title, create_from_template_survey_question_path(q, params: {parent_type: parent.class.to_s, parent_id: parent.id.to_s}) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
<li>
|
||||
<%= link_to "Neue FRage", new_survey_question_path(params: {parent_type: parent.class.to_s, parent_id: parent.id.to_s}) %>
|
||||
</li>
|
||||
<% question_templates.each do |q| %>
|
||||
<li>
|
||||
<%= link_to q.title, create_from_template_survey_question_path(q, params: {parent_type: parent.class.to_s, parent_id: parent.id.to_s}) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<%= @lva.desc.to_s.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="span4">
|
||||
<div class="contentbox">
|
||||
@@ -80,6 +81,10 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= new_question_for(@lva) %>
|
||||
<% @questions.each do |q| %>
|
||||
<%= render q if can? :show, q %>
|
||||
<% end %>
|
||||
|
||||
<h2><%= I18n.t("lva.bspe") %></h2>
|
||||
<p>
|
||||
@@ -115,6 +120,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<% unless @lva.nlinks.empty? %>
|
||||
<h2><%= I18n.t("rubrik.title") %></h2>
|
||||
<% @lva.nlinks.each do |l| %>
|
||||
@@ -132,6 +138,7 @@
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% unless @crawlobjects.nil? %>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
Reference in New Issue
Block a user