From 6bb35c110a3fc809ec9ab1b6d4ef2e7926ac9588 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 6 Aug 2013 00:48:45 +0200 Subject: [PATCH 01/12] calendar feature generiert --- app/assets/javascripts/calendars.js.coffee | 3 + app/assets/javascripts/calentries.js.coffee | 3 + app/assets/stylesheets/calendars.css.scss | 3 + app/assets/stylesheets/calentries.css.scss | 3 + app/controllers/calendars_controller.rb | 83 +++++++++ app/controllers/calentries_controller.rb | 84 +++++++++ app/helpers/calendars_helper.rb | 2 + app/helpers/calentries_helper.rb | 2 + app/models/calendar.rb | 3 + app/models/calentry.rb | 4 + app/views/calendars/_form.html.erb | 10 ++ app/views/calendars/edit.html.erb | 6 + app/views/calendars/index.html.erb | 25 +++ app/views/calendars/new.html.erb | 5 + app/views/calendars/show.html.erb | 15 ++ app/views/calentries/_form.html.erb | 12 ++ app/views/calentries/edit.html.erb | 6 + app/views/calentries/index.html.erb | 29 ++++ app/views/calentries/new.html.erb | 5 + app/views/calentries/show.html.erb | 25 +++ app/views/calentries/show.ics.erb | 25 +++ config/routes.rb | 6 + .../20130805191709_create_calentries.rb | 12 ++ db/migrate/20130805191817_create_calendars.rb | 10 ++ spec/controllers/calendars_controller_spec.rb | 160 ++++++++++++++++++ .../controllers/calentries_controller_spec.rb | 160 ++++++++++++++++++ spec/factories/calendars.rb | 8 + spec/factories/calentries.rb | 10 ++ spec/helpers/calendars_helper_spec.rb | 15 ++ spec/helpers/calentries_helper_spec.rb | 15 ++ spec/models/calendar_spec.rb | 5 + spec/models/calentry_spec.rb | 5 + spec/requests/calendars_spec.rb | 11 ++ spec/requests/calentries_spec.rb | 11 ++ spec/routing/calendars_routing_spec.rb | 35 ++++ spec/routing/calentries_routing_spec.rb | 35 ++++ spec/views/calendars/edit.html.erb_spec.rb | 20 +++ spec/views/calendars/index.html.erb_spec.rb | 23 +++ spec/views/calendars/new.html.erb_spec.rb | 20 +++ spec/views/calendars/show.html.erb_spec.rb | 17 ++ spec/views/calentries/edit.html.erb_spec.rb | 20 +++ spec/views/calentries/index.html.erb_spec.rb | 23 +++ spec/views/calentries/new.html.erb_spec.rb | 20 +++ spec/views/calentries/show.html.erb_spec.rb | 17 ++ 44 files changed, 1011 insertions(+) create mode 100644 app/assets/javascripts/calendars.js.coffee create mode 100644 app/assets/javascripts/calentries.js.coffee create mode 100644 app/assets/stylesheets/calendars.css.scss create mode 100644 app/assets/stylesheets/calentries.css.scss create mode 100644 app/controllers/calendars_controller.rb create mode 100644 app/controllers/calentries_controller.rb create mode 100644 app/helpers/calendars_helper.rb create mode 100644 app/helpers/calentries_helper.rb create mode 100644 app/models/calendar.rb create mode 100644 app/models/calentry.rb create mode 100644 app/views/calendars/_form.html.erb create mode 100644 app/views/calendars/edit.html.erb create mode 100644 app/views/calendars/index.html.erb create mode 100644 app/views/calendars/new.html.erb create mode 100644 app/views/calendars/show.html.erb create mode 100644 app/views/calentries/_form.html.erb create mode 100644 app/views/calentries/edit.html.erb create mode 100644 app/views/calentries/index.html.erb create mode 100644 app/views/calentries/new.html.erb create mode 100644 app/views/calentries/show.html.erb create mode 100644 app/views/calentries/show.ics.erb create mode 100644 db/migrate/20130805191709_create_calentries.rb create mode 100644 db/migrate/20130805191817_create_calendars.rb create mode 100644 spec/controllers/calendars_controller_spec.rb create mode 100644 spec/controllers/calentries_controller_spec.rb create mode 100644 spec/factories/calendars.rb create mode 100644 spec/factories/calentries.rb create mode 100644 spec/helpers/calendars_helper_spec.rb create mode 100644 spec/helpers/calentries_helper_spec.rb create mode 100644 spec/models/calendar_spec.rb create mode 100644 spec/models/calentry_spec.rb create mode 100644 spec/requests/calendars_spec.rb create mode 100644 spec/requests/calentries_spec.rb create mode 100644 spec/routing/calendars_routing_spec.rb create mode 100644 spec/routing/calentries_routing_spec.rb create mode 100644 spec/views/calendars/edit.html.erb_spec.rb create mode 100644 spec/views/calendars/index.html.erb_spec.rb create mode 100644 spec/views/calendars/new.html.erb_spec.rb create mode 100644 spec/views/calendars/show.html.erb_spec.rb create mode 100644 spec/views/calentries/edit.html.erb_spec.rb create mode 100644 spec/views/calentries/index.html.erb_spec.rb create mode 100644 spec/views/calentries/new.html.erb_spec.rb create mode 100644 spec/views/calentries/show.html.erb_spec.rb diff --git a/app/assets/javascripts/calendars.js.coffee b/app/assets/javascripts/calendars.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/calendars.js.coffee @@ -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/ diff --git a/app/assets/javascripts/calentries.js.coffee b/app/assets/javascripts/calentries.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/calentries.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/calendars.css.scss b/app/assets/stylesheets/calendars.css.scss new file mode 100644 index 0000000..0efb58b --- /dev/null +++ b/app/assets/stylesheets/calendars.css.scss @@ -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/ diff --git a/app/assets/stylesheets/calentries.css.scss b/app/assets/stylesheets/calentries.css.scss new file mode 100644 index 0000000..47a2dcd --- /dev/null +++ b/app/assets/stylesheets/calentries.css.scss @@ -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/ diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb new file mode 100644 index 0000000..b3631aa --- /dev/null +++ b/app/controllers/calendars_controller.rb @@ -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 diff --git a/app/controllers/calentries_controller.rb b/app/controllers/calentries_controller.rb new file mode 100644 index 0000000..89990cd --- /dev/null +++ b/app/controllers/calentries_controller.rb @@ -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 diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb new file mode 100644 index 0000000..9712f62 --- /dev/null +++ b/app/helpers/calendars_helper.rb @@ -0,0 +1,2 @@ +module CalendarsHelper +end diff --git a/app/helpers/calentries_helper.rb b/app/helpers/calentries_helper.rb new file mode 100644 index 0000000..b46fa94 --- /dev/null +++ b/app/helpers/calentries_helper.rb @@ -0,0 +1,2 @@ +module CalentriesHelper +end diff --git a/app/models/calendar.rb b/app/models/calendar.rb new file mode 100644 index 0000000..5b55280 --- /dev/null +++ b/app/models/calendar.rb @@ -0,0 +1,3 @@ +class Calendar < ActiveRecord::Base + attr_accessible :name, :public +end diff --git a/app/models/calentry.rb b/app/models/calentry.rb new file mode 100644 index 0000000..6e892ad --- /dev/null +++ b/app/models/calentry.rb @@ -0,0 +1,4 @@ +class Calentry < ActiveRecord::Base + attr_accessible :ende, :start, :summary, :typ + +end diff --git a/app/views/calendars/_form.html.erb b/app/views/calendars/_form.html.erb new file mode 100644 index 0000000..dc6e021 --- /dev/null +++ b/app/views/calendars/_form.html.erb @@ -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 %> diff --git a/app/views/calendars/edit.html.erb b/app/views/calendars/edit.html.erb new file mode 100644 index 0000000..e882347 --- /dev/null +++ b/app/views/calendars/edit.html.erb @@ -0,0 +1,6 @@ +

Editing calendar

+ +<%= render 'form' %> + +<%= link_to 'Show', @calendar %> | +<%= link_to 'Back', calendars_path %> diff --git a/app/views/calendars/index.html.erb b/app/views/calendars/index.html.erb new file mode 100644 index 0000000..402c093 --- /dev/null +++ b/app/views/calendars/index.html.erb @@ -0,0 +1,25 @@ +

Listing calendars

+ + + + + + + + + + +<% @calendars.each do |calendar| %> + + + + + + + +<% end %> +
NamePublic
<%= calendar.name %><%= calendar.public %><%= link_to 'Show', calendar %><%= link_to 'Edit', edit_calendar_path(calendar) %><%= link_to 'Destroy', calendar, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Calendar', new_calendar_path %> diff --git a/app/views/calendars/new.html.erb b/app/views/calendars/new.html.erb new file mode 100644 index 0000000..0d60f9a --- /dev/null +++ b/app/views/calendars/new.html.erb @@ -0,0 +1,5 @@ +

New calendar

+ +<%= render 'form' %> + +<%= link_to 'Back', calendars_path %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb new file mode 100644 index 0000000..efadc5a --- /dev/null +++ b/app/views/calendars/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Name: + <%= @calendar.name %> +

+ +

+ Public: + <%= @calendar.public %> +

+ + +<%= link_to 'Edit', edit_calendar_path(@calendar) %> | +<%= link_to 'Back', calendars_path %> diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb new file mode 100644 index 0000000..bd74e58 --- /dev/null +++ b/app/views/calentries/_form.html.erb @@ -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 %> diff --git a/app/views/calentries/edit.html.erb b/app/views/calentries/edit.html.erb new file mode 100644 index 0000000..2d1c180 --- /dev/null +++ b/app/views/calentries/edit.html.erb @@ -0,0 +1,6 @@ +

Editing calentry

+ +<%= render 'form' %> + +<%= link_to 'Show', @calentry %> | +<%= link_to 'Back', calentries_path %> diff --git a/app/views/calentries/index.html.erb b/app/views/calentries/index.html.erb new file mode 100644 index 0000000..a54afda --- /dev/null +++ b/app/views/calentries/index.html.erb @@ -0,0 +1,29 @@ +

Listing calentries

+ + + + + + + + + + + + +<% @calentries.each do |calentry| %> + + + + + + + + + +<% end %> +
StartEndeSummaryTyp
<%= calentry.start %><%= calentry.ende %><%= calentry.summary %><%= calentry.typ %><%= link_to 'Show', calentry %><%= link_to 'Edit', edit_calentry_path(calentry) %><%= link_to 'Destroy', calentry, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Calentry', new_calentry_path %> diff --git a/app/views/calentries/new.html.erb b/app/views/calentries/new.html.erb new file mode 100644 index 0000000..022d6f8 --- /dev/null +++ b/app/views/calentries/new.html.erb @@ -0,0 +1,5 @@ +

New calentry

+ +<%= render 'form' %> + +<%= link_to 'Back', calentries_path %> diff --git a/app/views/calentries/show.html.erb b/app/views/calentries/show.html.erb new file mode 100644 index 0000000..908d8dc --- /dev/null +++ b/app/views/calentries/show.html.erb @@ -0,0 +1,25 @@ +

<%= notice %>

+ +

+ Start: + <%= @calentry.start %> +

+ +

+ Ende: + <%= @calentry.ende %> +

+ +

+ Summary: + <%= @calentry.summary %> +

+ +

+ Typ: + <%= @calentry.typ %> +

+ + +<%= link_to 'Edit', edit_calentry_path(@calentry) %> | +<%= link_to 'Back', calentries_path %> diff --git a/app/views/calentries/show.ics.erb b/app/views/calentries/show.ics.erb new file mode 100644 index 0000000..908d8dc --- /dev/null +++ b/app/views/calentries/show.ics.erb @@ -0,0 +1,25 @@ +

<%= notice %>

+ +

+ Start: + <%= @calentry.start %> +

+ +

+ Ende: + <%= @calentry.ende %> +

+ +

+ Summary: + <%= @calentry.summary %> +

+ +

+ Typ: + <%= @calentry.typ %> +

+ + +<%= link_to 'Edit', edit_calentry_path(@calentry) %> | +<%= link_to 'Back', calentries_path %> diff --git a/config/routes.rb b/config/routes.rb index 2603420..696aeb1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,11 @@ Fetsite::Application.routes.draw do + resources :calendars + + + resources :calentries + + devise_for :users resources :home, :only=>[:index] #get 'home',:controller=>home,:action=>:index,:as=>"home_index" diff --git a/db/migrate/20130805191709_create_calentries.rb b/db/migrate/20130805191709_create_calentries.rb new file mode 100644 index 0000000..c4ece84 --- /dev/null +++ b/db/migrate/20130805191709_create_calentries.rb @@ -0,0 +1,12 @@ +class CreateCalentries < ActiveRecord::Migration + def change + create_table :calentries do |t| + t.timestamp :start + t.timestamp :ende + t.string :summary + t.integer :typ + + t.timestamps + end + end +end diff --git a/db/migrate/20130805191817_create_calendars.rb b/db/migrate/20130805191817_create_calendars.rb new file mode 100644 index 0000000..bc12669 --- /dev/null +++ b/db/migrate/20130805191817_create_calendars.rb @@ -0,0 +1,10 @@ +class CreateCalendars < ActiveRecord::Migration + def change + create_table :calendars do |t| + t.string :name + t.boolean :public + + t.timestamps + end + end +end diff --git a/spec/controllers/calendars_controller_spec.rb b/spec/controllers/calendars_controller_spec.rb new file mode 100644 index 0000000..65fc3e7 --- /dev/null +++ b/spec/controllers/calendars_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe CalendarsController do + + # This should return the minimal set of attributes required to create a valid + # Calendar. As you add validations to Calendar, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "name" => "MyString" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # CalendarsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all calendars as @calendars" do + calendar = Calendar.create! valid_attributes + get :index, {}, valid_session + assigns(:calendars).should eq([calendar]) + end + end + + describe "GET show" do + it "assigns the requested calendar as @calendar" do + calendar = Calendar.create! valid_attributes + get :show, {:id => calendar.to_param}, valid_session + assigns(:calendar).should eq(calendar) + end + end + + describe "GET new" do + it "assigns a new calendar as @calendar" do + get :new, {}, valid_session + assigns(:calendar).should be_a_new(Calendar) + end + end + + describe "GET edit" do + it "assigns the requested calendar as @calendar" do + calendar = Calendar.create! valid_attributes + get :edit, {:id => calendar.to_param}, valid_session + assigns(:calendar).should eq(calendar) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Calendar" do + expect { + post :create, {:calendar => valid_attributes}, valid_session + }.to change(Calendar, :count).by(1) + end + + it "assigns a newly created calendar as @calendar" do + post :create, {:calendar => valid_attributes}, valid_session + assigns(:calendar).should be_a(Calendar) + assigns(:calendar).should be_persisted + end + + it "redirects to the created calendar" do + post :create, {:calendar => valid_attributes}, valid_session + response.should redirect_to(Calendar.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved calendar as @calendar" do + # Trigger the behavior that occurs when invalid params are submitted + Calendar.any_instance.stub(:save).and_return(false) + post :create, {:calendar => { "name" => "invalid value" }}, valid_session + assigns(:calendar).should be_a_new(Calendar) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Calendar.any_instance.stub(:save).and_return(false) + post :create, {:calendar => { "name" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested calendar" do + calendar = Calendar.create! valid_attributes + # Assuming there are no other calendars in the database, this + # specifies that the Calendar created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Calendar.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" }) + put :update, {:id => calendar.to_param, :calendar => { "name" => "MyString" }}, valid_session + end + + it "assigns the requested calendar as @calendar" do + calendar = Calendar.create! valid_attributes + put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session + assigns(:calendar).should eq(calendar) + end + + it "redirects to the calendar" do + calendar = Calendar.create! valid_attributes + put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session + response.should redirect_to(calendar) + end + end + + describe "with invalid params" do + it "assigns the calendar as @calendar" do + calendar = Calendar.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Calendar.any_instance.stub(:save).and_return(false) + put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session + assigns(:calendar).should eq(calendar) + end + + it "re-renders the 'edit' template" do + calendar = Calendar.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Calendar.any_instance.stub(:save).and_return(false) + put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested calendar" do + calendar = Calendar.create! valid_attributes + expect { + delete :destroy, {:id => calendar.to_param}, valid_session + }.to change(Calendar, :count).by(-1) + end + + it "redirects to the calendars list" do + calendar = Calendar.create! valid_attributes + delete :destroy, {:id => calendar.to_param}, valid_session + response.should redirect_to(calendars_url) + end + end + +end diff --git a/spec/controllers/calentries_controller_spec.rb b/spec/controllers/calentries_controller_spec.rb new file mode 100644 index 0000000..63605e7 --- /dev/null +++ b/spec/controllers/calentries_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe CalentriesController do + + # This should return the minimal set of attributes required to create a valid + # Calentry. As you add validations to Calentry, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "start" => "2013-08-05 21:17:10" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # CalentriesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all calentries as @calentries" do + calentry = Calentry.create! valid_attributes + get :index, {}, valid_session + assigns(:calentries).should eq([calentry]) + end + end + + describe "GET show" do + it "assigns the requested calentry as @calentry" do + calentry = Calentry.create! valid_attributes + get :show, {:id => calentry.to_param}, valid_session + assigns(:calentry).should eq(calentry) + end + end + + describe "GET new" do + it "assigns a new calentry as @calentry" do + get :new, {}, valid_session + assigns(:calentry).should be_a_new(Calentry) + end + end + + describe "GET edit" do + it "assigns the requested calentry as @calentry" do + calentry = Calentry.create! valid_attributes + get :edit, {:id => calentry.to_param}, valid_session + assigns(:calentry).should eq(calentry) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Calentry" do + expect { + post :create, {:calentry => valid_attributes}, valid_session + }.to change(Calentry, :count).by(1) + end + + it "assigns a newly created calentry as @calentry" do + post :create, {:calentry => valid_attributes}, valid_session + assigns(:calentry).should be_a(Calentry) + assigns(:calentry).should be_persisted + end + + it "redirects to the created calentry" do + post :create, {:calentry => valid_attributes}, valid_session + response.should redirect_to(Calentry.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved calentry as @calentry" do + # Trigger the behavior that occurs when invalid params are submitted + Calentry.any_instance.stub(:save).and_return(false) + post :create, {:calentry => { "start" => "invalid value" }}, valid_session + assigns(:calentry).should be_a_new(Calentry) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Calentry.any_instance.stub(:save).and_return(false) + post :create, {:calentry => { "start" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested calentry" do + calentry = Calentry.create! valid_attributes + # Assuming there are no other calentries in the database, this + # specifies that the Calentry created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Calentry.any_instance.should_receive(:update_attributes).with({ "start" => "2013-08-05 21:17:10" }) + put :update, {:id => calentry.to_param, :calentry => { "start" => "2013-08-05 21:17:10" }}, valid_session + end + + it "assigns the requested calentry as @calentry" do + calentry = Calentry.create! valid_attributes + put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session + assigns(:calentry).should eq(calentry) + end + + it "redirects to the calentry" do + calentry = Calentry.create! valid_attributes + put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session + response.should redirect_to(calentry) + end + end + + describe "with invalid params" do + it "assigns the calentry as @calentry" do + calentry = Calentry.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Calentry.any_instance.stub(:save).and_return(false) + put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session + assigns(:calentry).should eq(calentry) + end + + it "re-renders the 'edit' template" do + calentry = Calentry.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Calentry.any_instance.stub(:save).and_return(false) + put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested calentry" do + calentry = Calentry.create! valid_attributes + expect { + delete :destroy, {:id => calentry.to_param}, valid_session + }.to change(Calentry, :count).by(-1) + end + + it "redirects to the calentries list" do + calentry = Calentry.create! valid_attributes + delete :destroy, {:id => calentry.to_param}, valid_session + response.should redirect_to(calentries_url) + end + end + +end diff --git a/spec/factories/calendars.rb b/spec/factories/calendars.rb new file mode 100644 index 0000000..f5cafa0 --- /dev/null +++ b/spec/factories/calendars.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :calendar do + name "MyString" + public false + end +end diff --git a/spec/factories/calentries.rb b/spec/factories/calentries.rb new file mode 100644 index 0000000..3e2d9b9 --- /dev/null +++ b/spec/factories/calentries.rb @@ -0,0 +1,10 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :calentry do + start "2013-08-05 21:17:10" + ende "2013-08-05 21:17:10" + summary "MyString" + typ 1 + end +end diff --git a/spec/helpers/calendars_helper_spec.rb b/spec/helpers/calendars_helper_spec.rb new file mode 100644 index 0000000..67df5e7 --- /dev/null +++ b/spec/helpers/calendars_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the CalendarsHelper. For example: +# +# describe CalendarsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe CalendarsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/calentries_helper_spec.rb b/spec/helpers/calentries_helper_spec.rb new file mode 100644 index 0000000..b496788 --- /dev/null +++ b/spec/helpers/calentries_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the CalentriesHelper. For example: +# +# describe CalentriesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe CalentriesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb new file mode 100644 index 0000000..f4477ee --- /dev/null +++ b/spec/models/calendar_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Calendar do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb new file mode 100644 index 0000000..0e3a169 --- /dev/null +++ b/spec/models/calentry_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Calentry do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/calendars_spec.rb b/spec/requests/calendars_spec.rb new file mode 100644 index 0000000..b3ab70b --- /dev/null +++ b/spec/requests/calendars_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Calendars" do + describe "GET /calendars" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get calendars_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/calentries_spec.rb b/spec/requests/calentries_spec.rb new file mode 100644 index 0000000..8f33562 --- /dev/null +++ b/spec/requests/calentries_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Calentries" do + describe "GET /calentries" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get calentries_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/calendars_routing_spec.rb b/spec/routing/calendars_routing_spec.rb new file mode 100644 index 0000000..3aba097 --- /dev/null +++ b/spec/routing/calendars_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe CalendarsController do + describe "routing" do + + it "routes to #index" do + get("/calendars").should route_to("calendars#index") + end + + it "routes to #new" do + get("/calendars/new").should route_to("calendars#new") + end + + it "routes to #show" do + get("/calendars/1").should route_to("calendars#show", :id => "1") + end + + it "routes to #edit" do + get("/calendars/1/edit").should route_to("calendars#edit", :id => "1") + end + + it "routes to #create" do + post("/calendars").should route_to("calendars#create") + end + + it "routes to #update" do + put("/calendars/1").should route_to("calendars#update", :id => "1") + end + + it "routes to #destroy" do + delete("/calendars/1").should route_to("calendars#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/calentries_routing_spec.rb b/spec/routing/calentries_routing_spec.rb new file mode 100644 index 0000000..214c524 --- /dev/null +++ b/spec/routing/calentries_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe CalentriesController do + describe "routing" do + + it "routes to #index" do + get("/calentries").should route_to("calentries#index") + end + + it "routes to #new" do + get("/calentries/new").should route_to("calentries#new") + end + + it "routes to #show" do + get("/calentries/1").should route_to("calentries#show", :id => "1") + end + + it "routes to #edit" do + get("/calentries/1/edit").should route_to("calentries#edit", :id => "1") + end + + it "routes to #create" do + post("/calentries").should route_to("calentries#create") + end + + it "routes to #update" do + put("/calentries/1").should route_to("calentries#update", :id => "1") + end + + it "routes to #destroy" do + delete("/calentries/1").should route_to("calentries#destroy", :id => "1") + end + + end +end diff --git a/spec/views/calendars/edit.html.erb_spec.rb b/spec/views/calendars/edit.html.erb_spec.rb new file mode 100644 index 0000000..1332e40 --- /dev/null +++ b/spec/views/calendars/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "calendars/edit" do + before(:each) do + @calendar = assign(:calendar, stub_model(Calendar, + :name => "MyString", + :public => false + )) + end + + it "renders the edit calendar form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", calendar_path(@calendar), "post" do + assert_select "input#calendar_name[name=?]", "calendar[name]" + assert_select "input#calendar_public[name=?]", "calendar[public]" + end + end +end diff --git a/spec/views/calendars/index.html.erb_spec.rb b/spec/views/calendars/index.html.erb_spec.rb new file mode 100644 index 0000000..2d35f2d --- /dev/null +++ b/spec/views/calendars/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "calendars/index" do + before(:each) do + assign(:calendars, [ + stub_model(Calendar, + :name => "Name", + :public => false + ), + stub_model(Calendar, + :name => "Name", + :public => false + ) + ]) + end + + it "renders a list of calendars" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Name".to_s, :count => 2 + assert_select "tr>td", :text => false.to_s, :count => 2 + end +end diff --git a/spec/views/calendars/new.html.erb_spec.rb b/spec/views/calendars/new.html.erb_spec.rb new file mode 100644 index 0000000..026c0fd --- /dev/null +++ b/spec/views/calendars/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "calendars/new" do + before(:each) do + assign(:calendar, stub_model(Calendar, + :name => "MyString", + :public => false + ).as_new_record) + end + + it "renders new calendar form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", calendars_path, "post" do + assert_select "input#calendar_name[name=?]", "calendar[name]" + assert_select "input#calendar_public[name=?]", "calendar[public]" + end + end +end diff --git a/spec/views/calendars/show.html.erb_spec.rb b/spec/views/calendars/show.html.erb_spec.rb new file mode 100644 index 0000000..53cecc6 --- /dev/null +++ b/spec/views/calendars/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "calendars/show" do + before(:each) do + @calendar = assign(:calendar, stub_model(Calendar, + :name => "Name", + :public => false + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Name/) + rendered.should match(/false/) + end +end diff --git a/spec/views/calentries/edit.html.erb_spec.rb b/spec/views/calentries/edit.html.erb_spec.rb new file mode 100644 index 0000000..72b00fd --- /dev/null +++ b/spec/views/calentries/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "calentries/edit" do + before(:each) do + @calentry = assign(:calentry, stub_model(Calentry, + :summary => "MyString", + :typ => 1 + )) + end + + it "renders the edit calentry form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", calentry_path(@calentry), "post" do + assert_select "input#calentry_summary[name=?]", "calentry[summary]" + assert_select "input#calentry_typ[name=?]", "calentry[typ]" + end + end +end diff --git a/spec/views/calentries/index.html.erb_spec.rb b/spec/views/calentries/index.html.erb_spec.rb new file mode 100644 index 0000000..cd488a9 --- /dev/null +++ b/spec/views/calentries/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "calentries/index" do + before(:each) do + assign(:calentries, [ + stub_model(Calentry, + :summary => "Summary", + :typ => 1 + ), + stub_model(Calentry, + :summary => "Summary", + :typ => 1 + ) + ]) + end + + it "renders a list of calentries" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Summary".to_s, :count => 2 + assert_select "tr>td", :text => 1.to_s, :count => 2 + end +end diff --git a/spec/views/calentries/new.html.erb_spec.rb b/spec/views/calentries/new.html.erb_spec.rb new file mode 100644 index 0000000..32e477b --- /dev/null +++ b/spec/views/calentries/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "calentries/new" do + before(:each) do + assign(:calentry, stub_model(Calentry, + :summary => "MyString", + :typ => 1 + ).as_new_record) + end + + it "renders new calentry form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", calentries_path, "post" do + assert_select "input#calentry_summary[name=?]", "calentry[summary]" + assert_select "input#calentry_typ[name=?]", "calentry[typ]" + end + end +end diff --git a/spec/views/calentries/show.html.erb_spec.rb b/spec/views/calentries/show.html.erb_spec.rb new file mode 100644 index 0000000..588baec --- /dev/null +++ b/spec/views/calentries/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "calentries/show" do + before(:each) do + @calentry = assign(:calentry, stub_model(Calentry, + :summary => "Summary", + :typ => 1 + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Summary/) + rendered.should match(/1/) + end +end From ae75459d58a14998e9e115be850537f99855140f Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Thu, 8 Aug 2013 09:08:43 +0200 Subject: [PATCH 02/12] Relationship Calentry,Calendar --- app/models/calendar.rb | 1 + app/models/calentry.rb | 10 ++++++++-- ...8062732_create_calendar_calentries_join_table.rb | 13 +++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20130808062732_create_calendar_calentries_join_table.rb diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 5b55280..eaaa1a9 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -1,3 +1,4 @@ class Calendar < ActiveRecord::Base attr_accessible :name, :public + has_and_belongs_to_many :calentries end diff --git a/app/models/calentry.rb b/app/models/calentry.rb index 6e892ad..7d7ded6 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -1,4 +1,10 @@ class Calentry < ActiveRecord::Base - attr_accessible :ende, :start, :summary, :typ - + attr_accessible :ende, :start, :summary, :typ,:calendar_ids + has_and_belongs_to_many :calendar + def start_time + start + end + def name + summary + end end diff --git a/db/migrate/20130808062732_create_calendar_calentries_join_table.rb b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb new file mode 100644 index 0000000..bbf0362 --- /dev/null +++ b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb @@ -0,0 +1,13 @@ +class CreateCalendarCalentriesJoinTable < ActiveRecord::Migration + def up + create_table :calendars_calentries, :id=>false do |t| + t.integer :calentry_id + t.integer :calendar_id + end + add_index :calendars_calentries, [:calentry_id, :calendar_id] + add_index :calendars_calentries, :calendar_id + end + + def down + end +end From b329fa489603761a724a5d28c6a9a22c2d35acef Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Thu, 8 Aug 2013 09:09:34 +0200 Subject: [PATCH 03/12] simple_calendar, calender_show_view Kalender in Tabellenansicht --- Gemfile | 2 ++ app/controllers/calentries_controller.rb | 2 +- app/views/calendars/show.html.erb | 9 +++++++++ app/views/calentries/_form.html.erb | 1 + app/views/layouts/menu.html.erb | 4 ++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 7fce64e..d81643d 100755 --- a/Gemfile +++ b/Gemfile @@ -75,3 +75,5 @@ group :development, :test do gem 'factory_girl_rails' gem 'rspec-rails' end + +gem "simple_calendar", "~> 0.1.9" diff --git a/app/controllers/calentries_controller.rb b/app/controllers/calentries_controller.rb index 89990cd..3452d72 100644 --- a/app/controllers/calentries_controller.rb +++ b/app/controllers/calentries_controller.rb @@ -18,7 +18,7 @@ class CalentriesController < ApplicationController respond_to do |format| format.html # show.html.erb format.json { render json: @calentry } - format.ics { render 'show.ics.erb',} + format.ics { render 'show.ics.erb'} end end diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index efadc5a..8778ca8 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -9,7 +9,16 @@ Public: <%= @calendar.public %>

+

+

From 8ec00d6a5658513069263a46d55d3aa8ac105089 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Thu, 8 Aug 2013 09:09:55 +0200 Subject: [PATCH 04/12] Lokalisierung date,time --- config/locales/de.yml | 201 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 197 insertions(+), 4 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 84fa7a6..75fd73f 100755 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -101,7 +101,200 @@ de: blank: "Geben Sie den Namen des Studiums ein" taken: "Der Name ist bereits vergeben" typ: - inclusion: 'Wählen Sie "Bachelor" oder "Master" aus' - - - + inclusion: 'Wählen Sie "Bachelor" oder "Master" aus' + + date: + abbr_day_names: + - So + - Mo + - Di + - Mi + - Do + - Fr + - Sa + abbr_month_names: + - + - Jan + - Feb + - Mär + - Apr + - Mai + - Jun + - Jul + - Aug + - Sep + - Okt + - Nov + - Dez + day_names: + - Sonntag + - Montag + - Dienstag + - Mittwoch + - Donnerstag + - Freitag + - Samstag + formats: + default: ! '%d.%m.%Y' + long: ! '%e. %B %Y' + short: ! '%e. %b' + month_names: + - + - Januar + - Februar + - März + - April + - Mai + - Juni + - Juli + - August + - September + - Oktober + - November + - Dezember + order: + - :day + - :month + - :year + datetime: + distance_in_words: + about_x_hours: + one: etwa eine Stunde + other: etwa %{count} Stunden + about_x_months: + one: etwa ein Monat + other: etwa %{count} Monate + about_x_years: + one: etwa ein Jahr + other: etwa %{count} Jahre + almost_x_years: + one: fast ein Jahr + other: fast %{count} Jahre + half_a_minute: eine halbe Minute + less_than_x_minutes: + one: weniger als eine Minute + other: weniger als %{count} Minuten + less_than_x_seconds: + one: weniger als eine Sekunde + other: weniger als %{count} Sekunden + over_x_years: + one: mehr als ein Jahr + other: mehr als %{count} Jahre + x_days: + one: ein Tag + other: ! '%{count} Tage' + x_minutes: + one: eine Minute + other: ! '%{count} Minuten' + x_months: + one: ein Monat + other: ! '%{count} Monate' + x_seconds: + one: eine Sekunde + other: ! '%{count} Sekunden' + prompts: + day: Tag + hour: Stunden + minute: Minuten + month: Monat + second: Sekunden + year: Jahr + errors: + format: ! '%{attribute} %{message}' + messages: + accepted: muss akzeptiert werden + blank: muss ausgefüllt werden + confirmation: stimmt nicht mit der Bestätigung überein + empty: muss ausgefüllt werden + equal_to: muss genau %{count} sein + even: muss gerade sein + exclusion: ist nicht verfügbar + greater_than: muss größer als %{count} sein + greater_than_or_equal_to: muss größer oder gleich %{count} sein + inclusion: ist kein gültiger Wert + invalid: ist nicht gültig + less_than: muss kleiner als %{count} sein + less_than_or_equal_to: muss kleiner oder gleich %{count} sein + not_a_number: ist keine Zahl + not_an_integer: muss ganzzahlig sein + odd: muss ungerade sein + record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}' + taken: ist bereits vergeben + too_long: ist zu lang (nicht mehr als %{count} Zeichen) + too_short: ist zu kurz (nicht weniger als %{count} Zeichen) + wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben) + template: + body: ! 'Bitte überprüfen Sie die folgenden Felder:' + header: + one: ! 'Konnte %{model} nicht speichern: ein Fehler.' + other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.' + helpers: + select: + prompt: Bitte wählen + submit: + create: ! '%{model} erstellen' + submit: ! '%{model} speichern' + update: ! '%{model} aktualisieren' + number: + currency: + format: + delimiter: . + format: ! '%n %u' + precision: 2 + separator: ! ',' + significant: false + strip_insignificant_zeros: false + unit: € + format: + delimiter: . + precision: 2 + separator: ! ',' + significant: false + strip_insignificant_zeros: false + human: + decimal_units: + format: ! '%n %u' + units: + billion: + one: Milliarde + other: Milliarden + million: Millionen + quadrillion: + one: Billiarde + other: Billiarden + thousand: Tausend + trillion: Billionen + unit: '' + format: + delimiter: '' + precision: 1 + significant: true + strip_insignificant_zeros: true + storage_units: + format: ! '%n %u' + units: + byte: + one: Byte + other: Bytes + gb: GB + kb: KB + mb: MB + tb: TB + percentage: + format: + delimiter: '' + precision: + format: + delimiter: '' + support: + array: + last_word_connector: ! ' und ' + two_words_connector: ! ' und ' + words_connector: ! ', ' + time: + am: vormittags + formats: + default: ! '%A, %d. %B %Y, %H:%M Uhr' + long: ! '%A, %d. %B %Y, %H:%M Uhr' + short: ! '%d. %B, %H:%M Uhr' + pm: nachmittags From a6b4501d2d40b38a42fce74988cc6c68b4efb371 Mon Sep 17 00:00:00 2001 From: Thomas Blazek Date: Fri, 9 Aug 2013 18:49:56 +0200 Subject: [PATCH 05/12] Form designs Conflicts: app/assets/stylesheets/formtastic-changes.css.scss --- .../stylesheets/formtastic-changes.css.scss | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/assets/stylesheets/formtastic-changes.css.scss diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss new file mode 100644 index 0000000..192ee43 --- /dev/null +++ b/app/assets/stylesheets/formtastic-changes.css.scss @@ -0,0 +1,20 @@ +form.formtastic .stringish input { +width:90%; +} +form.formtastic textarea { +width:90%; +height:20em; +} + + +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; +} \ No newline at end of file From 5f7bad1004544f748e13c436ccbad2a90829d3b0 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 10 Aug 2013 14:27:15 +0200 Subject: [PATCH 06/12] Date-String Input angelegt --- app/inputs/date_string_input.rb | 6 ++++++ app/views/calentries/_form.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 app/inputs/date_string_input.rb diff --git a/app/inputs/date_string_input.rb b/app/inputs/date_string_input.rb new file mode 100644 index 0000000..d10e2c9 --- /dev/null +++ b/app/inputs/date_string_input.rb @@ -0,0 +1,6 @@ +class DateStringInput < FormtasticBootstrap::Inputs::StringInput + def input_html_options + super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l(@object.send(method.to_sym))) + end + +end diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb index 6dd64ad..5306d58 100644 --- a/app/views/calentries/_form.html.erb +++ b/app/views/calentries/_form.html.erb @@ -1,6 +1,6 @@ <%= semantic_form_for @calentry do |f| %> <%= f.inputs do %> - <%= f.input :start %> + <%= f.input :start , :as => :date_string %> <%= f.input :ende %> <%= f.input :summary %> <%= f.input :calendar, :as=> :radio %> From c31c530e626ad2c602ad32cbce18aedb12844cbd Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 10 Aug 2013 14:28:17 +0200 Subject: [PATCH 07/12] Datumsformat - Time.short angepasst --- config/locales/de.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 75fd73f..16f6956 100755 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -294,7 +294,7 @@ de: time: am: vormittags formats: - default: ! '%A, %d. %B %Y, %H:%M Uhr' + default: ! '%d.%m.%Y, %H:%M Uhr' long: ! '%A, %d. %B %Y, %H:%M Uhr' - short: ! '%d. %B, %H:%M Uhr' + short: ! '%d.%m.%Y, %H:%M Uhr' pm: nachmittags From 116446ff63d82a4fd3885cfef34912e5be701581 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 10 Aug 2013 14:29:36 +0200 Subject: [PATCH 08/12] merge layout formular moduls & studien --- app/views/moduls/_form.html.erb | 31 +++++++++++++++++++++++-------- app/views/studien/_form.html.erb | 29 ++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/app/views/moduls/_form.html.erb b/app/views/moduls/_form.html.erb index fb6b68b..db03f9d 100755 --- a/app/views/moduls/_form.html.erb +++ b/app/views/moduls/_form.html.erb @@ -1,15 +1,30 @@ +
+ <%= semantic_form_for @modul do |f| %> -<%= semantic_form_for @modul do |f| %> <%= f.inputs do %> - <% # f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %> - <%= f.input :modulgruppen %> - <%= f.input :name ,:hint=>true%> - <%= f.input :desc, :as=>:tinymce_text %> - <%= f.input :depend %> +
+
+ <%= f.input :name ,:hint=>true%> +
+
+ <%= f.input :desc, :as=>:tinymce_text %> +
+
+ <%= f.input :depend %> +
+
+
+
+ <%= f.input :modulgruppen,:as => :check_boxes, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}.sort] %> +
+
+ <% end %> <%= f.actions do %> - <%= f.action :submit, :as => :input %> + <%= f.action :submit, :as => :input %> <% end %> -<% end %> + + <% end %> +
<%= tinymce %> diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb index 471a8c3..0973ef5 100755 --- a/app/views/studien/_form.html.erb +++ b/app/views/studien/_form.html.erb @@ -1,13 +1,28 @@ +
<%= tinymce_assets %> -<%= semantic_form_for @studium do |f| %> + <%= semantic_form_for @studium do |f| %> +
<%= f.inputs do %> - <%= f.input :zahl %> - <%= f.input :name,:append=>"NAME" %> + +
+
+ <%= f.input :name,:append=>"NAME" %> +
+
+ <%= f.input :zahl %> +
+
+ <%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"]%> +
+
+
<%= f.input :desc, :as=>:tinymce_text %> - <%= f.input :typ, :as=>:radio, :collection=>["Bachelor","Master"]%> +
<% end %> -<%= tinymce %> + <%= tinymce %> <%= f.actions do %> - <%= f.action :submit, :as => :input %> + <%= f.action :submit, :as => :input %> <% end %> -<% end %> +
+ <% end %> +
From a5a02e065a319d162c5a280605c2c0d3c15643ca Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 11 Aug 2013 01:17:37 +0200 Subject: [PATCH 09/12] =?UTF-8?q?Calendar=20Klasse=20=C3=BCberarbeitet=20V?= =?UTF-8?q?iews,gefixt,=20Pictures=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 5 +- app/assets/stylesheets/application.css.scss | 2 +- app/controllers/calendars_controller.rb | 2 +- app/inputs/date_string_input.rb | 3 +- app/models/calendar.rb | 3 +- app/models/calentry.rb | 9 ++- app/uploaders/picture_uploader.rb | 51 ++++++++++++++ app/views/calendars/_form.html.erb | 1 + app/views/calendars/index.html.erb | 27 +++----- app/views/calendars/show.html.erb | 40 ++++++----- app/views/calendars/show.ics.erb | 3 + app/views/calentries/_calentry.ics.erb | 5 ++ app/views/calentries/_form.html.erb | 27 +++++++- app/views/calentries/show.html.erb | 36 +++++----- ...20130810214456_add_picture_to_calendars.rb | 5 ++ db/schema.rb | 69 ++++++++++++++++++- spec/models/calentry_spec.rb | 17 ++++- 17 files changed, 238 insertions(+), 67 deletions(-) create mode 100644 app/uploaders/picture_uploader.rb create mode 100644 app/views/calendars/show.ics.erb create mode 100644 app/views/calentries/_calentry.ics.erb create mode 100644 db/migrate/20130810214456_add_picture_to_calendars.rb diff --git a/Gemfile b/Gemfile index d81643d..1fdf2bd 100755 --- a/Gemfile +++ b/Gemfile @@ -12,9 +12,9 @@ gem 'rails', '3.2.9' # Gems used only for assets and not required # in production environments by default. group :assets do - gem 'sass-rails', '~> 3.2.3' + gem 'sass-rails', '~> 3.2' gem 'coffee-rails', '~> 3.2.1' - gem 'bootstrap-sass','~> 2.2.0' + gem 'bootstrap-sass','~> 2.3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', :platforms => :ruby gem 'uglifier', '>= 1.0.3' @@ -77,3 +77,4 @@ gem 'rspec-rails' end gem "simple_calendar", "~> 0.1.9" +gem 'rmagick' diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 71eebc4..ecbb13d 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -10,7 +10,7 @@ * *= require_self *= require_tree . - * require 'bootstrap' + *= require 'bootstrap' */ $linkColor: #03006E; @import 'bootstrap'; diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index b3631aa..059a7f0 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -3,7 +3,6 @@ class CalendarsController < ApplicationController # GET /calendars.json def index @calendars = Calendar.all - respond_to do |format| format.html # index.html.erb format.json { render json: @calendars } @@ -18,6 +17,7 @@ class CalendarsController < ApplicationController respond_to do |format| format.html # show.html.erb format.json { render json: @calendar } + format.ics { render 'show.ics.erb'} end end diff --git a/app/inputs/date_string_input.rb b/app/inputs/date_string_input.rb index d10e2c9..a70ab33 100644 --- a/app/inputs/date_string_input.rb +++ b/app/inputs/date_string_input.rb @@ -1,6 +1,7 @@ class DateStringInput < FormtasticBootstrap::Inputs::StringInput def input_html_options - super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l(@object.send(method.to_sym))) + 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 diff --git a/app/models/calendar.rb b/app/models/calendar.rb index eaaa1a9..4f5de1d 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -1,4 +1,5 @@ class Calendar < ActiveRecord::Base - attr_accessible :name, :public + attr_accessible :name, :public, :picture has_and_belongs_to_many :calentries + mount_uploader :picture, PictureUploader end diff --git a/app/models/calentry.rb b/app/models/calentry.rb index 7d7ded6..d6cf59e 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -1,6 +1,13 @@ class Calentry < ActiveRecord::Base attr_accessible :ende, :start, :summary, :typ,:calendar_ids - has_and_belongs_to_many :calendar + 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 diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb new file mode 100644 index 0000000..ec0f27a --- /dev/null +++ b/app/uploaders/picture_uploader.rb @@ -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 diff --git a/app/views/calendars/_form.html.erb b/app/views/calendars/_form.html.erb index dc6e021..139e9d8 100644 --- a/app/views/calendars/_form.html.erb +++ b/app/views/calendars/_form.html.erb @@ -2,6 +2,7 @@ <%= f.inputs do %> <%= f.input :name %> <%= f.input :public %> + <%= f.input :picture, :as => :file %> <% end %> <%= f.actions do %> diff --git a/app/views/calendars/index.html.erb b/app/views/calendars/index.html.erb index 402c093..8d6c591 100644 --- a/app/views/calendars/index.html.erb +++ b/app/views/calendars/index.html.erb @@ -1,25 +1,14 @@

Listing calendars

- - - - - - - - - <% @calendars.each do |calendar| %> - - - - - - - +
+ + + +
+

<%= link_to calendar.name, calendar %>

+
+
<% end %> -
NamePublic
<%= calendar.name %><%= calendar.public %><%= link_to 'Show', calendar %><%= link_to 'Edit', edit_calendar_path(calendar) %><%= link_to 'Destroy', calendar, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
<%= link_to 'New Calendar', new_calendar_path %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 8778ca8..0c7e038 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,24 +1,30 @@ +
+

<%= notice %>

-

- Name: - <%= @calendar.name %> -

- -

- Public: - <%= @calendar.public %> -

-

-

    +

    + <%= ''.html_safe unless !@calendar.public%> + <%= @calendar.name %> +

    +
    +
      <% @calendar.calentries.each do |entry| %> -<%= entry.summary+ "- " + entry.start.to_s %> +
    • +<%= link_to entry.summary+ " - " + I18n.l(entry.start), entry %> +
    • <% end %> - +
    +
    +
    <%= calendar @calendar.calentries do |entry| %>
    <%= link_to entry.name, entry %>
    <% end %> - -<%= link_to 'New Entry', new_calentry_path %> -<%= link_to 'Edit', edit_calendar_path(@calendar) %> | -<%= link_to 'Back', calendars_path %> +
    +
    +
    +<%= 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"} %> +
    +
    +
diff --git a/app/views/calendars/show.ics.erb b/app/views/calendars/show.ics.erb new file mode 100644 index 0000000..8d3126f --- /dev/null +++ b/app/views/calendars/show.ics.erb @@ -0,0 +1,3 @@ +<% @calendar.calentries.each do |entry| %> +<%= render entry %> +<% end %> diff --git a/app/views/calentries/_calentry.ics.erb b/app/views/calentries/_calentry.ics.erb new file mode 100644 index 0000000..dead832 --- /dev/null +++ b/app/views/calentries/_calentry.ics.erb @@ -0,0 +1,5 @@ + <%= calentry.start %> + <%= calentry.ende %> + <%= calentry.summary %> + <%= calentry.typ %> + diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb index 5306d58..eb9bb02 100644 --- a/app/views/calentries/_form.html.erb +++ b/app/views/calentries/_form.html.erb @@ -1,13 +1,34 @@ +
<%= semantic_form_for @calentry do |f| %> <%= f.inputs do %> +
+
<%= f.input :start , :as => :date_string %> - <%= f.input :ende %> +
+
+ <%= f.input :ende , :as => :date_string %> +
+
+
+
<%= f.input :summary %> - <%= f.input :calendar, :as=> :radio %> +
+
+
+
+ <%= f.input :calendars, :as=> :radio %> +
+
<%= f.input :typ %> +
+
<% end %> - +
+
<%= f.actions do %> <%= f.action :submit, :as => :input %> <% end %> +
+
<% end %> +
diff --git a/app/views/calentries/show.html.erb b/app/views/calentries/show.html.erb index 908d8dc..faa5c9c 100644 --- a/app/views/calentries/show.html.erb +++ b/app/views/calentries/show.html.erb @@ -1,25 +1,25 @@

<%= notice %>

- -

- Start: - <%= @calentry.start %> -

- -

- Ende: - <%= @calentry.ende %> -

- -

- Summary: +

+
+
+ <%= @calentry.summary %> -

+
-

- Typ: +

+
+
+
+ <%= I18n.l @calentry.start %> + <%= " bis " unless @calentry.ende.nil? %> + <%= I18n.l @calentry.ende %> +
+
<%= @calentry.typ %> -

- +
+
+
<%= link_to 'Edit', edit_calentry_path(@calentry) %> | <%= link_to 'Back', calentries_path %> +
diff --git a/db/migrate/20130810214456_add_picture_to_calendars.rb b/db/migrate/20130810214456_add_picture_to_calendars.rb new file mode 100644 index 0000000..d1b4b44 --- /dev/null +++ b/db/migrate/20130810214456_add_picture_to_calendars.rb @@ -0,0 +1,5 @@ +class AddPictureToCalendars < ActiveRecord::Migration + def change + add_column :calendars, :picture, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 6a96d37..b8d0781 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,23 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130729085446) do +ActiveRecord::Schema.define(:version => 20130810214456) do + + create_table "attachments", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "beispiel_translations", :force => true do |t| + t.string "locale" + t.text "desc" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "beispiele_id" + end + + add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale" create_table "beispiele", :force => true do |t| t.string "name" @@ -22,6 +38,38 @@ ActiveRecord::Schema.define(:version => 20130729085446) do t.string "beispieldatei" end + create_table "calendars", :force => true do |t| + t.string "name" + t.boolean "public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "picture" + end + + create_table "calendars_calentries", :id => false, :force => true do |t| + t.integer "calentry_id" + t.integer "calendar_id" + end + + add_index "calendars_calentries", ["calendar_id"], :name => "index_calendars_calentries_on_calendar_id" + add_index "calendars_calentries", ["calentry_id", "calendar_id"], :name => "index_calendars_calentries_on_calentry_id_and_calendar_id" + + create_table "calentries", :force => true do |t| + t.datetime "start" + t.datetime "ende" + t.string "summary" + t.integer "typ" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "fragen", :force => true do |t| + t.string "title" + t.text "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "lva_translations", :force => true do |t| t.integer "lva_id" t.string "locale" @@ -50,11 +98,14 @@ ActiveRecord::Schema.define(:version => 20130729085446) do t.integer "modul_id" end - create_table "lvas_semesters", :force => true do |t| + create_table "lvas_semesters", :id => false, :force => true do |t| t.integer "lva_id" t.integer "semester_id" end + add_index "lvas_semesters", ["lva_id", "semester_id"], :name => "index_lvas_semesters_on_lva_id_and_semester_id" + add_index "lvas_semesters", ["semester_id"], :name => "index_lvas_semesters_on_semester_id" + create_table "modul_translations", :force => true do |t| t.integer "modul_id" t.string "locale" @@ -161,6 +212,20 @@ ActiveRecord::Schema.define(:version => 20130729085446) do add_index "studium_translations", ["locale"], :name => "index_studium_translations_on_locale" + create_table "themen", :force => true do |t| + t.string "title" + t.text "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "themengruppen", :force => true do |t| + t.string "title" + t.text "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "email", :default => "", :null => false t.string "encrypted_password", :default => "", :null => false diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb index 0e3a169..02e654e 100644 --- a/spec/models/calentry_spec.rb +++ b/spec/models/calentry_spec.rb @@ -1,5 +1,20 @@ require 'spec_helper' describe Calentry do - pending "add some examples to (or delete) #{__FILE__}" + it "should be valid with full data" do + e = FactoryGirl.build(:calentry) + c = FactoryGirl.create(:calendar) + e.calendars< nil) + c=FactoryGirl.create(:calendar) + e.calendars< Date: Sun, 11 Aug 2013 17:05:56 +0200 Subject: [PATCH 10/12] Kleine Anpassungen Calentry --- app/models/calentry.rb | 3 +++ app/views/calendars/show.html.erb | 2 +- config/routes.rb | 8 +++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/calentry.rb b/app/models/calentry.rb index d6cf59e..47f90ee 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -11,6 +11,9 @@ class Calentry < ActiveRecord::Base def start_time start end + def start1 + start.to_date + end def name summary end diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 0c7e038..cb20b2a 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -10,7 +10,7 @@
    <% @calendar.calentries.each do |entry| %>
  • -<%= link_to entry.summary+ " - " + I18n.l(entry.start), entry %> +<%= link_to entry.summary+ " - " + I18n.l(entry.start1), entry %>
  • <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 696aeb1..5a7fbf6 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,6 @@ Fetsite::Application.routes.draw do - resources :calendars - - - resources :calentries + devise_for :users @@ -48,7 +45,8 @@ Fetsite::Application.routes.draw do resources :home, :only=>[:index] get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev' resources :beispiele - + resources :calendars + resources :calentries end # The priority is based upon order of creation: From 7bdd3b19599a190e748573925e5c21df28c34f1b Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 11 Aug 2013 17:06:22 +0200 Subject: [PATCH 11/12] =?UTF-8?q?Bootstrap=20wieder=20zur=C3=BCck=20korrig?= =?UTF-8?q?iert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.css.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index ecbb13d..3de1cac 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -10,7 +10,7 @@ * *= require_self *= require_tree . - *= require 'bootstrap' + * require 'bootstrap' */ $linkColor: #03006E; @import 'bootstrap'; From ac09de9e0ab1c45aa641d6b7a7d92a2853c4612a Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 11 Aug 2013 17:06:39 +0200 Subject: [PATCH 12/12] =?UTF-8?q?Link=20->Issues=20f=C3=BCr=20Startseite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 11 ++++++++--- app/views/home/index.html.erb | 10 ++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2f98cfb..ff6d52b 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,7 +35,7 @@ GEM activerecord (>= 3.0.0) bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1-x86-mingw32) - bootstrap-sass (2.2.2.0) + bootstrap-sass (2.3.2.1) sass (~> 3.2) builder (3.0.4) cancan (1.6.9) @@ -128,6 +128,7 @@ GEM rdoc (3.12.1) json (~> 1.4) ref (1.0.2) + rmagick (2.13.2) rolify (3.2.0) rspec-core (2.14.4) rspec-expectations (2.14.0) @@ -145,6 +146,8 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + simple_calendar (0.1.9) + rails (>= 3.0) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -176,7 +179,7 @@ PLATFORMS DEPENDENCIES annotate (>= 2.5.0) awesome_nested_set - bootstrap-sass (~> 2.2.0) + bootstrap-sass (~> 2.3.2.1) cancan carrierwave coffee-rails (~> 3.2.1) @@ -192,9 +195,11 @@ DEPENDENCIES paper_trail (>= 2.7.0) paperclip (~> 3.4.0) rails (= 3.2.9) + rmagick rolify rspec-rails - sass-rails (~> 3.2.3) + sass-rails (~> 3.2) + simple_calendar (~> 0.1.9) sqlite3 therubyracer tinymce-rails (>= 3.5.8) diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 4d56fdb..9dc3abb 100755 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,3 +1,13 @@

<%= t 'home.willkommen' %>

<%= t 'home.hallobeiderfet' %>

+
+

Alpha Test

+

Die Webseite befindet sich derzeit in einem Entsicklungsstadium, +volle Funktionsfähigkeit ist noch nicht erreicht. Bitte Featurerequests und +Fehlermeldungen auf GitHub melden. +

+

+<%= link_to "Issues", "http://www.github.com/fetsite/fetsite/issues" %> +

+
<%= link_to "Entwicklungsstatus" , home_dev_path %>