calendar feature generiert

This commit is contained in:
Andreas Stephanides
2013-08-06 00:48:45 +02:00
parent f8d5cb0ddd
commit 6bb35c110a
44 changed files with 1011 additions and 0 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

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

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

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

@@ -0,0 +1,3 @@
class Calendar < ActiveRecord::Base
attr_accessible :name, :public
end

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

@@ -0,0 +1,4 @@
class Calentry < ActiveRecord::Base
attr_accessible :ende, :start, :summary, :typ
end

View File

@@ -0,0 +1,10 @@
<%= semantic_form_for @calendar do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :public %>
<% 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,25 @@
<h1>Listing calendars</h1>
<table>
<tr>
<th>Name</th>
<th>Public</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @calendars.each do |calendar| %>
<tr>
<td><%= calendar.name %></td>
<td><%= calendar.public %></td>
<td><%= link_to 'Show', calendar %></td>
<td><%= link_to 'Edit', edit_calendar_path(calendar) %></td>
<td><%= link_to 'Destroy', calendar, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= 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,15 @@
<p id="notice"><%= notice %></p>
<p>
<b>Name:</b>
<%= @calendar.name %>
</p>
<p>
<b>Public:</b>
<%= @calendar.public %>
</p>
<%= link_to 'Edit', edit_calendar_path(@calendar) %> |
<%= link_to 'Back', calendars_path %>

View File

@@ -0,0 +1,12 @@
<%= semantic_form_for @calentry do |f| %>
<%= f.inputs do %>
<%= f.input :start %>
<%= f.input :ende %>
<%= f.input :summary %>
<%= f.input :typ %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

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

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