Merge branch 'kalender' of https://github.com/andreassteph/fetsite into calendar

Conflicts:
	app/assets/stylesheets/formtastic-changes.css.scss
	app/controllers/beispiele_controller.rb
	app/views/studien/_form.html.erb
	config/locales/de.yml
	config/routes.rb
This commit is contained in:
Thomas Blazek
2013-08-11 10:34:03 +02:00
60 changed files with 1575 additions and 8 deletions

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@@ -10,7 +10,7 @@
*
*= require_self
*= require_tree .
* require 'bootstrap'
*= require 'bootstrap'
*/
$linkColor: #03006E;
@import 'bootstrap';

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the calendars controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the calentries controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -6,7 +6,22 @@ width:90%;
height:20em;
}
<<<<<<< HEAD
form.formtastic .input label.control-label {
font-weight:bold;
font-size:125%;
}
=======
div.form-group {
border-width: 1px;
border-style: none;
padding: 10px;
// border-radius: 10px;
}
div.verwalten-block {
border-width: 1px;
border-style: solid;
padding: 5px;
}
>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca

View File

@@ -26,7 +26,8 @@ class BeispieleController < ApplicationController
# GET /beispiele/new.json
def new
@beispiel = Beispiel.new
@beispiel.lva_id = params[:lva_id]
@beispiel.lva = Lva.find(params[:lva_id])
respond_to do |format|
format.html # new.html.erb
format.json { render json: @beispiel }
@@ -41,8 +42,13 @@ class BeispieleController < ApplicationController
# POST /beispiele
# POST /beispiele.json
def create
lvaid=params[:lva_id]
params.delete(:lva_id)
@beispiel = Beispiel.new(params[:beispiel])
<<<<<<< HEAD
=======
>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
respond_to do |format|
if @beispiel.save
format.html { redirect_to @beispiel, notice: 'Beispiel was successfully created.' }

View File

@@ -0,0 +1,83 @@
class CalendarsController < ApplicationController
# GET /calendars
# GET /calendars.json
def index
@calendars = Calendar.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @calendars }
end
end
# GET /calendars/1
# GET /calendars/1.json
def show
@calendar = Calendar.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @calendar }
format.ics { render 'show.ics.erb'}
end
end
# GET /calendars/new
# GET /calendars/new.json
def new
@calendar = Calendar.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @calendar }
end
end
# GET /calendars/1/edit
def edit
@calendar = Calendar.find(params[:id])
end
# POST /calendars
# POST /calendars.json
def create
@calendar = Calendar.new(params[:calendar])
respond_to do |format|
if @calendar.save
format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }
format.json { render json: @calendar, status: :created, location: @calendar }
else
format.html { render action: "new" }
format.json { render json: @calendar.errors, status: :unprocessable_entity }
end
end
end
# PUT /calendars/1
# PUT /calendars/1.json
def update
@calendar = Calendar.find(params[:id])
respond_to do |format|
if @calendar.update_attributes(params[:calendar])
format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @calendar.errors, status: :unprocessable_entity }
end
end
end
# DELETE /calendars/1
# DELETE /calendars/1.json
def destroy
@calendar = Calendar.find(params[:id])
@calendar.destroy
respond_to do |format|
format.html { redirect_to calendars_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,84 @@
class CalentriesController < ApplicationController
# GET /calentries
# GET /calentries.json
def index
@calentries = Calentry.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @calentries }
end
end
# GET /calentries/1
# GET /calentries/1.json
def show
@calentry = Calentry.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @calentry }
format.ics { render 'show.ics.erb'}
end
end
# GET /calentries/new
# GET /calentries/new.json
def new
@calentry = Calentry.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @calentry }
end
end
# GET /calentries/1/edit
def edit
@calentry = Calentry.find(params[:id])
end
# POST /calentries
# POST /calentries.json
def create
@calentry = Calentry.new(params[:calentry])
respond_to do |format|
if @calentry.save
format.html { redirect_to @calentry, notice: 'Calentry was successfully created.' }
format.json { render json: @calentry, status: :created, location: @calentry }
else
format.html { render action: "new" }
format.json { render json: @calentry.errors, status: :unprocessable_entity }
end
end
end
# PUT /calentries/1
# PUT /calentries/1.json
def update
@calentry = Calentry.find(params[:id])
respond_to do |format|
if @calentry.update_attributes(params[:calentry])
format.html { redirect_to @calentry, notice: 'Calentry was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @calentry.errors, status: :unprocessable_entity }
end
end
end
# DELETE /calentries/1
# DELETE /calentries/1.json
def destroy
@calentry = Calentry.find(params[:id])
@calentry.destroy
respond_to do |format|
format.html { redirect_to calentries_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,2 @@
module CalendarsHelper
end

View File

@@ -0,0 +1,2 @@
module CalentriesHelper
end

View File

@@ -0,0 +1,7 @@
class DateStringInput < FormtasticBootstrap::Inputs::StringInput
def input_html_options
value = (@object.send(method.to_sym))
super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l((value.is_a?(Time)||value.is_a?(Date)||value.is_a?(DateTime)) ? value : Time.now))
end
end

5
app/models/calendar.rb Normal file
View File

@@ -0,0 +1,5 @@
class Calendar < ActiveRecord::Base
attr_accessible :name, :public, :picture
has_and_belongs_to_many :calentries
mount_uploader :picture, PictureUploader
end

17
app/models/calentry.rb Normal file
View File

@@ -0,0 +1,17 @@
class Calentry < ActiveRecord::Base
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
has_and_belongs_to_many :calendars
validates :start, :presence => true
validates :typ, :presence => true
validate do |entry|
if entry.ende.nil?
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
end
end
def start_time
start
end
def name
summary
end
end

View File

@@ -0,0 +1,51 @@
# encoding: utf-8
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [64, 64]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View File

@@ -0,0 +1,11 @@
<%= semantic_form_for @calendar do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :public %>
<%= f.input :picture, :as => :file %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1,6 @@
<h1>Editing calendar</h1>
<%= render 'form' %>
<%= link_to 'Show', @calendar %> |
<%= link_to 'Back', calendars_path %>

View File

@@ -0,0 +1,14 @@
<h1>Listing calendars</h1>
<% @calendars.each do |calendar| %>
<div class="media">
<a class="pull-left" href="#">
<img class="media-object img-circle" src="<%= calendar.picture.thumb.url %>"/>
</a>
<div class="media-body">
<h4><%= link_to calendar.name, calendar %></h4>
</div>
</div>
<% end %>
<%= link_to 'New Calendar', new_calendar_path %>

View File

@@ -0,0 +1,5 @@
<h1>New calendar</h1>
<%= render 'form' %>
<%= link_to 'Back', calendars_path %>

View File

@@ -0,0 +1,30 @@
<div class="container-fluid">
<div class="row-fluid">
<p id="notice"><%= notice %></p>
<h1>
<%= '<i class="icon-globe"></i>'.html_safe unless !@calendar.public%>
<%= @calendar.name %>
</h1>
<div class="row-fluid">
<ul class="list-group">
<% @calendar.calentries.each do |entry| %>
<li class="list-group-item">
<%= link_to entry.summary+ " - " + I18n.l(entry.start), entry %>
</li>
<% end %>
</ul>
</div>
<div class="row-fluid">
<%= calendar @calendar.calentries do |entry| %>
<div><%= link_to entry.name, entry %></div>
<% end %>
</div>
<div class="row-fluid">
<div class="btn-group">
<%= link_to 'New Entry', new_calentry_path, {:class=>"btn"} %>
<%= link_to 'Edit', edit_calendar_path(@calendar), {:class=>"btn"} %>
<%= link_to 'Back', calendars_path, {:class=>"btn"} %>
</div>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<% @calendar.calentries.each do |entry| %>
<%= render entry %>
<% end %>

View File

@@ -0,0 +1,5 @@
<%= calentry.start %>
<%= calentry.ende %>
<%= calentry.summary %>
<%= calentry.typ %>

View File

@@ -0,0 +1,34 @@
<div class="container-fluid">
<%= semantic_form_for @calentry do |f| %>
<%= f.inputs do %>
<div class="row-fluid">
<div class="span6">
<%= f.input :start , :as => :date_string %>
</div>
<div class="span6">
<%= f.input :ende , :as => :date_string %>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<%= f.input :summary %>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<%= f.input :calendars, :as=> :radio %>
</div>
<div class="span6">
<%= f.input :typ %>
</div>
</div>
<% end %>
<div class="row-fluid">
<div class="span12">
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
</div>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,6 @@
<h1>Editing calentry</h1>
<%= render 'form' %>
<%= link_to 'Show', @calentry %> |
<%= link_to 'Back', calentries_path %>

View File

@@ -0,0 +1,29 @@
<h1>Listing calentries</h1>
<table>
<tr>
<th>Start</th>
<th>Ende</th>
<th>Summary</th>
<th>Typ</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @calentries.each do |calentry| %>
<tr>
<td><%= calentry.start %></td>
<td><%= calentry.ende %></td>
<td><%= calentry.summary %></td>
<td><%= calentry.typ %></td>
<td><%= link_to 'Show', calentry %></td>
<td><%= link_to 'Edit', edit_calentry_path(calentry) %></td>
<td><%= link_to 'Destroy', calentry, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Calentry', new_calentry_path %>

View File

@@ -0,0 +1,5 @@
<h1>New calentry</h1>
<%= render 'form' %>
<%= link_to 'Back', calentries_path %>

View File

@@ -0,0 +1,25 @@
<p id="notice"><%= notice %></p>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<b>
<%= @calentry.summary %>
</b>
</div>
</div>
<div class="row-fluid">
<div class="span9">
<%= I18n.l @calentry.start %>
<%= " bis " unless @calentry.ende.nil? %>
<%= I18n.l @calentry.ende %>
</div>
<div class="span3">
<%= @calentry.typ %>
</div></div>
<div class="row-fluid">
<div class="span12">
<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
<%= link_to 'Back', calentries_path %>
</div></div></div>

View File

@@ -0,0 +1,25 @@
<p id="notice"><%= notice %></p>
<p>
<b>Start:</b>
<%= @calentry.start %>
</p>
<p>
<b>Ende:</b>
<%= @calentry.ende %>
</p>
<p>
<b>Summary:</b>
<%= @calentry.summary %>
</p>
<p>
<b>Typ:</b>
<%= @calentry.typ %>
</p>
<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
<%= link_to 'Back', calentries_path %>

View File

@@ -4,8 +4,8 @@
</li>
<li><%= link_to I18n.t(:news,:scope=>'home' ),rubriken_path %></li>
<li><%= link_to I18n.t(:info,:scope=>'home' ) %></li>
<li><%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %>
</li>
<li><%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %></li>
<li><%= link_to "Kalender", calendars_path %></li>
<li><%= link_to "wiki intern", page_path(1) %>
</li>
</ul>

View File

@@ -9,6 +9,8 @@
<p><h4>Beschreibung</h4>
<%= @lva.desc %>
<%= link_to "Beispiel neu" , new_beispiel_path(:lva_id=>@lva.id) %>
</p>
<div class="row-fluid">
<h4>Beispiele</h4>

View File

@@ -1,8 +1,14 @@
<div class="container-fluid">
<%= tinymce_assets %>
<%= semantic_form_for @studium do |f| %>
<<<<<<< HEAD
<%= f.inputs do %>
=======
<div class="span9">
<%= f.inputs do %>
>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<div class="row-fluid">
<div class="span6">
<%= f.input :name,:append=>"NAME" %>
@@ -17,12 +23,19 @@
<div class="row-fluid">
<%= f.input :desc, :as=>:tinymce_text %>
</div>
<<<<<<< HEAD
=======
>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<% end %>
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<<<<<<< HEAD
=======
</div>
>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<% end %>
</div>