Kalender überarbeitet Issue 91
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// Place all the styles related to the rubriken controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ class NeuigkeitenController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
|
||||
def show
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@rubrik=@neuigkeit.rubrik
|
||||
if !params[:version].nil?
|
||||
@neuigkeit.versions.reverse[params[:version].to_i].reify.save!
|
||||
@neuigkeit=Neuigkeit.find(params[:id])
|
||||
@@ -30,6 +31,8 @@ class NeuigkeitenController < ApplicationController
|
||||
@neuigkeit = Neuigkeit.new
|
||||
@rubrik=Rubrik.find(params[:rubrik_id]) unless params[:rubrik_id].nil?
|
||||
@neuigkeit.rubrik=@rubrik unless @rubrik.nil?
|
||||
@calentries= [Calentry.new]
|
||||
|
||||
end
|
||||
def add_calentry
|
||||
@neuigkeit=Neuigkeit.find(params[:id])
|
||||
|
||||
@@ -4,6 +4,7 @@ class RubrikenController < ApplicationController
|
||||
def index
|
||||
@rubriken = Rubrik.all
|
||||
@neuigkeiten = Neuigkeit.recent
|
||||
@calentries= Calentry.all
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -27,7 +27,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||
before_validation :sanitize
|
||||
before_validation :sanitize
|
||||
def datum_nilsave
|
||||
self.datum.nil? ? Time.now + 42.years : self.datum
|
||||
end
|
||||
@@ -51,6 +51,9 @@ end
|
||||
md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.text
|
||||
md[:text].split(" ")[0..100].join(" ")+ " ..."
|
||||
end
|
||||
def has_calentries?
|
||||
!self.calentries.nil? && !self.calentries.empty?
|
||||
end
|
||||
private
|
||||
def sanitize
|
||||
self.calentries.each do |calentry|
|
||||
|
||||
@@ -16,13 +16,22 @@ class Rubrik < ActiveRecord::Base
|
||||
has_many :calentries, :through => :neuigkeiten, :as=>:object
|
||||
resourcify
|
||||
has_one :calendar
|
||||
validates :calender , :presence=>true
|
||||
validates :calendar , :presence=>true
|
||||
before_validation :sanitize
|
||||
def moderator
|
||||
u=User.with_role(:newsmoderator).first
|
||||
if !u.nil?
|
||||
u.id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def sanitize
|
||||
if self.calendar.nil?
|
||||
self.calendar=Calendar.new
|
||||
|
||||
|
||||
end
|
||||
self.calendar.name=self.name
|
||||
self.calendar.public=self.public
|
||||
self.calendar.save
|
||||
end
|
||||
end
|
||||
|
||||
3
app/views/calendars/_calendar.html.erb
Normal file
3
app/views/calendars/_calendar.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<%= calendar calendar.calentries do |entry| %>
|
||||
<div><%= link_to entry.name.to_s, polymorphic_path(entry.object) %></div>
|
||||
<% end %>
|
||||
3
app/views/calendars/_calentries.html.erb
Normal file
3
app/views/calendars/_calentries.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<%= calendar object do |entry| %>
|
||||
<div><%= link_to entry.name.to_s, polymorphic_path(entry.object) %></div>
|
||||
<% end %>
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="contentbox">
|
||||
<%= image_tag("/icon_kalender_small.png") %>
|
||||
<%= image_tag("/calendar-day-icon-small.png") %>
|
||||
<% if calentry.start.to_date == calentry.ende.to_date
|
||||
format=:timeonly
|
||||
else
|
||||
format =:default
|
||||
end%>
|
||||
<%= link_to I18n.l(calentry.start) +" bis "+ I18n.l(calentry.ende,:format=>format), calendar_path(calentry.calendar) %>
|
||||
<%= link_to I18n.l(calentry.start) +" bis "+ I18n.l(calentry.ende,:format=>format), calentry_path(calentry) %>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<%= f.input :calendars, :as=> :radio %>
|
||||
<%= f.input :calendar, :as=> :radio %>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<%= f.input :typ %>
|
||||
|
||||
@@ -14,6 +14,9 @@ Bezüglich Design und Steuerung sind Vorschläge erwünscht.
|
||||
<p><%= link_to "Steuerelemente und Komponenten", "http://getbootst<rap.com/2.3.2/index.html" %></p>
|
||||
<p>Um bei der Entwicklung mitzuhelfen braucht nur Ruby on Rails installiert werden</p>
|
||||
<p><%= link_to "Getting Started" , home_startdev_path%></p>
|
||||
<p> Das Kalender Feature wird überarbeitet, in Zukunft soll folgender Link nicht mehr funktionieren <%= link_to "Kalender", calendars_path %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<p><%= I18n.t('home.hallobeiderfet') %></p>
|
||||
<%= render 'beispiele' %>
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<small><%= neuigkeit.rubrik.name %></small>
|
||||
<small class="pull-right"><%= "am "+ I18n.l(neuigkeit.try(:datum).try(:to_date)) unless neuigkeit.try(:datum).try(:to_date).nil? %></small>
|
||||
</div>
|
||||
<h1><%= neuigkeit.title%></h1>
|
||||
<h1><%= image_tag("/calendar-day-icon-small.png") if neuigkeit.has_calentries? %>
|
||||
<%= neuigkeit.title%></h1>
|
||||
<%= raw(neuigkeit.text_first_words) unless neuigkeit.text.nil?%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
<%= render 'tabs' %>
|
||||
<h1><%= I18n.t("rubrik.title")%></h1>
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<ul class="unstyled linkbox-list" style="max-width:70em">
|
||||
<% @neuigkeiten.each do |n| %>
|
||||
<li><%= render n %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<h1><%= I18n.t("rubrik.title")%></h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span9">
|
||||
|
||||
<ul class="unstyled linkbox-list" style="max-width:70em">
|
||||
<% @neuigkeiten.each do |n| %>
|
||||
<li><%= render n %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<%= render 'tabs' %>
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<h1><%= @rubrik.name %></h1>
|
||||
<p>
|
||||
<%= @rubrik.desc %>
|
||||
@@ -12,8 +13,10 @@
|
||||
<%= m.email%>,
|
||||
<% end%>
|
||||
</i>
|
||||
</div></div>
|
||||
<div class="row-fluid">
|
||||
|
||||
|
||||
<div class="span9">
|
||||
<% @neuigkeiten.each_slice(1) do |row| %>
|
||||
<ul class="unstyled" style="max-width:70em">
|
||||
<% row.each do |neuigkeit| %>
|
||||
@@ -24,10 +27,18 @@
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="span3">
|
||||
<%= render 'calendars/calentries', :object=>@rubrik.calendar.calentries %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
BIN
public/calendar-day-icon-small.png
Normal file
BIN
public/calendar-day-icon-small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/calendar-day-icon.png
Normal file
BIN
public/calendar-day-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
public/icon_kalender.png
Normal file
BIN
public/icon_kalender.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Reference in New Issue
Block a user