themengruppen verwalten form

This commit is contained in:
Andreas Stephanides
2014-02-16 15:32:04 +01:00
parent e466ed5679
commit 87d7cc247a
12 changed files with 78 additions and 56 deletions

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ Verwendung: Aufruf mit
<% toolbar_elements.each do |t| %>
<% unless t[:method]==:versions %>
<% text='<i class="'.html_safe+ t[:hicon].to_s.html_safe + '"></i>'.html_safe+t[:text] %>
<%= link_to text, t[:path], :method=>t[:method], :confirm=>t[:confirm].to_s, :data=>t[:data], :class=>((t[:method].to_s=='delete') ? "btn btn-danger" : "btn") %>
<%= link_to text, t[:path], :method=>t[:method], :confirm=>t[:confirm].to_s, :data=>t[:data], :class=>((t[:method].to_s=='delete') ? "btn btn-danger" : "btn") ,:remote=>(t[:remote])?true : false %>
<% else %>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">

View File

@@ -1,41 +1,32 @@
<%= tinymce_assets %>
<%= semantic_form_for @thema do |f| %>
<div class="container-fluid">
<%= semantic_form_for @thema, :remote=>true do |f| %>
<%= f.inputs do %>
<div class="row-fluid">
<div class="span6">
<%= f.input :title %>
</div>
<div class="span6">
<%= f.input :themengruppe %>
<%= f.input :text, :as=>:tinymce_text%>
<% end %>
<%= tinymce %>
</div>
<div class="row-fluid">
<div class="span12">
<%= f.input :text, :as=>:tinymce_text,:label=>false %>
</div>
</div>
<h2>Attachments:</h2>
<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %>
</div>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<!--
<% @thema.attachments.each do |attachment| %>
<ul>
<li>
<%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %>
<button type="button" onclick="insertAttachment(<%="\"" + attachment.datei.url + "\""%>,<%="\""+attachment.name+"\""%>)">Insert Me!</button>
</li>
</ul>
<% end %>
<%= f.action :cancel, :as => :link %>
<% end %>
<% end %><% end %>
<%= tinymce %>
<h2>Attachments:</h2>
<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %>
<% end %>
-->
<!--
<script>
function insertAttachment(url) {
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "Test");
//editor.setContent(editor.getContent + "<img src=\"" + url + "\">")
}
</script>
-->

View File

@@ -24,8 +24,9 @@
</br>
<% unless @thema.id.nil? %>
<% @att_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('attachment.add'), :path=>new_thema_attachment_path(@thema)}] %>
<% @att_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('attachment.add'), :path=>new_thema_attachment_path(@thema),:remote=>true}] %>
<div id="attachmentform">
</div>
<%= render :partial=>'layouts/pretty_toolbar', :object=>@att_elements %>
<% end %>
<br/>

View File

@@ -1,5 +1,5 @@
<div id="themaview">
<h1>Editing thema</h1>
<%= render 'form' %>
</div>
</br><%= link_to 'Back', @thema %>

View File

@@ -11,18 +11,14 @@
-->
<%= render :partial=>'layouts/pretty_toolbar' %>
<h2>FAQs:</h2>
<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 %>
<%= render :partial=>'themen/fragen' %>
<!--
<%= link_to 'Neue Frage', new_frage_path %> <br/>
-->
<br/>
<h2><%= I18n.t('attachment.title')%>:</h2>
<div id="attachmentform">
</div>
<%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %>
<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %>

View File

@@ -2,18 +2,26 @@
#themen { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px;zoom: 1; }
#themen li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 95%; }
</style>
<div class="container-fluid">
<div class="row-fluid">
<div class="span4">
<ul id="themen" class="sort" >
<% @themen.each do |thema| %>
<li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox" ><h2><%= thema.title %></h2> </div></li>
<li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox handle" ><h2><%= thema.title %></h2> </div> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to thema_fragen_path(thema),:remote=>true do %> Fragen <% end %></li>
<% end %>
</ul>
</div>
<div class="span8">
<div id="themaview"></div>
</div>
<script>
$( document ).ready(function(){
$("#themen").sortable({
cursor: 'crosshair',
drag:true,
handle: '.handle',
update: function(){
$.ajax({
url: '<%= themengruppe_sort_themen_path(@themengruppe) %>',