calentry inline form

This commit is contained in:
Andreas Stephanides
2014-10-28 08:43:44 +01:00
parent 2622ed1513
commit 2688bca831
8 changed files with 41 additions and 2 deletions

View File

@@ -173,3 +173,11 @@ span.linklist a {
float:left; float:left;
} }
form.inline div {
float:left;}
form.inline input {
}
form.inline {
float:clear; }

View File

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

View File

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

View File

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

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

View File

@@ -0,0 +1,2 @@
alert("sdf");
$("#calentry_<%= @calentry.id %>").html("<%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry)%>");

View File

@@ -0,0 +1 @@
$("#calentry_<%= @calentry.id %>").replaceWith("<%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%>");

View File

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