Skip to content

Commit cbe62e9

Browse files
committed
#2 Add validations and use Hierapolis theme
1 parent 5f90a04 commit cbe62e9

File tree

5 files changed

+34
-27
lines changed

5 files changed

+34
-27
lines changed

app/models/kebapage/static_page.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module Kebapage
22
class StaticPage < ActiveRecord::Base
3+
validates :title, :content, presence: true
34
end
45
end
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
%h1 Editing static_page
1+
%h1 Editing Static Page
22

33
= render 'form', :static_page => @static_page
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
1-
%h1 Listing static_pages
2-
%table
3-
%thead
4-
%tr
5-
%th Title
6-
%th Content
7-
%th
8-
%th
9-
%th
10-
%tbody
11-
- @static_pages.each do |static_page|
1+
=stylesheet_link_tag 'stylesheets/application'
2+
3+
.panel.panel-default.grid
4+
.panel-heading
5+
%i.icon-table.icon-large
6+
Static Pages
7+
8+
%table.table
9+
%thead
1210
%tr
13-
%td
14-
= static_page.title
15-
%td
16-
= static_page.content
17-
%td
18-
= link_to 'Show', static_page
19-
%td
20-
= link_to 'Edit', edit_static_page_path(static_page)
21-
%td
22-
= link_to 'Destroy', static_page, method: :delete, data: { confirm: 'Are you sure?' }
11+
%th #
12+
%th Title
13+
%th Content
14+
%th.actions
15+
Action
16+
%tbody.success
17+
- @static_pages.each do |static_page|
18+
%tr
19+
%td
20+
= static_page.id
21+
%td
22+
= static_page.title
23+
%td
24+
= static_page.content
25+
%td.action
26+
%a.btn.btn-success{href: static_page_path(static_page), data: { toggle: 'tooltip'}, title: 'Zoom'}
27+
%i.icon-zoom-in
28+
%a.btn.btn-info{href: edit_static_page_path(static_page)}
29+
%i.icon-edit
30+
= link_to static_page_path(static_page), method: :delete, data: { confirm: 'Are you sure?'}, class: 'btn btn-danger' do
31+
%i.icon-trash
2332

2433
= link_to 'New Static Page', new_static_page_path
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
%h1 New static_page
1+
%h1 New Static Page
22

33
= render 'form', :static_page => @static_page

app/views/kebapage/static_pages/show.html.haml

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@
44

55
%p
66
%strong Content:
7-
= @static_page.content
8-
9-
= link_to 'Edit', edit_static_page_path(@static_page)
10-
= link_to 'Back', static_pages_path
7+
= @static_page.content

0 commit comments

Comments
 (0)