-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html.slim
149 lines (148 loc) · 5.54 KB
/
index.html.slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
- if notice.present?
.alert.alert-info.fade.in
a.close[href="#" data-dismiss="alert" aria-label="close"]
| ×
strong
= notice
.container
.panel.panel
.panel-heading
h3.panel-title
.container-fluid
.row
.col-sm-4
= link_to t('.new', :default => t("New Post")),
- new_post_path,
- :class => 'btn btn-primary'
.col-sm-4
p[align="center"]
=link_to image_tag("Json.png", size: "32") , "/posts.json"
.col-sm-4
.search-form.navbar-right
= form_for('posts' , method: :get) do
.col-sm-7
= search_field_tag :query, params[:query] , :class => "form-control"
= submit_tag 'Search' , :class => "btn btn-success" ,data: { disable_with: "Searching..." }
- if @posts.count > 0
- - model_class = Post
.container
- @posts.each_with_index do |post, index|
.panel.panel-primary
.panel-heading
= post.title
.panel-body
table.table.table-condensed
tr
td[align="justify"]
= post.body
tr
td
font[color="#858585"]
b
i
= post.tags
tr
th
p[align="right"]
| Created by
= post.user.name
tr
td[align="right"]
= post.created_at.strftime("Posted on %B %d, %A, %Y at %H:%M")
| |
= post.updated_at.strftime("Updated on %B %d, %A, %Y at %H:%M")
tr
td[align="left"]
| <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo
= index+1
| ">Actions
| <div id="demo
= index+1
| " class="collapse" >
= link_to t('.edit', :default => t("helpers.links.edit")),
- edit_post_path(post), :class => 'btn btn-xs btn-success'
= link_to t('.show', :default => t("helpers.links.show")),
- post_path(post), :class => 'btn btn-xs btn-warning'
| <button type="button" class="btn btn-xs btn-warning main" data-toggle="modal" data-target="#myModal
= index+1
| ">Show Modal
| <div id="myModal
= index+1
| " class="modal fade" role="dialog">
.modal-dialog
.modal-content
.modal-header
button.close[type="button" data-dismiss="modal"]
| ×
h4.modal-title
| Post
= post.id
.modal-body
table.table.table-striped
thead
tr
th
= model_class.human_attribute_name(:title)
th
= model_class.human_attribute_name(:body)
th
= model_class.human_attribute_name(:tags)
th
= model_class.human_attribute_name(:created_at)
th
= model_class.human_attribute_name(:updated_at)
th
= model_class.human_attribute_name(:user_id)
tbody
tr
td
= post.title
td
= post.body
td
= post.tags
td
=l post.created_at
td
=l post.updated_at
td
= post.user.name
td
.modal-footer
button.btn.btn-default[type="button" data-dismiss="modal"]
| Close
= link_to t('.destroy', :default => t("helpers.links.destroy")),
- post_path(post),
- :method => :delete,
- :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
- :class => 'btn btn-xs btn-danger'
.container
.panel.panel
.panel-heading
h3.panel-title
.container-fluid
.row
.col-sm-4
.col-sm-4
= link_to(posts_path(format: "xls"), :class => 'btn btn-xs btn-success') do
strong
| Download all
span.badge
= @posts.count
= image_tag("XLS.png", size: "32")
= link_to(posts_path(format: "csv"), :class => 'btn btn-xs btn-success') do
strong
| Download all
span.badge
= @posts.count
= image_tag("CSV.png", size: "32")
.col-sm-4
- else
.container
.panel.panel-danger
.panel-heading
p[align="center"]
font[size="5"]
| Nothing Found.
.container
= link_to 'Back', url_for(:back), :class => 'btn btn-primary btn-block'