Created
December 8, 2008 17:28
-
-
Save dmilith/33524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
about.html.haml: | |
= throw_content :main_pl do | |
%br | |
- if @admin | |
= "Tutaj proszę wprowadzić tekst formatowany:" | |
%script{ :type => "text/javascript" } | |
$(document).ready(pocalujmniewdupe); | |
pocalujmniewdupe(); | |
= form_for :text, :class => :text, :action => url( :action => :about, :method => :post ) do | |
%textarea{ :name => :content, :style => "width:100%; height:20em;" } | |
= @content.about_content | |
%div{ :style => "margin-top: 25px;" } | |
= "Podgląd wygenerowanej treści na stronie:" | |
= submit "Aktualizuj treść strony" | |
%fieldset | |
.generated_content= @generated_content | |
- else | |
.generated_content= @generated_content | |
%br | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def about | |
if request.get? | |
if Content.count == 0 | |
@content = Content.new( :about_content => "h1. O mnie." ) | |
else | |
@content = Content.find(:first) | |
end | |
Merb.logger.debug request.inspect | |
Merb.logger.debug request.get? | |
Merb.logger.debug request.post? | |
render | |
else #request.post? | |
Merb.logger.debug request.inspect | |
Merb.logger.debug request.get? | |
Merb.logger.debug request.post? | |
@content = Content.find(:first) | |
@content.about_content = params[:content] | |
Merb.logger.info "\n\nABOUT POST: " + @content.about_content.inspect if $debug | |
@content.save! | |
end | |
@generated_content = @content.about_content | |
Merb.logger.info "\n\nABOUT UPDATE GENERATED:\n\n" + @generated_content if $debug | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment