forked from bofh/fetsite
AutoCommit Don Aug 27 15:03:02 CEST 2015
This commit is contained in:
7
app/controllers/emails_controller.rb
Normal file
7
app/controllers/emails_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class EmailsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
end
|
||||
@@ -16,7 +16,7 @@ class RubrikenController < ApplicationController
|
||||
@rubriken= Rubrik.accessible_by(current_ability, :show)
|
||||
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :list).page(params[:page]).per(3)
|
||||
|
||||
@calentries= (@rubriken.map {|r| r.calendar}).collect(&:calentries).flatten.select {|c| c.object !=nil}
|
||||
@calentries= (@rubriken.map {|r| r.calendar.calentries.of_month(Date.new(params[:year],params[:month],1))}).flatten.select {|c| c.object !=nil}
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js {render action: :show}
|
||||
|
||||
@@ -28,7 +28,7 @@ render locals: {current_user: User.first}
|
||||
@user=user
|
||||
self.message.perform_deliveries = false unless user.flag_getemails
|
||||
@ability = Ability.new(user)
|
||||
@calentries = Calentry.limit(100)
|
||||
@calentries = Calentry.of_month(Date.today).limit(100)
|
||||
# @neuigkeiten=Neuigkeit.accessiblße_by(ability).published_scope.where("cache_order<2")
|
||||
mail(to: user.email, content_type: "text/html", subject: "sdf")
|
||||
render locals: {c_user: user}
|
||||
|
||||
@@ -227,7 +227,8 @@ end
|
||||
can :doadmin, User
|
||||
end
|
||||
|
||||
unless user.has_role?("fetadmin")
|
||||
if user.has_role?("fetadmin")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
class Calentry < ActiveRecord::Base
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar, :dauer, :object_id, :object_type
|
||||
belongs_to :calendar
|
||||
belongs_to :calendar, touch: true
|
||||
#belongs_to :neuigkeit
|
||||
validates :start, :presence => true
|
||||
validates :object, :presence => true
|
||||
validates :typ, :presence => true
|
||||
before_save :get_public
|
||||
belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
||||
scope :of_month,(d) -> {where("start >= ? AND start <= ?", d.beginning_of_month, d.end_of_month)}
|
||||
scope :of_month, ->(d) {where("start >= ? AND start <= ?", d.beginning_of_month, d.end_of_month)}
|
||||
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
|
||||
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
|
||||
validate do |entry|
|
||||
@@ -31,7 +31,10 @@ class Calentry < ActiveRecord::Base
|
||||
end
|
||||
|
||||
resourcify
|
||||
|
||||
def self.updated_at
|
||||
#Calentry.select("MAX(updated_at) as m_updated_at").first.m_updated_at
|
||||
Calentry.all.max_by(&:updated_at).updated_at
|
||||
end
|
||||
def is_upcomming?
|
||||
self.start > Time.now
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Survey::Answer < ActiveRecord::Base
|
||||
belongs_to :choice, class_name: 'Survey::Choice'
|
||||
belongs_to :choice, class_name: 'Survey::Choice', touch: true
|
||||
belongs_to :user
|
||||
# attr_accessible :title, :body
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Survey::Choice < ActiveRecord::Base
|
||||
belongs_to :question, class_name: 'Survey::Question'
|
||||
belongs_to :question, class_name: 'Survey::Question', touch: true
|
||||
attr_accessible :picture, :sort, :text, :icon, :picture_cache, :remove_picture, :question_id
|
||||
has_many :answers, class_name: 'Survey::Answer', dependent: :destroy
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
class Survey::Question < ActiveRecord::Base
|
||||
attr_accessible :text, :title, :typ, :choice_ids, :parent_type, :parent_id
|
||||
belongs_to :parent, polymorphic: true
|
||||
belongs_to :parent, polymorphic: true, touch: true
|
||||
has_many :choices, dependent: :destroy, class_name: "Survey::Choice"
|
||||
has_many :answers, through: :choices
|
||||
include IsCommentable
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<%= stylesheet_link_tag "http://"+ActionMailer::Base.default_url_options[:host].to_s + "/assets/themes/blue2/application.css", :media=>"all" %>
|
||||
|
||||
<% @calentries.each do |ce| %>
|
||||
<hr/>
|
||||
|
||||
<% if can?(:show , ce.object) %>
|
||||
<hr/>
|
||||
<%= render partial: "calentries/mail", object: ce %>
|
||||
<%= render partial: "neuigkeiten/mail", object: ce.object if ce.object.kind_of?(Neuigkeit)%>
|
||||
<% end %>
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
themes_for_rails
|
||||
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
|
||||
resources :home, :only=>[:index] do
|
||||
end
|
||||
end
|
||||
resources :emails, :only=>[:index] do
|
||||
|
||||
end
|
||||
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
||||
scope '(:locale)/admin' do
|
||||
resources :users, :only=>[] do
|
||||
|
||||
Reference in New Issue
Block a user