forked from bofh/fetsite
calentry inline form
This commit is contained in:
@@ -172,4 +172,12 @@ span.linklist a {
|
|||||||
display:block;
|
display:block;
|
||||||
float:left;
|
float:left;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.inline div {
|
||||||
|
float:left;}
|
||||||
|
|
||||||
|
form.inline input {
|
||||||
|
}
|
||||||
|
form.inline {
|
||||||
|
float:clear; }
|
||||||
@@ -37,6 +37,11 @@ class CalendarsController < ApplicationController
|
|||||||
# GET /calendars/1/edit
|
# GET /calendars/1/edit
|
||||||
def edit
|
def edit
|
||||||
@calendar = Calendar.find(params[:id])
|
@calendar = Calendar.find(params[:id])
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /calendars
|
# POST /calendars
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class CalentriesController < ApplicationController
|
|||||||
@calentry = Calentry.find(params[:id])
|
@calentry = Calentry.find(params[:id])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -67,9 +68,11 @@ class CalentriesController < ApplicationController
|
|||||||
if @calentry.update_attributes(params[:calentry])
|
if @calentry.update_attributes(params[:calentry])
|
||||||
format.html { redirect_to @calentry, notice: 'Calentry was successfully updated.' }
|
format.html { redirect_to @calentry, notice: 'Calentry was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
|
format.js
|
||||||
else
|
else
|
||||||
format.html { render action: "edit" }
|
format.html { render action: "edit" }
|
||||||
format.json { render json: @calentry.errors, status: :unprocessable_entity }
|
format.json { render json: @calentry.errors, status: :unprocessable_entity }
|
||||||
|
format.js { render action: "edit"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ format =:default
|
|||||||
end%>
|
end%>
|
||||||
<%= calentry.text %>
|
<%= calentry.text %>
|
||||||
|
|
||||||
<%= link_to "edit", edit_calentry_path(calentry) if can? :edit, calentry %>
|
<%= link_to "edit", edit_calentry_path(calentry),:remote=>true if can? :edit, calentry %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
10
app/views/calentries/_nested_form.html.erb
Normal file
10
app/views/calentries/_nested_form.html.erb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<%= fa_icon("calendar 2x") %>
|
||||||
|
<%= semantic_form_for @calentry, :remote=>true, :html=>{:class=>"inline"} do |f| %>
|
||||||
|
|
||||||
|
<%= f.input :start, :as => :datetimepicker %>
|
||||||
|
<%= f.input :dauer , :as => :string, :append=>"h" %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= f.action :submit, :as => :input_ %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
2
app/views/calentries/edit.js.erb
Normal file
2
app/views/calentries/edit.js.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
alert("sdf");
|
||||||
|
$("#calentry_<%= @calentry.id %>").html("<%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry)%>");
|
||||||
1
app/views/calentries/update.js.erb
Normal file
1
app/views/calentries/update.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$("#calentry_<%= @calentry.id %>").replaceWith("<%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%>");
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
|
<%= content_for :header do %>
|
||||||
|
<title>Fetsite - <%= @lva.full_name %></title>
|
||||||
|
<% set_meta_tags :og => {
|
||||||
|
:url=>lva_path(:theme=>nil) }
|
||||||
|
%>
|
||||||
|
<%= display_meta_tags %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<%= render 'studien/tabs'%>
|
<%= render 'studien/tabs'%>
|
||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user