Zeit formatiert

Datetimepicker fixed, Speichern und weiter
This commit is contained in:
2014-06-21 16:36:30 +05:30
parent 6c9a1b51c4
commit a87990c338
6 changed files with 25 additions and 17 deletions

View File

@@ -97,7 +97,13 @@ class ThemenController < ApplicationController
respond_to do |format| respond_to do |format|
if @thema.save if @thema.save
format.html { redirect_to @thema, notice: I18n.t("thema.updated") } format.html {
if params["button"]=="continue"
render action: "edit", notice: I18n.t("thema.updated")
else
redirect_to @thema, notice: I18n.t("thema.updated")
end
}
format.json { head :no_content } format.json { head :no_content }
format.js format.js
else else

View File

@@ -1,7 +1,9 @@
class DatetimepickerInput < FormtasticBootstrap::Inputs::StringInput class DatetimepickerInput < FormtasticBootstrap::Inputs::StringInput
def input_html_options def input_html_options
super s=super
super.merge(:class => "datetimepicker",:value=>builder.to_s) value=builder.object.send(method)
value=I18n.l(value) unless value.nil?
super.merge(:class => "datetimepicker",:value=>value)
end end
def html_options def html_options
@@ -13,7 +15,7 @@ class DatetimepickerInput < FormtasticBootstrap::Inputs::StringInput
#super.merge(:class=>"datepicker",'date-date-format'.to_sym=>"%d.%m.%Y") #super.merge(:class=>"datepicker",'date-date-format'.to_sym=>"%d.%m.%Y")
end end
def controls_wrapper_html_options def controls_wrapper_html_options
super.merge(:class=> " date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker'), 'data-time-format'.to_sym=>"hh:mm" ,) super.merge(:class=> " date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker'))
end end
def to_html def to_html
bootstrap_wrapping do bootstrap_wrapping do

View File

@@ -1,4 +1,5 @@
<%= tinymce_assets %> <%= tinymce_assets %>
<div class="container-fluid"> <div class="container-fluid">
<%= semantic_form_for @thema, :remote=>remote do |f| %> <%= semantic_form_for @thema, :remote=>remote do |f| %>
<%= f.inputs do %> <%= f.inputs do %>
@@ -17,8 +18,8 @@
</div> </div>
<%= f.actions do %> <%= f.actions do %>
<%= f.action :submit, :as => :button %> <%= f.action :submit, :as => :button, :label=> I18n.t("thema.save" ) %>
<%= f.action :submit, :as => :button, :label=> "&edit", :params=>{edit: true} %> <%= f.action :submit, :as => :button, :label=> I18n.t("thema.savecont"), :button_html=>{:value=>"continue"} %>
<%= f.action :cancel, :as => :link %> <%= f.action :cancel, :as => :link %>
<% end %> <% end %>
<% end %><% end %> <% end %><% end %>

View File

@@ -23,10 +23,7 @@
</div> </div>
</br> </br>
<% unless @thema.id.nil? %>
<% @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/> <br/>

View File

@@ -1,5 +1,5 @@
<div id="themaview"> <div id="themaview">
<h1>Editing thema</h1> <h1><%= I18n.t("thema.edit")%></h1>
<%= render 'form', :locals=>{:remote=>false}, :remote=>false %> <%= render 'form', :locals=>{:remote=>false}, :remote=>false %>
</div> </div>
</br><%= link_to 'Back', @thema %> </br><%= link_to 'Back', @thema %>

View File

@@ -14,6 +14,8 @@ de:
edit: "Thema bearbeiten" edit: "Thema bearbeiten"
remove: "Thema löschen" remove: "Thema löschen"
manage: "Thema verwalten" manage: "Thema verwalten"
save: "Thema speichern"
savecont: "Thema zwischenspeichern"
created: "Thema erfolgreich erstellt" created: "Thema erfolgreich erstellt"
updated: "Thema erfolgreich gespeichert" updated: "Thema erfolgreich gespeichert"
sure: "Sicher, dass Sie dieses Thema löschen möchten?" sure: "Sicher, dass Sie dieses Thema löschen möchten?"
@@ -42,8 +44,8 @@ de:
text: "Antwort" text: "Antwort"
thema: "Thema" thema: "Thema"
hints: hints:
thema:
title: "Überschrift"
activerecord: activerecord:
errors: errors:
models: models: