themen fix + remote form für themen

This commit is contained in:
Andreas Stephanides
2014-02-07 22:15:05 +01:00
parent 35cc371d22
commit 48fc0455c7
9 changed files with 41 additions and 12 deletions

View File

@@ -4,5 +4,5 @@
<br/>
<%= link_to 'Edit', edit_frage_path(frage) %> |
<%= link_to 'Destroy',frage, method: :delete, data: { confirm: 'Are you sure?' } %>
<%= link_to 'Destroy',frage, method: :delete, :remote=> true , data: { confirm: 'Are you sure?' } %>
</p>

View File

@@ -0,0 +1,3 @@
<% @fragen.each do |frage| %>
<%= render frage %>
<% end %>

View File

@@ -0,0 +1,12 @@
<%= tinymce_assets %>
<%= semantic_form_for @frage , :remote=>true do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
<%= f.input :thema %>
<%= f.input :text, :as=>:tinymce_text%>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1 @@
$("#fragen").html("<%=escape_javascript( render :partial=>'fragen/liste' )%>")

View File

@@ -10,6 +10,8 @@
</p>
<br/>
<% end %>
<% @small_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small}]
@small_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('thema.remove'), :path=>small, :method=>:delete,:confirm=>I18n.t('thema.sure')}%>
<%= render :partial=>'layouts/pretty_toolbar', :object=>@small_elements %>
<%
@small_elements = []
@small_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small} if can? :edit, small
@small_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('thema.remove'), :path=>small, :method=>:delete,:confirm=>I18n.t('thema.sure')} if can? :delete, small %>
<%= render :partial=>'layouts/pretty_toolbar', :object=>@small_elements unless @small_elements.empty? %>

View File

@@ -12,10 +12,11 @@
<%= render :partial=>'layouts/pretty_toolbar' %>
<h2>FAQs:</h2>
<% @thema.fragen.each do |frage| %>
<%= render frage %>
<% end %>
<div id="fragen">
<%= render :partial=>'fragen/liste' %>
</div>
<% @frage=Frage.new; @frage.thema=@thema %>
<%= render :partial=>'fragen/rform' %>
<% @frage_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('frage.add'), :path=>new_frage_path}] %>
<%= render :partial=>'layouts/pretty_toolbar', :object=>@frage_elements %>
<!--