Kalender überarbeitet Issue 91

This commit is contained in:
Andreas Stephanides
2013-11-28 10:14:36 +01:00
parent 6fa208dcbe
commit 0a507502ba
16 changed files with 72 additions and 19 deletions

View File

@@ -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/

View File

@@ -4,6 +4,7 @@ class NeuigkeitenController < ApplicationController
def show
@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])

View File

@@ -4,6 +4,7 @@ class RubrikenController < ApplicationController
def index
@rubriken = Rubrik.all
@neuigkeiten = Neuigkeit.recent
@calentries= Calentry.all
end
def show

View File

@@ -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|

View File

@@ -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

View File

@@ -0,0 +1,3 @@
<%= calendar calendar.calentries do |entry| %>
<div><%= link_to entry.name.to_s, polymorphic_path(entry.object) %></div>
<% end %>

View File

@@ -0,0 +1,3 @@
<%= calendar object do |entry| %>
<div><%= link_to entry.name.to_s, polymorphic_path(entry.object) %></div>
<% end %>

View File

@@ -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>

View File

@@ -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 %>

View File

@@ -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' %>

View File

@@ -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>

View File

@@ -1,11 +1,28 @@
<%= render 'tabs' %>
<p id="notice"><%= notice %></p>
<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>

View File

@@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
public/icon_kalender.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB