calentry js interface

This commit is contained in:
Andreas Stephanides
2014-11-16 14:30:04 +01:00
parent 4c47919543
commit c49ec5e736
11 changed files with 71 additions and 43 deletions

View File

@@ -1,13 +1,13 @@
<div class="contentbox" id="calentry_<%= calentry.id%>">
<% image_tag("/iconnavy/time.png") %>
<%= fa_icon("calendar 2x") %>
<% image_tag("/iconnavy/time.png") %>
<%= fa_icon("calendar 2x") %>
<% if calentry.start.to_date == calentry.ende.to_date
format=:timeonly
else
format =:default
end%>
<%= calentry.text %>
<%= link_to "edit", edit_calentry_path(calentry),:remote=>true if can? :edit, calentry %>
<% if (calentry.start.to_date - calentry.ende.to_date) < 1.day
format=:timeonly
else
format =:default
end %>
<%= calentry.text %>
<%= link_to "edit", edit_calentry_path(calentry),:remote=>true if can? :edit, calentry %>
<%= link_to 'Delete', calentry, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, calentry %>
</div>

View File

@@ -1,8 +1,13 @@
<%= fa_icon("calendar 2x") %>
<p id="notice"><%= notice %></p>
<%= semantic_form_for @calentry, :remote=>true, :html=>{:class=>"inline"} do |f| %>
<%= f.input :start, :as => :datetimepicker %>
<%= f.input :dauer , :as => :string, :append=>"h" %>
<%= f.input :dauer , :as => :string, :append=>"h" %>
<%= f.input :object_id , :as => :hidden %>
<%= f.input :object_type , :as => :hidden %>
<%= f.input :typ , :as => :hidden %>
<%= f.action :submit, :as => :input_ %>

View File

@@ -0,0 +1,2 @@
alert("sdf");
$("#calentry_new").replaceWith("<div id=\"calentry_<%= @calentry.id %>\"> <%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%> </div><div id=\"calentry_new\"><%= escape_javascript( link_to "new Calentry", new_calentry_path, :remote=>true) %></div>");

View File

@@ -0,0 +1 @@
$("#calentry_<%= @calentry_id %>").remove();

View File

@@ -0,0 +1 @@
$("#calentry_<%= @calentry_id %>").remove();

View File

@@ -1,2 +1,7 @@
$("#calentry_<%= @calentry.id %>").html("<%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry)%>");
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})

View File

@@ -0,0 +1,3 @@
$("#calentry_new").replaceWith("<div id=\"calentry_new\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry) %></div>");
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})