Class: CssController
Constant Summary
PaginationHelper::DEFAULT_OPTIONS, PaginationHelper::OPTIONS
Instance Method Summary
collapse
included, #paginate, validate_options!
Instance Method Details
#edit ⇒ Object
16
17
18
19
|
# File 'app/controllers/css_controller.rb', line 16
def edit
@lastpost = current_user.last_post
@stylesheet = current_user.stylesheet || current_user.build_stylesheet
end
|
#getstyle ⇒ Object
4
5
6
7
8
9
|
# File 'app/controllers/css_controller.rb', line 4
def getstyle
style = User.find(@params['id']).stylesheet.data rescue nil
render_text('', 404) and return unless style
response.['Content-type'] = 'text/css'
render_text style
end
|
#index ⇒ Object
11
12
13
14
|
# File 'app/controllers/css_controller.rb', line 11
def index
edit
render_action 'edit'
end
|
#update ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/css_controller.rb', line 21
def update
@stylesheet = current_user.stylesheet || current_user.build_stylesheet
@stylesheet.data = @params['stylesheet']['data']
if @stylesheet.save
flash['notice'] = 'Stylesheet was successfully updated.'
redirect_to_my_home
else
render_action 'edit'
end
end
|