forked from bofh/fetsite
meetingtyp management
This commit is contained in:
@@ -126,6 +126,6 @@ $box-background: white;
|
||||
|
||||
@import 'extra';
|
||||
body {
|
||||
background: url('http://www.fet.at/stvn.jpg') fixed no-repeat;
|
||||
background: $color_schema_1_dark;
|
||||
background-size:100%;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,76 @@
|
||||
class MeetingtypsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
@meetingtyps=Meetingtyp.all
|
||||
end
|
||||
def show
|
||||
redirect_to action: :index
|
||||
end
|
||||
def edit
|
||||
@meetingtyp = Meetingtyp.find(params[:id])
|
||||
end
|
||||
def new
|
||||
@meetingtyp=Meetingtyp.new
|
||||
end
|
||||
def create_protocol_and_agenda
|
||||
@meetingtyp = Meetingtyp.find(params[:id])
|
||||
if @meetingtyp.agenda.nil?
|
||||
d=Document.new
|
||||
d.typ=11
|
||||
d.name="Agendavorlage"
|
||||
d.save
|
||||
@meetingtyp.agenda=d
|
||||
end
|
||||
if @meetingtyp.protocol.nil?
|
||||
d=Document.new
|
||||
d.typ=10
|
||||
d.name="Protokollvorlage"
|
||||
d.save
|
||||
@meetingtyp.protocol=d
|
||||
end
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@meetingtyp = Meetingtyp.new(params[:meetingtyp])
|
||||
@meetingtyp.assign_attributes(params[:meetingtyp])
|
||||
|
||||
respond_to do |format|
|
||||
if @meetingtyp.save
|
||||
format.html { redirect_to @meetingtyp, notice: 'Meeting was successfully created.' }
|
||||
#format.json { render json: @meeting, status: :created, location: @meeting }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
# format.json { render json: @meeting.errors, status: :unprocessable_entity }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@meetingtyp = Meetingtyp.find(params[:id])
|
||||
respond_to do |format|
|
||||
if @meetingtyp.update_attributes(params[:meetingtyp])
|
||||
format.html { redirect_to @meetingtyp, notice: 'Meeting was successfully updated.' }
|
||||
# format.json { head :no_content }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
# format.json { render json: @meeting.errors, status: :unprocessable_entity }
|
||||
format.js { render action: "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
def destroy
|
||||
@meetingtyp = Meeting.find(params[:id])
|
||||
@meetingtyp.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to action: :index}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -53,6 +53,9 @@ class Meeting < ActiveRecord::Base
|
||||
d=Document.new
|
||||
d.typ=10
|
||||
d.name="Protokoll"
|
||||
unless self.meetingtyp.protocol.nil?
|
||||
d.text=self.meetingtyp.protocol.text
|
||||
end
|
||||
d.save
|
||||
self.protocol=d
|
||||
end
|
||||
@@ -60,16 +63,19 @@ class Meeting < ActiveRecord::Base
|
||||
end
|
||||
def create_calentry
|
||||
if self.calentry.nil?
|
||||
ce =Calentry.new
|
||||
ce.typ=2
|
||||
self.calentry=ce
|
||||
end
|
||||
end
|
||||
ce =Calentry.new
|
||||
ce.typ=2
|
||||
self.calentry=ce
|
||||
end
|
||||
end
|
||||
def create_agenda
|
||||
if self.agenda.nil?
|
||||
d=Document.new
|
||||
d.typ=11
|
||||
d.name="Agenda"
|
||||
unless self.meetingtyp.agenda.nil?
|
||||
d.text=self.meetingtyp.agenda.text
|
||||
end
|
||||
d.save
|
||||
self.agenda=d
|
||||
end
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
class Meetingtyp < ActiveRecord::Base
|
||||
attr_accessible :agendaintern, :desc, :name, :protocolintern
|
||||
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id
|
||||
belongs_to :rubrik
|
||||
validate :rubrik, :presence=>true
|
||||
has_many :meetings
|
||||
has_one :calendar, through: :rubrik
|
||||
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
|
||||
has_one :agenda , :as=>:parent, :conditions=>{:typ=>11}, :class_name=>'Document'
|
||||
def text
|
||||
self.name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
scope :intern, ->{includes(:rubrik).where("rubriken.public"=>false)}
|
||||
|
||||
# scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||
LINKTYPES=["Thema", "Themengruppe", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||
before_validation :sanitize
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<%= f.semantic_fields_for :calentry, @meeting.calentry do |ff| %>
|
||||
<%= ff.input :start, :as => :datetimepicker %>
|
||||
<%= ff.input :ende, :as => :datetimepicker %>
|
||||
<%= ff.input :typ %>
|
||||
<%= ff.input :typ, :as=>:hidden %>
|
||||
<% ff.input :object_id, :as=>:hidden %>
|
||||
<% ff.input :object_type %>
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
<%= f.action :submit, :as => :input_ %>
|
||||
|
||||
<% end %>
|
||||
<%= @meeting.calentry.to_yaml %>
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
$("#<%= @meeting.divid %>").html("<%=escape_javascript( render :partial=>"nested_form" ,:object=>@meeting)%>");
|
||||
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
$("#<%= Meeting.new_divid_for(@parent) %>").replaceWith("<div id=\"<%= Meeting.new_divid_for(@parent) %>\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@meeting) %></div>");
|
||||
|
||||
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})
|
||||
|
||||
|
||||
12
app/views/meetingtyps/_form.html.erb
Normal file
12
app/views/meetingtyps/_form.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<%= semantic_form_for [@meetingtyp] do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :name, :placeholder=> "Name" %>
|
||||
<%= f.input :rubrik %>
|
||||
<%= f.input :agendaintern %>
|
||||
<%= f.input :protocolintern %>
|
||||
<% end %>
|
||||
<%= f.actions do %>
|
||||
<%= f.action :submit, :as => :input %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
5
app/views/meetingtyps/_meetingtyp.html.erb
Normal file
5
app/views/meetingtyps/_meetingtyp.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= meetingtyp.name %> <%= link_to "edit", edit_meetingtyp_path(meetingtyp) %>
|
||||
|
||||
<%= link_to "create" , create_protocol_and_agenda_meetingtyp_path(meetingtyp) %>
|
||||
<%= render meetingtyp.protocol unless meetingtyp.protocol.nil? %>
|
||||
<%= render meetingtyp.agenda unless meetingtyp.agenda.nil? %>
|
||||
1
app/views/meetingtyps/edit.html.erb
Normal file
1
app/views/meetingtyps/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render "form" %>
|
||||
6
app/views/meetingtyps/index.html.erb
Normal file
6
app/views/meetingtyps/index.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<ul>
|
||||
<% @meetingtyps.each do |mt| %>
|
||||
<li><%= render mt %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to "New" , new_meetingtyp_path %>
|
||||
1
app/views/meetingtyps/new.html.erb
Normal file
1
app/views/meetingtyps/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render "form" %>
|
||||
@@ -1 +1,14 @@
|
||||
<h2><%= nlink.title %> </h2>
|
||||
<% themengruppe=nlink %>
|
||||
<h3>
|
||||
<% unless themengruppe.icon.nil? or themengruppe.icon.empty? %> <i class="<%= themengruppe.icon %>" style="font-size:1.5em;margin:0"></i>
|
||||
<% end %>
|
||||
|
||||
<%= themengruppe.title%> </h3>
|
||||
<p>
|
||||
<%= if themengruppe.text.split.size > Themengruppe::WORD_COUNT
|
||||
themengruppe.text.split[0..Themengruppe::WORD_COUNT].join(" ") + " ..."
|
||||
else
|
||||
themengruppe.text
|
||||
end%>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -181,7 +181,11 @@
|
||||
end
|
||||
|
||||
|
||||
resources :meetingtyps
|
||||
resources :meetingtyps do
|
||||
member do
|
||||
get :create_protocol_and_agenda
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
root :to => 'home#index'
|
||||
|
||||
Reference in New Issue
Block a user