Class/Module Index [+]

Quicksearch

NeuigkeitenController

Public Instance Methods

add_calentry() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 43
def add_calentry
  @neuigkeit=Neuigkeit.find(params[:id])
  if params[:calentry_id].nil?
    ce = Calentry.new(:start=>Time.now, :ende=>1.hour.from_now, :typ=>1, :calendar=>@neuigkeit.rubrik.calendar)
  else
    ce = Calentry.find(params[:calentry_id])
  end
  @calentry=ce 
  ce.object=@neuigkeit
  @neuigkeit.calentry=ce
  @neuigkeit.save
  
  render 'edit'
end
create() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 189
def create
  @neuigkeit = Neuigkeit.new(params[:neuigkeit])
  @neuigkeit.author=current_user
  
  respond_to do |format|
    if @neuigkeit.save
      format.html { redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit was successfully created.' }
    else
      format.html { render action: "new" }
    end
  end
end
default_url_options() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 10
  def default_url_options
    super
#    super.merge({host: request.host_with_port})
  end
destroy() click to toggle source

DELETE /neuigkeiten/1 DELETE /neuigkeiten/1.json

# File app/controllers/neuigkeiten_controller.rb, line 216
def destroy
  @neuigkeit = Neuigkeit.find(params[:id])
  rubrik=@neuigkeit.rubrik
  @neuigkeit.destroy
  respond_to do |format|
    format.html { redirect_to rubrik }
    
  end
 end
edit() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 138
def edit
  @neuigkeit = Neuigkeit.find(params[:id])
  @neuigkeit.no_fallbacks=true
 @rubrik=@neuigkeit.rubrik    
 
  @calentries= @neuigkeit.calentries
  @calentries<<  Calentry.new 

end
mail_preview() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 121
def mail_preview
ActionMailer::Base.default_url_options[:host] = request.host_with_port 

  @neuigkeit = Neuigkeit.find(params[:id])
  @user=current_user
  @ability=Ability.new(@user)
  @mail = NewsMailer.neuigkeit_mail("all@fet.at", params[:id])

  authorize! :publish, @neuigkeit
  render  layout: false
end
mail_to_fet() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 107
def mail_to_fet

ActionMailer::Base.default_url_options[:host] = request.host_with_port 

  @neuigkeit = Neuigkeit.find(params[:id])
  authorize! :publish, @neuigkeit
  unless @neuigkeit.published?
    redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie als Mail zu versenden.'
  else      
    NewsMailer.neuigkeit_mail("all@fet.at", params[:id]).deliver
    redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit versendet'

  end  
end
new() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 35
def new
  @neuigkeit = Neuigkeit.new
  @rubrik=Rubrik.find(params[:rubrik_id]) unless params[:rubrik_id].nil?
  @neuigkeit.author=current_user
  @neuigkeit.rubrik=@rubrik unless @rubrik.nil?
  @calentries= [Calentry.new] 

end
newsletter_preview() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 132
 def newsletter_preview
   authorize! :publish, Neuigkeit
   @neuigkeiten=Neuigkeit.accessible_by(current_ability).where("cache_order<2")
   render template: "news_mailer/daily_newsletter", layout: false

end
publish() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 75
  def publish 
    @neuigkeit = Neuigkeit.find(params[:id])
    @neuigkeit.publish
    @neuigkeit.save

    @questions = @neuigkeit.questions.accessible_by(current_ability,:show)
  
   if params[:verwalten] 
      redirect_to verwalten_rubrik_path(@neuigkeit.rubrik)
else
    respond_to do |format|
      format.html { redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit)}
      format.js { render partial: "show"}
    end
end
  end
publish_to_facebook() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 91
 def publish_to_facebook
   @neuigkeit = Neuigkeit.find(params[:id])
   unless @neuigkeit.picture.url.nil?
     picture_url=URI(root_url)
     picture_url.path=@neuigkeit.picture.url(:locale=>nil, :theme=>nil)
   end
   unless @neuigkeit.published?
     redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie auf Facebook zu posten.'
   else
     page=YAML.load_file("#{::Rails.root.to_s}/config/page.yml")
    # page.feed!(:access_token=>page.access_token, :message=>@neuigkeit.text_first_words, :name=>@neuigkeit.title, :link=>rubrik_neuigkeit_url(@neuigkeit.rubrik, @neuigkeit)+".html", :picture=>@neuigkeit.picture.url)
page.feed!(:access_token=>page.access_token, :message=>@neuigkeit.text_first_words, :name=>@neuigkeit.title, :link=>rubrik_neuigkeit_url(@neuigkeit.rubrik, @neuigkeit)+".html")# , :picture=>picture_url)
    
     redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit auf Facebook gepostet'
   end
 end
show() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 14
def show
  @neuigkeit = Neuigkeit.find(params[:id])
  @rubrik = @neuigkeit.rubrik    
  @questions = @neuigkeit.questions.accessible_by(current_ability,:show)
  if can?(:shownonpublic, Rubrik)
    @rubriken = Rubrik.all
  else
    @rubriken = Rubrik.where(:public=>true)
  end   
  
  if  !params[:version].nil? && can?(:showversions, Neuigkeit)
    @neuigkeit.assign_attributes(@neuigkeit.translation.versions.reverse[params[:version].to_i].reify.attributes.select{|k,v| @neuigkeit.translated_attribute_names.include? k.to_sym })
  end 
  @calentries1=@neuigkeit.calentries
  respond_to do |format|
    format.html 
    format.js
  end
  
end
unpublish() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 58
  def unpublish
    @neuigkeit = Neuigkeit.find(params[:id])
    @neuigkeit.reverse_publish
    @neuigkeit.save

    @questions = @neuigkeit.questions.accessible_by(current_ability,:show)

    if params[:verwalten] 
      redirect_to verwalten_rubrik_path(@neuigkeit.rubrik)
   else
    respond_to do |format|
      format.html { redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit)}
      format.js { render partial: "show"}
    end
end
   
  end
update() click to toggle source
# File app/controllers/neuigkeiten_controller.rb, line 203
def update
  @neuigkeit = Neuigkeit.find(params[:id])
  respond_to do |format|
    if @neuigkeit.update_attributes(params[:neuigkeit])
      format.html { redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit was successfully updated.' }
    else
      format.html { render action: "edit" }  
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.